%PDF- %PDF-
Direktori : /home/opti/workflow/src/views/role/ |
Current File : /home/opti/workflow/src/views/role/right.ejs |
<% include ../partials/header %> <% include ../partials/sidebar %> <style> .quick-btn { background: #EEEEEE; box-shadow: 0 0 0 1px #F8F8F8 inset, 0 0 0 1px #CCCCCC; color: #444444; display: inline-block; height: 80px; margin: 10px; padding-top: 16px; text-align: center; text-decoration: none; width: 90px; position: relative; } .quick-btn span { display: block; } .quick-btn .label { position: absolute; right: -5px; top: -5px; } .quick-btn:hover { text-decoration: none; color: #fff; background-color: #4d7589; box-shadow: 3px 4px 1px #ccc; } .quick-btn.small { width: 40px; height: 30px; padding-top: 6px; } </style> <div class="app-content content"> <div class="content-wrapper"> <div class="content-header row"> </div> <div class="content-body"> <!-- Breadcrumb starts--> <div class="content-header-left col-md-6 col-12 mb-2"> <h3 class="content-header-title">Roles Right</h3> <div class="row breadcrumbs-top"> <div class="breadcrumb-wrapper col-12"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="/">Dashboard</a> </li> <li class="breadcrumb-item active">Roles Right </li> </ol> </div> </div> </div> <!-- Breadcrumb ends--> <div class="content-body"> <!-- Zero configuration table --> <section id="configuration"> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-header"> <h4 class="card-title">Roles Right</h4> <a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a> <div class="heading-elements"> <ul class="list-inline mb-0"> <li><a data-action="collapse"><i class="ft-minus"></i></a></li> <li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li> <li><a data-action="expand"><i class="ft-maximize"></i></a></li> <li><a data-action="close"><i class="ft-x"></i></a></li> </ul> </div> </div> <div class="card-content collapse show"> <div class="card-body card-dashboard"> <input type="hidden" name="roleId" value="<%= roleId %>" id="roleId"> <table class="table table-striped table-bordered zero-configuration"> <thead> <tr> <th>S/N</th> <th>Module</th> <th>CanCreate</th> <th>CanView</th> <th>CanEdit</th> <th>CanDelete</th> </tr> </thead> <tbody> <% modules.forEach(function(module, index){ %> <tr> <td> <%= (index + 1) %> </td> <td> <%= module.name %> </td> <td> <fieldset> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input getValue getValueC" moduleId="<%= module.id %>" value="<%= module.canCreate %>" rightId="canCreate" name="canCreate" id="<%= module.name %>canCreate"> <label class="custom-control-label" for="<%= module.name %>canCreate"></label> </div> </fieldset> </td> <td> <fieldset> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input getValue getValueV" moduleId="<%= module.id %>" rightId="canView" name="canView" id="<%= module.name %>canView"> <label class="custom-control-label" for="<%= module.name %>canView"></label> </div> </fieldset> </td> <td> <fieldset> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input getValue getValueE" moduleId="<%= module.id %>" rightId="canEdit" name="canEdit" id="<%= module.name %>canEdit"> <label class="custom-control-label" for="<%= module.name %>canEdit"></label> </div> </fieldset> </td> <td> <fieldset> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input getValue getValueD" moduleId="<%= module.id %>" rightId="canDelete" name="canDelete" id="<%= module.name %>canDelete"> <label class="custom-control-label" for="<%= module.name %>canDelete"></label> </div> </fieldset> </td> </tr> <% }); %> </tbody> <tfoot> <tr> <th>S/N</th> <th>Module</th> <th>CanCreate</th> <th>CanView</th> <th>CanEdit</th> <th>CanDelete</th> </tr> </tfoot> </table> <!-- <div class="modal-footer"> <input type="submit" class="btn btn-outline-primary btn-lg" value="Save"> </div> --> <!-- </form> --> </div> </div> </div> </div> </div> </section> <!--/ Zero configuration table --> </div> </div> </div> </div> <!-- ////////////////////////////////////////////////////////////////////////////--> <% include ../partials/footer %> <script> $(document).ready(function () { $('table tr td').on('change', '.getValue', function () { if ($(this).is(':checked')) { const roleId = $('#roleId').val(); const rightId = $(this).attr('rightId'); const moduleId = $(this).attr('moduleId'); const rightVal = $('.getValue').is(':checked'); var canCre = $('.getValueC').is(':checked'); var canView = $('.getValueV').is(':checked'); var canEdit = $('.getValueE').is(':checked'); var canDelete = $('.getValueD').is(':checked'); if (canCre == true) { let canCre = true; } else { let canCre = false; } if (canView == true) { let canView = true; } else { let canView = false; } if (canEdit == true) { let canEdit = true; } else { let canEdit = false; } if (canDelete == true) { let canDelete = true; } else { let canDelete = false; } $.ajax({ type: "POST", // Post / Get method url: "/roles/rights", //Where form data is sent on submission dataType: "text", // Data type, HTML, json etc. data: { roleId: roleId, rightId: rightId, moduleId: moduleId, canCreate: canCre, canEdit: canEdit, canView: canView, canDelete: canDelete }, //Form variables // data: { roleId: roleId, rightId: rightId }, //Form variables success: function (response) { if (response === 'success') { $('.barcodeNumber').text('*Barcode Number already Exist Kindly Generate new barcode for this product*').css('color', 'red'); } else { $('.barcodeNumber').empty(); } } }); // } else { // console.log('select user'); // } } else { const roleId = $('#roleId').val(); const rightId = $(this).attr('rightId'); const moduleId = $(this).attr('moduleId'); const rightVal = $('.getValue').is(':checked'); var canCre = $('.getValueC').is(':checked'); var canView = $('.getValueV').is(':checked'); var canEdit = $('.getValueE').is(':checked'); var canDelete = $('.getValueD').is(':checked'); if (canCre == true) { let canCre = true; } else { let canCre = false; } if (canView == true) { let canView = true; } else { let canView = false; } if (canEdit == true) { let canEdit = true; } else { let canEdit = false; } if (canDelete == true) { let canDelete = true; } else { let canDelete = false; } $.ajax({ type: "POST", // Post / Get method url: "/roles/rights", //Where form data is sent on submission dataType: "text", // Data type, HTML, json etc. data: { roleId: roleId, rightId: rightId, moduleId: moduleId, canCreate: canCre, canEdit: canEdit, canView: canView, canDelete: canDelete }, //Form variables // data: { roleId: roleId, rightId: rightId }, //Form variables success: function (response) { if (response === 'success') { $('.barcodeNumber').text('*Barcode Number already Exist Kindly Generate new barcode for this product*').css('color', 'red'); } else { $('.barcodeNumber').empty(); } } }); } }); }); </script>