280 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			280 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
| <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_wallet_carte'); ?>
 | ||
| 		</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">×</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-5 col-xs-6">
 | ||
| 				<div class="small-box bg-aqua-active">
 | ||
| 					<div class="inner">
 | ||
| 						<h3><?php echo $taux_u_w_cart; ?><sup style="font-size: 20px">%</sup></h3>
 | ||
| 						<p><?php echo $this->lang->line('rate_com_user_wallet_cart') ?> </p>
 | ||
| 					</div>
 | ||
| 					<div class="icon">
 | ||
| 						<i class="ion ion-android-arrow-up"></i>
 | ||
| 					</div>
 | ||
| 				</div>
 | ||
| 			</div>
 | ||
| 		</div>
 | ||
| 		<div class="row">
 | ||
| 			<!--Taux  commission wallet agent carte client et Taux  commission wallet agent carte client-->
 | ||
| 			<div class="col-lg-2 col-lg-offset-4 col-xs-6">
 | ||
| 				<div class="small-box bg-light-blue-active">
 | ||
| 					<div class="inner">
 | ||
| 						<h3><?php echo $taux_hyp_s_wallet_cart_ilink; ?><sup style="font-size: 20px">%</sup></h3>
 | ||
| 						<p><?php echo $this->lang->line('rate_com_hyp_send_wallet_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-light-blue-active">
 | ||
| 					<div class="inner">
 | ||
| 						<h3><?php echo $taux_bq_s_wallet_cart_ilink; ?><sup style="font-size: 20px">%</sup></h3>
 | ||
| 						<p><?php echo $this->lang->line('rate_com_bq_send_wallet_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">×</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_w_cart"
 | ||
| 											   class="col-form-label"><?php echo $this->lang->line('rate_com_user_wallet_cart') . ' (%)'; ?></label>
 | ||
| 										<input type="number" min="0" step=".01" required class="form-control"
 | ||
| 											   id="taux_u_w_cart"
 | ||
| 											   name="taux_u_w_cart" value="<?= $taux_u_w_cart ?>">
 | ||
| 									</div>
 | ||
| 								</div>
 | ||
| 
 | ||
| 								<div class="col-lg-6">
 | ||
| 									<div class="form-group">
 | ||
| 										<label for="taux_hyp_s_wallet_cart_ilink"
 | ||
| 											   class="col-form-label"><?php echo $this->lang->line('rate_com_hyp_send_wallet_cart_ilink') . ' (%)'; ?></label>
 | ||
| 										<input type="number" min="0" step=".01" required class="form-control"
 | ||
| 											   name="taux_hyp_s_wallet_cart_ilink" id="taux_hyp_s_wallet_cart_ilink"
 | ||
| 											   value="<?= $taux_hyp_s_wallet_cart_ilink ?>">
 | ||
| 									</div>
 | ||
| 									<div class="form-group">
 | ||
| 										<label for="taux_bq_s_wallet_cart_ilink"
 | ||
| 											   class="col-form-label"><?php echo $this->lang->line('rate_com_bq_send_wallet_cart_ilink') . ' (%)'; ?></label>
 | ||
| 										<input type="number" min="0" step=".01" required class="form-control"
 | ||
| 											   name="taux_bq_s_wallet_cart_ilink" id="taux_bq_s_wallet_cart_ilink"
 | ||
| 											   value="<?= $taux_bq_s_wallet_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>
 | ||
| <!-- 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>
 | ||
| 	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 d'envoi de wallet vers carte  utilisateur ilink (retrait)
 | ||
| 		const total6 = parseFloat($('#taux_hyp_s_wallet_cart_ilink').val()) + parseFloat($('#taux_bq_s_wallet_cart_ilink').val());
 | ||
| 
 | ||
| 		 if (total6 != 100) {
 | ||
| 			toastr.error("<?php echo $this->lang->line('ilink_sixth_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_wallet_carte",
 | ||
| 						"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>
 |