You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
208 lines
7.9 KiB
208 lines
7.9 KiB
<!-- Content Wrapper. Contains page content -->
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
Gestions des
|
|
<small>Remises</small>
|
|
</h1>
|
|
<ol class="breadcrumb">
|
|
<li><a href="#"><i class="fa fa-dashboard"></i> Accueil</a></li>
|
|
<li class="active">Remise</li>
|
|
</ol>
|
|
</section>
|
|
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-12 col-xs-12">
|
|
<div id="messages"></div>
|
|
<?php if (session()->getFlashdata('success')): ?>
|
|
<div class="alert alert-success alert-dismissible" role="alert">
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
<?php echo session()->getFlashdata('success'); ?>
|
|
</div>
|
|
<?php elseif (session()->getFlashdata('error')): ?>
|
|
<div class="alert alert-error alert-dismissible" role="alert">
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
<?php echo session()->getFlashdata('error'); ?>
|
|
</div>
|
|
<?php elseif (session()->getFlashdata('errors')): ?>
|
|
<div class="alert alert-warning alert-dismissible" role="alert">
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
<?php echo session()->getFlashdata('errors'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Gérer les remises</h3>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table id="manageTable" class="table table-bordered table-striped ">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Produit</th>
|
|
<th>Prix total</th>
|
|
<th>Demande</th>
|
|
<th>Statut</th>
|
|
<?php if (in_array('validateRemise', $user_permission) || in_array('refusedRemise', $user_permission)): ?>
|
|
<th>Action</th>
|
|
<?php endif; ?>
|
|
</tr>
|
|
</thead>
|
|
|
|
|
|
</table>
|
|
<!-- totaliter mvola = somme tranche 1 izay type mvola tranche 1 + somme tranche 2
|
|
totaliter mvola dia - recouvrement izay sortie ùmvola plus recouvremnt entrer mvola
|
|
-->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
// datatable-fr.js
|
|
$.extend(true, $.fn.dataTable.defaults, {
|
|
language: {
|
|
sProcessing: "Traitement en cours...",
|
|
sSearch: "Rechercher :",
|
|
sLengthMenu: "Afficher _MENU_ éléments",
|
|
sInfo: "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
|
|
sInfoEmpty: "Affichage de l'élement 0 à 0 sur 0 élément",
|
|
sInfoFiltered: "(filtré de _MAX_ éléments au total)",
|
|
sLoadingRecords: "Chargement en cours...",
|
|
sZeroRecords: "Aucun élément à afficher",
|
|
sEmptyTable: "Aucune donnée disponible dans le tableau",
|
|
oPaginate: {
|
|
sFirst: "Premier",
|
|
sPrevious: "Précédent",
|
|
sNext: "Suivant",
|
|
sLast: "Dernier"
|
|
},
|
|
oAria: {
|
|
sSortAscending: ": activer pour trier la colonne par ordre croissant",
|
|
sSortDescending: ": activer pour trier la colonne par ordre décroissant"
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#remise_menu").addClass('active');
|
|
|
|
// Check if the URL contains the _ parameter
|
|
if (window.location.search.startsWith("?_=")) {
|
|
window.location.href = window.location.origin + window.location.pathname;
|
|
}
|
|
|
|
manageTable = $('#manageTable').DataTable({
|
|
ajax: '<?= base_url('remise/fetchRemiseData') ?>',
|
|
order:[],
|
|
columns: [
|
|
{ data: 0 },
|
|
{ data: 1 },
|
|
{ data: 2 },
|
|
{ data: 3 },
|
|
{ data: 4 },
|
|
{ data: 5 }
|
|
],
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
function refuseFunc(id) {
|
|
|
|
$.ajax({
|
|
url: '<?= base_url('remise/updateRemise') ?>/' + id,
|
|
type: 'POST',
|
|
data: {
|
|
'demande_status': 'rejete'
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
|
|
manageTable.ajax.reload(null, false);
|
|
|
|
if (response.success === true) {
|
|
$("#messages").html('<div class="alert alert-warning alert-dismissible" role="alert">' +
|
|
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' +
|
|
'<strong> <span class="glyphicon glyphicon-ok-sign"></span> </strong>' + response.messages +
|
|
'</div>');
|
|
|
|
} else {
|
|
|
|
if (response.messages instanceof Object) {
|
|
$.each(response.messages, function(index, value) {
|
|
var id = $("#" + index);
|
|
|
|
id.closest('.form-group')
|
|
.removeClass('has-error')
|
|
.removeClass('has-success')
|
|
.addClass(value.length > 0 ? 'has-error' : 'has-success');
|
|
|
|
id.after(value);
|
|
|
|
});
|
|
} else {
|
|
$("#messages").html('<div class="alert alert-danger alert-dismissible" role="alert">' +
|
|
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' +
|
|
'<strong> <span class="glyphicon glyphicon-exclamation-sign"></span> </strong>' + response.messages +
|
|
'</div>');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function valideFunc(id) {
|
|
|
|
$.ajax({
|
|
url: '<?= base_url('remise/updateRemise') ?>/' + id,
|
|
type: 'POST',
|
|
data: {
|
|
'demande_status': 'accepte'
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
|
|
manageTable.ajax.reload(null, false);
|
|
|
|
if (response.success === true) {
|
|
$("#messages").html('<div class="alert alert-success alert-dismissible" role="alert">' +
|
|
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' +
|
|
'<strong> <span class="glyphicon glyphicon-ok-sign"></span> </strong>' + response.messages +
|
|
'</div>');
|
|
|
|
} else {
|
|
|
|
if (response.messages instanceof Object) {
|
|
$.each(response.messages, function(index, value) {
|
|
var id = $("#" + index);
|
|
|
|
id.closest('.form-group')
|
|
.removeClass('has-error')
|
|
.removeClass('has-success')
|
|
.addClass(value.length > 0 ? 'has-error' : 'has-success');
|
|
|
|
id.after(value);
|
|
|
|
});
|
|
} else {
|
|
$("#messages").html('<div class="alert alert-warning alert-dismissible" role="alert">' +
|
|
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' +
|
|
'<strong> <span class="glyphicon glyphicon-exclamation-sign"></span> </strong>' + response.messages +
|
|
'</div>');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|