-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage_task.php
96 lines (90 loc) · 2.99 KB
/
manage_task.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
<?php
include 'db_connect.php';
if(isset($_GET['id'])){
$qry = $conn->query("SELECT * FROM task_list where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
}
?>
<div class="container-fluid">
<form action="" id="manage-task">
<input type="hidden" name="id" value="<?php echo isset($id) ? $id : '' ?>">
<div class="col-lg-12">
<div class="row">
<div class="col-md-5">
<div class="form-group">
<label for="">Tarea</label>
<input type="text" class="form-control form-control-sm" name="task" value="<?php echo isset($task) ? $task : '' ?>" required>
</div>
<div class="form-group">
<label for="">Asignar a</label>
<select name="employee_id" id="employee_id" class="form-control form-control-sm" required="">
<option value=""></option>
<?php
$employees = $conn->query("SELECT *,concat(lastname,', ',firstname,' ',middlename) as name FROM employee_list order by concat(lastname,', ',firstname,' ',middlename) asc");
while($row=$employees->fetch_assoc()):
?>
<option value="<?php echo $row['id'] ?>" <?php echo isset($employee_id) && $employee_id == $row['id'] ? 'selected' : '' ?>><?php echo $row['name'] ?></option>
<?php endwhile; ?>
</select>
</div>
<div class="form-group">
<label for="">Fecha de Vencimiento</label>
<input type="date" class="form-control form-control-sm" name="due_date" value="<?php echo isset($due_date) ? $due_date : date("Y-m-d") ?>" required>
</div>
</div>
<div class="col-md-7">
<div class="form-group">
<label for="">Descripción</label>
<textarea name="description" id="" cols="30" rows="10" class="summernote form-control">
<?php echo isset($description) ? $description : '' ?>
</textarea>
</div>
</div>
</div>
</div>
</form>
</div>
<script>
$(document).ready(function(){
$('#employee_id').select2({
placeholder:'Elija empleado',
width:'100%'
})
$('.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' ] ]
]
})
})
$('#manage-task').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'ajax.php?action=save_task',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp == 1){
alert_toast('Datos grabados satisfactoriamente',"Proceso Exitóso");
setTimeout(function(){
location.reload()
},1500)
}
}
})
})
</script>