File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/application/modules/leave_sub/views/approval_group.php
Back
<!-- BEGIN DATATABLE SCRIPTS --> <link href="<?php echo base_url(); ?>assets/global/plugins/jquery-nestable/jquery.nestable.css" rel="stylesheet" > <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-nestable/jquery.nestable.js"></script> <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-switch/css/bootstrap-switch.min.css" rel="stylesheet" > <script src="<?php echo base_url(); ?>assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script> <script src="<?php echo base_url(); ?>assets/global/plugins/jquery-repeater/jquery.repeater.min.js"></script> <!-- END DATATABLE SCRIPTS --> <style> .dd-handle { height:35px; } form td { padding:10px 0px; } .disabled { color:grey; text-decoration: line-through; } </style> <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"> <a href="#addModal" class="dt-button btn green-jungle btn-outline addapproval_group" data-toggle="modal"> <i class="fa fa-plus"></i> <?php echo $this->lang->line('add'); ?> </a> </div> </div> <div class="portlet-body"> <table class="table table-striped table-bordered table-hover" id="data_table"> <thead> <tr> <th><?php echo $this->lang->line('title'); ?></th> <th><?php echo $this->lang->line('user'); ?></th> <th><?php echo $this->lang->line('approver'); ?></th> <th><?php echo $this->lang->line('actions'); ?></th> </tr> </thead> <tbody> <!-- load variables from controller --> <?php foreach($approval_group as $key => $group): ?> <tr class="odd gradeX"> <td><?php echo $group['title']; ?></td> <td> <?php foreach($group['users'] as $user) { echo '<span class="label label-sm label-success">'.allUsers($user['uid']).'</span> '; } ?> </td> <td> <?php foreach($group['approvers'] as $user) { echo '<span class="label label-sm label-success">'.allUsers($user['uid']).'</span> '; } ?> </td> <td> <a class="btn btn-xs blue editapproval_group" data-id="<?php echo $group['id']; ?>" data-toggle="modal" href="javascript:void(0)" > <i class="fa fa-edit"></i> <?php echo $this->lang->line('edit'); ?> </a> <a class="btn btn-xs red actionModal" data-id="<?php echo $group['id'];?>" data-action-title="<?php echo $this->lang->line('delete'); ?>" data-toggle="modal" href="#actionModal" > <i class="fa fa-trash-o"></i> <?php echo $this->lang->line('delete'); ?> </a> </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 method="post" action="<?php echo base_url(); ?>leave_sub/approval_group/add" class="createxxxxxxForm"> <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('create'); ?> <?php echo $pagetitle; ?></h4> </div> <div class="modal-body"> <div class="scroller" style="height:500px" data-always-visible="1" data-rail-visible="1"> <div class="form-group"> <label class="control-label"><?php echo $this->lang->line('title'); ?><span class="required">*</span></label> <input type="text" name="title" class="form-control" required> </div> <div class="form-group" style="width:100%"> <label class="control-label"><?php echo "Users"; ?><span class="required">*</span></label> <select class="form-control multi_select" multiple="multiple" id="users_select" name="my-select[]" > <?php foreach($users as $user) { echo "<option value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; } ?> </select> </div> <label class="control-label"><?php echo "Approver"; ?></label> <div class="form-group form-repeater"> <div data-repeater-list="approver_level"> <div data-repeater-item class="form-repeater-item"> <div class="row form-repeater-row"> <div class="col-md-7"> <select class="select2" name="uid" > <?php foreach($users as $user) { echo "<option value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; } ?> </select> </div> <div class="col-md-1"> <a href="javascript:;" data-repeater-delete class="btn btn-danger form-repeater-delete" style="margin-top:0em"> <i class="fa fa-close"></i> </a> </div> </div> </div> </div> <label class="label"> <a href="javascript:;" data-repeater-create class="btn btn-info form-repeater-add"><i class="fa fa-plus"></i><?php echo $this->lang->line('add_more'); ?></a> </label> </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 method="post" action="" class="editapproval_groupForm"> <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:500px" data-always-visible="1" data-rail-visible="1"> <div class="form-group"> <label class="control-label"><?php echo $this->lang->line('title'); ?><span class="required">*</span></label> <input type="text" name="title" class="form-control" required> </div> <div class="form-group"> <label class="control-label"><?php echo "Users"; ?><span class="required">*</span></label> <select class="form-control multi_select" multiple="multiple" id="users_select_edit" name="my-select[]" > <?php foreach($users as $user) { echo "<option value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; } ?> </select> </div> <label class="control-label"><?php echo "Approver"; ?></label> <div class="form-group form-repeater"> <div data-repeater-list="approver_level" class="approval_level"> <div data-repeater-item class="form-repeater-item"> <div class="row form-repeater-row"> <div class="col-md-7 approver_list"> <select class="select2" name="uid" required > <option value="" >select approver</option> <?php foreach($users as $user) { echo "<option value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; } ?> </select> </div> <div class="col-md-1"> <a href="javascript:;" data-repeater-delete class="btn btn-danger form-repeater-delete" style="margin-top:0em"> <i class="fa fa-close"></i> </a> </div> </div> </div> </div> <label class="label"> <a href="javascript:;" data-repeater-create class="btn btn-info form-repeater-add" id="addMoreedit"><i class="fa fa-plus"></i> <?php echo $this->lang->line('add_more'); ?> </a> </label> </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'); ?></a> </div> </div> </div> </div> <style> #ms-users_select input{ width:100%; } </style> <script> $(document).ready(function(){ $(document).on('click','.addapproval_group',function(){ disableUser(); }); $(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 + 'leave_sub/approval_group/delete/' + $(this).attr('data-id')); }); $(document).on('click','.editapproval_group',function(){ $('#multiSelect option').prop('disabled', false); $('#users_select_edit').multiSelect("deselect_all"); var id = $(this).attr('data-id'); $('.approval_level').empty(); $('#addMoreedit').trigger('click'); var i,j, len, text; $.ajax({ type: "POST", url: BASE_URL + "leave_sub/approval_group/getApproval/" + id, dataType: "json", success: function(data) { $('#editModal input[name=title]').val(data['group']['title']); for(i=0; i < data['user'].length; i++) { $('#users_select_edit option[value="'+data['user'][i].uid+'"]').prop('selected', true); } initForm(data['level']) $('#users_select_edit').multiSelect("refresh"); $('#editModal').modal('show'); $('.editapproval_groupForm').attr('action',BASE_URL+'leave_sub/approval_group/edit/'+id); $('.editapproval_groupForm').validate(); } }); disableUser(id) }); }); function initForm(data) { $.each(data, function (i, value) { $('#editModal select[name="approver_level['+i+'][uid]"]').val(value['uid']).change(); if(i<data.length-1) $('#addMoreedit').trigger("click"); }); } $('#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(); }, afterDeselect: function(){ this.qs1.cache(); this.qs2.cache(); } }) $('#users_select_edit').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(); }, afterDeselect: function(){ this.qs1.cache(); this.qs2.cache(); } }) function disableUser(id) { $('.multi_select option').prop('disabled', false); $.ajax({ type: "POST", url: BASE_URL + "leave_sub/approval_group/getOccupiedUsers/" + id, dataType: "json", success: function(data) { for(i=0; i < data.length; i++) { $('.multi_select option[value="'+ data[i].uid+'"]').prop('disabled', true); } $('.multi_select').multiSelect("refresh"); } }) } </script> <script> $(document).ready(function(){ $('.form-repeater').repeater({ show: function () { $(this).slideDown(); $('.select2-container').remove(); $('.select2').select2({ placeholder: "Next Approver", allowClear: true }); $('.select2-container').css('width','100%'); }, hide: function (remove) { $(this).slideUp(remove); } }); }); </script>
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.34 |
proxy
|
phpinfo
|
Settings