crm-summit/app/Views/emails_index.php

71 lines
2.1 KiB
PHP
Raw Normal View History

2024-04-24 13:20:52 +07:00
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<div class="page-wrapper">
<div class="container-fluid">
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h4 class="text-themecolor">Emails Management Page</h4>
</div>
<div class="col-md-7 align-self-center text-end">
<a class='btn btn-info text-white btn-sm' href='emails/create/'
onclick="window.open(this.href, 'editor','width=900,height=400,toolbar=1,resizable=0'); return false;">
<i class="fas fa-plus-circle"></i> Create
</a>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table id="myTable" class="table display table-striped border">
<thead>
<th>ID</th> <th>Email</th> <th>End Date</th> <th></th>
</thead>
<tbody>
<?php
foreach($emails as $data) {
$emailid = $data['emailid'];
$email = $data['email'];
$enddate = '';
if($data['enddate']!='') { $enddate = date('d-m-Y', strtotime($data['enddate'])); }
?>
<tr>
<td><?=$emailid;?></td> <td><?=$email;?></td> <td><?=$enddate;?></td>
<td>
<a class='btn btn-warning btn-sm' href='emails/edit/<?=$emailid;?>'
onclick="window.open(this.href, 'Editor','width=900,height=400,toolbar=1,resizable=0'); return false;">
<i class="fas fa-pencil-alt"></i> Edit
</a>
<button class="btn btn-sm btn-dark" type="button" onclick='toggle(this, <?=$emailid;?>)'>Toggle</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
$(function () {
$('#myTable').DataTable({
"order" : []
});
});
function toggle(e, emailid) {
if(confirm('Are you sure?')) {
$.get("<?=base_url();?>/emails/toggle/"+emailid);
}
}
</script>
<?= $this->endSection() ?>