File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/application/modules/attendance/views/edit_user_trule_assign.php
Back
<link href="<?php echo base_url(); ?>assets/global/plugins/jquery-multi-select/css/multi-select.css" rel="stylesheet" > <script src="<?php echo base_url(); ?>assets/global/plugins/jquery-multi-select/js/jquery.multi-select.js"></script> <script src="<?php echo base_url(); ?>assets/custom/js/jquery.quicksearch.js"></script> <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/moment.min.js"></script> <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> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/global/plugins/jquery-ui/jquery-ui.min.css"> <script src="<?php echo base_url(); ?>assets/global/plugins/jquery-ui/jquery-ui.min.js"></script> <script src="<?php echo base_url(); ?>assets/global/scripts/app.min.js"></script> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/custom/jquery-multidates-picker/jquery-ui.multidatespicker.css"> <script src="<?php echo base_url(); ?>assets/custom/jquery-multidates-picker/jquery-ui.multidatespicker.js"></script> <style> .dd-handle { height:35px; } .ms-container { width:100%; } .search-input { width:100%; margin-bottom:10px; } form td { padding:10px 0px; } .disabled { color:grey; text-decoration: line-through; } .ui-datepicker-inline { width: 100% !important; } .ui-datepicker .ui-datepicker-calendar .ui-state-highlight a { background: #743620 none; /* a color that fits the widget theme */ color: white; /* a color that is readeable with the color above */ } </style> <div class="portlet light bordered"> <div class="portlet-title"> <div class="caption"> <i class="icon-edit font-dark"></i> <span class="bold"><?php echo "Edit User Time Rule"; ?></span> </div> </div> <div class="row"> <form method="post" action="<?php echo base_url(); ?>attendance/setting/edit_user_trule/<?php echo $id; ?>" > <div class="col-md-12"> <div class="col-md-3"> <div class="form-group"> <label class="control-label"><?php echo $this->lang->line('rule_name'); ?><span class="required">*</span></label> <input type="text" name="rule_name" value="<?php echo $usertimerule['rule_name'] ; ?>" class="form-control " required> </div> </div> </div> <div class="col-md-12"> <div class="col-md-4"> <select multiple="multiple" id="users_select" name="my-select[]" required> <?php $user_arr = explode(',',$userlist); foreach($users as $user) { if(in_array($user['id'],$user_arr)) echo "<option selected value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; else echo "<option value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; } ?> </select> </div> <div class="col-md-8"> <div class="col-md-8"> <label class="control-label col-md-4">Effective From</label> <div class="col-md-8"> <div class="input-group input-daterange " data-date="2012-12-12"> <input type="text" class="form-control datepicker" data-date-format="yyyy-mm-dd" value="<?php echo $usertimerule['effective_from'] ; ?>" id="fromdate" name="from"> <span class="input-group-addon"> to </span> <input type="text" class="form-control datepicker" data-date-format="yyyy-mm-dd" value="<?php echo $usertimerule['effective_to'] ; ?>" id="todate" name="to"> </div> </div> </div> <div class="col-md-4"> <div class="form-group" style="margin-bottom:0px"> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" style="margin-bottom:0px"> <input type="checkbox" name="school_holiday" id="school_holiday" data="<?php echo $holidays['school'];?>" class="form-control school_holiday" <?php if($usertimerule['school_holiday'] == '1') { ?> checked value="1" <?php }else { ?> value="0" <?php } ?>> Bypass School Holiday <span></span> </label> </div> <div class="form-group" style="margin-bottom:0px"> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" style="margin-bottom:0px"> <input type="checkbox" name="public_holiday" id="public_holiday" data="<?php echo $holidays['public'];?>" class="form-control public_holiday" <?php if($usertimerule['public_holiday'] == '1' ) { ?> checked value="1" <?php }else { ?> value="0" <?php } ?>> Bypass Public Holiday <span></span> </label> </div> </div> <div class="col-md-12"> <div class="portlet-body"> <div class="table-scrollable"> <table class="table table-bordered table-hover"> <tbody> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline"> <input data-id="1" type="checkbox" value="Mon" name="days[]" class="form-control dayselect" <?php if(strpos( 'Everyday'.$everyday,'Mon')){ echo "checked";} ?>> <span></span> </label> </td> <td><label> Every Monday</label></td> <td width="60%"> <select id="single" name="Mon" class="form-control select2 selectdailyattendancetimeset"> <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Mon', $get_rules)) { if($dt_time['id']==$get_rules['Mon']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" > <input type="checkbox" data-id="2" value="Tue" name="days[]" class="form-control dayselect" <?php if(strpos( 'Everyday'.$everyday,'Tue')){ echo "checked";} ?> > <span></span> </label> </td> <td><label> Every Tuesday</label></td> <td width="60%"> <select id="single" name="Tue" class="form-control select2 selectdailyattendancetimeset" > <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Tue', $get_rules)) { if($dt_time['id']==$get_rules['Tue']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" > <input type="checkbox" data-id="3" value="Wed" name="days[]" class="form-control dayselect " <?php if(strpos( 'Everyday'.$everyday,'Wed')){ echo "checked";} ?>> <span></span> </label> </td> <td><label> Every Wednesday</label></td> <td width="60%"> <select id="single" name="Wed" class="form-control select2 selectdailyattendancetimeset" > <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Wed', $get_rules)) { if($dt_time['id']==$get_rules['Wed']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" > <input type="checkbox" data-id="4" value="Thu" name="days[]" class="form-control dayselect" <?php if(strpos( 'Everyday'.$everyday,'Thu')){ echo "checked";} ?>> <span></span> </label> </td> <td> <label> Every Thursday</label></td> <td width="60%"> <select id="single" name="Thu" class="form-control select2 selectdailyattendancetimeset" > <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Thu', $get_rules)) { if($dt_time['id']==$get_rules['Thu']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" > <input type="checkbox" data-id="5" value="Fri" name="days[]" class="form-control dayselect" <?php if(strpos( 'Everyday'.$everyday,'Fri')){ echo "checked";} ?>> <span></span> </label> </td> <td><label> Every Friday</label></td> <td width="60%"> <select id="single" name="Fri" class="form-control select2 selectdailyattendancetimeset" > <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Fri', $get_rules)) { if($dt_time['id']==$get_rules['Fri']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" > <input type="checkbox" data-id="6" value="Sat" name="days[]" class="form-control dayselect" <?php if(strpos( 'Everyday'.$everyday,'Sat')){ echo "checked";} ?>> <span></span> </label> </td> <td><label> Every Saturday</label></td> <td width="60%"> <select id="single" name="Sat" class="form-control select2 selectdailyattendancetimeset" > <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Sat', $get_rules)) { if($dt_time['id']==$get_rules['Sat']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td> <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline" > <input type="checkbox" data-id="0" value="Sun" name="days[]" class="form-control dayselect" <?php if(strpos( 'Everyday'.$everyday,'Sun')){ echo "checked";} ?>> <span></span> </label> </td> <td><label> Every Sunday</label></td> <td width="60%"> <select id="single" name="Sun" class="form-control select2 selectdailyattendancetimeset" > <option></option> <?php foreach($daily_time as $ey => $dt_time): ?> <option value="<?php echo $dt_time['id']; ?>" <?php if(array_key_exists('Sun', $get_rules)) { if($dt_time['id']==$get_rules['Sun']){echo "selected";} }?>><?php echo $dt_time['rule_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> <div class="col-md-12"> <textarea style="display:none;" name="dates" id="dates"><?php echo $all_dates;?></textarea> <div class="col-md-12"> <label>Calender Preview</label> <div id="calenderView"> </div> </div> </div> <div class="col-md-12"> <div class="pull-right" style="margin-top: 12px;"> <a href="<?php echo base_url(); ?>attendance/setting/user_trule_assign" class="btn default"><?php echo $this->lang->line('close'); ?></a> <input type="submit" class="btn green" value="<?php echo $this->lang->line('edit'); ?>"> </div> </div> </form> </div> <script> var dates = $("#dates").html().split(','); var old_dates = dates.slice(0); var dayChanged = 0; var old_from_date = "<?php echo $usertimerule['effective_from'] ; ?>" var old_to_date = "<?php echo $usertimerule['effective_to'] ; ?>" $(document).ready(function() { $('.datepicker').datepicker({ dateFormat: 'yy-mm-dd', }); dates = $("#dates").html().split(','); console.log('init dates',dates) $(document).on('click', '#public_holiday', function(event) { console.log('public_holiday changed') var value = $('#public_holiday').val(); if (value == 0) { var holiday = $('#public_holiday').attr('data'); $.each(holiday.split(','),function(key,date){ var index = dates.indexOf(date); if (index > -1) { dates.splice(index, 1); } $("#dates").html(dates.join(',')); }) $('#public_holiday').val(1); $('#public_holiday').prop('checked', true); $('#public_holiday').parent('span').removeClass('checked'); $('#public_holiday').parent().addClass('checked'); } else { $("#dates").html(old_dates.join(',')); dates = old_dates.slice(0); $('#public_holiday').val(0); $('#public_holiday').prop('checked', false); $('#public_holiday').parent('span').removeClass('checked'); $('#public_holiday').parent().addClass('checked'); } generateCalenderPreview(); }); $(document).on('click', '#school_holiday', function(event) { console.log('school_holiday changed') var value = $('#school_holiday').val(); if (value == 0) { var holiday = $('#school_holiday').attr('data'); $.each(holiday.split(','),function(key,date){ var index = dates.indexOf(date); if (index > -1) { dates.splice(index, 1); } $("#dates").html(dates.join(',')); }) $('#school_holiday').val(1); $('#school_holiday').prop('checked', true); $('#school_holiday').parent('span').removeClass('checked'); $('#school_holiday').parent().addClass('checked'); } else { $("#dates").html(old_dates.join(',')); dates = old_dates.slice(0); $('#school_holiday').val(0); $('#school_holiday').prop('checked', false); $('#school_holiday').parent('span').removeClass('checked'); $('#school_holiday').parent().addClass('checked'); } generateCalenderPreview(); }); $(".selectdailyattendancetimeset").select2({ placeholder: "Select Daily Attendance Time Set" }); $(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 + 'attendance/setting/delete_daily_trule/' + $(this).attr('data-id')); }); $(document).on('change', '#fromdate,#todate', function(event) { generateCalenderPreview(); }); $(document).on('click', '.dayselect', function(event) { dayChanged = $(this).data('id'); generateCalenderPreview(); }); $('#users_select').multiSelect({ selectableHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='Search Users...'>", selectionHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='Search Users...'>", afterInit: function(ms) { var that = this, $selectableSearch = that.$selectableUl.prev(), $selectionSearch = that.$selectionUl.prev(), selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)', selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected'; that.qs1 = $selectableSearch.quicksearch(selectableSearchString).on('keydown', function(e) { if (e.which === 40) { that.$selectableUl.focus(); return false; } }); that.qs2 = $selectionSearch.quicksearch(selectionSearchString).on('keydown', function(e) { if (e.which == 40) { that.$selectionUl.focus(); return false; } }); }, afterSelect: function() { this.qs1.cache(); this.qs2.cache(); generateCalenderPreview(); }, afterDeselect: function() { this.qs1.cache(); this.qs2.cache(); generateCalenderPreview(); } }) generateCalenderPreview(); }); function generateCalenderPreview() { console.log(dates) if(dates!=undefined) { dates = dates.filter(function (el) { return el != null && el != ''; }); } console.log('generating preview') var school_holiday = $('#school_holiday').val(); var public_holiday = $('#public_holiday').val(); var column_index = []; $('input[type=checkbox]:checked').each(function() { column_index.push($(this).attr('data-id')); }); var s_holiday = []; var p_holidays = []; var mon, row, column; var fromdate = $("#fromdate").val(); var todate = $("#todate").val(); console.log(fromdate,todate) if (fromdate) { var date1 = new Date(fromdate); //Remember, months are 0 based in JS var date2 = new Date(todate); var d1Y = date1.getFullYear(); var d2Y = date2.getFullYear(); var d1M = date1.getMonth(); var d2M = date2.getMonth(); var mon = (d2M + 12 * d2Y) - (d1M + 12 * d1Y); if (mon <= 4) { if (mon == 0) { column = 1; } else column = mon + 1; row = 1 } else { column = 4; row = Math.ceil(mon/4) } var changed = false; $("#calenderView").multiDatesPicker("destroy"); $("#calenderView").multiDatesPicker({ dateFormat: "yy-mm-dd", numberOfMonths: [row, column], maxPicks:2000, onSelect: function(date) { var index = dates.indexOf(date); if (index > -1) { dates.splice(index, 1); } else { dates.push(date); } $("#dates").html(dates.join(',')); }, beforeShowDay: function(dt) { var dt_date = $.datepicker.formatDate("yy-mm-dd", dt); if (dt.getDay() == column_index[0] || dt.getDay() == column_index[1] || dt.getDay() == column_index[2] || dt.getDay() == column_index[3] || dt.getDay() == column_index[4] || dt.getDay() == column_index[5] || dt.getDay() == column_index[6] || dt.getDay() == column_index[7]) { var idx = dates.indexOf(dt_date); if (old_from_date != fromdate || old_to_date != todate || dayChanged == dt.getDay()) { if (idx == -1 && !($('#school_holiday').val() && $('#school_holiday').attr('data').indexOf(dt_date)>=0) && !($('#public_holiday').val() && $('#public_holiday').attr('data').indexOf(dt_date)>0 )) { dates.push(dt_date); changed=true; } } } return [dt.getDay() == column_index[0] || dt.getDay() == column_index[1] || dt.getDay() == column_index[2] || dt.getDay() == column_index[3] || dt.getDay() == column_index[4] || dt.getDay() == column_index[5] || dt.getDay() == column_index[6] || dt.getDay() == column_index[7] ? true : false]; }, minDate: fromdate, maxDate: todate }); if (1 <= dates.length) { $('#calenderView').multiDatesPicker('resetDates'); $("#calenderView").multiDatesPicker('addDates', dates); } if (changed) { old_dates = dates.slice(0) } if(dayChanged>0) dayChanged = 0 if (old_from_date != fromdate) old_from_date = fromdate if(old_to_date != todate) old_to_date = todate changed=false; $('#dates').html(dates.join(',')) } } </script>
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.22 |
proxy
|
phpinfo
|
Settings