feat: add commission config in hypervisor dashboard

This commit is contained in:
Djery-Tom 2023-07-27 15:49:58 +01:00
parent ca208a0daf
commit b07c36f55f
5 changed files with 706 additions and 25 deletions

View File

@ -1572,22 +1572,22 @@ class Gestion extends CI_Controller
$this->insertPalier($plr_user_wallet_cash_national, "user_wallet_cash_national", $idConfig);
break;
case 'user_carte_wallet':
// $plr_user_cart_wallet_international = $_POST['plr_user_cart_wallet_international'] ?? null;
$plr_user_cart_wallet_international = $_POST['plr_user_cart_wallet_international'] ?? null;
$plr_user_cart_wallet_national = $_POST['plr_user_cart_wallet_national'] ?? null;
// $plr_user_cart_cash_international = $_POST['plr_user_cart_cash_international'] ?? null;
$plr_user_cart_cash_international = $_POST['plr_user_cart_cash_international'] ?? null;
$plr_user_cart_cash_national = $_POST['plr_user_cart_cash_national'] ?? null;
// $plr_hyp_user_cart_cash_international = $_POST['plr_hyp_user_cart_cash_international'] ?? null;
$plr_hyp_user_cart_cash_international = $_POST['plr_hyp_user_cart_cash_international'] ?? null;
$plr_hyp_user_cart_cash_national = $_POST['plr_hyp_user_cart_cash_national'] ?? null;
// $plr_bank_user_cart_cash_international = $_POST['plr_bank_user_cart_cash_international'] ?? null;
$plr_bank_user_cart_cash_international = $_POST['plr_bank_user_cart_cash_international'] ?? null;
$plr_bank_user_cart_cash_national = $_POST['plr_bank_user_cart_cash_national'] ?? null;
// $this->insertPalier($plr_user_cart_wallet_international, "user_cart_wallet_international", $idConfig,'paliers_commissions_wallet');
$this->insertPalier($plr_user_cart_wallet_international, "user_cart_wallet_international", $idConfig,'paliers_commissions_wallet');
$this->insertPalier($plr_user_cart_wallet_national, "user_cart_wallet_national", $idConfig ,'paliers_commissions_wallet');
// $this->insertPalier($plr_user_cart_cash_international, "user_cart_cash_international", $idConfig,'paliers_commissions_wallet');
$this->insertPalier($plr_user_cart_cash_international, "user_cart_cash_international", $idConfig,'paliers_commissions_wallet');
$this->insertPalier($plr_user_cart_cash_national, "user_cart_cash_national", $idConfig,'paliers_commissions_wallet');
// $this->insertPalier($plr_hyp_user_cart_cash_international, "hyp_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet');
$this->insertPalier($plr_hyp_user_cart_cash_international, "hyp_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet');
$this->insertPalier($plr_hyp_user_cart_cash_national, "hyp_user_cart_cash_national", $idConfig,'paliers_commissions_wallet');
// $this->insertPalier($plr_bank_user_cart_cash_international, "bank_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet');
$this->insertPalier($plr_bank_user_cart_cash_international, "bank_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet');
$this->insertPalier($plr_bank_user_cart_cash_national, "bank_user_cart_cash_national", $idConfig,'paliers_commissions_wallet');
break;

View File

@ -1433,16 +1433,16 @@ class Hyperviseur_dash extends CI_Controller
break;
case 'user_carte_wallet':
$data['plr_user_cart_wallet_national'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_wallet_national", $data['idConfig']);
// $data['plr_user_cart_wallet_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_wallet_international", $data['idConfig']);
$data['plr_user_cart_wallet_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_wallet_international", $data['idConfig']);
$data['plr_user_cart_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_cash_national", $data['idConfig']);
// $data['plr_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_cash_international", $data['idConfig']);
$data['plr_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_cash_international", $data['idConfig']);
$data['plr_hyp_user_cart_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("hyp_user_cart_cash_national", $data['idConfig']);
// $data['plr_hyp_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("hyp_user_cart_cash_international", $data['idConfig']);
$data['plr_hyp_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("hyp_user_cart_cash_international", $data['idConfig']);
$data['plr_bank_user_cart_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_cash_national", $data['idConfig']);
// $data['plr_bank_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_cash_international", $data['idConfig']);
$data['plr_bank_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_cash_international", $data['idConfig']);
$this->load->view('header_hyp', $data);
$this->load->view('config_wallet_ilink_hyp/user_carte_wallet');

View File

@ -364,7 +364,7 @@ $lang['rate_com_hyp_send_wallet_cart_ilink_international'] = "Hypervisor commiss
$lang['rate_com_bq_send_wallet_cart_ilink_national'] = "Bank commission rate on wallet-to-card transaction for national iLink user";
$lang['rate_com_bq_send_wallet_cart_ilink_international'] = "Bank commission rate on wallet-to-card transaction for iLink international user";
$lang['rate_com_user_cart_autre_wallet_national'] = "Customer commission rate for sending a card to another national wallet";
$lang['config_ilink_user_cart_autre_wallet'] = 'Card withdrawal to another wallet';
$lang['config_ilink_user_cart_autre_wallet'] = 'Sending card to another wallet';
$lang['rate_com_user_cart_autre_wallet_international'] = 'Customer commission rate on international money withdrawal operation';
$lang['rate_com_user_cart_autre_wallet_national'] = "Customer commission rate for national money withdrawal operations";
$lang['rate_com_bank_user_cart_autre_wallet_international'] = "Bank commission rate for international money withdrawal operations";

View File

@ -376,7 +376,7 @@
$lang['rate_com_bq_send_wallet_cart_ilink_national'] = "Taux de commission banque sur operation d'envoi de wallet vers carte pour utilisateur iLink national";
$lang['rate_com_bq_send_wallet_cart_ilink_international'] = "Taux de commission banque sur operation d'envoi de wallet vers carte pour utilisateur iLink international";
$lang['rate_com_user_cart_autre_wallet_national'] = "Taux de commission du client sur opération d'envoi de carte à un autre wallet national";
$lang['config_ilink_user_cart_autre_wallet'] = 'Retrait de carte vers autre wallet';
$lang['config_ilink_user_cart_autre_wallet'] = 'Envoi de carte vers autre wallet';
$lang['rate_com_user_cart_autre_wallet_international'] = "Taux de commission du client sur operation de retrait d'argent international";
$lang['rate_com_user_cart_autre_wallet_national'] = "Taux de commission du client sur operation de retrait d'argent national";
$lang['rate_com_bank_user_cart_autre_wallet_international'] = "Taux de commission de la banque sur operation de retrait d'argent international";

View File

@ -97,6 +97,41 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
<!-- /.box-body -->
</div>
</div>
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_user_cart_wallet_international'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_user_cart_wallet_international) {
foreach ($plr_user_cart_wallet_international->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
<div class="row mt-5">
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
@ -130,6 +165,39 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
<!-- /.box-body -->
</div>
</div>
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_user_cart_cash_international'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_user_cart_cash_international) {
foreach ($plr_user_cart_cash_international->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
<div class="row" style="margin-top: 20px">
<div class="col-lg-6 col-xs-12">
@ -165,6 +233,41 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
<!-- /.box-body -->
</div>
</div>
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_hyp_remove_cart_ilink_international'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_hyp_user_cart_cash_international) {
foreach ($plr_hyp_user_cart_cash_international->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
<div class="row" style="margin-top: 20px">
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
@ -198,6 +301,39 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
<!-- /.box-body -->
</div>
</div>
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_bq_remove_cart_ilink_international'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_bank_user_cart_cash_international) {
foreach ($plr_bank_user_cart_cash_international->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
<div class="modal fade" id="modal-update">
@ -259,6 +395,55 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
</table>
</div>
</div>
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_user_cart_wallet_international'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new12"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="user_cart_wallet_international" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_user_cart_wallet_international) {
foreach ($plr_user_cart_wallet_international->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add12" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit12" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete delete12" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
@ -269,7 +454,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new7"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
@ -306,6 +491,53 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
</table>
</div>
</div>
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_user_cart_cash_international'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new72"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="user_cart_cash_international" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_user_cart_cash_international) {
foreach ($plr_user_cart_cash_international->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add72" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit72" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete delete72" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE8722;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
@ -355,6 +587,55 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
</table>
</div>
</div>
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_hyp_remove_cart_ilink_international'); ?></label>
</div>
<div class="col-sm-42">
<button type="button" class="btn btn-info add-new new42"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="hyp_user_cart_cash_international" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_hyp_user_cart_cash_international) {
foreach ($plr_hyp_user_cart_cash_international->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add42" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit42" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE2542;</i></a>
<a class="delete delete42" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
@ -365,7 +646,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new5"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
@ -402,6 +683,53 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
</table>
</div>
</div>
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_bq_remove_cart_ilink_international'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new52"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="bank_user_cart_cash_international" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_bank_user_cart_cash_international) {
foreach ($plr_bank_user_cart_cash_international->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add52" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit52" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE2524;</i></a>
<a class="delete delete52" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</form>
</div>
@ -454,16 +782,16 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
if ($('#walletForm')[0].checkValidity()) {
// Paliers
// let plr_hyp_user_cart_cash_international = getPaliersTable('hyp_user_cart_cash_international');
let plr_hyp_user_cart_cash_international = getPaliersTable('hyp_user_cart_cash_international');
let plr_hyp_user_cart_cash_national = getPaliersTable('hyp_user_cart_cash_national');
// let plr_user_cart_cash_international = getPaliersTable('user_cart_cash_international');
let plr_user_cart_cash_international = getPaliersTable('user_cart_cash_international');
let plr_user_cart_cash_national = getPaliersTable('user_cart_cash_national');
// let plr_user_cart_wallet_international = getPaliersTable('user_cart_wallet_international');
let plr_user_cart_wallet_international = getPaliersTable('user_cart_wallet_international');
let plr_user_cart_wallet_national = getPaliersTable('user_cart_wallet_national');
// let plr_bank_user_cart_cash_international = getPaliersTable('bank_user_cart_cash_international');
let plr_bank_user_cart_cash_international = getPaliersTable('bank_user_cart_cash_international');
let plr_bank_user_cart_cash_national = getPaliersTable('bank_user_cart_cash_national');
@ -478,7 +806,11 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
"plr_hyp_user_cart_cash_national": plr_hyp_user_cart_cash_national,
"plr_user_cart_cash_national": plr_user_cart_cash_national,
"plr_user_cart_wallet_national": plr_user_cart_wallet_national,
"plr_bank_user_cart_cash_national" : plr_bank_user_cart_cash_national
"plr_bank_user_cart_cash_national" : plr_bank_user_cart_cash_national,
"plr_hyp_user_cart_cash_international": plr_hyp_user_cart_cash_international,
"plr_user_cart_cash_international": plr_user_cart_cash_international,
"plr_user_cart_wallet_international": plr_user_cart_wallet_international,
"plr_bank_user_cart_cash_international": plr_bank_user_cart_cash_international
},
success: function (data) {
if (data == '200') {
@ -779,9 +1111,9 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
// Paliers nationaux
// Table 7
// Table 7
var actions7 = $("#user_cart_cash_national td:last-child").html();
// Append table with add row form on add new button click
// Append table with add row form on add new button click
$(".new7").click(function () {
if (!actions7) {
actions7 = '<a class="add add7" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE07B;</i></a>\n' +
@ -801,7 +1133,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$("#user_cart_cash_national tbody tr").eq(index + 1).find(".add7, .edit7").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
// Add row on add button click
$(document).on("click", ".add7", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
@ -844,7 +1176,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$(".new7").removeAttr("disabled");
}
});
// Edit row on edit button click
// Edit row on edit button click
$(document).on("click", ".edit7", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
@ -864,5 +1196,354 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$(this).parents("tr").remove();
$(".new7").removeAttr("disabled");
});
// Internationaux
//Table 12
var actions12 = $("#user_cart_wallet_international td:last-child").html();
// Append table with add row form on add new button click
$(".new12").click(function () {
if (!actions12) {
actions12 = '<a class="add add12" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit12" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete12" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#user_cart_wallet_international tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required class="form-control" min="0" step="any" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions12 + '</td>' +
'</tr>';
$("#user_cart_wallet_international").append(row);
$("#user_cart_wallet_international tbody tr").eq(index + 1).find(".add12, .edit12").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add12", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add12, .edit12").toggle();
$(".new12").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit12", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add12, .edit12").toggle();
$(".new12").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete12", function () {
$(this).parents("tr").remove();
$(".new12").removeAttr("disabled");
});
// Table 72
var actions72 = $("#user_cart_cash_international td:last-child").html();
// Append table with add row form on add new button click
$(".new72").click(function () {
if (!actions72) {
actions72 = '<a class="add add72" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE072B;</i></a>\n' +
' <a class="edit edit72" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete72" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE8722;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#user_cart_cash_international tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required step="any" class="form-control" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions72 + '</td>' +
'</tr>';
$("#user_cart_cash_international").append(row);
$("#user_cart_cash_international tbody tr").eq(index + 1).find(".add72, .edit72").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add72", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add72, .edit72").toggle();
$(".new72").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit72", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add72, .edit72").toggle();
$(".new72").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete72", function () {
$(this).parents("tr").remove();
$(".new72").removeAttr("disabled");
});
// Table 42
var actions42 = $("#hyp_user_cart_cash_international td:last-child").html();
// Append table with add row form on add new button click
$(".new42").click(function () {
if (!actions42) {
actions42 = '<a class="add add42" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit42" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE2542;</i></a>\n' +
' <a class="delete delete42" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#hyp_user_cart_cash_international tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required step="any" class="form-control" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions42 + '</td>' +
'</tr>';
$("#hyp_user_cart_cash_international").append(row);
$("#hyp_user_cart_cash_international tbody tr").eq(index + 1).find(".add42, .edit42").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add42", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add42, .edit42").toggle();
$(".new42").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit42", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add42, .edit42").toggle();
$(".new42").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete42", function () {
$(this).parents("tr").remove();
$(".new42").removeAttr("disabled");
});
var actions52 = $("#bank_user_cart_cash_international td:last-child").html();
// Append table with add row form on add new button click
$(".new52").click(function () {
if (!actions52) {
actions52 = '<a class="add add52" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit52" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE2524;</i></a>\n' +
' <a class="delete delete52" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#bank_user_cart_cash_international tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required step="any" class="form-control" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions52 + '</td>' +
'</tr>';
$("#bank_user_cart_cash_international").append(row);
$("#bank_user_cart_cash_international tbody tr").eq(index + 1).find(".add52, .edit52").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add52", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add52, .edit52").toggle();
$(".new52").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit52", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add52, .edit52").toggle();
$(".new52").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete52", function () {
$(this).parents("tr").remove();
$(".new52").removeAttr("disabled");
});
});
</script>