Add history of expired insurance

This commit is contained in:
Djery-Tom 2022-02-14 19:14:45 +01:00
parent 94f8b058b6
commit 862c63604d
6 changed files with 269 additions and 11 deletions

View File

@ -625,6 +625,8 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('nano_health/hyper/insurances_subscriptions.php');
else if ($type == 'insurance-insured')
$this->load->view('nano_health/hyper/insurances_insured.php');
else if ($type == 'insurance-expired-insured')
$this->load->view('nano_health/hyper/insurances_expired_insured.php');
else if ($type == 'insurance-health_care_sheets')
$this->load->view('nano_health/hyper/insurances_health_care_sheets.php');
else if ($type == 'insurance-invoices')

View File

@ -866,4 +866,5 @@ $lang['beneficiaries_deletion_history'] = "Deletion history of beneficiaries";
$lang['deletion_date'] = "Date of deletion";
$lang['STOP_INSURANCE'] = "Stopping insurance";
$lang['RENEWAL'] = "Insurance renewal";
$lang['expired_insurance'] = "Insurance expired";
?>

View File

@ -877,4 +877,5 @@ $lang['beneficiaries_deletion_history'] = "Historique de suppression des ayants
$lang['deletion_date'] = "Date de suppression";
$lang['STOP_INSURANCE'] = "Arrêt de l'assurance";
$lang['RENEWAL'] = "Renouvellement de l'assurance";
$lang['expired_insurance'] = "Assurances arrivées à échéance";
?>

View File

@ -494,8 +494,8 @@
toastr.options.closeEasing = 'swing';
$(document).ready(function () {
$('#start_at').text(moment("<?=$insurance->start_at?>", 'YYYY-MM-DD HH:mm:ss').format('D MMMM YYYY HH:mm:s'));
$('#end_at').text(moment("<?=$insurance->end_at?>", 'YYYY-MM-DD HH:mm:ss').format('D MMMM YYYY HH:mm:s'));
$('#start_at').text(moment("<?=$insurance->start_at?>", 'YYYY-MM-DD').format('D MMMM YYYY'));
$('#end_at').text(moment("<?=$insurance->end_at?>", 'YYYY-MM-DD').format('D MMMM YYYY'));
});

View File

