<div class="col-lg-10 col-lg-offset-1">
	<section class="panel">
		<header class="panel-heading" style="min-height:50px">
			<div class="col-lg-3"> <span> &nbsp; </span> </div>
			<div class="col-lg-6">
				<h4 class="text-center"> <b> <?php echo $rep_type;?> Reports</b></h4>
			</div> 
			<div class="col-lg-3"><span> &nbsp; </span></div>
		</header>
		<div class="clear"></div>
		<div class="panel-body"> 
			<form class="form-horizontal"method="post" action="<?php echo base_url();?>icd/icd_rep_ctrl/rep_search_details/<?php if(isset($rep_type)){ echo $rep_type;}?>">
                <input type="text" name="rep_type" value="<?php if(isset($rep_type)){ echo $rep_type;}?>" hidden>
                
                <?php
                    if($rep_type=='icd'){
                ?>
                    <div class="col-lg-12">
                        
                        <div class=" col-md-3">
                            <labal class="col-md-12">Search Type</label>
                            <select class="form-control option_rep_cls"  required> <!-- name="rep_ser_val" -->
                                <option value="0">--Select--</option>
                                <option value="da_in">      Date Search</option>
                                <!-- <option value="da_out">     Date Out Search</option> -->
                                <option value="con_n">      Container Search</option>
                                <option value="bill_la">    Bill Of Lading</option>
                                <option value="ref_n">      Ref No</option>
                                <option value="tok_n">      Token No</option>
                                <option value="ge_n">       Gate Entry No</option> 
                            </select> 	
                        </div>		
                        <div class=" col-md-7" id="rep_data_div_id">
                        </div>
                        	
                        <div class="form-group col-md-2">
                            <div class="col-lg-offset-10 col-lg-2">
                                <button type="submit" class="btn btn-success pull-right">Search</button>
                            </div>
                        </div>
                    </div>
                <?php
                    }
                ?>
			</form>
		</div>
	</section>
</div>

<div class="col-lg-10 col-lg-offset-1">
	<section class="panel">
		<header class="panel-heading">
			<h4 class="text-center"><b>Container List</b></h4>
		</header>
		<div class="panel-body">
			<section id="unseen">
			     
                    
                <button type="submit" class="btn btn-danger pull-right" id="rep_download"> Download Report</button> <br><br><br> 
                <div class="col-md-12" id="rep_div_download"> 
                    <div class="col-md-12">
                        <?php 
                            $se_type ='';
                            $display_ft_text ='';
                            if(isset($rep_form_data['date_in']) && isset($rep_form_data['date_out']) ){
                                $se_type = 'Date Wise';
                                $display_ft_text = "<b>From Date :</b> ".$rep_form_data['date_in'] ."  <b>To Date :</b> ".$rep_form_data['date_out'];
                            }else if(isset($rep_form_data['con_no'])){
                                $se_type = 'Container Wise';
                                $display_ft_text = "Container No : ".$rep_form_data['con_no'];                                
                            }else if(isset($rep_form_data['bill_la_no'])){
                                $se_type = 'Bill Of Lading Wise';
                                $display_ft_text = "Bill Of Lading  : ".$rep_form_data['bill_la_no'];                                
                            }else if(isset($rep_form_data['ref_no'])){
                                $se_type = 'Ref No Wise';
                                $display_ft_text = "Ref No  : ".$rep_form_data['ref_no'];
                                
                            }else if(isset($rep_form_data['tok_no'])){
                                $se_type = 'Token No Wise';
                                $display_ft_text = "Token No  : ".$rep_form_data['tok_no'];
                            }else if(isset($rep_form_data['ge_no'])){
                                $se_type = 'Gate Entry No Wise';
                                $display_ft_text = "Gate Entry No  : ".$rep_form_data['ge_no'];    
                            }
                        ?>
                        <div class="col-md-12">
                            <h4 style="text-align: center;">
                                <b><?php if($se_type!=''){ echo $se_type;}?> Search </b>
                            </h4>
                            <p  style="text-align: center;"><?php if($display_ft_text!=''){ echo $display_ft_text;}?></p>
                        </div>
                    </div>
                    <table class="table table-bordered table-striped table-condensed" id="">
                        <thead>
                            <tr>
                                <th> Sl No</th>
                                <th> Container No</th>
                                <th> Bill Of Lading</th>
                                <th> Agent Name</th>
                                <th> Importer Name</th>
                                <th> In date <br> <p>(Gatepass Date)</p> </th>
                                <th> Out Date <br> (Gatepass Date) </th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
                                foreach($rep_result as $rep_i=>$rep_row){
                                    $sl_no = $rep_i+1;
                            ?>
                                    <tr>
                                        <td> <?php echo $sl_no;?> </td>
                                        <td> <?php echo $rep_row['icdl_c_no'];?> </td>                                     
                                        <td> <?php echo $rep_row['idl_bill_of_loading'];?> </td>          
                                        <td> <?php echo $rep_row['agl_name'];?> </td>          
                                        <td> <?php echo $rep_row['iml_name'];?> </td>          
                                        <td> <?php echo $rep_row['idl_date'];?> </td>
                                        <td> <?php echo $rep_row['igedl_igeo_gate_out_pass_date'];?> </td> 
                                    </tr>
                            <?php
                                }
                            ?>
                        </tbody>
                    </table>
                </div>
			</section>
		</div>
	</section>
