<?php require_once('../auth/auth.php'); ?>
   <?php
     $eco_tamplate_query= mysqli_query($conn,"SELECT * FROM  eco_tamplate WHERE coid='$coid' AND bid ='$bid' AND brid ='$brid' ") or die (mysqli_error($conn)); 
    $rowcount = mysqli_num_rows($eco_tamplate_query);
    ?>  
<section class="content">
 <div class="container-fluid">
  <div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-10">
      <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
        <div class="card-header" style="padding: 3px 8px;">
          <h3 class="card-title"> Balance Statment </h3>
          <div class="card-tools">

            <button type="button" class="btn btn-tool" onclick="printMe('#b_statment')" title="Print Now"><i class="fas fa-print"></i></button>
            <button type="button" class="btn btn-tool" data-card-widget="remove" data-dismiss="modal">
              <i class="fas fa-times"></i>
            </button>
          </div>
        </div>      
            <div class="card-body p-1 table-responsive cscroll" id="b_statment" style="max-height: 450px;">
              <table id="sttable<?php echo $gcoid;?>" class="ttable" cellpadding="0" cellspacing="0">
                 <thead>
                    <tr class="sticky-top" style="background: hsl(0deg 0% 50% / 42%);">
                       <th class="text-center" style="width:3%;"> <?php echo language(15);?></th>
                       <th class="text-center" style="width:9%;"><?php echo 'Col Name';?></th>
                       <th class="text-center" style="width:34%;"><?php echo language(295);?></th>
                       <th class="text-center" style="width:34%;"><?php echo language(295);?></th>
                    </tr>
                 </thead>
                 <tbody>

                                 <?php
         $result= mysqli_query($conn,"SELECT `eco_id`, `coid`, `bid`, `brid`, `col_name`, `col_value`, `col_type` FROM eco_tamplate WHERE coid='$coid' AND bid ='$bid' AND brid ='$brid' AND col_type !='slider' ") or die (mysqli_error($conn));
         $i=0;
         while ($row= mysqli_fetch_array ($result) ){
         $eco_id = $row['eco_id'];
         
         
         
         ?>
                    <tr>
      
                       <td class="text-center"  style="border-top:0;"><dt> <?php echo ++$i;?> </dt></td>
                       <td class="text-center" style="border-top:0;"><dt><?php 
                       
                       if($row['col_name']=='eco_title'){
                           echo 'Write Your Title';
                       }else if($row['col_name']=='eco_topbar'){
                             echo 'Write Topbar Title';
                       }else if($row['col_name']=='eco_min'){
                             echo 'Filter Min Price';
                       }else if($row['col_name']=='eco_max'){
                             echo 'Filter Max Price';
                       }else if($row['col_name']=='eco_step'){
                             echo 'Filter Per Step Price';
                       }else if($row['col_name']=='eco_care'){
                             echo 'Customer Care';
                       }else if($row['col_name']=='eco_care2'){
                             echo 'customer care 2';
                       }else if($row['col_name']=='eco_email'){
                             echo 'Email Address';
                       }else if($row['col_name']=='eco_email2'){
                             echo 'Email Address 2';
                       }else if($row['col_name']=='eco_address'){
                             echo 'Address';
                       }else if($row['col_name']=='eco_footer1'){
                             echo 'Footer Short Details';
                       }else if($row['col_name']=='eco_slink1'){
                             echo 'Facebook Url';
                       }else if($row['col_name']=='eco_slink2'){
                             echo 'Twitter Url';
                       }else if($row['col_name']=='eco_slink3'){
                             echo 'Linkden Url';
                       }else if($row['col_name']=='eco_slink4'){
                             echo 'Instragram Url';
                       }else if($row['col_name']=='eco_slider_fot'){
                             echo 'Slider Footer Content';
                       }else if($row['col_name']=='eco_fot_facebook'){
                             echo 'Facebook Iframe';
                       }
                       
                       ?></dt></td>
                       <td class="text-left" style="border-top:0;"><dt>
                          <input type="text" name="col_value" col_name="col_value" value="<?php echo $row['col_value'];?>" eco_id="<?php echo $eco_id;?>" class="form-control form-control-sm  onlive"  required="true">
                           </dt></td>
                       <td class="text-right" style="border-top:0;"><dt><?php echo $row['col_type'];?></dt></td>
                    </tr>

                 <?php } ?>
                 </tbody>
       
              </table>
            </div>
           </div>
        </div>
      <div class="col-md-1"></div>
   </div>
  </div>
</section>






<script type="text/javascript">
  $(document).ready(function() {
    $(".onlive").on('input change', function(){
      eco_id = $(this).attr("eco_id");
      col_name = $(this).attr("col_name");
      col_value = $(this).val();
      $.ajax({
        type: "POST",
        url: "../eco/eco_tamplate_db.php",
        data: ({eco_id: eco_id,col_name: col_name,col_value:col_value}),
        cache:false,
      });
    });
  });
</script>