@ -0,0 +1,245 @@
<!-- DataTables -->
<link rel="stylesheet"
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<?php
?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $this->lang->line('expired_insurance') ?>
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
<div class="info-box-content">
<span class="info-box-text"><?= $this->lang->line('Période') ?> </span>
<span class="info-box-number">
<input id="picker"
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%"
data-category="<?= isset($category) ? $category : null ?>"
type="text" name="daterange"
data-lang="<?= $this->session->userdata('site_lang') ?>"
value="<?= ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
</span>
<span> Format : <?= $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('export_insured_list') ?></h3>
<div class="box-tools">
</div>
</div>
<div class="box-body" style="overflow-x:auto;">
<table id="subscriptions" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'><?= $this->lang->line('insured_id') ?></th>
<th><?= $this->lang->line('Nom') ?></th>
<th><?= $this->lang->line('Contact') ?></th>
<th><?= $this->lang->line('number_of_months') ?></th>
<th><?= $this->lang->line('number_of_beneficiaries') ?></th>
<th><?= $this->lang->line('bonus_amount') ?></th>
<th><?= $this->lang->line('start_at') ?></th>
<th><?= $this->lang->line('end_at') ?></th>
<th align='center'><?= $this->lang->line('subscription_date') ?></th>
<th align='center'>Action</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- SlimScroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
<script>
$(function () {
const lang = $('#picker').data('lang');
const format = lang === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
var table = $('#subscriptions').DataTable({
// Processing indicator
"processing": true,
"language": {
"processing": "<?= $this->lang->line('loading') ?>",
"emptyTable" : "<?= $this->lang->line('no_insured') ?>"
},
// DataTables server-side processing mode
"serverSide": true,
// Initial no order.
"order": [],
// Load data from an Ajax source
"ajax": {
"url": "<?= base_url('pagination/Insurances/getLists'); ?>",
"data":{
"state" : "STOPPED",
"startDate" : "<?= $startDate?>",
"endDate" : "<?= $endDate?>",
"id_network" : "<?= $id_network ?>",
"currentURL" : "<?= current_url()?>"
},
"type": "POST"
},
"aaSorting": [[8, "desc"]],
"columnDefs": [
{
"targets": [6,7],
// "orderable": false,
render: $.fn.dataTable.render.moment('YYYY-MM-DD', 'D MMMM YYYY', format)
},
{
"targets": [8],
// "orderable": false,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}
],
dom: 'Bfrtip',
"buttons": [
'pageLength',
{
"extend": 'excelHtml5',
title: "<?= $this->lang->line('subscriptions_history') ?>",
// exportOptions: {
// columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
// },
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([6].includes(j)) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data.body[i][j].replace(',', ".")
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
}
}
}
},
trim: false,
"action": newexportaction
},
{
extend: 'csvHtml5',
title: "<?= $this->lang->line('subscriptions_history') ?>",
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([6].includes(j)) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data.body[i][j].replace(',', ".")
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
}
}
}
},
trim: false,
"action": newexportaction
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
title: "<?= $this->lang->line('subscriptions_history') ?>",
trim: false,
"action": newexportaction
},
// 'colvis'
]
});
table.buttons().container()
.appendTo('#example_wrapper .col-sm-6:eq(0)');
});
</script>
<script type="text/javascript">
var startDate;
var endDate;
$(function () {
const lang = $('#picker').data('lang');
const category = $('#picker').data('category');
const id_network = "<?= $id_network?>";
$('input[name="daterange"]').daterangepicker({
opens: 'left',
autoUpdateInput: false,
locale: {
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
cancelLabel: 'Clear'
}
}, function (start, end, label) {
const debut = start.format('YYYY-MM-DD');
const fin = end.format('YYYY-MM-DD');
if(category)
window.location = "<?= current_url()?>" + "?history=insurance-expired-insured" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=insurance-expired-insured" + "&d=" + debut + "&f=" + fin;
});
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input
$('#daterange').val('');
if(category)
window.location = "<?= current_url()?>" + "?history=insurance-expired-insured";
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=insurance-expired-insured";
});
});
</script>

View File

@ -44,7 +44,9 @@
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('export_insured_list') ?></h3>
<div class="box-tools">
<a class="btn btn-danger" href="<?php echo current_url().'?history=insurance-expired-insured'?>">
<?php echo $this->lang->line('expired_insurance'); ?>
</a>
</div>
</div>
<div class="box-body" style="overflow-x:auto;">
@ -134,11 +136,18 @@
"type": "POST"
},
"aaSorting": [[8, "desc"]],
"columnDefs": [{
"targets": [6,7,8],
"columnDefs": [
{
"targets": [6,7],
// "orderable": false,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}],
render: $.fn.dataTable.render.moment('YYYY-MM-DD', 'D MMMM YYYY', format)
},
{
"targets": [8],
// "orderable": false,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}
],
dom: 'Bfrtip',
"buttons": [
'pageLength',
@ -220,9 +229,9 @@
const debut = start.format('YYYY-MM-DD');
const fin = end.format('YYYY-MM-DD');
if(category)
window.location = "<?= current_url()?>" + "?history=insurance-subscriptions" + "&d=" + debut + "&f=" + fin;
window.location = "<?= current_url()?>" + "?history=insurance-insured" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=insurance-subscriptions" + "&d=" + debut + "&f=" + fin;
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=insurance-insured" + "&d=" + debut + "&f=" + fin;
});
@ -230,9 +239,9 @@
//do something, like clearing an input
$('#daterange').val('');
if(category)
window.location = "<?= current_url()?>" + "?history=insurance-subscriptions";
window.location = "<?= current_url()?>" + "?history=insurance-insured";
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=insurance-subscriptions";
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=insurance-insured";
});
});