donation/app/Views/user_list.php
2023-12-14 17:38:07 +05:30

99 lines
5.0 KiB
PHP

<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session('error') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="table-responsive">
<!-- <table id="datatable-buttons" class="table dt-responsive w-100"> -->
<table id="scroll-horizontal-datatable_user" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden ></th>
<th>Name</th>
<?php if($loged_user === 'sadmin'){ ?>
<th>Org Name</th>
<?php } ?>
<th>Email</th>
<th>Mobile Number</th>
<th>Role</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($details as $row):
if ($row['isactive']) {
$class = 'badge badge-soft-success';
$message = 'Active';
} else {
$class = 'badge badge-soft-danger';
$message = 'In-Active';
}
$edit_page_route = base_url()."user_page/".$row['user_id'];
$addressParts = array(
$row['address'],
$row['city'],
$row['state'].($row['postal_code'] ? "-".$row['postal_code'] : ""),
$row['country']
);
// echo implode(', ', array_filter($addressParts)) . '.';
?>
<tr>
<td hidden><?= $row['user_id'] ?></td>
<td><?php echo $row['first_name'].' '.$row['last_name'] ; ?></td>
<?php if($loged_user === 'sadmin'){ ?>
<td><?php echo $row['org_name'] ; ?></td>
<?php } ?>
<td><?php echo $row['email'] ; ?></td>
<td><?php echo $row['mobile_no'] ; ?></td>
<td><?php echo $row['role'] ; ?></td>
<td>
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
</td>
<td>
<a href="<?= $edit_page_route; ?>" class="edit-button" title="Click to Edit User" ><i class="ri-pencil-line"></i></a>
<a href="<?php echo "delete_user/".$row['user_id']; ?>" class="delete-button" title="Click to Delete User" ><i class="ri-delete-bin-line"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- end row-->
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_user').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>