Add payment_period_days to customers openings accounts configuration
This commit is contained in:
parent
9384d0842f
commit
322160a631
|
@ -90,7 +90,7 @@ class OpeningAccountAgent extends CI_Controller
|
|||
|
||||
public function treatRequest($request_id)
|
||||
{
|
||||
echo makeRequest('user-service', 'PUT','/customers_accounts_requests/'.$request_id.'/treat', $_POST);
|
||||
echo makeRequest('user-service', 'PUT','/customers_accounts_requests/'.$request_id, $_POST);
|
||||
}
|
||||
|
||||
private function isLogged()
|
||||
|
|
|
@ -1049,4 +1049,6 @@ $lang['debit_card_type'] = "Debit card type";
|
|||
$lang['opening_account_request_accepted'] = "Customer account opening request accepted";
|
||||
$lang['opening_account_request_rejected'] = "The request to open an account has been rejected";
|
||||
$lang['opening_account_request_more_information'] = "The request to open an account has been rejected";
|
||||
$lang['payment_period_days'] = "Payment period (in days)";
|
||||
$lang['required_payment_period_days'] = "Payment period is required"
|
||||
?>
|
||||
|
|
|
@ -1057,4 +1057,6 @@ $lang['debit_card_type'] = "Type de carte de débit";
|
|||
$lang['opening_account_request_accepted'] = "La demande d'ouverture de compte client été acceptée";
|
||||
$lang['opening_account_request_rejected'] = "La demande d'ouverture de compte client été rejetée";
|
||||
$lang['opening_account_request_more_information'] = "La demande d'ouverture de compte client en attente de complement d'informations";
|
||||
$lang['payment_period_days'] = "Délai de paiement (en jours)";
|
||||
$lang['required_payment_period_days'] = "Délai de paiement est obligatoire"
|
||||
?>
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
$this->converter = new CurrencyConverter($provider);
|
||||
$this->context = new AutoContext();
|
||||
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||
|
||||
$context = new AutoContext();
|
||||
?>
|
||||
</section>
|
||||
|
||||
|
@ -100,23 +102,38 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(in_array($request->status, ['REJECTED','MORE_INFORMATION'])) { ?>
|
||||
<?php if(!empty($request->opening_amount)) { ?>
|
||||
<div class="col-lg-4 col-xs-6">
|
||||
<div class="small-box bg-blue-active">
|
||||
<div class="inner">
|
||||
<p style="white-space: pre-wrap;"><?= $request->reject_reason ?> </p>
|
||||
<p><?= $this->lang->line('reject_reason') ?></p>
|
||||
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= Money::of(round($request->opening_amount, 2), $request->currency_code ?? 'XAF', $context)->formatTo('fr_FR') ?> </h3>
|
||||
<p><?= $this->lang->line('opening_amount') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-info"></i>
|
||||
<i class="fa fa-money"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if(in_array($request->status, ['REJECTED','MORE_INFORMATION'])) { ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="small-box bg-blue-active">
|
||||
<div class="inner">
|
||||
<p style="white-space: pre-wrap;"><?= $request->reject_reason ?> </p>
|
||||
<p><?= $this->lang->line('reject_reason') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-info"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Personal details -->
|
||||
<div class="box box-success">
|
||||
<div class="box-header with-border">
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<th align='center'><?=$this->lang->line('request_id')?></th>
|
||||
<th>Type</th>
|
||||
<th><?= $this->lang->line('Nom') ?></th>
|
||||
<th><?= $this->lang->line('Nom') ?></th>
|
||||
<th><?= $this->lang->line('Prénom') ?></th>
|
||||
<th><?= $this->lang->line('Contact') ?></th>
|
||||
<th><?= $this->lang->line('state') ?></th>
|
||||
<th>Date </th>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<th>Description</th>
|
||||
<th>Parent</th>
|
||||
<th><?= $this->lang->line('opening_amount'); ?></th>
|
||||
<th><?= $this->lang->line('payment_period_days'); ?></th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -44,9 +45,10 @@
|
|||
<td><?=$row->description?></td>
|
||||
<td><?=$row->parent?></td>
|
||||
<td><?= empty($row->opening_amount) ? '' : Money::of(round($row->opening_amount, 2), $currency_code ?? 'XAF', $context)->formatTo('fr_FR')?></td>
|
||||
<td><?= $row->opening_amount_payment_period_days?></td>
|
||||
<td>
|
||||
<button class="btn btn-success edit" data-id="<?=$row->id?>" data-name="<?=$row->name?>" data-description="<?=$row->description?>"
|
||||
data-parent_id="<?=$row->parent_id?>" data-opening_amount="<?=$row->opening_amount?>">
|
||||
data-parent_id="<?=$row->parent_id?>" data-opening_amount="<?=$row->opening_amount?>" data-opening_amount_payment_period_days="<?=$row->opening_amount_payment_period_days?>">
|
||||
<i class="fa fa-edit"></i>
|
||||
</button>
|
||||
<button data-toggle="modal" class="btn btn-danger delete-doc" data-id="<?=$row->id?>" >
|
||||
|
@ -79,6 +81,10 @@
|
|||
<label for="opening_amount"><?= $this->lang->line('opening_amount'); ?></label>
|
||||
<input type="number" value="" class="form-control input-lg" name="opening_amount" id="opening_amount">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="opening_amount_payment_period_days_u"><?= $this->lang->line('payment_period_days'); ?></label>
|
||||
<input type="number" value="" class="form-control input-lg" name="opening_amount_payment_period_days" id="opening_amount_payment_period_days_u">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Parent</label>
|
||||
<select class="form-control input-lg" name="parent_id" >
|
||||
|
@ -108,7 +114,7 @@
|
|||
<h4 class="modal-title"><?= $this->lang->line('Mettre à jour des informations'); ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="update-form" method="post" class="bottom-75 center-block">
|
||||
<form id="update-form" class="bottom-75 center-block">
|
||||
<div class="form-group">
|
||||
<label for="name_u"><?= $this->lang->line('Nom'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="name" id="name_u" required>
|
||||
|
@ -121,6 +127,10 @@
|
|||
<label for="opening_amount_u"><?= $this->lang->line('opening_amount'); ?></label>
|
||||
<input type="number" value="" class="form-control input-lg" name="opening_amount" id="opening_amount_u">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="opening_amount_payment_period_days_u"><?= $this->lang->line('payment_period_days'); ?></label>
|
||||
<input type="number" value="" class="form-control input-lg" name="opening_amount_payment_period_days" id="opening_amount_payment_period_days_u">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Parent</label>
|
||||
<select class="form-control input-lg" name="parent_id" ></select>
|
||||
|
@ -150,8 +160,9 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="btn-update" type="submit"
|
||||
value="<?= $this->lang->line('save'); ?>" class="btn btn-primary">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<?= $this->lang->line('save'); ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default pull-right"
|
||||
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
|
||||
</div>
|
||||
|
@ -274,6 +285,7 @@
|
|||
$("#update-form input[name='name']").val($(this).data('name'));
|
||||
$("#update-form textarea[name='description']").val($(this).data('description'));
|
||||
$("#update-form input[name='opening_amount']").val($(this).data('opening_amount'));
|
||||
$("#update-form input[name='opening_amount_payment_period_days']").val($(this).data('opening_amount_payment_period_days'));
|
||||
|
||||
$("#update-form select[name='parent_id']").empty().append("<option value='0'>"+ "<?this->lang->line('no_parent')?>" + "</option>");
|
||||
$.each(types, function (j, it) {
|
||||
|
@ -306,87 +318,103 @@
|
|||
});
|
||||
|
||||
$("#update-form").submit(function () {
|
||||
// Paliers
|
||||
var documents = [];
|
||||
|
||||
$('#documents_list tr').has('td').each(function() {
|
||||
var arrayItem = {};
|
||||
$('td', $(this)).each(function(index, item) {
|
||||
if(index < 2){
|
||||
arrayItem[index] = $(item).html();
|
||||
let openingAmount = $("input[name=opening_amount]",this).val();
|
||||
let paymentPeriod = $("input[name=opening_amount_payment_period_days]",this).val();
|
||||
|
||||
if (openingAmount && !paymentPeriod){
|
||||
toastr.warning("<?= $this->lang->line('required_payment_period_days')?>" , "<?= $this->lang->line('request_error')?>");
|
||||
}else {
|
||||
// Paliers
|
||||
var documents = [];
|
||||
|
||||
$('#documents_list tr').has('td').each(function() {
|
||||
var arrayItem = {};
|
||||
$('td', $(this)).each(function(index, item) {
|
||||
if(index < 2){
|
||||
arrayItem[index] = $(item).html();
|
||||
}
|
||||
});
|
||||
documents.push(arrayItem);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('Hyperviseur_dash/storeCustomerAccountType')?>',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: selectedId,
|
||||
network_id : networkId,
|
||||
name: $("input[name=name]",this).val(),
|
||||
description: $("textarea[name=description]",this).val(),
|
||||
opening_amount: $("input[name=opening_amount]",this).val(),
|
||||
opening_amount_payment_period_days: $("input[name=opening_amount_payment_period_days]", this).val(),
|
||||
parent_id : $("select[name=parent_id]",this).val(),
|
||||
documents: documents
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if(data.code === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('customer_account_type_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')?>");
|
||||
}
|
||||
});
|
||||
documents.push(arrayItem);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('Hyperviseur_dash/storeCustomerAccountType')?>',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: selectedId,
|
||||
network_id : networkId,
|
||||
name: $("input[name=name]",this).val(),
|
||||
description: $("textarea[name=description]",this).val(),
|
||||
opening_amount: $("input[name=opening_amount]",this).val(),
|
||||
parent_id : $("select[name=parent_id]",this).val(),
|
||||
documents: documents
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if(data.code === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('customer_account_type_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({
|
||||
url: '<?= base_url('Hyperviseur_dash/storeCustomerAccountType')?>',
|
||||
type: 'post',
|
||||
data: {
|
||||
network_id : networkId,
|
||||
name: $("input[name=name]",this).val(),
|
||||
description: $("textarea[name=description]",this).val(),
|
||||
opening_amount: $("input[name=opening_amount]",this).val(),
|
||||
parent_id : $("select[name=parent_id]",this).val()
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if(data.code === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('customer_account_type_created')?>",
|
||||
text:"<?= $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
||||
let openingAmount = $("input[name=opening_amount]",this).val();
|
||||
let paymentPeriod = $("input[name=opening_amount_payment_period_days]",this).val();
|
||||
if (openingAmount && !paymentPeriod){
|
||||
toastr.warning("<?= $this->lang->line('required_payment_period_days')?>" , "<?= $this->lang->line('request_error')?>");
|
||||
}else {
|
||||
$.ajax({
|
||||
url: '<?= base_url('Hyperviseur_dash/storeCustomerAccountType')?>',
|
||||
type: 'post',
|
||||
data: {
|
||||
network_id: networkId,
|
||||
name: $("input[name=name]", this).val(),
|
||||
description: $("textarea[name=description]", this).val(),
|
||||
opening_amount: $("input[name=opening_amount]", this).val(),
|
||||
opening_amount_payment_period_days: $("input[name=opening_amount_payment_period_days]", this).val(),
|
||||
parent_id: $("select[name=parent_id]", this).val()
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('customer_account_type_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')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue