127 lines
4.0 KiB
PHP
127 lines
4.0 KiB
PHP
|
|
|
|
mem_select=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_select_3',0,0);?>;
|
|
var mem_listactive=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_listactive',1,0);?>;
|
|
|
|
if ('<?php echo($new);?>'=='new'){
|
|
createpagination_produits(0,1,0);
|
|
|
|
}else{
|
|
createpagination_produits(0);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$("#inline").change( function(){
|
|
if(this.checked) {
|
|
mem_listactive=0
|
|
}else{
|
|
mem_listactive=1
|
|
}
|
|
//alert(mem_listactive);
|
|
createpagination_produits(0);
|
|
});
|
|
|
|
$("body").on("click", ".emp a", function(){
|
|
|
|
$.ajax({
|
|
url: '<?=base_url()?>index.php/Produits/form/'+$(this).attr("data-id"),
|
|
type: 'get',
|
|
dataType: 'json',
|
|
success: function(responseData){
|
|
|
|
|
|
|
|
$('#modal_info').html(responseData);
|
|
|
|
|
|
|
|
}
|
|
});
|
|
$('#myModal').modal('show');
|
|
});
|
|
|
|
$('#pagination_produits').on('click','a',function(e){
|
|
e.preventDefault();
|
|
var pageNum = $(this).attr('data-ci-pagination-page');
|
|
createpagination_produits(pageNum);
|
|
});
|
|
|
|
|
|
|
|
|
|
$("body").on("keyup", "input.filtre_produits_1", function(e){
|
|
if(e.which == 13) {
|
|
createpagination_produits(0,1)
|
|
}
|
|
});
|
|
$("body").on("keyup", "input.filtre_produits_2", function(e){
|
|
if(e.which == 13) {
|
|
createpagination_produits(0,2)
|
|
}
|
|
});
|
|
mem_select=0;
|
|
$("body").on("change", ".filtre_produits_3", function(){
|
|
var optionSelected = $("option:selected", this);
|
|
mem_select = this.value;
|
|
|
|
createpagination_produits(0,3)
|
|
|
|
});
|
|
|
|
(function($){
|
|
$.fn.focusTextToEnd = function(){
|
|
this.focus();
|
|
var $thisVal = this.val();
|
|
this.val('').val($thisVal);
|
|
return this;
|
|
}
|
|
}(jQuery));
|
|
|
|
function createpagination_produits(pageNum,nofiltre=1,focus=1){
|
|
|
|
if (typeof $('input.filtre_produits_1').val()!=='undefined')
|
|
mem_filtre_produits_1=$('input.filtre_produits_1').val().trim();
|
|
else
|
|
mem_filtre_produits_1=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_select_1','null',0,0);?>;
|
|
;
|
|
|
|
if (typeof $('input.filtre_produits_2').val()!=='undefined') {
|
|
|
|
mem_filtre_produits_2=$('input.filtre_produits_2').val().trim();}
|
|
else
|
|
mem_filtre_produits_2=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_select_2','null',0,0);?>;
|
|
if (mem_filtre_produits_2=="")
|
|
mem_filtre_produits_2="null";
|
|
if (mem_filtre_produits_1=="")
|
|
mem_filtre_produits_1="null";
|
|
if (mem_select!=0)
|
|
|
|
mem_filtre_produits_3=mem_select;
|
|
else
|
|
mem_filtre_produits_3='null';
|
|
|
|
$.ajax({
|
|
url: '<?=base_url()?>index.php/Produits/loadData_list/'+pageNum+'/'+mem_filtre_produits_1+'/'+mem_filtre_produits_2+'/'+mem_filtre_produits_3+'/'+mem_listactive+'/<?php echo($model_de_produits);?>' ,
|
|
type: 'get',
|
|
dataType: 'json',
|
|
success: function(responseData){
|
|
|
|
$('#pagination_produits').empty();
|
|
$('#pagination_produits').html(responseData.pagination);
|
|
$('#produits_list').empty();
|
|
$('#produits_list').html(responseData.list);
|
|
$('#Produits_actif').empty();
|
|
$('#Produits_actif').html(responseData.recordCount);
|
|
if (focus==1)
|
|
$('input.filtre_produits_'+nofiltre).focusTextToEnd();
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|