pbmc-cmod/app/Views/users_index.php

74 lines
1.8 KiB
PHP

<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<div class="card border-0">
<div class="body-card">
<div class="table-responsive">
<table id="table_dashboard" class="table">
<thead>
<tr>
<th>#</th>
<th>Userid</th>
<th>Name</th>
<th>Role</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
foreach ($users as $data) {
$userid = $data['USERID'];
$username = $data['USERNAME'];
$userrolecode = $data['USERROLEID'];
?>
<tr class="table-row">
<td><?=$i;?></td>
<td><?=$userid;?></td>
<td><?=$username;?></td>
<td>
<button class='badge text-bg-dark editRole' data-bs-toggle="modal" data-bs-target="#modal" data-userid='<?=$userid;?>'>edit role</button>
<button class='badge text-bg-warning editPass' data-userid='<?=$userid;?>'>edit password</button>
</td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modal" aria-hidden="true" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
$(document).ready(function() {
$('#table_dashboard').DataTable({
order: [],
pageLength: 25
});
});
$('.editPass').on('click',function(){
var userid = $(this).data('userid');
$('.modal-content').load('<?=base_url();?>users/editPass/'+userid, function(){
$('#modal').modal('show');
});
});
$('.editRole').on('click',function(){
var userid = $(this).data('userid');
$('.modal-content').load('<?=base_url();?>users/editRole/'+userid , function(){
$('#modal').modal('show');
});
});
</script>
<?= $this->endSection() ?>