|
Server : LiteSpeed System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : elvh3918 ( 1528) PHP Version : 8.2.31 Disable Function : mail Directory : /home/elvh3918/public_html/tenant/storage/framework/views/ |
<?php $__env->startSection('title', $breadcrumbs[count($breadcrumbs) - 1]['name']); ?>
<?php $__env->startSection('content'); ?>
<?php echo $__env->make('components/breadcrumb', ['breadcrumbs' => $breadcrumbs], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="card card-solid">
<form class="form" action="<?php echo e(route('admin.users.update', $query['id'])); ?>" method="POST">
<?php echo csrf_field(); ?>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label class="form-label" for="tenant">Tenant</label>
<select class="form-control tenantSelect2
<?php echo e(count($errors) == 0 ? '' : (count($errors->get('tenant')) == 0 ? '' : 'is-invalid')); ?>" name="tenant" id="tenant" required>
<?php $__currentLoopData = $buss; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($data->id); ?>,<?php echo e($data->model); ?>" <?php echo e(count($errors) == 0 ? ($query['tenant'] == "$data->id,$data->model" ? 'selected' : '') : (old('tenant') == "$data->id,$data->model" ? "selected" : "")); ?>><?php echo e($data->name); ?> <?php echo e($data->is_head == 1 ? '(HO)' : ''); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php $__currentLoopData = $tenant; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($data->id); ?>,<?php echo e($data->model); ?>" <?php echo e(count($errors) == 0 ? ($query['tenant'] == "$data->id,$data->model" ? 'selected' : '') : (old('tenant') == "$data->id,$data->model" ? "selected" : "")); ?>><?php echo e($data->name); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php if (isset($component)) { $__componentOriginalf94ed9c5393ef72725d159fe01139746 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf94ed9c5393ef72725d159fe01139746 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-error','data' => ['messages' => $errors->get('tenant'),'class' => 'mt-2']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['messages' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->get('tenant')),'class' => 'mt-2']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $attributes = $__attributesOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__attributesOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $component = $__componentOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__componentOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
</div>
<div class="mb-3">
<label class="form-label" for="name">Name<span class="text-danger">*</span></label>
<input type="text" class="form-control <?php echo e(count($errors) == 0 ? '' : (count($errors->get('name')) == 0 ? '' : 'is-invalid')); ?>"
id="name" name="name" placeholder="name"
value="<?php echo e(count($errors) == 0 ? $query['name'] : old('name')); ?>" required />
<?php if (isset($component)) { $__componentOriginalf94ed9c5393ef72725d159fe01139746 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf94ed9c5393ef72725d159fe01139746 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-error','data' => ['messages' => $errors->get('name'),'class' => 'mt-2']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['messages' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->get('name')),'class' => 'mt-2']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $attributes = $__attributesOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__attributesOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $component = $__componentOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__componentOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
</div>
<div class="mb-3">
<label class="form-label" for="email">Email<span class="text-danger">*</span></label>
<input type="email" class="form-control <?php echo e(count($errors) == 0 ? '' : (count($errors->get('email')) == 0 ? '' : 'is-invalid')); ?>"
id="email" name="email" placeholder="email"
value="<?php echo e(count($errors) == 0 ? $query['email'] : old('email')); ?>" required />
<?php if (isset($component)) { $__componentOriginalf94ed9c5393ef72725d159fe01139746 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf94ed9c5393ef72725d159fe01139746 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-error','data' => ['messages' => $errors->get('email'),'class' => 'mt-2']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['messages' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->get('email')),'class' => 'mt-2']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $attributes = $__attributesOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__attributesOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $component = $__componentOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__componentOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
</div>
<div class="mb-3">
<label class="form-label" for="password">Password<span id="lblPassword" class="text-danger">*</span></label>
<input type="password"
class="form-control <?php echo e(count($errors) == 0 ? '' : (count($errors->get('password')) == 0 ? '' : 'is-invalid')); ?>"
id="password" name="password" placeholder="password"
value="<?php echo e(old('password')); ?>" required />
<?php if (isset($component)) { $__componentOriginalf94ed9c5393ef72725d159fe01139746 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf94ed9c5393ef72725d159fe01139746 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-error','data' => ['messages' => $errors->get('password'),'class' => 'mt-2']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['messages' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->get('password')),'class' => 'mt-2']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $attributes = $__attributesOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__attributesOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf94ed9c5393ef72725d159fe01139746)): ?>
<?php $component = $__componentOriginalf94ed9c5393ef72725d159fe01139746; ?>
<?php unset($__componentOriginalf94ed9c5393ef72725d159fe01139746); ?>
<?php endif; ?>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="is_active" name="is_active"
<?php if(count($errors) == 0): ?>
<?php if($query['is_active'] == 1): ?>
checked
<?php endif; ?>
<?php else: ?>
<?php if(old('is_active') != null): ?>
checked
<?php endif; ?>
<?php endif; ?>
/>
<label for="is_active" class="form-check-label ml-1">Active</label>
</div>
</div>
</div>
<div class="col-md-6">
<span class="mb-3">Roles : </span> <a href="#" onclick="clickCopy()"><span class="badge bg-dark my-1 ml-2"><i class="fa fa-copy mr-1"></i>Copy</span></a>
<div class="d-flex flex-wrap mb-3">
<?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="form-check mt-1 mr-3">
<input class="form-check-input roles <?php echo e($value->is_active == 0 ? 'bg-secondary' : ''); ?>" type="checkbox" id="role_<?php echo e($value->id); ?>" name="roles[]" value="<?php echo e($value->id); ?>" onclick='role_checkbox_is_clicked(this.id, <?php echo e($value->is_active); ?>)'
/>
<label for="role_<?php echo e($value->id); ?>" class="form-check-label ml-1 <?php echo e($value->is_active == 0 ? 'text-secondary' : ''); ?>" id="name_role_<?php echo e($value->id); ?>"><?php echo e($value->name); ?></label>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
</div>
</div>
<div class="row">
<div class="col">
<span class="mb-3">Permissions : </span>
<table id="example1" class="table table-bordered table-sm mt-2">
<thead class="bg-light">
<tr>
<th scope="col" class="text-center align-middle" rowspan="2">Modules</th>
<th scope="col" class="text-center align-middle" rowspan="2">Units</th>
<th scope="col" class="text-center align-middle" rowspan="2">Programs</th>
<th scope="col" class="text-center align-middle">View</th>
<th scope="col" class="text-center align-middle">Create</th>
<th scope="col" class="text-center align-middle">Edit</th>
<th scope="col" class="text-center align-middle">Delete</th>
<th scope="col" class="text-center align-middle">Print</th>
</tr>
<tr>
<th scope="col" class="align-middle text-center">
<input type="checkbox" id="is_view" name="is_view"
onclick='select_is_view(this.checked)' checked />
</th>
<th scope="col" class="align-middle text-center">
<input type="checkbox" id="is_create" name="is_create"
onclick='select_is_create(this.checked)' checked />
</th>
<th scope="col" class="align-middle text-center">
<input type="checkbox" id="is_edit" name="is_edit"
onclick='select_is_edit(this.checked)' checked />
</th>
<th scope="col" class="align-middle text-center">
<input type="checkbox" id="is_delete" name="is_delete"
onclick='select_is_delete(this.checked)' checked />
</th>
<th scope="col" class="align-middle text-center">
<input type="checkbox" id="is_print" name="is_print"
onclick='select_is_print(this.checked)' checked />
</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
<tfoot>
<tr>
<th scope="col" class="text-center align-middle"></th>
<th scope="col" class="text-center align-middle"></th>
<th scope="col" class="text-center align-middle"></th>
<th scope="col" class="text-center align-middle" colspan="5"></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="p-2 card-footer d-print-none">
<div class="d-flex justify-content-end">
<div class="form-check mr-2">
<input class="form-check-input" type="checkbox" id="is_update_password" name="is_update_password" onClick="updatePassword()" />
<label for="is_update_password" class="form-check-label ml-1">Update Password</label>
</div>
<button class="btn btn-warning mr-2" type="submit" onclick='buttonSpin("btn_save", "spinner-border spinner-border-sm")'>
<i id="btn_save" class="fa fa-save"></i>
<span class="ml-2">Update</span>
</button>
<button type="button" onclick='backToList()' class="btn btn-dark">
<i class="fa fa-share"></i>
<span class="ml-2">Cancel</span>
</button>
</div>
</div>
</form>
</div>
</div>
<!--/. container-fluid -->
</section>
<!-- /.content -->
<div class="modal fade" id="frmUser">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Users</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table id="example2" class="table table-sm table-bordered table-striped">
<thead>
<tr>
<th class="text-center">User</th>
<th class="text-center">Roles</th>
<th class="text-center">Updated</th>
<th class="text-center d-print-none">#</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td>
<div class="user-block">
<img src="https://ui-avatars.com/api/?color=ffffff&background=0ab204&name=<?php echo e($data->name); ?>"
alt="avatar" class="img-circle img-bordered-sm">
<span class="username"><?php echo e($data->name); ?></span>
<span class="description"><?php echo e($data->email); ?></span>
</div>
</td>
<td>
<?php $__currentLoopData = $data->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $subdata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<span class="badge bg-indigo my-1">
<?php echo e($subdata->name); ?>
</span>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</td>
<td>
<?php echo e($data->updated_at); ?>
</td>
<td class="d-print-none">
<a href="#" onclick="selectCopy(<?php echo e($data); ?>)">
<span class="badge bg-warning p-1"><i class="fa fa-arrow-right"></i>
Select</span>
</a>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
<div class="modal-footer d-flex justify-content-start justify-content-md-end d-print-none">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-style'); ?>
<link rel="stylesheet" href="<?php echo e(asset('assets/plugins/datatables-bs4/css/dataTables.bootstrap4.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('assets/plugins/toastr/toastr.min.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-script'); ?>
<script src="<?php echo e(asset('assets/plugins/datatables/dataTables.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables/dataTables.bootstrap4.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/dataTables.buttons.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.bootstrap4.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.print.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/jszip.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.html5.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.colVis.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/toastr/toastr.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/external/split-upper.js')); ?>"></script>
<script src="<?php echo e(asset('assets/external/load-toastr.js')); ?>"></script>
<script src="<?php echo e(asset('assets/external/button-spin.js')); ?>"></script>
<script>
loadToastr(<?php echo json_encode(Session::get('message')); ?>);
fillRoles(<?php echo json_encode($roles); ?>, <?php echo json_encode(old('roles')); ?> == null ? <?php echo json_encode($query['roles']); ?> : <?php echo json_encode(old('roles')); ?>);
fillData_Permission(<?php echo json_encode($permissions); ?>, <?php echo json_encode(old('temps')); ?>);
updatePassword();
new DataTable('#example2');
$("#example1").DataTable({
paging: true,
lengthChange: true,
searching: true,
ordering: true,
info: true,
autoWidth: false,
responsive: true,
pageLength: 100,
scrollY: true,
columnDefs: [{
data: 'module',
name: 'module',
targets: 0,
className: 'dt-body-left'
},
{
data: 'unit',
name: 'unit',
targets: 1,
className: 'dt-body-left'
},
{
data: 'program',
name: 'program',
targets: 2,
className: 'dt-body-left'
},
{
data: 'view',
name: 'view',
targets: 3,
className: 'dt-body-center',
orderable: false
},
{
data: 'create',
name: 'create',
targets: 4,
className: 'dt-body-center',
orderable: false
},
{
data: 'edit',
name: 'edit',
targets: 5,
className: 'dt-body-center',
orderable: false
},
{
data: 'delete',
name: 'delete',
targets: 6,
className: 'dt-body-center',
orderable: false
},
{
data: 'print',
name: 'print',
targets: 7,
className: 'dt-body-center',
orderable: false
}
],
buttons: [
'pageLength',
{
extend: 'collection',
text: 'Control',
buttons: [
'copy', 'excel', 'print',
{
text: 'Visibility',
popoverTitle: 'Control',
extend: 'colvis',
collectionLayout: 'two-column',
postfixButtons: ['colvisRestore']
}
]
}
],
layout: {
topStart: ['buttons']
},
initComplete: function () {
this.api().columns([0, 1, 2]).every(function () {
var column = this;
var select = $('<select class="rounded" style="width:100%;padding: 2px;"><option value="">None</option></select>')
.appendTo($(column.footer()))
.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
column.data().unique().sort().each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>')
});
});},
});
function backToList() {
window.location.href = "<?php echo e(route('admin.users.index')); ?>";
}
function updatePassword() {
// reset
document.getElementById("lblPassword").innerHTML = "";
document.getElementById('password').required = false;
if (document.getElementById("is_update_password").checked == true) {
document.getElementById("lblPassword").innerHTML = "*";
document.getElementById('password').required = true;
}
}
function clickCopy() {
$('#frmUser').modal('toggle')
}
function fillRoles(roles, data) {
for (let index = 0; index < roles.length; index++) {
for (const [key, id] of Object.entries(data)) {
if (roles[index]['id'] == id) {
document.getElementById('role_' + roles[index]['id']).checked = true;
}
}
}
}
function selectCopy(data) {
//reset all unchecked
var chk = document.getElementsByClassName('roles');
for (var i = 0; i < chk.length; i++) {
chk[i].checked = false;
}
// reset table
var chk = document.getElementsByClassName('is_view'); for (var i = 0; i < chk.length; i++) { chk[i].checked = false; }
chk = document.getElementsByClassName('is_create'); for (var i = 0; i < chk.length; i++) { chk[i].checked = false; }
chk = document.getElementsByClassName('is_edit'); for (var i = 0; i < chk.length; i++) { chk[i].checked = false; }
chk = document.getElementsByClassName('is_delete'); for (var i = 0; i < chk.length; i++) { chk[i].checked = false; }
chk = document.getElementsByClassName('is_print'); for (var i = 0; i < chk.length; i++) { chk[i].checked = false; }
// set roles
var roles = data['roles'];
for (let index = 0; index < roles.length; index++) {
document.getElementById("role_" + roles[index]['id']).checked = true;
}
// set permissions
var user_has_permissions = data['user_has_permissions'];
for (let index = 0; index < user_has_permissions.length; index++) {
var permissions = user_has_permissions[index]['permissions'];
selectCopySetValue('view', permissions['id']);
selectCopySetValue('create', permissions['id']);
selectCopySetValue('edit', permissions['id']);
selectCopySetValue('delete', permissions['id']);
selectCopySetValue('print', permissions['id']);
}
$('#frmUser').modal('hide');
}
function selectCopySetValue(type, id) {
var chk = document.getElementsByClassName('is_' + type);
for (var i = 0; i < chk.length; i++) {
let text = chk[i].id;
let result = text.replace("temps", "");
result = result.replace("[" + type + "]", "");
result = result.replace("][", ",");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace("[", ",");
result = result.replace("]", "");
const myArray = result.split(",");
if (myArray[1] == id) {
if (myArray[1] > 0 && myArray[2] == 1) {
chk[i].checked = true;
return;
}
}
}
}
function select_is_view(value) {
var chk = document.getElementsByClassName('is_view');
for (var i = 0; i < chk.length; i++) {
let text = chk[i].id;
let result = text.replace("temps", "");
result = result.replace("[view]", "");
result = result.replace("][", ",");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace("[", ",");
result = result.replace("]", "");
const myArray = result.split(",");
if (myArray[1] > 0 && myArray[2] == 1) {
chk[i].checked = value;
}
}
}
function select_is_create(value) {
var chk = document.getElementsByClassName('is_create');
for (var i = 0; i < chk.length; i++) {
let text = chk[i].id;
let result = text.replace("temps", "");
result = result.replace("[create]", "");
result = result.replace("][", ",");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace("[", ",");
result = result.replace("]", "");
const myArray = result.split(",");
if (myArray[1] > 0 && myArray[2] == 1) {
chk[i].checked = value;
}
}
}
function select_is_edit(value) {
var chk = document.getElementsByClassName('is_edit');
for (var i = 0; i < chk.length; i++) {
let text = chk[i].id;
let result = text.replace("temps", "");
result = result.replace("[edit]", "");
result = result.replace("][", ",");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace("[", ",");
result = result.replace("]", "");
const myArray = result.split(",");
if (myArray[1] > 0 && myArray[2] == 1) {
chk[i].checked = value;
}
}
}
function select_is_delete(value) {
var chk = document.getElementsByClassName('is_delete');
for (var i = 0; i < chk.length; i++) {
let text = chk[i].id;
let result = text.replace("temps", "");
result = result.replace("[delete]", "");
result = result.replace("][", ",");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace("[", ",");
result = result.replace("]", "");
const myArray = result.split(",");
if (myArray[1] > 0 && myArray[2] == 1) {
chk[i].checked = value;
}
}
}
function select_is_print(value) {
var chk = document.getElementsByClassName('is_print');
for (var i = 0; i < chk.length; i++) {
let text = chk[i].id;
let result = text.replace("temps", "");
result = result.replace("[print]", "");
result = result.replace("][", ",");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace("[", ",");
result = result.replace("]", "");
const myArray = result.split(",");
if (myArray[1] > 0 && myArray[2] == 1) {
chk[i].checked = value;
}
}
}
function role_checkbox_is_clicked(id, status) {
if (status == 0) {
var checked=document.getElementById(id).checked;
if (checked == true) {
document.getElementById(id).checked = false;
} else {
document.getElementById(id).checked = true;
}
}
}
function checkbox_is_clicked(id, status, rows, type) {
var el_id='temps[' + rows + '][' + id + '][' + status + '][' + type + ']';
if (id == 0) {
document.getElementById(el_id).checked = false;
} else if (status == 0) {
if (document.getElementById(el_id).checked == true) {
document.getElementById(el_id).checked = false;
} else {
document.getElementById(el_id).checked = true;
}
}
}
function fillData_Permission(data, old) {
var html = "";
for (let index = 0; index < data.length; index++) {
var total_element = $(".rowCount").length;
var rows = 1;
if (total_element > 0) {
var lastid = $(".rowCount:last").attr("id");
var split_id = lastid.split("_");
rows = Number(split_id[1]) + 1;
}
html += '<tr class="rowCount" id="rowCount_' + rows + '" name="rowCount_' + rows + '">';
html += '<td>';
html += split_upper(data[index]['module']);
html += '</td>';
html += '<td>';
if (data[index]['unit'] != data[index]['program']) {
html += split_upper(data[index]['unit']);
} else {
html += '-';
}
html += '</td>';
html += '<td>';
html += split_upper(data[index]['program']);
html += '</td>';
var bg = '';
var checked = '';
var disabled = '';
if (data[index]['view'] == 0 || data[index]['is_active'] == 0) { bg = 'bg-light'; }
if (data[index]['view'] == 0) { disabled = 'disabled'; }
if (old != null) {
checked = oldData_Permissions(old, data[index]['view']);
} else {
checked = fillData_PermissionSetValue(data[index]['view']);
}
html += '<td scope="row" class="align-middle text-center ' + bg + '">';
html += '<input type="checkbox" class="is_view" id="temps[' + rows + '][' + data[index]['view'] + '][' + data[index]['is_active'] + '][view]" name="temps[' + rows + '][' + data[index]['view'] + '][view]" ' + checked + ' ' + disabled + ' onClick="checkbox_is_clicked(' + data[index]['view'] + ', ' + data[index]['is_active'] + ',' + rows + ', `view`)" />';
html += '</td>';
bg = '';
checked = '';
disabled = '';
if (data[index]['create'] == 0 || data[index]['is_active'] == 0) { bg = 'bg-light'; }
if (data[index]['create'] == 0) { disabled = 'disabled'; }
if (old != null) {
checked = oldData_Permissions(old, data[index]['create']);
} else {
checked = fillData_PermissionSetValue(data[index]['create']);
}
html += '<td scope="row" class="align-middle text-center ' + bg + '">';
html += '<input type="checkbox" class="is_create" id="temps[' + rows + '][' + data[index]['create'] + '][' + data[index]['is_active'] + '][create]" name="temps[' + rows + '][' + data[index]['create'] + '][create]" ' + checked + ' ' + disabled + ' onClick="checkbox_is_clicked(' + data[index]['create'] + ', ' + data[index]['is_active'] + ',' + rows + ', `create`)" />';
html += '</td>';
bg = '';
checked = '';
disabled = '';
if (data[index]['edit'] == 0 || data[index]['is_active'] == 0) { bg = 'bg-light'; }
if (data[index]['edit'] == 0) { disabled = 'disabled'; }
if (old != null) {
checked = oldData_Permissions(old, data[index]['edit']);
} else {
checked = fillData_PermissionSetValue(data[index]['edit']);
}
html += '<td scope="row" class="align-middle text-center ' + bg + '">';
html += '<input type="checkbox" class="is_edit" id="temps[' + rows + '][' + data[index]['edit'] + '][' + data[index]['is_active'] + '][edit]" name="temps[' + rows + '][' + data[index]['edit'] + '][edit]" ' + checked + ' ' + disabled + ' onClick="checkbox_is_clicked(' + data[index]['edit'] + ', ' + data[index]['is_active'] + ',' + rows + ', `edit`)" />';
html += '</td>';
bg = '';
checked = '';
disabled = '';
if (data[index]['delete'] == 0 || data[index]['is_active'] == 0) { bg = 'bg-light'; }
if (data[index]['delete'] == 0) { disabled = 'disabled'; }
if (old != null) {
checked = oldData_Permissions(old, data[index]['delete']);
} else {
checked = fillData_PermissionSetValue(data[index]['delete']);
}
html += '<td scope="row" class="align-middle text-center ' + bg + '">';
html += '<input type="checkbox" class="is_delete" id="temps[' + rows + '][' + data[index]['delete'] + '][' + data[index]['is_active'] + '][delete]" name="temps[' + rows + '][' + data[index]['delete'] + '][delete]" ' + checked + ' ' + disabled + ' onClick="checkbox_is_clicked(' + data[index]['delete'] + ', ' + data[index]['is_active'] + ',' + rows + ', `delete`)" />';
html += '</td>';
bg = '';
checked = '';
disabled = '';
if (data[index]['print'] == 0 || data[index]['is_active'] == 0) { bg = 'bg-light'; }
if (data[index]['print'] == 0) { disabled = 'disabled'; }
if (old != null) {
checked = oldData_Permissions(old, data[index]['print']);
} else {
checked = fillData_PermissionSetValue(data[index]['print']);
}
html += '<td scope="row" class="align-middle text-center ' + bg + '">';
html += '<input type="checkbox" class="is_print" id="temps[' + rows + '][' + data[index]['print'] + '][' + data[index]['is_active'] + '][print]" name="temps[' + rows + '][' + data[index]['print'] + '][print]" ' + checked + ' ' + disabled + ' onClick="checkbox_is_clicked(' + data[index]['print'] + ', ' + data[index]['is_active'] + ',' + rows + ', `print`)" />';
html += '</td>';
html += '</tr>';
}
$("#tbody").append(html);
}
function fillData_PermissionSetValue(id) {
var checked = '';
var data = <?php echo json_encode($query['permissions']); ?>;
for (let index = 0; index < data.length; index++) {
if (data[index] == id) {
checked = 'checked';
}
}
return checked;
}
function oldData_Permissions(data, id) {
for (const [key, value] of Object.entries(data)) {
for (const [key2, value2] of Object.entries(value)) {
if (key2 == id) {
return 'checked';
}
}
}
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts/app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/elvh3918/public_html/tenant/resources/views/content/admin/users/edit.blade.php ENDPATH**/ ?>