<?php $this->load->view('site/students/profile_header') ?>

<div class="flex-row-fluid ml-lg-8">
    <!--begin::Card-->
    <div class="card card-custom card-stretch">
        <?php echo form_open_multipart(base_url('' . $thispage . '/invoices/')); ?>
        <div class="card-header py-3">
            <div class="card-title align-items-start flex-column">
                <h3 class="card-label font-weight-bolder text-dark"><?= $this->lang->line('subscription') ?></h3>
                <span class="text-muted font-weight-bold font-size-sm mt-1"><?= $this->lang->line('check_your'). ' ' .$this->lang->line('subscription') ?></span>
            </div>
            <div class="clearfix"></div>
        </div>



        <div class="card-body" style="overflow: scroll">
            <h3><?= $this->lang->line('filters') ?></h3>

            <div class="form-group row">
                <label for="example-text-input" class="col-2 col-form-label"><?php echo $this->lang->line('products') ?></label>
                <div class="col-9">
                    <select class="form-control select2" name="products[]" multiple="multiple">
                   <!--<select multiple data-multi-select-plugin name="products[]" class="topnav form-control" >-->
                        <?php
                        foreach ($products as $value) {
                            $selected = '';
                            if (!empty($this->input->post('products'))) {
                                if (in_array($value->name, $this->input->post('products'))) {
                                    $selected = 'selected';
                                }
                            }
                            ?>
                            <option <?= $selected ?> value="<?php echo $value->id ?>"><?php echo $value->name ?></option>
                        <?php } ?>
                    </select> 
                </div>
            </div>
            <button type="submit" class="btn btn-primary pull-right"><?php echo $this->lang->line('submit') ?></button>
            <br/>
            <br/>
            <br/>
            <br/>
            <table class="table table-striped- table-bordered table-hover table-checkable dataTable no-footer dir-inline" id="kt_table_1">
                    <thead>
                      <tr>
                      <th><?php echo $this->lang->line('sno') ?></th>
                    <th><?php echo $this->lang->line('date-added') ?></th>
                   <th><?php echo $this->lang->line('number') ?></th>
                  <!--<th><?php //echo $this->lang->line('the-name') ?></th>-->
                 
            
                  <th ><?php echo $this->lang->line('the-product') ?></th>
                   <th ><?php echo $this->lang->line('the-beginning') ?></th>
                   <th ><?php echo $this->lang->line('end') ?></th>
                        <!--<th > <?php //echo $this->lang->line('fees') ?></th>-->
                   <!--<th ><?php //echo $this->lang->line('payment') ?></th>-->
                      <th ><?php echo $this->lang->line('status') ?></th>
                      <th><?php echo $this->lang->line('print') ?></th>
                  <!--<th><?php //echo $this->lang->line('action') ?></th>-->
                        <!-- <th><?php echo $this->lang->line('edit') ?></th>
                        <th><?php echo $this->lang->line('delete') ?></th> -->
                      </tr>
                    </thead>
                    <tbody>
                      
                        <?php $count=0; foreach($all_groups as $row) {?>
                <tr>
                           <td><?php echo $count++; ?></td>
                  <td><?= $row['date_now']; ?></td>
                        <td><?= $row['id']; ?></td>
                        
                        <!--<td>  <a  class="update btn btn-sm " href="<?//= base_url('user/show/'.$row['id_user'])?>"><?//= $row['name']; ?></a></td>-->
                 
                      <td><?= $row['name_order']; ?> </td>
                          <td><?= $row['start_date']; ?> </td>
                              <td><?= $row['expiry_date']; ?> </td>
<!--                                  <td><?php 
//if(empty($row['discount_remainder'])){
//                          echo $row['payment'];
//                          }else{
//                          echo $row['discount_remainder'];
//                          }?> </td>-->
                
            <!-- <td><?php //if($row['paid']=='0')echo '<span class="label label-danger">'.$this->lang->line("not-paid").'</span>';  
             
             
//             if($row['paid']=='1')echo '<span class="label label-success">'.$this->lang->line("payment-is-made").'</span>';
//             
//                     if($row['paid']=='3')echo '<span class="label label-warning">'.$this->lang->line("is-free").'</span>';
//                             if($row['paid']=='4')echo '<span class="label label-primary">'.$this->lang->line('retriever').'</span>';
             
             ?></td> -->
             
               <td><?php  if($row['active']!='0')echo '<span class="label label-danger label-inline mr-2">'.$this->lang->line('not-active').'</span>'; 
             
             
             if($row['active']=='0')echo '<span class="label label-success label-inline mr-2">'.$this->lang->line('active').'</span>';
             
               
             
             ?></td>
             
               
               <td>    <a href="<?= base_url('orders/printorder/' . $row['id']) ?>" target="_block" class="btn btn-light btn-text-primary btn-hover-text-primary font-weight-bold"><?php echo $this->lang->line('print') ?></a>
                    </td>
                    
<!--                    <td>     <a  class="update btn btn-sm btn-warning pull-right"  onclick="alert_box(<?php //echo $row['id'] ?>)"><i class="material-icons"><?php echo $this->lang->line('delete') ?></i></a>
                    </td>-->
                <!-- <td> <a href="<?= base_url(''.$this->thispage.'/show/'.$row['id'])?>" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="view details">
                    <i class="fa fa-eye"></i>
                  </a>  </td>
                  <td>
                  <a href="<?= base_url(''.$this->thispage.'/edit/'.$row['id'])?>" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Edit details">
                    <i class="la la-edit"></i>
                  </a></td><td>
                  <a href=""  onclick="alert_box(<?php echo $row['id'] ?>)" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Delete">
                    <i class="la la-trash"></i>
                  </a>
                    </td> --> 
                      </tr>
                       <?php } ?>
                    </tbody>
                  </table>
        </div>
<?php echo form_close(); ?>
    </div>
</div>
<?php $this->load->view('site/students/profile_footer') ?>
<script>
    $(function () {
        $('.select2').select2({
            placeholder: "<?= $this->lang->line('select') ?>"
        });
    });
</script>
