ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/list_pod.php

<?php require_once('header.php'); ?>
<script src="js/jszip.min.js"></script>
<script src="js/multiple-download-file.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        
        
        $('#btndownload').click(function(){
            var checkValues = $('input[name=checkboxlists]:checked').map(function()
            {
                return $(this).val();
            }).get();
             if(checkValues!=""){
                    var urls=checkValues;
                    var d = new Date();          
            var n = d.toLocaleString([], { hour12: true});
                    var filename = "POD "+n;
                    compressed_img(urls,filename);

            }else{
                alert('No Value Selected For Download Pod');
            }
        });
        
$('#loader').hide();

//compressed_img(urls, filename);

function compressed_img(urls, filename) {
    $('#loader').show();
    var zip = new JSZip();
    var count = 0;
    var name = filename + ".zip";
    urls.forEach(function(url,i) {

        JSZipUtils.getBinaryContent(url, function(err, data) {
            if (err) {
                throw err;
            }
            
        var filename = url.split('/').pop();
           var fname=filename;
            
            zip.file(fname, data, {
                binary: true
            });
            count++;
            if (count == urls.length) {
                zip.generateAsync({
                    type: 'blob'
                }).then(function(content) {
                    saveAs(content, name);
                });
            }
        }, function(e) {
            p[e.target.responseURL] = e;
            var total = 0, prog = 0;
            for(prop in p){
            	total+=p[prop].total;
                prog+=p[prop].loaded;
            }
            console.log(prog/total);
            p1.value = prog/total;
        });
    });
    $('#loader').hide();
}

