-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage_progress.php
116 lines (114 loc) · 5.45 KB
/
manage_progress.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
include 'db_connect.php';
if(isset($_GET['id'])){
$qry = $conn->query("SELECT * FROM user_productivity where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
}
?>
<div class="container-fluid">
<form action="" id="manage-progress" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo isset($id) ? $id : '' ?>">
<input type="hidden" name="project_id" value="<?php echo isset($_GET['pid']) ? $_GET['pid'] : '' ?>">
<div class="col-lg-12">
<div class="row">
<div class="col-md-5">
<?php if(!isset($_GET['tid'])): ?>
<div class="form-group">
<label for="" class="control-label">Project Manager</label>
<select class="form-control form-control-sm select2" name="task_id">
<option></option>
<?php
$tasks = $conn->query("SELECT * FROM task_list where project_id = {$_GET['pid']} order by task asc ");
while($row= $tasks->fetch_assoc()):
?>
<option value="<?php echo $row['id'] ?>" <?php echo isset($task_id) && $task_id == $row['id'] ? "selected" : '' ?>><?php echo ucwords($row['task']) ?></option>
<?php endwhile; ?>
</select>
</div>
<?php else: ?>
<input type="hidden" name="task_id" value="<?php echo isset($_GET['tid']) ? $_GET['tid'] : '' ?>">
<?php endif; ?>
<div class="form-group">
<label for="">Subject</label>
<input type="text" class="form-control form-control-sm" name="subject" value="<?php echo isset($subject) ? $subject : '' ?>" required>
</div>
<div class="form-group">
<label for="">Date</label>
<input type="date" class="form-control form-control-sm" name="date" value="<?php echo isset($date) ? date("Y-m-d",strtotime($date)) : '' ?>" required>
</div>
<div class="form-group">
<label for="">Start Time</label>
<input type="time" class="form-control form-control-sm" name="start_time" value="<?php echo isset($start_time) ? date("H:i",strtotime("2020-01-01 ".$start_time)) : '' ?>" required>
</div>
<div class="form-group">
<label for="">End Time</label>
<input type="time" class="form-control form-control-sm" name="end_time" value="<?php echo isset($end_time) ? date("H:i",strtotime("2020-01-01 ".$end_time)) : '' ?>" required>
</div>
</div>
<div class="col-md-7">
<div class="form-group">
<label for="">Comment/Progress Description</label>
<textarea name="comment" id="" cols="30" rows="10" class="summernote form-control" required=""><?php echo isset($comment) ? $comment : '' ?></textarea>
</div>
<div class="form-group">
<label for="">Upload File</label>
<input type="file" class="form-control form-control-sm" name="file_upload">
</div>
<?php if(isset($file_name) && !empty($file_name)): ?>
<div class="form-group">
<label for="">Uploaded File</label>
<div>
<i class="fa fa-file"></i>
<a href="proof_uploads/<?php echo $file_name ?>" target="_blank"><?php echo $file_name ?></a>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</form>
</div>
<script>
$(document).ready(function(){
$('.summernote').summernote({
height: 200,
toolbar: [
[ 'style', [ 'style' ] ],
[ 'font', [ 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'clear'] ],
[ 'fontname', [ 'fontname' ] ],
[ 'fontsize', [ 'fontsize' ] ],
[ 'color', [ 'color' ] ],
[ 'para', [ 'ol', 'ul', 'paragraph', 'height' ] ],
[ 'table', [ 'table' ] ],
[ 'view', [ 'undo', 'redo', 'fullscreen', 'codeview', 'help' ] ]
]
})
$('.select2').select2({
placeholder: "Please select here",
width: "100%"
});
});
$('#manage-progress').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url: 'ajax.php?action=save_progress',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success: function(resp){
if(resp == 1){
alert_toast('Data successfully saved', "success");
setTimeout(function(){
location.reload()
}, 1500)
}
}
})
})
</script>