Improved insured details and add amount to act
This commit is contained in:
parent
1678e4e37b
commit
9338a6c7e2
|
@ -2052,6 +2052,26 @@ class Hyperviseur_dash extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function exclusions(){
|
||||
if ($this->isLogged()) {
|
||||
$data['alert'] = "";
|
||||
$data['active'] = "wallet_exclusions";
|
||||
$data['network'] = $this->session->userdata('network');
|
||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||
|
||||
$data['currency_code'] = $this->session->userdata('currency_code');
|
||||
$data['category'] = $this->session->userdata('category');
|
||||
$data['network_id'] = $this->session->userdata('network_id');
|
||||
|
||||
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||
$data['exclusion'] = $this->nano_health_model->getConfig($data['network_id']);
|
||||
|
||||
$this->load->view('header_hyp', $data);
|
||||
$this->load->view('nano_health/hyper/exclusions');
|
||||
$this->load->view('footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function drugs_and_devices(){
|
||||
if ($this->isLogged()) {
|
||||
$data['active'] = "wallet_drugs_and_devices";
|
||||
|
|
|
@ -76,6 +76,7 @@ class NanoHealthController extends CI_Controller
|
|||
if (isset($_POST)) {
|
||||
$id = $_POST['id'] ?? null;
|
||||
$_POST['nh_network_config_id'] = $_POST['config_id'];
|
||||
$_POST['amount'] = empty($_POST['amount']) ? null : $_POST['amount'];
|
||||
unset($_POST['config_id']);
|
||||
|
||||
$exist = $this->db->get_where('nh_acts', ['id !=' => $id , 'nh_network_config_id' => $_POST['nh_network_config_id'] , 'code' => $_POST['code']]);
|
||||
|
|
|
@ -900,5 +900,8 @@ $lang['payment_duration_months'] = "Payment duration (in months)";
|
|||
$lang['ONE_TIME'] = "One time only";
|
||||
$lang['DAILY'] = "Daily";
|
||||
$lang['undefined'] = "Not defined";
|
||||
$lang['number_of_fractions'] = "Number of fractions"
|
||||
$lang['number_of_fractions'] = "Number of fractions";
|
||||
$lang['PARTIALLY_PAID'] = "Partially paid";
|
||||
$lang['SUSPENDED'] = "Suspended";
|
||||
$lang['amount_required'] = "Amount is required";
|
||||
?>
|
||||
|
|
|
@ -910,5 +910,8 @@ $lang['payment_duration_months'] = "Durée du paiment (en mois)";
|
|||
$lang['ONE_TIME'] = "Une seule fois";
|
||||
$lang['DAILY'] = "Journalier";
|
||||
$lang['undefined'] = "Non défini";
|
||||
$lang['number_of_fractions'] = "Nombre de fractions"
|
||||
$lang['number_of_fractions'] = "Nombre de fractions";
|
||||
$lang['PARTIALLY_PAID'] = "Partiellement payée";
|
||||
$lang['SUSPENDED'] = "Suspendue";
|
||||
$lang['amount_required'] = "Le montant est requis";
|
||||
?>
|
||||
|
|
|
@ -185,4 +185,8 @@ class Nano_health_model extends CI_Model
|
|||
}
|
||||
return $query->count_all_results();
|
||||
}
|
||||
|
||||
public function getExclusion($id_network){
|
||||
return $this->db->get_where('nh_exclusions',['network_id'=> $id_network]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,11 +39,8 @@ class Insurances_model extends CI_Model
|
|||
$this->db->from($this->table);
|
||||
$this->db->where('network_id', $postData['id_network']);
|
||||
if (!empty($postData['state'])) {
|
||||
if($postData['state'] == "STOPPED"){
|
||||
$this->db->where_in('state', ["STOPPED","EXPIRED"]);
|
||||
}else{
|
||||
$this->db->where('state', $postData['state']);
|
||||
}
|
||||
$state = explode(',',$postData['state']);
|
||||
$this->db->where_in('state', $state);
|
||||
}
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
@ -73,11 +70,8 @@ class Insurances_model extends CI_Model
|
|||
$this->db->where('created_at <', date('Y-m-d', strtotime($postData['endDate']. "+1 day")));
|
||||
}
|
||||
if (!empty($postData['state'])) {
|
||||
if($postData['state'] == "STOPPED"){
|
||||
$this->db->where_in('state', ["STOPPED","EXPIRED"]);
|
||||
}else{
|
||||
$this->db->where('state', $postData['state']);
|
||||
}
|
||||
$state = explode(',',$postData['state']);
|
||||
$this->db->where_in('state', $state);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
|
|
@ -235,6 +235,12 @@
|
|||
<span><?php echo $this->lang->line('invoices'); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="<?php if ($active == "wallet_exclusions") {echo "active";} ?>">
|
||||
<a href="<?php echo base_url('Hyperviseur_dash/exclusions') ?>">
|
||||
<i class="fa fa-times"></i>
|
||||
<span>Exclusions</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="<?php if ($active == "wallet_password") {
|
||||
echo "active";
|
||||
|
|
|
@ -366,6 +366,7 @@ $careRequests = [];
|
|||
<th>".$this->lang->line('Nom')."</th>
|
||||
<th>".$this->lang->line('billing_type')."</th>
|
||||
<th>".$this->lang->line('authorization_type')."</th>
|
||||
<th>".$this->lang->line('Montant')."</th>
|
||||
<th>Action</th>";
|
||||
?>
|
||||
</tr>
|
||||
|
@ -373,16 +374,19 @@ $careRequests = [];
|
|||
<tbody>
|
||||
<?php
|
||||
if(isset($acts)){
|
||||
foreach($acts->result() as $i => $row) { ?>
|
||||
foreach($acts->result() as $i => $row) {
|
||||
$amount = isset($row->amount) ? Money::of(round($row->amount, 2), $currency_code, $context)->formatTo('fr_FR') : ''
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $i+1 ?></td>
|
||||
<td><?= $row->code ?></td>
|
||||
<td><?= $row->name ?></td>
|
||||
<td><?= $this->lang->line($row->billing_type); ?></td>
|
||||
<td><?= $this->lang->line($row->authorization_type); ?></td>
|
||||
<td><?= $amount ?></td>
|
||||
<td>
|
||||
<button class='btn btn-success editAct' data-id="<?=$row->id?>" data-name="<?=$row->name?>" data-billing_type="<?=$row->billing_type?>"
|
||||
data-authorization_type="<?=$row->authorization_type?>" data-code="<?=$row->code?>" >
|
||||
data-authorization_type="<?=$row->authorization_type?>" data-code="<?=$row->code?>" data-amount="<?=$row->amount?>" >
|
||||
<i class='fa fa-edit'></i>
|
||||
</button>
|
||||
<button data-toggle='modal' class='btn btn-danger deleteAct' data-id="<?=$row->id?>" >
|
||||
|
@ -715,6 +719,10 @@ $careRequests = [];
|
|||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" id="div-amount">
|
||||
<label class="col-form-label"><?= $this->lang->line('Montant'); ?></label>
|
||||
<input type="number" min="0" step="1" class="form-control input-lg" name="amount">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label"><?= $this->lang->line('authorization_type'); ?></label>
|
||||
<select class="form-control input-lg" name="authorization_type" required>
|
||||
|
@ -1027,47 +1035,68 @@ $careRequests = [];
|
|||
});
|
||||
|
||||
$("#actForm").submit(function( event ) {
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('NanoHealthController/storeAct')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"config_id": config_id,
|
||||
"id" : selectedActId,
|
||||
"code": $("input[name='code']",this).val(),
|
||||
"name": $("input[name='name']",this).val(),
|
||||
"billing_type": $("select[name='billing_type'] :selected",this).val(),
|
||||
"authorization_type": $("select[name='authorization_type'] :selected",this).val(),
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('wallet_update')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
toastr.error(data.message , "<?php echo $this->lang->line('request_error')?>");
|
||||
let billing_type = $("select[name='billing_type'] :selected",this).val()
|
||||
let amount = parseFloat($("input[name='amount']",this).val())
|
||||
if(billing_type === "UNIT_PRICE" && isNaN(amount)){
|
||||
toastr.error("<?= $this->lang->line('amount_required')?>", "<?= $this->lang->line('management_rule')?>");
|
||||
}else{
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('NanoHealthController/storeAct')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"config_id": config_id,
|
||||
"id" : selectedActId,
|
||||
"code": $("input[name='code']",this).val(),
|
||||
"name": $("input[name='name']",this).val(),
|
||||
"billing_type": billing_type,
|
||||
"authorization_type": $("select[name='authorization_type'] :selected",this).val(),
|
||||
"amount" : isNaN(amount) ? null : amount
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('wallet_update')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
toastr.error(data.message , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// function hideOrShowActAmountDiv(billing_type){
|
||||
// if(billing_type === 'PACKAGE'){
|
||||
// $("#actForm div[id='div-amount']").hide()
|
||||
// }else{
|
||||
// $("#actForm div[id='div-amount']").show()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $("#actForm select[name='billing_type']").change(function () {
|
||||
// hideOrShowActAmountDiv($(this).val())
|
||||
// });
|
||||
|
||||
$('.editAct').click(function (){
|
||||
selectedActId = $(this).data('id');
|
||||
$("#modal-act h3").html("<?=$this->lang->line('edit_act')?>");
|
||||
$("#actForm input[name='code']").val($(this).data('code'));
|
||||
$("#actForm input[name='name']").val($(this).data('name'));
|
||||
$("#actForm select[name='billing_type']").val($(this).data('billing_type'));
|
||||
$("#actForm input[name='amount']").val($(this).data('amount'));
|
||||
$("#actForm select[name='authorization_type']").val($(this).data('authorization_type'));
|
||||
// hideOrShowActAmountDiv($(this).data('billing_type'))
|
||||
$('#modal-act').modal('show');
|
||||
});
|
||||
|
||||
|
@ -1077,7 +1106,10 @@ $careRequests = [];
|
|||
$("#actForm input[name='code']").val(null);
|
||||
$("#actForm input[name='name']").val(null);
|
||||
$("#actForm select[name='billing_type']").prop('selectedIndex',0);
|
||||
$("#actForm input[name='amount']").val(null);
|
||||
$("#actForm select[name='authorization_type']").prop('selectedIndex',0);
|
||||
|
||||
// $("#actForm div[id='div-amount']").hide();
|
||||
$('#modal-act').modal('show');
|
||||
});
|
||||
|
||||
|
|
|
@ -159,6 +159,17 @@
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-xs-6">
|
||||
<div class="small-box bg-aqua-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= $this->lang->line($insurance->state) ?></h3>
|
||||
<p><?= $this->lang->line('state') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-info"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<div class="small-box bg-aqua-active">
|
||||
<div class="inner">
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
"ajax": {
|
||||
"url": "<?= base_url('pagination/Insurances/getLists'); ?>",
|
||||
"data":{
|
||||
"state" : "STOPPED",
|
||||
"state" : "STOPPED,SUSPENDED,EXPIRED",
|
||||
"startDate" : "<?= $startDate?>",
|
||||
"endDate" : "<?= $endDate?>",
|
||||
"id_network" : "<?= $id_network ?>",
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
"ajax": {
|
||||
"url": "<?= base_url('pagination/Insurances/getLists'); ?>",
|
||||
"data":{
|
||||
"state" : "PAID",
|
||||
"state" : "PAID,PARTIALLY_PAID",
|
||||
"startDate" : "<?= $startDate?>",
|
||||
"endDate" : "<?= $endDate?>",
|
||||
"id_network" : "<?= $id_network ?>",
|
||||
|
|
Loading…
Reference in New Issue