File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/application/modules/overtime/views/overtime.php
Back
<link href="<?php echo base_url(); ?>assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" > <link href="<?php echo base_url(); ?>assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" > <script src="<?php echo base_url(); ?>assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script> <script src="<?php echo base_url(); ?>assets/global/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js"></script> <script src="<?php echo base_url(); ?>assets/global/scripts/app.min.js"></script> <script src="<?php echo base_url(); ?>assets/pages/scripts/components-date-time-pickers.min.js"></script> <!-- BEGIN DATATABLE SCRIPTS --> <link href="<?php echo base_url(); ?>assets/custom/datatables/datatables.min.css" rel="stylesheet" > <script src="<?php echo base_url(); ?>assets/custom/datatables/datatables.min.js"></script> <script src="<?php echo base_url(); ?>assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js"></script> <script src="<?php echo base_url(); ?>assets/custom/js/camplus-datatable.js"></script> <!-- END DATATABLE SCRIPTS --> <div class="portlet light bordered"> <div class="portlet-title"> <div class="caption"> <i class="icon-doc font-dark"></i> <span class="bold"><?php echo $pagetitle; ?></span> </div> <div class="actions"> <?php if($this->acl->hasPermission('APPLY_OVERTIME')) : ?> <a href="#addModal" class="dt-button btn green-jungle btn-outline" data-toggle="modal"> <i class="fa fa-pencil"></i> <?php echo $this->lang->line('apply_overtime'); ?> </a> <?php endif; ?> </div> </div> <div class="portlet-body"> <table class="table table-striped table-bordered table-hover" id="data_table"> <thead> <tr> <th>id</th> <th><?php echo $this->lang->line('date'); ?></th> <th><?php echo $this->lang->line('from_time'); ?></th> <th><?php echo $this->lang->line('to_time'); ?></th> <th><?php echo $this->lang->line('hours'); ?></th> <th><?php echo $this->lang->line('remark'); ?></th> <th><?php echo $this->lang->line('status'); ?></th> <th><?php echo $this->lang->line('last_approval'); ?></th> <th><?php echo $this->lang->line('action'); ?></th> </tr> </thead> <tbody> <?php //print_r($overtimes); ?> <?php foreach($overtimes as $key => $overtime): ?> <?php $diff = strtotime($overtime['to_time']) - strtotime($overtime['from_time']); $hrs = $diff / 3600; ?> <tr class="odd gradeX"> <td><?php echo $overtime['id']; ?></td> <td><?php echo $overtime['date']; ?></td> <td><?php echo substr($overtime['from_time'], 0, -3); ?></td> <td><?php echo substr($overtime['to_time'], 0, -3); ?></td> <td><?php echo number_format($hrs, 2, '.', '') ; ?></td> <td><?php echo $overtime['remarks'].' <div><b style="color:red" >'.$overtime['reason'].'</b></div>'; ?></td> <td><?php echo $overtime['last_approval']; ?></td> <td><?php if($overtime['status']=='P') echo "<span class='label label-sm label-warning'>Pending (".allUsers($overtime['ap_uid'],1).")</span>"; else if($overtime['status']=='A') echo " <span class='label label-sm label-success'>Approved (".allUsers($overtime['ap_uid'],1).")</span>"; else if($overtime['status']=='D') echo "<span class='label label-sm label-info'>Draft</span>"; else if($overtime['status']=='R') echo "<span class='label label-sm label-danger'>Rejected (".allUsers($overtime['ap_uid'],1).")</span>" ; ?></td> <td> <?php if($overtime['status']=='D') {?> <a class="btn btn-xs blue submitModal" data-id="<?php echo $overtime['id'];?>" data-action="submit" data-toggle="modal" href="#actionModal" > <i class="fa fa-close"></i> <?php echo $this->lang->line('submit'); ?> </a> <a class="btn btn-xs blue editovertime " data-action-title="Edit" data-id="<?php echo $overtime['id']; ?>" data-toggle="modal" href="#editModal" > <i class="fa fa-edit"></i> <?php echo $this->lang->line('edit'); ?> </a> <a class="btn btn-xs red actionModal" data-action-title="Delete" data-id="<?php echo $overtime['id'];?>" data-action="delete" data-toggle="modal" href="#actionModal" > <i class="fa fa-close"></i> <?php echo $this->lang->line('delete'); ?> </a> <?php }?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <div id="addModal" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <form id="addFormOverTime" method="post" action="<?php echo base_url(); ?>overtime/add" class="createOvertimeForm"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title"> <?php echo $this->lang->line('apply_overtime'); ?></h4> </div> <div class="modal-body"> <div class="scroller" style="height:250px" data-always-visible="1" data-rail-visible="1"> <div class="form-group"> <label class="control-label"><?php echo $this->lang->line('date'); ?><span class="required">*</span></label> <input id="date" name="date" class="form-control form-control-inline input-medium date-picker" data-date="2012-12-12" data-date-format="yyyy-mm-dd" placeholder="yyyy-mm-dd" value="" type="text"> </div> <div class="form-group"> <div class="input-group"> <span class="input-group-addon"><?php echo $this->lang->line('from_time'); ?></span> <input type="text" class="form-control timepicker timepicker-24" id="from_time" name="from_time"> <span class="input-group-addon"><?php echo $this->lang->line('to_time'); ?></span> <input type="text" class="form-control timepicker timepicker-24" id="to_time" name="to_time"> </div> </div> <div class="form-group"> <label class="control-label"><?php echo $this->lang->line('remark'); ?></label> <textarea name="remarks" class="form-control" id="add_remarks" placeholder="<?php echo $this->lang->line('reason_remark'); ?>" required> </textarea> </div> </div> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> <input type="submit" class="btn green" value="<?php echo $this->lang->line('create'); ?>"> </div> </form> </div> </div> </div> <div id="editModal" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <form id="editFormOverTime" method="post" action="" class="editholidayForm"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title"><?php echo $this->lang->line('edit'); ?> <?php echo $pagetitle; ?></h4> </div> <div class="modal-body"> <div class="scroller" style="height:250px" data-always-visible="1" data-rail-visible="1"> <div class="form-group"> <label class="control-label"><?php echo $this->lang->line('date'); ?><span class="required">*</span></label> <input id="edate" name="date" class="form-control form-control-inline input-medium date-picker" data-date="2012-12-12" data-date-format="yyyy-mm-dd" placeholder="yyyy-mm-dd" value="" type="text"> </div> <div class="form-group"> <div class="input-group"> <span class="input-group-addon"> From Time</span> <input type="text" class="form-control timepicker timepicker-24" id="efrom_time" name="from_time"> <span class="input-group-addon"> To Time</span> <input type="text" class="form-control timepicker timepicker-24" id="eto_time" name="to_time"> </div> </div> <div class="form-group"> <label class="control-label">Remark</label> <textarea name="remarks" id="edit_remarks" class="form-control form-control-inline placeholder " placeholder="Remark" required> </textarea> </div> </div> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> <input type="submit" class="btn green" value="<?php echo $this->lang->line('edit'); ?>"> </div> </form> </div> </div> </div> <div id="actionModal" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title"><span class="actionEventTitle"></span> <?php echo $pagetitle; ?></h4> </div> <div class="modal-body"> <h4><?php echo $this->lang->line('are_you_sure'); ?></h4> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> <a href="" type="button" class="btn default green confirmAction"><?php echo $this->lang->line('yes'); ?><span class="actionEvent"></span></a> </div> </div> </div> </div> <div id="errorModal" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title">Error Message</h4> </div> <div class="modal-body"> <h4><?php echo 'You are not belong to any Approval Group,'; ?></h4> <h4>Please contact the School HR Manager to assign you to appropriate Approval Group.</h4> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> </div> </div> </div> </div> <div id="errorModalOvertime" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title">Error Message</h4> </div> <div class="modal-body"> <h4 class="errortitle"></h4> <p class="conflictinfo"></p> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> </div> </div> </div> </div> <script> $(document).ready(function(){ initTable(); $(document).on('click','.actionModal',function(){ $('#actionModal span.actionEventTitle').html($(this).attr('data-action-title')); $('#actionModal span.actionEvent').html('<?php echo $this->lang->line("Delete");?>'); $('a.confirmAction').attr('href', BASE_URL + 'overtime/delete/' + $(this).attr('data-id')); }); $(document).on('click','.submitModal',function(){ $('#actionModal span.actionEventTitle').html($(this).attr('data-action-title')); $('#actionModal span.actionEvent').html('<?php echo $this->lang->line("Submit");?>'); $('a.confirmAction').attr('href', BASE_URL + 'overtime/submit/' + $(this).attr('data-id')); }); $(document).on('click','.editovertime',function(){ var id=$(this).attr('data-id'); $.ajax({ type: "POST", url: BASE_URL + "overtime/get/" + id, dataType: "json", success: function(data) { //console.log(holiday); $('#editModal input[name=date]').val(data['date']); $('#editModal input[name=from_time]').val(data['from_time'].substr(0, data['from_time'].length-3)); $('#editModal input[name=to_time]').val(data['to_time'].substr(0, data['to_time'].length-3)); $('#editModal textarea[name=remarks]').val(data['remarks']); $('#editModal').modal('show'); $('.editholidayForm').attr('action',BASE_URL+'overtime/edit/'+id); //$('.editholidayForm').validate(); } }); }); // add overtime and check conflict from and to time ////////////////////////////////// $('#addFormOverTime').on('submit', function(e){ e.preventDefault(); var date = $('#date').val(); var from_time=$('#from_time').val(); var from_array=from_time.split(":") var to_time=$('#to_time').val(); var to_array=to_time.split(":") var remarks = $.trim($('#add_remarks').val()); // Check if empty of not if (remarks === '') { alert('Reason field is empty.'); return false; } console.log(from_array[0] > to_array[0]) console.log((from_array[0] == to_array[0] && from_array[1] > to_array[1])) if (parseInt(from_array[0]) > parseInt(to_array[0]) || (parseInt(from_array[0]) == parseInt(to_array[0]) && parseInt(from_array[1]) > parseInt(to_array[1]))) {alert('Please input correct time.'); return false; } $.ajax({ type: "POST", url: BASE_URL + "overtime/overtime/checkconflictovertime/"+ date + '/'+ from_time +'/' + to_time, dataType: "json", success: function(data) { if(data['dailytimerule']) { $('.conflictinfo').html(''); var info=''; $('#addModal').modal('hide'); info='Time In: '+ data['dailytimerule']['time_in'] +' Time Out: '+ data['dailytimerule']['time_out'] + '<br > <b style="color:red"> You can select overtime before or after time in and time out.</b>'; $('.errortitle').html('Your Daily Time Rule '); $('.conflictinfo').html(info); $('#errorModalOvertime').modal('show'); }else if(data['overtimetime']) { $('.conflictinfo').html(''); var info=''; $('#addModal').modal('hide'); info='From Time: '+ data['overtimetime']['from_time'] +' To Time: '+ data['overtimetime']['to_time'] + '<br > <b style="color:red"> You can select overtime before or after from time and to time.</b>'; $('.errortitle').html('Your Overtime '); $('.conflictinfo').html(info); $('#errorModalOvertime').modal('show'); } else { document.getElementById("addFormOverTime").submit(); } } }); }); $('#editFormOverTime').on('submit', function(e){ e.preventDefault(); var url =$('#editFormOverTime').attr('action').split('/'); var id = url[url.length-1]; console.log(id) var date = $('#edate').val(); var from_time=$('#efrom_time').val(); var from_array=from_time.split(":") var to_time=$('#eto_time').val(); var to_array=to_time.split(":") console.log(from_array);console.log(to_array); var remarks = $.trim($('#edit_remarks').val()); // Check if empty of not if (remarks === '') { alert('Reason field is empty.'); return false; } console.log(from_array[0] > to_array[0]) console.log((from_array[0] == to_array[0] && from_array[1] > to_array[1])) if (from_array[0] > to_array[0] || (from_array[0] == to_array[0] && from_array[1] > to_array[1])) {alert('Please input correct time.'); return false; } $.ajax({ type: "POST", url: BASE_URL + "overtime/overtime/checkconflictovertime/"+ date + '/'+ from_time +'/' + to_time, dataType: "json", success: function(data) { console.log(data) if(data['dailytimerule']) { $('.conflictinfo').html(''); var info=''; $('#editModal').modal('hide'); info='Time In: '+ data['dailytimerule']['time_in'] +' Time Out: '+ data['dailytimerule']['time_out'] + '<br > <b style="color:red"> You can select overtime before or after time in and time out.</b>'; $('.errortitle').html('Your Daily Time Rule '); $('.conflictinfo').html(info); $('#errorModalOvertime').modal('show'); }else if(data['overtimetime'] && data['overtimetime'].id!=id) { $('.conflictinfo').html(''); var info=''; $('#editModal').modal('hide'); info='From Time: '+ data['overtimetime']['from_time'] +' To Time: '+ data['overtimetime']['to_time'] + '<br > <b style="color:red"> You have applied overtime during this time period.</b>'; $('.errortitle').html('Your Overtime '); $('.conflictinfo').html(info); $('#errorModalOvertime').modal('show'); } else { document.getElementById("editFormOverTime").submit(); } } }); }); }); $(document).on('change','.date-picker',function(){ var uid = $("#uid").val(); $.ajax({ type: "POST", url: BASE_URL + "overtime/overtime_approval/checkovertimeapproval/", dataType: "json", success: function(data) { if(parseInt(data)==2) { $('#addModal').modal('hide'); $('#errorModal').modal('show'); } } }); }); </script>
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.44 |
proxy
|
phpinfo
|
Settings