var p={};
});
</script>
<script type="text/javascript">
$(document).ready(function(){
    $("#pod_type").select2();
    $('#select_all').on('click',function(){
        if(this.checked){
            $('.checkbox').each(function(){
                this.checked = true;
            });
        }else{
             $('.checkbox').each(function(){
                this.checked = false;
            });
        }
    });
    
    $('#select_alls').on('click',function(){
        if(this.checked){
            $('.checkboxs').each(function(){
                this.checked = true;
            });
        }else{
             $('.checkboxs').each(function(){
                this.checked = false;
            });
        }
    });
    
    $('.checkbox').on('click',function(){
        if($('.checkbox:checked').length == $('.checkbox').length){
            $('#select_all').prop('checked',true);
        }else{
            $('#select_all').prop('checked',false);
        }
    });
    
    $('.checkboxs').on('click',function(){
        if($('.checkboxs:checked').length == $('.checkboxs').length){
            $('#select_alls').prop('checked',true);
        }else{
            $('#select_alls').prop('checked',false);
        }
    });
 
        $('#btnadd').click(function(){
            var checkValues = $('input[name=checkboxlist]:checked').map(function()
            {
                return $(this).val();
            }).get();
             if(checkValues!=""){
           //alert(checkValues);
                  $.ajax({
                url: 'pod_multi_delete.php',
                type: 'post',
                data: {pod_ids:checkValues},
                dataType: 'json',
                 success:function(response){
                    alert(response[0]['status']);
                    if(response[0]['status']==1)
                    {
                        alert('Selected PODs Has Been Deleted !!'); 
                        location.reload();
                    }
                    else{
                       alert('Failed To Delete !!');
                      location.reload();
                    }
                }
        
            });
                }
                    else{
                        alert('No Value Selected');
                    }
                    getData();
                });
      
                function getData(){
			    var from=  $('#from').val();     
                var to=  $('#to').val();   
                var pod_type=  $('#pod_type').val();  
                var client_id=  $('#client_id').val();  
                
               
				var dataTable = $('#employee-grid').DataTable( {
					"processing": true,
					"serverSide": true,
                    "destroy":true,
                    "lengthMenu": [ [10, 25, 50, 100,500,1000,5000], [10, 25, 50,100,500,1000, "All"] ],
                    "ajax":{
						url :"data-tables/pod-dt.php", // json datasource
						data: {pod_type:pod_type,from:from,to:to,client_id:client_id},
						type: "post",  // method  , by default get
						error: function(){  // error handling
							$(".employee-grid-error").html("");
							$("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
							$("#employee-grid_processing").css("display","none");
						}
					}
				} );
			    }
			    getData();
                
                 $('#get_filter').on('click', function(){
			      var from_date=  $('#from').val();
			      var to=  $('#to').val();
			      if(from_date && to){
			        getData();
			      }
			      else
                    {
                        alert('Select a Date !!');
                    }
			  } );
                
                
            });
</script>

 
<section class="content-header" style="background-color: white;">
	
	<div class="row">
		<div class="col-md-12" style="text-align: center;">
			<h4><i class="fa fa-info-circle"></i> All Cargo Entry Details</h4>
		</div>
		
	</div>
<div class="row">


<div style="padding-bottom: 25px;padding-top: 10px;">

     
		<div class="col-md-2" style="text-align: center;">	
			<label for="" class="control-label">From <span>*</span></label>
			<input type="date" class="form-control" id="from" value="<?php echo date("Y-m-d") ?>" name="from">
		</div>
		<div class="col-md-2" style="text-align: center;">	
			<label for="" class="control-label">To <span>*</span></label>
			<input type="date" class="form-control" id="to" value="<?php echo date("Y-m-d") ?>" name="to">
		</div>
		
		<div class="col-md-4" style="text-align: center;">
		    	<label for="" class="control-label">POD Type <span>*</span></label>		
        <select class="form-control" name="pod_type" id="pod_type">
                <option value="all">All POD</option>
                <option value="1" >Pickup POD</option>
				<option value="2">Delivery POD</option>
            </select>
		</div>
		
		
        <div class="col-md-3" style="text-align: center;">
    		<label for="" class="control-label">Select Branch <span>*</span></label>
    		<div class="">
    		   	<select class="form-control select2" name="branch_id" id="branch_id" required>
                </select>
    		</div>
    	</div>
    
        <div class="col-md-3" style="text-align: center;padding-top:10px;">
    		<label for="" class="control-label">Select Client <span>*</span></label>
    		<div class="">
    		   	<select class="form-control select2" name="client_id" id="client_id" required>
                </select>
    		</div>
    	</div>
		
		<div class="col-md-6" style="text-align: left;padding-top:10px;">		
			<label for=""  class="control-label">..</label><br>
			<a id="get_filter" class="btn btn-info btn-sm"><i class="fa fa-filter" aria-hidden="true"></i> Filter List</a>
			<a href="pod_upload.php" class="btn btn-warning btn-sm"><i class="fa fa-plus" aria-hidden="true"></i> Add POD</a>
		</div>
</div>


	</div>
    	<div class="row">
    	   <div style='margin:20px;' id="loader">
                <progress type="range" id="p1" min=0 max=1 style="width: 100%;">
        </div>
    </div>
</section>		
		
<section class="content" style="background-color: white;">
	<div class="row">
		<div class="col-md-12">
			<div>
				<div class="box-body table-responsive">
					<table id="employee-grid" class="table table-bordered table-striped">
						<thead>
							<tr>
								<th width="30">SL</th>
								<th data-sortable="false"><i class="fa fa-check"></i><input type="checkbox" class='checkbox' id="select_all" /></th>
								<th>AWB No</th>
								<th>POD Type</th>
								<th>Date</th>
								<th data-sortable="false"><i class="fa fa-check"></i><input type="checkbox" class='checkboxs' id="select_alls" /></th>
								<th>File-1</th>
								<th>File-2</th>
								<th>File-3</th>
								<th>File-4</th>
								<th>File-5</th>
							</tr>
						</thead>
					</table>
				</div>
			</div>	<center>
			<?php if($_SESSION['lily_express_software_live']['id']==1 || $allPermissions['customer']['create']=="1" ){ ?>
		<button id='btnadd' class=" btn btn-danger btn-sm"><i class="fa fa-trash" aria-hidden="true"></i> Delete Selected POD's</button>
			
			
		 <?php }?>
			<button id='btndownload' class=" btn btn-warning btn-sm"><i class="fa fa-download" aria-hidden="true"></i> Download Selected POD's</button>	</center>
		</div>
	</div>


</section>


<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Delete Confirmation</h4>
            </div>
            <div class="modal-body">
                <p>Are you sure want to delete this item?</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <a class="btn btn-danger btn-ok">Delete</a>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" language="javascript" >
	$(document).ready(function() {
	    $("#client_id").select2();
	    $("#branch_id").select2();
	    
		    
function branchDetails(){ // branch and Employee Details Set
   /*var branch = $("#branch").val();*/
        $.ajax({
          url: 'data-tables/custom-function.php',
          type: 'post',
          data: {type:'get_branch'},
          success: function(response)
          {
               var datas = JSON.parse(response)         
               $('#branch_id').empty();
                var tot = datas.length;
                  if(tot==0)
                  {
                          $('#branch_id')
                                        .append($("<option></option>")
                                      .attr("value", '0')
                                      .text("Employee Not Available"));
                  }
                  else
                  {
                    $('#branch_id')
                                        .append($("<option></option>")
                                      .attr("value", '0')
                                      .text("All Branch"));
                  }

                for (var index = 0; index < tot; index++) {
                     $('#branch_id')
                      .append($("<option></option>")
                    .attr("value", datas[index]['id'])
                    .text(datas[index]['branch_name']));
                                                 
                }   
          }
      });
}


function clientDetails(){ // branch and Employee Details Set
   var branch = $("#branch_id").val();
    if(branch!=0){
        $.ajax({
          url: 'data-tables/custom-function.php',
          type: 'post',
          data: {type:'get_client',branch_id:branch},
          success: function(response)
          {
               var datas = JSON.parse(response)         
               $('#client_id').empty();
                var tot = datas.length;
                  if(tot==0)
                  {
                          $('#client_id')
                                        .append($("<option></option>")
                                      .attr("value", '0')
                                      .text("Client Not Available"));
                  }
                  else
                  {
                    $('#client_id')
                                        .append($("<option></option>")
                                      .attr("value", '0')
                                      .text("All Client"));
                  }

                for (var index = 0; index < tot; index++) {
                     $('#client_id')
                      .append($("<option></option>")
                    .attr("value", datas[index]['id'])
                    .text(datas[index]['client_name']));
                                                 
                }   
          }
      });
    }else{
        $('#client_id').empty();
        $('#client_id')
            .append($("<option></option>")
          .attr("value", '0')
          .text("All Client"));
    }
}

				branchDetails();
			    clientDetails();
			  
			   $('#branch_id').on('change', function(){			    
			        clientDetails();
			  } ); 
			} );
		</script>

<?php require_once('footer.php'); ?>

Zerion Mini Shell 1.0