donation/app/Views/campaign_creation.php

89 lines
4.8 KiB
PHP

<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url()."campaign_creation_form/0"; ?>" class="btn btn-primary"><i class="ri-file-edit-line"></i> Add campaign </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="scroll-horizontal-datatable_customer" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Campaign Name</th>
<th>Template Name</th>
<th>Group Name</th>
<th>Total Customer</th>
<th>Scheduled at</th>
<th>Created at</th>
<th>Created by</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<?php foreach ($campaign as $c) :
if ($c['isactive']) {
$class = 'badge badge-soft-success';
$message = 'Active';
} else {
$class = 'badge badge-soft-danger';
$message = 'In-Active';
}
$scheduled_date = date('d/m/Y', strtotime($c['scheduled_date']));
$scheduled_time = date('h:i A', strtotime($c['scheduled_time']));
?>
<tr>
<td hidden><?= $c['campaign_id']; ?></td>
<td><?= $c['campaign_name']; ?></td>
<td><?= $c['template_name']; ?></td>
<td><?= $c['group_name']; ?></td>
<td><?= $c['customer_group_count']; ?></td>
<td><?= $scheduled_date." ".$scheduled_time; ?></td>
<td><?= $c['formatted_created_on']; ?></td>
<td><?= $c['created_by_name']; ?></td>
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
<td>
<a href="<?= base_url()."campaign_creation_form/".$c['campaign_id']; ?>" class="edit-button" title="Click to Edit Campaign" ><i class="ri-pencil-line"></i></a>
<?php if ($c['isactive']) { ?> <a href="<?= base_url() . "campaign_creation_delete/".$c['campaign_id']; ?>" class="delete-button" title="Click to Delete Campaign" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
</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_customer').DataTable({
"order": [
[0, "desc"]
] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>