Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
3.5 kB
2
Indexable
Never
show_konsep(); //call function show all product

  var dtable = $('#datatables').dataTable();
  var dtable_load;

      //function show all product
      function show_konsep(){
        $.ajax({
          type  : 'GET',
          url   : '<?php echo site_url('Konsep/getdataKonsep')?>',
          async : false,
          dataType : 'json',
          // beforeSend: function(){
          //   swal({
          //     title: 'Tunggu',
          //     allowEscapeKey: false,
          //     allowOutsideClick: false,
          //     onOpen: () => {
          //       swal.showLoading();
          //     }
          //   })
          // },
          success : function(data){
            var html = '';
            var i;
            var no;
            no = 1; 
            dtable_load = $('#datatables').DataTable().clear().destroy();

            for(i=0; i<data.length; i++){


              html += '<tr>'+
              '<td style="text-left: right; width:70px;">'+no+'</td>'+
              
              '<td>'+data[i].tanggal+ '</td>'+
              '<td>'+data[i].jenis_produk+ '</td>'+
              '<td>'+data[i].nama_bb+ '</td>'+
              '<td>' + 
if(data[i].jmlh_roll > 0) { 
'<a href="#modal_add" class="tambah_datakonsep btn btn-link btn-info btn-sm text-white">tombol</a>' 
} else { 'TIDAK ADA DATA' } + '</td>'
              '<td>'+data[i].jmlh_kg+ '</td>'+
              '<td>'+data[i].hasil_cutting+ '</td>'+
              '<td>'+data[i].hasil_sewing+ '</td>'+
              '<td>'+data[i].hasil_packing+ '</td>'+
            
              '<td>'+data[i].dibuat+ '</td>';
              <?php if($this->session->userdata('level')=='admin'): ?>
                html+='<td style="width:150px;">'+

                '<a title="Tambah Pemakaian" href="javascript:void(0);" class="tambah_datakonsep btn btn-link btn-info btn-sm text-white" data-id_konsep="'+data[i].id_konsep+'" data-jmlh_roll="'+data[i].jmlh_roll+'"data-jmlh_kg="'+data[i].jmlh_kg+'"data-hasil_cutting="'+data[i].hasil_cutting+'"data-hasil_sewing="'+data[i].hasil_sewing+'"data-hasil_packing="'+data[i].hasil_packing+'"><i class="fa fa-plus"></i></a>'+' '+
                 //'<a title="Tambah Pemakaian" href="javascript:void(0);" class="add_datapemakaian btn btn-link btn-info btn-sm text-white" data-id_konsep="'+data[i].id_konsep+'"><i class="fa fa-plus"></i></a>'+' '+
                '<a title="Edit Data" href="javascript:void(0);" class="edit_datakonsep btn btn-link btn-warning btn-sm text-white" data-id_konsep="'+data[i].id_konsep+'" data-jmlh_roll="'+data[i].jmlh_roll+'"data-jmlh_kg="'+data[i].jmlh_kg+'"data-hasil_cutting="'+data[i].hasil_cutting+'"data-hasil_sewing="'+data[i].hasil_sewing+'"data-hasil_packing="'+data[i].hasil_packing+'"><i class="fa fa-edit"></i></a>'+' '+
                '<a title="Delete Data" href="javascript:void(0);" class="btn btn-link btn-danger btn-sm delete_konsep" data-id_konsep="'+data[i].id_konsep+'"><i class="fa fa-trash"></i></a>'+
                '</td>'+
                '</tr>';
              <?php endif; ?>

              <?php if($this->session->userdata('level')=='admin toko'): ?>
                html+='</tr>';
              <?php endif; ?>
              no++;
            }
            $('#data_konsep').html(html);
            dtable_load = $('#datatables').DataTable({

            });
            swal.close();
          }

        });
      }