2020-07-06 15:56:17 +00:00
|
|
|
|
<link rel="stylesheet"
|
|
|
|
|
href="<?php echo base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
|
|
|
|
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
|
|
|
|
|
<link rel="stylesheet"
|
|
|
|
|
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
|
|
|
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
2022-04-15 07:47:21 +00:00
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="<?= base_url('bower_components/google-material-icons/google-material-icons.min.css') ?>">
|
|
|
|
|
|
|
|
|
|
|
2021-10-26 14:37:13 +00:00
|
|
|
|
<link rel="stylesheet" href="<?= base_url('dist/css/custom/levels-table.css') ?>">
|
2020-07-06 15:56:17 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use Brick\Money\Context\CustomContext;
|
|
|
|
|
use Brick\Money\Money;
|
|
|
|
|
|
|
|
|
|
$context = new \Brick\Money\Context\AutoContext();
|
|
|
|
|
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
<!-- Content Header (Page header) -->
|
|
|
|
|
<section class="content-header">
|
|
|
|
|
|
|
|
|
|
<h1>
|
|
|
|
|
<?php echo $this->lang->line('config_user').' - '.$this->lang->line('config_ilink_user_wallet_wallet'); ?>
|
|
|
|
|
</h1>
|
|
|
|
|
<?php
|
2021-10-14 14:33:02 +00:00
|
|
|
|
|
2020-07-06 15:56:17 +00:00
|
|
|
|
|
|
|
|
|
if ($alert == "ok") {
|
|
|
|
|
|
|
|
|
|
if (!$success == "ok") {
|
|
|
|
|
?>
|
|
|
|
|
<div class='alert alert-danger alert-dismissible col-xs-6'>
|
|
|
|
|
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
|
|
|
|
|
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
|
|
|
|
|
<?php echo $message; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
} else {
|
|
|
|
|
?>
|
|
|
|
|
<div class="alert alert-success alert-dismissible col-xs-6">
|
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
|
|
|
|
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
|
|
|
|
<?php echo $message; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="content">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<div class="margin">
|
|
|
|
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
|
|
|
|
|
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row centered">
|
|
|
|
|
<div class="col-lg-6 col-xs-12">
|
|
|
|
|
<div class="box">
|
|
|
|
|
<div class="box-header">
|
|
|
|
|
<h3 class="box-title"><?php echo $this->lang->line('rate_com_user_wallet_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>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<th><?= $this->lang->line('ceiling')?></th>
|
2020-07-06 15:56:17 +00:00
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
if ($plr_user_wallet_wallet != false) {
|
|
|
|
|
foreach ($plr_user_wallet_wallet->result() as $row) {
|
|
|
|
|
echo "<tr>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<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>';
|
2020-07-06 15:56:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- /.box-body -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-6 col-xs-12">
|
|
|
|
|
<div class="box">
|
|
|
|
|
<div class="box-header">
|
|
|
|
|
<h3 class="box-title"><?php echo $this->lang->line('rate_com_user_wallet_wallet_national'); ?></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>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<th><?= $this->lang->line('ceiling')?></th>
|
2020-07-06 15:56:17 +00:00
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
if ($plr_user_wallet_wallet_national != false) {
|
|
|
|
|
foreach ($plr_user_wallet_wallet_national->result() as $row) {
|
|
|
|
|
echo "<tr>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<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>';
|
2020-07-06 15:56:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- /.box-body -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
<div class="callout callout-info">
|
|
|
|
|
<p>Note</p>
|
|
|
|
|
<h4><?php echo $this->lang->line('config_ilink_note') ?></h4>
|
|
|
|
|
</div>
|
2020-07-06 15:56:17 +00:00
|
|
|
|
<div class="modal fade" id="modal-update">
|
|
|
|
|
<div class="modal-dialog" style="max-width: 1200px; width: 100%;">
|
|
|
|
|
<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>
|
|
|
|
|
<h3 class="modal-title"><?php echo $this->lang->line('Configuration du wallet'); ?></h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<form id="walletForm">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<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"><?php echo $this->lang->line('rate_com_user_wallet_wallet_international'); ?></label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<button type="button" class="btn btn-info add-new new1"><i
|
|
|
|
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_level'); ?>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<table id="user_wallet_wallet" class="table table-bordered">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Min</th>
|
|
|
|
|
<th>Max</th>
|
|
|
|
|
<th><?php echo $this->lang->line('rate'); ?> (%)</th>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<th><?= $this->lang->line('ceiling')?></th>
|
2020-07-06 15:56:17 +00:00
|
|
|
|
<th>Actions</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<?php
|
|
|
|
|
if ($plr_user_wallet_wallet != false) {
|
|
|
|
|
foreach ($plr_user_wallet_wallet->result() as $row) {
|
|
|
|
|
echo "<tr>
|
|
|
|
|
<td>" . $row->min . "</td>
|
|
|
|
|
<td>" . $row->max . "</td>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<td>" . $row->taux . "</td>
|
|
|
|
|
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
|
2020-07-06 15:56:17 +00:00
|
|
|
|
<td>
|
|
|
|
|
<a class="add add1" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
|
|
|
<a class="edit edit1" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
|
|
|
<a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tbody>
|
|
|
|
|
</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"><?php echo $this->lang->line('rate_com_user_wallet_wallet_national'); ?></label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<button type="button" class="btn btn-info add-new new7"><i
|
|
|
|
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_level'); ?>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<table id="user_wallet_wallet_national" class="table table-bordered">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Min</th>
|
|
|
|
|
<th>Max</th>
|
|
|
|
|
<th><?php echo $this->lang->line('rate'); ?> (%)</th>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<th><?= $this->lang->line('ceiling')?></th>
|
2020-07-06 15:56:17 +00:00
|
|
|
|
<th>Actions</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<?php
|
|
|
|
|
if ($plr_user_wallet_wallet_national != false) {
|
|
|
|
|
foreach ($plr_user_wallet_wallet_national->result() as $row) {
|
|
|
|
|
echo "<tr>
|
|
|
|
|
<td>" . $row->min . "</td>
|
|
|
|
|
<td>" . $row->max . "</td>
|
2022-04-14 18:27:49 +00:00
|
|
|
|
<td>" . $row->taux . "</td>
|
|
|
|
|
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
|
2020-07-06 15:56:17 +00:00
|
|
|
|
<td>
|
|
|
|
|
<a class="add add7" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
|
|
|
<a class="edit edit7" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
|
|
|
<a class="delete delete7" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<button type="button" class="btn btn-default pull-left"
|
|
|
|
|
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
|
|
|
|
<button type="button" id="updateWallet" data-network-id="<?= $network_id ?>"
|
|
|
|
|
data-id-config="<?= $idConfig ?>"
|
2021-10-11 00:14:08 +00:00
|
|
|
|
class="btn btn-primary"><?php echo $this->lang->line('save'); ?></button>
|
2020-07-06 15:56:17 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- jQuery 3 -->
|
|
|
|
|
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
|
|
|
|
<!-- Bootstrap 3.3.7 -->
|
|
|
|
|
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
|
|
|
|
<!-- DataTables -->
|
|
|
|
|
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
|
|
|
|
|
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
|
|
|
|
|
<!-- Slimscroll -->
|
|
|
|
|
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
|
|
|
|
<!-- FastClick -->
|
|
|
|
|
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
|
|
|
|
<!-- AdminLTE App -->
|
|
|
|
|
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
|
|
|
|
|
<!-- AdminLTE for demo purposes -->
|
|
|
|
|
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
|
|
|
|
|
|
|
|
|
|
<script src="<?php echo base_url('bower_components/moment/min/moment.min.js') ?>"></script>
|
|
|
|
|
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
|
|
|
|
|
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
|
|
|
|
<!-- ChartJS -->
|
|
|
|
|
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script>
|
|
|
|
|
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
|
|
|
|
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
toastr.options.closeButton = true;
|
|
|
|
|
toastr.options.closeMethod = 'fadeOut';
|
|
|
|
|
toastr.options.closeDuration = 5000;
|
|
|
|
|
toastr.options.closeEasing = 'swing';
|
|
|
|
|
|
|
|
|
|
$('#updateWallet').click(function () {
|
|
|
|
|
const network_id = $(this).data('network-id');
|
|
|
|
|
const id_config = $(this).data('id-config');
|
|
|
|
|
if ($('#walletForm')[0].checkValidity()) {
|
|
|
|
|
|
|
|
|
|
// Paliers
|
|
|
|
|
var plr_user_wallet_wallet = [];
|
|
|
|
|
|
|
|
|
|
var plr_user_wallet_wallet_national = [];
|
|
|
|
|
|
|
|
|
|
$('#user_wallet_wallet tr').has('td').each(function () {
|
|
|
|
|
var arrayItem = {};
|
|
|
|
|
$('td', $(this)).each(function (index, item) {
|
2022-04-14 18:27:49 +00:00
|
|
|
|
if (index < 4){
|
|
|
|
|
let val = parseFloat($(item).html())
|
|
|
|
|
arrayItem[index] = !isNaN(val) ? val : null;
|
|
|
|
|
}
|
2020-07-06 15:56:17 +00:00
|
|
|
|
});
|
|
|
|
|
plr_user_wallet_wallet.push(arrayItem);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#user_wallet_wallet_national tr').has('td').each(function () {
|
|
|
|
|
var arrayItem = {};
|
|
|
|
|
$('td', $(this)).each(function (index, item) {
|
2022-04-14 18:27:49 +00:00
|
|
|
|
if (index < 4){
|
|
|
|
|
let val = parseFloat($(item).html())
|
|
|
|
|
arrayItem[index] = !isNaN(val) ? val : null;
|
|
|
|
|
}
|
2020-07-06 15:56:17 +00:00
|
|
|
|
});
|
|
|
|
|
plr_user_wallet_wallet_national.push(arrayItem);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
2021-10-14 14:33:02 +00:00
|
|
|
|
url: '<?php echo base_url('Gestion/config_wallet/update')?>',
|
2020-07-06 15:56:17 +00:00
|
|
|
|
type: 'POST',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
"type": "ilink",
|
|
|
|
|
"config":"user_wallet_wallet",
|
|
|
|
|
"network_id": network_id, "id_config": id_config,
|
|
|
|
|
"plr_user_wallet_wallet": plr_user_wallet_wallet,
|
|
|
|
|
"plr_user_wallet_wallet_national": plr_user_wallet_wallet_national,
|
|
|
|
|
},
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data == '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();
|
|
|
|
|
});
|
|
|
|
|
// alert("Les informations ont été mises à jour.") ? "" :
|
|
|
|
|
} else {
|
|
|
|
|
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')?>");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$('#walletForm')[0].reportValidity();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
// Paliers scripts
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
|
|
|
var actions1 = $("#user_wallet_wallet td:last-child").html();
|
|
|
|
|
// Append table with add row form on add new button click
|
|
|
|
|
$(".new1").click(function () {
|
|
|
|
|
if (!actions1) {
|
|
|
|
|
actions1 = '<a class="add add1" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
|
|
|
' <a class="edit edit1" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
|
|
|
' <a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
|
|
|
|
}
|
|
|
|
|
$(this).attr("disabled", "disabled");
|
|
|
|
|
var index = $("#user_wallet_wallet 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" name="taux" id="taux"></td>' +
|
2022-04-14 18:27:49 +00:00
|
|
|
|
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
|
2020-07-06 15:56:17 +00:00
|
|
|
|
'<td> ' + actions1 + '</td>' +
|
|
|
|
|
'</tr>';
|
|
|
|
|
$("#user_wallet_wallet").append(row);
|
2022-04-15 07:26:04 +00:00
|
|
|
|
$("#user_wallet_wallet tbody tr").eq(index + 1).find(".add1, .edit1").toggle();
|
2020-07-06 15:56:17 +00:00
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
|
|
|
});
|
|
|
|
|
// Add row on add button click
|
|
|
|
|
$(document).on("click", ".add1", 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());
|
|
|
|
|
});
|
2022-04-15 07:26:04 +00:00
|
|
|
|
$(this).parents("tr").find(".add1, .edit1").toggle();
|
2020-07-06 15:56:17 +00:00
|
|
|
|
$(".new1").removeAttr("disabled");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// Edit row on edit button click
|
|
|
|
|
$(document).on("click", ".edit1", 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" min="0" value="' + $(this).text() + '">');
|
2022-04-14 18:27:49 +00:00
|
|
|
|
if (index == 3)
|
|
|
|
|
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
|
2020-07-06 15:56:17 +00:00
|
|
|
|
});
|
2022-04-15 07:26:04 +00:00
|
|
|
|
$(this).parents("tr").find(".add1, .edit1").toggle();
|
2020-07-06 15:56:17 +00:00
|
|
|
|
$(".new1").attr("disabled", "disabled");
|
|
|
|
|
});
|
|
|
|
|
// Delete row on delete button click
|
|
|
|
|
$(document).on("click", ".delete1", function () {
|
|
|
|
|
$(this).parents("tr").remove();
|
|
|
|
|
$(".new1").removeAttr("disabled");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Paliers nationaux
|
|
|
|
|
|
|
|
|
|
// Table 7
|
|
|
|
|
var actions7 = $("#user_wallet_wallet_national td:last-child").html();
|
|
|
|
|
// 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"></i></a>\n' +
|
|
|
|
|
' <a class="edit edit7" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
|
|
|
' <a class="delete delete7" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
|
|
|
|
}
|
|
|
|
|
$(this).attr("disabled", "disabled");
|
|
|
|
|
var index = $("#user_wallet_wallet_national 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" name="taux" id="taux"></td>' +
|
2022-04-14 18:27:49 +00:00
|
|
|
|
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
|
2020-07-06 15:56:17 +00:00
|
|
|
|
'<td> ' + actions7 + '</td>' +
|
|
|
|
|
'</tr>';
|
|
|
|
|
$("#user_wallet_wallet_national").append(row);
|
2022-04-15 07:26:04 +00:00
|
|
|
|
$("#user_wallet_wallet_national tbody tr").eq(index + 1).find(".add7, .edit7").toggle();
|
2020-07-06 15:56:17 +00:00
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
|
|
|
});
|
|
|
|
|
// Add row on add button click
|
|
|
|
|
$(document).on("click", ".add7", 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());
|
|
|
|
|
});
|
2022-04-15 07:26:04 +00:00
|
|
|
|
$(this).parents("tr").find(".add7, .edit7").toggle();
|
2020-07-06 15:56:17 +00:00
|
|
|
|
$(".new7").removeAttr("disabled");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 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)
|
|
|
|
|
$(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" min="0" value="' + $(this).text() + '">');
|
2022-04-14 18:27:49 +00:00
|
|
|
|
if (index == 3)
|
|
|
|
|
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
|
2020-07-06 15:56:17 +00:00
|
|
|
|
});
|
2022-04-15 07:26:04 +00:00
|
|
|
|
$(this).parents("tr").find(".add7, .edit7").toggle();
|
2020-07-06 15:56:17 +00:00
|
|
|
|
$(".new7").attr("disabled", "disabled");
|
|
|
|
|
});
|
|
|
|
|
// Delete row on delete button click
|
|
|
|
|
$(document).on("click", ".delete7", function () {
|
|
|
|
|
$(this).parents("tr").remove();
|
|
|
|
|
$(".new7").removeAttr("disabled");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|