backoffice/application/views/config_wallet_ilink_hyp/user_carte_wallet.php

293 lines
11 KiB
PHP
Raw Normal View History

<link rel="stylesheet" href="<?php echo base_url('bower_components/jvectormap/jquery-jvectormap.css') ?>">
<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('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.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') ?>">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round|Open+Sans">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<?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_carte_wallet'); ?>
</h1>
<?php
$site_url = base_url();
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">&times;</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-2 col-lg-offset-4 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_u_c_w; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('rate_com_user_cart_wallet') ?></p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_u_c_c; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('rate_com_user_cart_cash') ?></p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-2 col-lg-offset-4 col-xs-6">
<div class="small-box bg-teal-active">
<div class="inner">
<h3><?php echo $taux_hyp_r_cart_ilink; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('rate_com_hyp_remove_cart_ilink') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-teal-active">
<div class="inner">
<h3><?php echo $taux_bq_r_cart_ilink; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('rate_com_bq_remove_cart_ilink') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-update">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</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">
<label for="taux_u_c_w"
class="col-form-label"><?php echo $this->lang->line('rate_com_user_cart_wallet') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" max="100" required class="form-control"
id="taux_u_c_w" name="taux_u_c_w" value="<?= $taux_u_c_w ?>">
</div>
<div class="form-group">
<label for="taux_u_c_c"
class="col-form-label"><?php echo $this->lang->line('rate_com_user_cart_cash') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" max="100" required class="form-control"
name="taux_u_c_c" id="taux_u_c_c" value="<?= $taux_u_c_c ?>">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="taux_hyp_r_cart_ilink"
class="col-form-label"><?php echo $this->lang->line('rate_com_hyp_remove_cart_ilink') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_hyp_r_cart_ilink" id="taux_hyp_r_cart_ilink"
value="<?= $taux_hyp_r_cart_ilink ?>">
</div>
<div class="form-group">
<label for="taux_bq_r_cart_ilink"
class="col-form-label"><?php echo $this->lang->line('rate_com_bq_remove_cart_ilink') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_bq_r_cart_ilink" id="taux_bq_r_cart_ilink"
value="<?= $taux_bq_r_cart_ilink ?>">
</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 ?>"
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
</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>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script>
var serializeArray = function (form) {
// Setup our serialized data
var serialized = [];
// Loop through each field in the form
var elements = document.getElementById(form).elements;
for (var i = 0, field; field = elements[i++];) {
// Don't serialize fields without a name, submits, buttons, file and reset inputs, and disabled fields
if (!field.name || field.disabled || field.type === 'file' || field.type === 'reset' || field.type === 'submit' || field.type === 'button') continue;
// If a multi-select, get all selections
if (field.type === 'select-multiple') {
for (var n = 0; n < field.options.length; n++) {
if (!field.options[n].selected) continue;
serialized.push({
name: field.name,
value: field.options[n].value
});
}
}
// Convert field data to a query string
else if ((field.type !== 'checkbox' && field.type !== 'radio') || field.checked) {
serialized.push({
name: field.name,
value: field.value
});
}
}
return serialized;
};
</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');
// total répartition commission réseau retrait carte-cash utilisateur ilink (retrait)
const total5 = parseFloat($('#taux_hyp_r_cart_ilink').val()) + parseFloat($('#taux_bq_r_cart_ilink').val());
if (total5 != 100) {
toastr.error("<?php echo $this->lang->line('ilink_fifth_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
} else {
if ($('#walletForm')[0].checkValidity()) {
$.ajax({
url: '<?php echo base_url('index.php/Gestion/config_wallet/update')?>',
type: 'POST',
dataType: 'json',
data: {
"type": "ilink",
"config": "user_carte_wallet",
"network_id": network_id, "id_config": id_config,
"fields": serializeArray('walletForm')
},
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>