2021-11-19 05:10:52 +00:00
|
|
|
<link rel="stylesheet"
|
2022-04-18 11:39:19 +00:00
|
|
|
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
|
|
|
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
|
2021-11-19 05:10:52 +00:00
|
|
|
<div class="content-wrapper">
|
|
|
|
<!-- Content Header (Page header) -->
|
|
|
|
<section class="content-header">
|
|
|
|
<h1>
|
|
|
|
<?= $this->lang->line('manage_drugs_and_devices')?>
|
|
|
|
</h1>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section class="content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-xs-8">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header">
|
2022-04-18 11:39:19 +00:00
|
|
|
<h3 class="box-title"><?= $this->lang->line( 'drugs_and_devices') ?></h3>
|
2021-11-19 05:10:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="box-body" style="overflow-x:auto;">
|
|
|
|
<table id="institutions" class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th align='center'>#</th>
|
|
|
|
<th>Code</th>
|
2022-04-18 11:39:19 +00:00
|
|
|
<th><?= $this->lang->line('Nom'); ?></th>
|
2021-11-19 05:10:52 +00:00
|
|
|
<th>Type</th>
|
2022-04-18 11:39:19 +00:00
|
|
|
<th><?= $this->lang->line('on_prescription'); ?></th>
|
2021-11-19 05:10:52 +00:00
|
|
|
<th>Action</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-xs-4">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header">
|
2022-04-18 11:39:19 +00:00
|
|
|
<h3 class="box-title"><?= $this->lang->line('add_drug_and_device'); ?></h3>
|
2021-11-19 05:10:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
<form id="create-form" class="bottom-75 center-block">
|
|
|
|
<div class="form-group">
|
|
|
|
<label>Code</label>
|
|
|
|
<input type="text" class="form-control input-lg" name="code" >
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2022-04-18 11:39:19 +00:00
|
|
|
<label for="firstname"><?= $this->lang->line('Nom'); ?></label>
|
2021-11-19 05:10:52 +00:00
|
|
|
<input type="text" class="form-control input-lg" name="name">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-form-label">Type</label>
|
|
|
|
<select class="form-control input-lg" name="provider_billing_period" required>
|
|
|
|
<?php $array = array_values($types);
|
|
|
|
foreach ($array as $value) { ?>
|
|
|
|
<option value="<?=$value?>"> <?=$this->lang->line($value)?> </option>
|
|
|
|
<?php } ?>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="on_prescription">
|
2022-04-18 11:39:19 +00:00
|
|
|
<label ><?= $this->lang->line('on_prescription'); ?></label>
|
2021-11-19 05:10:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="submit"
|
2022-04-18 11:39:19 +00:00
|
|
|
value="<?= $this->lang->line('save'); ?>"
|
2021-11-19 05:10:52 +00:00
|
|
|
class="btn btn-primary">
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal fade" id="editModal">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
2022-04-18 11:39:19 +00:00
|
|
|
<h4 class="modal-title"><?= $this->lang->line('Mettre à jour des informations'); ?></h4>
|
2021-11-19 05:10:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<form id="update-form" method="post" class="bottom-75 center-block">
|
|
|
|
<div class="form-group">
|
|
|
|
<label>Code</label>
|
|
|
|
<input type="text" class="form-control input-lg" name="code" >
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2022-04-18 11:39:19 +00:00
|
|
|
<label><?= $this->lang->line('Nom'); ?></label>
|
2021-11-19 05:10:52 +00:00
|
|
|
<input type="text" class="form-control input-lg" name="name" >
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-form-label">Type</label>
|
|
|
|
<select class="form-control input-lg" name="provider_billing_period" required>
|
|
|
|
<?php $array = array_values($types);
|
|
|
|
foreach ($array as $value) { ?>
|
|
|
|
<option value="<?=$value?>"> <?=$this->lang->line($value)?> </option>
|
|
|
|
<?php } ?>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="on_prescription">
|
2022-04-18 11:39:19 +00:00
|
|
|
<label ><?= $this->lang->line('on_prescription'); ?></label>
|
2021-11-19 05:10:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input id="btn-update" type="submit"
|
2022-04-18 11:39:19 +00:00
|
|
|
value="<?= $this->lang->line('save'); ?>" class="btn btn-primary">
|
2021-11-19 05:10:52 +00:00
|
|
|
<button type="button" class="btn btn-default pull-right"
|
2022-04-18 11:39:19 +00:00
|
|
|
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
|
2021-11-19 05:10:52 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php $this->load->view('include/delete_modal',['title' => $this->lang->line('delete_drug_and_device')]) ?>
|
|
|
|
<?php $this->load->view('include/loader') ?>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- jQuery 3 -->
|
2022-04-18 11:39:19 +00:00
|
|
|
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
2021-11-19 05:10:52 +00:00
|
|
|
<!-- Bootstrap 3.3.7 -->
|
2022-04-18 11:39:19 +00:00
|
|
|
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
2021-11-19 05:10:52 +00:00
|
|
|
<!-- DataTables -->
|
2022-04-18 11:39:19 +00:00
|
|
|
<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>
|
2021-11-19 05:10:52 +00:00
|
|
|
<!-- Slimscroll -->
|
2022-04-18 11:39:19 +00:00
|
|
|
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
2021-11-19 05:10:52 +00:00
|
|
|
<!-- FastClick -->
|
2022-04-18 11:39:19 +00:00
|
|
|
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
2021-11-19 05:10:52 +00:00
|
|
|
<!-- AdminLTE App -->
|
2022-04-18 11:39:19 +00:00
|
|
|
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
|
2021-11-19 05:10:52 +00:00
|
|
|
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
|
|
|
|
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
toastr.options.closeButton = true;
|
|
|
|
toastr.options.closeMethod = 'fadeOut';
|
|
|
|
toastr.options.closeDuration = 5000;
|
|
|
|
toastr.options.closeEasing = 'swing';
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
$('#institutions').DataTable({
|
|
|
|
// Processing indicator
|
|
|
|
"processing": true,
|
|
|
|
"language": {
|
|
|
|
"processing": "<?= $this->lang->line('loading') ?>",
|
|
|
|
"emptyTable" : "<?= $this->lang->line('no_drug_and_device') ?>"
|
|
|
|
},
|
|
|
|
// DataTables server-side processing mode
|
|
|
|
"serverSide": true,
|
|
|
|
// Initial no order.
|
|
|
|
"order": [],
|
|
|
|
// Load data from an Ajax source
|
|
|
|
"ajax": {
|
|
|
|
"url": "<?= base_url('pagination/DrugAndDevices/getLists'); ?>",
|
|
|
|
"data":{
|
|
|
|
"id_network" : "<?= $network_id ?>",
|
|
|
|
},
|
|
|
|
"type": "POST"
|
|
|
|
},
|
|
|
|
"aaSorting": [],
|
|
|
|
dom: 'Bfrtip',
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
var networkId = <?= $network_id ?>;
|
|
|
|
var selectedId = null
|
|
|
|
|
|
|
|
$(document).on("click", ".edit", function () {
|
|
|
|
selectedId = $(this).data('id');
|
|
|
|
$("#update-form input[name='code']").val($(this).data('code'));
|
|
|
|
$("#update-form input[name='name']").val($(this).data('name'));
|
|
|
|
$("#update-form input[name='type']").val($(this).data('type'));
|
|
|
|
$("#update-form input[name='on_prescription']").prop('checked', $(this).data('on_prescription'));
|
|
|
|
$('#editModal').modal('show');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on("click", ".delete", function () {
|
|
|
|
selectedId = $(this).data('id');
|
|
|
|
$('#delete-modal').modal('show');
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#update-form").submit(function () {
|
|
|
|
$.ajax({
|
2022-04-18 11:39:19 +00:00
|
|
|
url: '<?= base_url('NanoHealthController/storeDrugAndDevice')?>',
|
2021-11-19 05:10:52 +00:00
|
|
|
type: 'post',
|
|
|
|
data: {
|
|
|
|
id: selectedId,
|
|
|
|
network_id : networkId,
|
|
|
|
code: $("input[name=code]",this).val(),
|
|
|
|
name: $("input[name=name]",this).val(),
|
|
|
|
type: $("input[name=type]",this).val(),
|
|
|
|
on_prescription : $("input[name=on_prescription]",this).is(':checked') ? 1 : 0
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (data) {
|
|
|
|
if(data.code === 200){
|
|
|
|
Swal.fire({
|
|
|
|
icon: 'success',
|
|
|
|
title: "<?= $this->lang->line('drug_and_device_updated')?>",
|
|
|
|
text:"<?= $this->lang->line('informations_updated')?>",
|
|
|
|
timer: 3000
|
|
|
|
}).then(()=>{
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function (resultat, statut, error) {
|
|
|
|
console.log(resultat + " " + error);
|
|
|
|
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#create-form").submit(function (event) {
|
|
|
|
|
|
|
|
$.ajax({
|
2022-04-18 11:39:19 +00:00
|
|
|
url: '<?= base_url('NanoHealthController/storeDrugAndDevice')?>',
|
2021-11-19 05:10:52 +00:00
|
|
|
type: 'post',
|
|
|
|
data: {
|
|
|
|
network_id : networkId,
|
|
|
|
code: $("input[name=code]",this).val(),
|
|
|
|
name: $("input[name=name]",this).val(),
|
|
|
|
type: $("input[name=type]",this).val(),
|
|
|
|
on_prescription : $("input[name=on_prescription]",this).is(':checked') ? 1 : 0
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (data) {
|
|
|
|
if(data.code === 200){
|
|
|
|
Swal.fire({
|
|
|
|
icon: 'success',
|
|
|
|
title: "<?= $this->lang->line('drug_and_device_created')?>",
|
|
|
|
text:"<?= $this->lang->line('informations_updated')?>",
|
|
|
|
timer: 3000
|
|
|
|
}).then(()=>{
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function (resultat, statut, error) {
|
|
|
|
console.log(resultat + " " + error);
|
|
|
|
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("#delete-btn").click(function () {
|
|
|
|
$.ajax({
|
2022-04-18 11:39:19 +00:00
|
|
|
url: '<?= base_url('NanoHealthController/deleteDrugAndDevice')?>',
|
2021-11-19 05:10:52 +00:00
|
|
|
type: 'post',
|
|
|
|
data: {id: selectedId},
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (data) {
|
|
|
|
if(data.code === 200){
|
|
|
|
Swal.fire({
|
|
|
|
icon: 'success',
|
|
|
|
title: "<?= $this->lang->line('drug_and_device_deleted')?>",
|
|
|
|
text:"<?= $this->lang->line('informations_updated')?>",
|
|
|
|
timer: 3000
|
|
|
|
}).then(()=>{
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function (resultat, statut, error) {
|
|
|
|
console.log(resultat + " " + error);
|
|
|
|
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|