</div>

<script type='text/javascript'> 
    $(document).ready(function(){
        
    });
	$('.option_rep_cls').on('change', function() {
        this_val = $(this).val();
        console.log(this_val);
        $('#rep_data_div_id').html('');
        
        if(this_val=="da_in"){
            $('#rep_data_div_id').html('<div class="form-group col-md-6"> <labal class="col-md-12">From</label>'+
                    '<input type="date" class="form-control " placeholder="YYYY-MM-DD (Date In)" name="date_in" required> </div> &nbsp;'+ 
                    '<div class="form-group col-md-6"> <labal class="col-md-12">To</label>'+
                    '<input type="date" class="form-control " placeholder="YYYY-MM-DD (Date Out)" name="date_out" required> </div>' );
        }else if(this_val=="con_n"){
            $('#rep_data_div_id').html('<div class="form-group col-md-12"> <labal class="col-md-12">Container No</label>'+
                    '<input type="text" class="form-control"placeholder="Container No" name="con_no" required> </div>' );
        }else if(this_val=="bill_la"){
            $('#rep_data_div_id').html('<div class="form-group col-md-12"> <labal class="col-md-12">Bill Of Lading</label>'+
                    '<input type="text" class="form-control"placeholder="Bill Of Lading" name="bill_la_no" required> </div>' );
        }else if(this_val=="ref_n"){
            $('#rep_data_div_id').html('<div class="form-group col-md-12"> <labal class="col-md-12">Ref No</label>'+
                    '<input type="text" class="form-control"placeholder="Ref No" name="ref_no" required> </div>' );
        }else if(this_val=="tok_n"){
            $('#rep_data_div_id').html('<div class="form-group col-md-12"> <labal class="col-md-12">Token No</label>'+
                    '<input type="text" class="form-control"placeholder="Token No" name="tok_no" required> </div>' );
        }else if(this_val=="ge_n"){
            $('#rep_data_div_id').html('<div class="form-group col-md-12"> <labal class="col-md-12">Gate Entry No</label>'+
                    '<input type="text" class="form-control"placeholder="Gate Entry No" name="ge_no" required> </div>' );
        }

        
        
    });
</script>


<script src="<?php echo base_url();?>public_html/admin_assets/plugins/jQuery_print/jQuery.print.js"></script>
<script type="text/javascript">
	// jQuery('#rep_div_download').print();
	$('#rep_download').click(function(){
	//$('#rep_div_download').css("background","url('https://sjcreations.in/icd/public_html/background.png')")
		jQuery('#rep_div_download').print();
	});
</script>