Fix insurance subscription flow
This commit is contained in:
parent
6b25bb12b6
commit
112d1080f6
|
@ -381,7 +381,7 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$data['active'] = "wallet_insured";
|
||||
$data['insured_id'] = $this->input->get('id');
|
||||
$data['insurance'] = $this->nano_health_model->getInfosInsuredById($this->input->get('id'));
|
||||
$data['beneficiaries'] = $this->db->get_where('nh_insurances_having_rights',['insurance_subscription_id' => $data['insurance']->insurance_subscription_id ?? null]);
|
||||
$data['beneficiaries'] = $this->nano_health_model->getInsuranceBeneficiaries($data['insurance']->id ?? null);
|
||||
$data['user'] = $this->db->get_where('user_infos',['user_id' => $data['insurance']->user_id ?? null])->first_row();
|
||||
$data['transactions'] = $this->nano_health_model->getInsurancePaymentTransactions($this->input->get('id'));
|
||||
|
||||
|
@ -390,7 +390,7 @@ class Hyperviseur_dash extends CI_Controller
|
|||
}else{
|
||||
$data['insurance_subscription_id'] = $this->input->get('id');
|
||||
$data['subscription'] = $this->nano_health_model->getInfosInsuranceSubscriptionById($this->input->get('id'));
|
||||
$data['beneficiaries'] = $this->db->get_where('nh_insurances_having_rights',['insurance_subscription_id' => $data['insurance_subscription_id']]);
|
||||
$data['beneficiaries'] = $this->nano_health_model->getSubscriptionBeneficiaries($data['subscription']->id ?? null);
|
||||
$data['user'] = $this->db->get_where('user_infos',['user_id' => $data['subscription']->user_id ?? null])->first_row();
|
||||
$this->load->view('header_hyp', $data);
|
||||
$this->load->view('nano_health/hyper/infos_insurance_subscription');
|
||||
|
|
|
@ -57,11 +57,10 @@ class InsuranceSubscription extends CI_Controller
|
|||
$current_url = $_POST['currentURL'];
|
||||
foreach ($witData as $row) {
|
||||
$i++;
|
||||
|
||||
$bonus_amount = Money::of(round($row->total_bonus_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR');
|
||||
|
||||
$data[] = array($i,$row->insurance_subscription_id, $row->lastname, $row->phone, $row->number_of_months, $row->number_of_beneficiaries,
|
||||
$bonus_amount, mb_strtoupper($this->lang->line($row->state) ,'UTF-8'), $row->created_at,
|
||||
$bonus_amount, mb_strtoupper($this->lang->line($row->state) ,'UTF-8'), mb_strtoupper($this->lang->line($row->insurance_action), 'UTF-8') , $row->created_at,
|
||||
'<a href="'.$current_url.'?history=insurance-subscriptions&id='.$row->insurance_subscription_id.'" class="btn btn-primary" > '.$this->lang->line('Voir plus...').'</a>');
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class Insurances extends CI_Controller
|
|||
$bonus_amount = Money::of(round($row->total_bonus_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR');
|
||||
|
||||
$data[] = array($row->insured_id , $row->lastname, $row->phone, $row->number_of_months, $row->number_of_beneficiaries,
|
||||
$bonus_amount, mb_strtoupper($this->lang->line($row->state) ,'UTF-8'), $row->start_at, $row->end_at, $row->created_at,
|
||||
$bonus_amount, $row->start_at, $row->end_at, $row->created_at,
|
||||
'<a href="'.$current_url.'?history=insurance-insured&id='.$row->insured_id.'" class="btn btn-primary" > '.$this->lang->line('Voir plus...').'</a>');
|
||||
}
|
||||
|
||||
|
|
|
@ -762,5 +762,5 @@ $lang['payment_transaction_history'] = "Payment transaction history";
|
|||
$lang['reason'] = "Reason";
|
||||
$lang['ADDITION_OF_BENEFICIARY'] = "Addition of beneficiary";
|
||||
$lang['DELETION_OF_BENEFICIARY'] = "Deletion of beneficiary";
|
||||
$lang['ACTIVATION'] = "Activation";
|
||||
$lang['ACTIVATION'] = "Insurance activation";
|
||||
?>
|
||||
|
|
|
@ -773,5 +773,5 @@ $lang['payment_transaction_history'] = "Historique des transactions de paiements
|
|||
$lang['reason'] = "Motif";
|
||||
$lang['ADDITION_OF_BENEFICIARY'] = "Ajout d'ayant droit";
|
||||
$lang['DELETION_OF_BENEFICIARY'] = "Suppression d'ayant droit";
|
||||
$lang['ACTIVATION'] = "Activation";
|
||||
$lang['ACTIVATION'] = "Activation de l'assurance";
|
||||
?>
|
||||
|
|
|
@ -64,4 +64,16 @@ class Nano_health_model extends CI_Model
|
|||
public function getInsurancePaymentTransactions($insuredId){
|
||||
return $this->db->get_where('nh_insurances_payments',['insured_id'=> $insuredId]);
|
||||
}
|
||||
|
||||
public function getSubscriptionBeneficiaries($subscriptionId){
|
||||
return $this->db->select('b.*')
|
||||
->from('nh_having_rights b')->join('nh_insurances_having_rights i', 'b.id = i.having_right_id')
|
||||
->where('i.insurance_subscription_id',$subscriptionId)->order_by('i.created_at','asc')->get();
|
||||
}
|
||||
|
||||
public function getInsuranceBeneficiaries($insuranceId){
|
||||
return $this->db->select('b.*')
|
||||
->from('nh_having_rights b')->join('nh_insurances_having_rights i', 'b.id = i.having_right_id')
|
||||
->where('i.insurance_id',$insuranceId)->order_by('i.created_at','asc')->get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,11 @@ class InsuranceSubscription_model extends CI_Model
|
|||
// Set table name
|
||||
$this->table = 'nh_infos_insurances_subscriptions';
|
||||
// Set orderable column fields
|
||||
$this->column_order = array(null, 'insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state','created_at', null);
|
||||
$this->column_order = array(null, 'insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state',
|
||||
'insurance_action','created_at', null);
|
||||
// Set searchable column fields
|
||||
$this->column_search = array('insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state','created_at');
|
||||
$this->column_search = array('insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state',
|
||||
'insurance_action','created_at');
|
||||
// Set default order
|
||||
$this->order = array('created_at' => 'desc');
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ class Insurances_model extends CI_Model
|
|||
// Set table name
|
||||
$this->table = 'nh_infos_insurances';
|
||||
// Set orderable column fields
|
||||
$this->column_order = array('insured_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state', 'start_at',
|
||||
$this->column_order = array('insured_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'start_at',
|
||||
'end_at','created_at', null);
|
||||
// Set searchable column fields
|
||||
$this->column_search = array('insured_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state', 'start_at',
|
||||
$this->column_search = array('insured_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'start_at',
|
||||
'end_at', 'created_at');
|
||||
// Set default order
|
||||
$this->order = array('created_at' => 'desc');
|
||||
|
|
|
@ -156,34 +156,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4 col-xs-6">
|
||||
<div class="small-box bg-blue-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap"><?= $this->lang->line($insurance->state)?> </h3>
|
||||
<p><?= $this->lang->line('Statut') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-info"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($insurance->state == 'ADDITION_OF_BENEFICIARY') {?>
|
||||
<div class="col-lg-4 col-xs-6">
|
||||
<div class="small-box bg-blue-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap;"><?= Money::of(round($insurance->remaining_amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR') ?> </h3>
|
||||
<p><?= $this->lang->line('remaining_amount') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-money"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="box box-primary">
|
||||
|
|
|
@ -44,9 +44,7 @@
|
|||
<div class="box-header">
|
||||
<h3 class="box-title"><?= $this->lang->line('export_insured_list') ?></h3>
|
||||
<div class="box-tools">
|
||||
<a class="btn btn-primary" href="<?= current_url().('?history=insurance-payment-transactions')?>">
|
||||
<?= $this->lang->line('payment_transaction_history'); ?>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
|
@ -60,7 +58,6 @@
|
|||
<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('state') ?></th>
|
||||
<th><?= $this->lang->line('start_at') ?></th>
|
||||
<th><?= $this->lang->line('end_at') ?></th>
|
||||
<th align='center'><?= $this->lang->line('subscription_date') ?></th>
|
||||
|
@ -137,7 +134,7 @@
|
|||
},
|
||||
"aaSorting": [[8, "desc"]],
|
||||
"columnDefs": [{
|
||||
"targets": [7,8,9],
|
||||
"targets": [6,7,8],
|
||||
// "orderable": false,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||
}],
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<th><?php echo $this->lang->line('number_of_beneficiaries') ?></th>
|
||||
<th><?php echo $this->lang->line('bonus_amount') ?></th>
|
||||
<th><?php echo $this->lang->line('state') ?></th>
|
||||
<th><?php echo $this->lang->line('reason') ?></th>
|
||||
<th align='center'>Date</th>
|
||||
<th align='center'>Action</th>
|
||||
</tr>
|
||||
|
@ -132,7 +133,7 @@
|
|||
},
|
||||
"aaSorting": [[8, "desc"]],
|
||||
"columnDefs": [{
|
||||
"targets": [8],
|
||||
"targets": [9],
|
||||
// "orderable": false,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||
}],
|
||||
|
|
Loading…
Reference in New Issue