  <?php
    $this->load->view('templates/header');
    $action = (isset($_GET['action'])) ? $_GET['action'] : "";
    $search_value_entry_no      = (isset($_GET['search_value_entry_no'])) ? $_GET['search_value_entry_no'] : 0;
    $search_value_entry_date    = (isset($_GET['search_value_entry_date'])) ? $_GET['search_value_entry_date'] : '';
    $search_value_cust_id       = (isset($_GET['search_value_cust_id'])) ? $_GET['search_value_cust_id'] : 0;
    $search_value_broker_id     = (isset($_GET['search_value_broker_id'])) ? $_GET['search_value_broker_id'] : 0;
  ?>
    <script>
        var link     = "order_section";
        var sub_link =  "order_master" ;
    </script>
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>Order
       <?php //echo $label ?>
        <small>Master</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">Order Master</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12 col-sm-12">
                <div class="box box-primary">
                    <!-- <div class="box-body"> -->
                        <form class="form-horizontal" id="search_form" action="<?php echo base_url('order/orderctrl/order_master')?>" method="get">
                            <div class="panel panel-body remove-bottom">
                                <div class="form-group floating-form">
                                    <div class="col-md-2 col-sm-2 floating-label">
                                        <?php echo form_dropdown('', $data['entry_no_drop_down'], $search_value_entry_no,'id="search_value_entry_no" name="search_value_entry_no" class="form-control floating-select flexselect" ');?>
                                        <label>ENTRY NO</label>
                                    </div>

                                    <div class="col-md-2 col-sm-2 floating-label">
                                        <input type="text" class="form-control floating-input" name="search_value_entry_date" id="search_value_entry_date" value="<?php echo $search_value_entry_date ?>" placeholder=" " autocomplete="off"/>
                                        <label>Entry Date</label>
                                    </div>

                                    <div class="col-md-2 col-sm-2 floating-label">
                                        <?php echo form_dropdown('', $data['customer_drop_down'], $search_value_cust_id,'id="search_value_cust_id" name="search_value_cust_id" class="form-control floating-select flexselect" ');?>
                                        <label>CUSTOMER</label>
                                    </div>

                                    <div class="col-md-2 col-sm-2 floating-label">
                                        <?php echo form_dropdown('', $data['broker_drop_down'], $search_value_broker_id,'id="search_value_broker_id" name="search_value_broker_id" class="form-control floating-select flexselect" ');?>
                                        <label>BROKER</label>
                                    </div>

                                    <div class="col-md-1  col-sm-1 ">
                                        <button type="submit" class="btn btn-primary" tabindex="3"><i class="fa fa-search" aria-hidden="true"></i>Search</button>
                                    </div>

                                    <div class="col-md-1 col-sm-1">
                                        <a href="<?php echo base_url('order/orderctrl/order_master?action=view'); ?>" class="btn btn-primary" tabindex="8"><i class="fa fa-undo" aria-hidden="true"></i>
                                            Reset
                                        </a>
                                    </div>
                                  
                                    <div class="col-md-2 col-sm-2">
                                        <label for="inputEmail3" class="col-sm-1 control-label control-label_custom" style="width:100%;">
                                            Cnt :
                                            <span id="count_reload">
                                                <i id="total_rows"><?php echo $total_rows;?></i>
                                            </span>
                                        </label>
                                        <input type="hidden" class="form-control" id="action" name="action" value="<?php echo $action ?>" />
                                    </div>
                                </div>
                            </div>
                        </form>
                    <!-- </div> -->
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-body" id="table_reload">
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>ENTRY NO</th>
                                    <th>ENTRY DATE</th>
                                    <th>CUSTOMER</th>
                                    <th>BROKER</th>
                                    <!-- <th>PRINT</th> -->
                                    <th>ACTION</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php
                                if(!empty($data['order_data'])):
                                 
                                foreach ($data['order_data'] as $key => $value):
                                    $om_id      = encrypt_decrypt("encrypt", $value['om_id'], SECRET_KEY);
                            ?>
                                <tr>
                                    <td><?php echo $key+1 ?></td>
                                    <td><?php echo $value['om_entry_no'];?></td>
                                    <td><?php echo date('d-m-Y', strtotime($value['om_entry_date'])) ?></td>
                                    <td><?php echo strtoupper($value['customer_name'])?></td>
                                    <td><?php echo strtoupper($value['broker_name']) ?></td>
                                    <!-- <td><?php //echo $value['acc_tel_1']?></td> -->
                                    <td>
                                        <a href="<?php echo base_url('order/orderctrl/order_master?action=edit&id='.$om_id); ?>" class="glyphicon glyphicon-pencil"></a>
                                        <!-- <span class="glyphicon glyphicon-trash" onClick="delete_master_item(<?php //echo $value['acc_id']?>,'account_delete');"></span> -->
                                    </td>
                                </tr>
                            <?php
                                endforeach;
                                else:
                            ?>
                                <tr>
                                    <td colspan="13" align="center" style="color: red;"> No Record Found! </td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="text-right">
                <?= $this->pagination->create_links(); ?>
            </div>
        </div>
    </section>

<?php
    $this->load->view('templates/footer');
?>
<script>
    (function () {
        disable_enable_background(false)
    }());
</script>
   </body>
</html>