Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).ready(function(){
- var site_url= $('section.content-section').attr('data-id');
- $('.pagination li').click(function(){
- cl = $(this).hasClass('active');
- if(!cl){
- $('.pagination').find('li.active').removeClass('active');
- $(this).addClass('active');
- p = $(this).attr('id');
- id = $('.table').attr('user-id')
- $.ajax({
- url : site_url+'scripts/admin.php',
- type : "POST",
- data : {
- action : "pagination",
- p : p,
- id : id,
- },
- dataType : "json",
- success : function(data){
- if(data.status == 1){
- $('.table .vide').remove();
- j = (data.data).length+(10*p);
- for(i=0;i<(data.data).length;i++){
- date = data.data[i]['DateDiff'] == null ? 'Non activé' : data.data[i]['DateDiff'];
- $('tr.titre').after("<tr class='vide'>"+
- "<td>"+(j--)+"</td>"+
- "<td>"+data.data[i]['Software_name']+"</td>"+
- "<td>"+data.data[i]['Licence']+"</td>"+
- "<td>"+date+"</td>"+
- "</tr>");
- }
- }
- else{
- alertbox('error', data.msg, 4000);
- }
- }
- });
- }
- });
- $('.soft').on('change',function(){
- id_soft = $(this).val();
- $.ajax({
- url : site_url+'scripts/info.php',
- type : "POST",
- data : {
- action : "dispo",
- id : id_soft,
- },
- dataType : "json",
- success : function(data){
- if(data.status == 1){
- $('.TypeL').empty();
- for(i=0;i<(data.data).length;i++){
- $('.TypeL').append('<option value='+data.data[i]['TypeLicence_id']+'>'+data.data[i]['TypeLicence_libelle']+'</option>');
- }
- }
- else{
- alertbox('error', data.msg, 4000);
- }
- }
- })
- });
- $('.export').click(function(){
- id = $('.table').attr('user-id');
- $.ajax({
- url : site_url+'scripts/admin.php',
- type : "POST",
- data : {
- action : "CSVlicenceU",
- id : id,
- },
- dataType : "json",
- success : function(data){
- if(data.status == 1){
- alertbox('success', data.msg, 4000);
- location.href= site_url+'csv/ExportLicenceClient.csv';
- }
- else{
- alertbox('error', data.msg, 4000);
- }
- }
- })
- });
- $('#addLicence').click(function(){
- soft = $('.soft option:selected').val();
- licence = $('.TypeL option:selected').val();
- qt = $('input[name=qt]').val();
- $.ajax({
- url : site_url+'scripts/info.php',
- type : "POST",
- data : {
- action : "info-prix",
- soft : soft,
- licence : licence,
- qt : qt,
- },
- dataType : "json",
- success : function(data){
- if(data.status == 1){
- id = parseInt($(".ListeLicence table tbody tr").last().attr('id'));
- $(".ListeLicence table tbody").append("<tr id="+data.data['Dispo_id']+" qt='"+qt+"' ><td>"+data.data['software_name']+"</td>"+
- "<td>"+data.data['TypeLicence_libelle']+"</td>"+
- "<td>"+qt+'</td><td>'+data.data['prix']+"€</td>"+
- "<td> <i id="+data.data['Dispo_id']+" class='glyphicon glyphicon-trash deleteSoft'></i></td></tr>");
- }
- else{
- alertbox('error', data.msg, 4000);
- }
- }
- })
- $('.ListeLicence table').on('click',".deleteSoft", function(){
- id = $(this).attr('id');
- $('.ListeLicence tbody tr').each(function() {
- if($(this).attr('id') == id){
- $(this).remove();
- }
- });
- });
- $('.btn-add-li').click(function(){
- var dispo = new Array();
- var qt = new Array();
- f = 0;
- id = $('.table').attr('user-id');
- $(this).prev(".table-striped").find('tr').each(function() {
- if($(this).attr('id') != 0){
- dispo.push($(this).attr('id'));
- }
- });
- console.log(dispo);
- console.log('ici');
- /* $.ajax({
- url : site_url+'scripts/admin.php',
- type : "POST",
- data : {
- action : "addLicenceUser",
- id : id,
- qt : qt,
- soft : soft,
- licence : licence,
- },
- dataType : "json",
- success : function(data){
- if(data.status == 1){
- alertbox('success', data.msg, 2000, site_url+'information/'+id);
- }
- else{
- alertbox('error', data.msg, 4000);
- }
- }
- })*/
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment