<section class="pcoded-main-container">
<div class="pcoded-content">
    <div class="page-header">
        <div class="page-block">
            <div class="row align-items-center">
                <div class="col-md-12">
                    <div class="page-header-title">
                         <h5 class="m-b-10">Papers
                         <?php if(@$userright_arr[0]->add_r):?>
                            <?php echo $this->Html->link('<i class="feather icon-plus-square" ></i> Add Papers',array('controller'=>'Papers','action'=>'add'), array('class' => 'btn btn-primary pull-right','escape'=>false),array());?>
                        <?php endif;?>
                         </h5>
                    </div>
                  
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xl-12 col-md-12">
            <div class="card">
                <div class="card-body table-border-style">
                    <div class="table-responsive dataTables_wrapper dt-bootstrap4" scroll="no" style="overflow: hidden">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="pull-right">
                                  <?= $this->Form->create('paper') ?>
                                    <div id="colum-rendr_filter" class="dataTables_filter">
                                        <label><input type="search" placeholder='Search by subject' name="search"  class="form-control"  aria-controls="papers"></label>
                                         <?= $this->Form->button('<i class="fas fa-search"></i> Submit',['type' => 'submit','class'=>'btn btn-success'],['escape' =>false]) ?>
                                      </div>
                                 
                                     <?= $this->Form->end() ?>
                                     </div>
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th scope="col">#</th>
                                            <th scope="col"><?= $this->Paginator->sort('subject') ?></th>
                                            <th scope="col"><?= $this->Paginator->sort('created') ?></th>
                                            <th scope="col"><?= $this->Paginator->sort('modified') ?></th>
                                            <th scope="col" class="actions"><?= __('Actions') ?></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php if($papers){$i=0;
                                            foreach ($papers as $paper): ?>
                                        <tr>
                                            <td><?= ++$i; ?></td>
                                            <td><?= h($paper->subject) ?></td>
                                            <td><?= date('d-M-y H:i A',strtotime($paper->created)) ?></td>
                                            <td><?= date('d-M-y H:i A',strtotime($paper->modified)) ?></td>
                                            <td class="actions">
                                            <?php if(@$userright_arr[0]->details_r):?>

                                                <?= $this->Html->link($this->Html->tag('i', '', array('class'=>"fas fa-eye btn btn-success")), array('action' => 'view', $paper->id),array('escape'=>false)) ?>
                                            <?php endif;?>
                                            <?php if(@$userright_arr[0]->edit):?>

                                                <?= $this->Html->link($this->Html->tag('i', '', array('class'=>"feather icon-edit btn btn-primary")), array('action' => 'edit', $paper->id),array('escape'=>false)) ?>
                                            <?php endif;?> 
                                            
                                                <?php if(@$userright_arr[0]->delete_r):?>
                                                <?= $this->Form->postLink($this->Html->tag('i', '', array('class' => "feather icon-trash-2 btn btn-danger")),
                                                    array('action' => 'delete', $paper->id),
                                                    array('escape'=>false,
                                                'confirm' => __('Are you sure you want to delete # {0}?', $paper->id))) ?>
                                                <?php endif;?>
                                            </td>
                                        </tr>
                                        <?php endforeach; }else{ ?>
                                            <tr><td colspan="5">No Records Found</td></tr>
                                        <?php } ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <?php if($filter==0){ ?>
                        <div class="row">
                            <div class="col-sm-12 col-md-5">
                            <div class="dataTables_info" id="user-list-table_info" role="status" aria-live="polite"><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></div>
                            </div>
                            <div class="col-sm-12 col-md-7">
                                <div class="dataTables_paginate paging_simple_numbers" id="user-list-table_paginate">
                                    <ul class="pagination">
                                       <?php 
                                        echo $this->Paginator->prev( '<<', array( 'class' => '', 'tag' => 'li' ), null, array( 'class' => 'dsisabled myclass', 'tag' => 'li' ) );
                                        echo $this->Paginator->numbers( array( 'tag' => 'li', 'separator' => '', 'currentClass' => 'disabled myclass' ) );
                                        echo $this->Paginator->next( '>>', array( 'class' => '', 'tag' => 'li' ), null, array( 'class' => 'disabled myclass', 'tag' => 'li' ) );
                                    ?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    <?php } ?>
                    </div>
                </div> 
            </div>
         </div> 
    </div>      
</div>
</section>