<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">Transactions<?php echo $this->Html->link('<i class="feather icon-plus-square" ></i> Add Transaction',array('controller'=>'Transactions','action'=>'add'), array('class' => 'btn btn-primary pull-right','escape'=>false),array());?>
                        </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('transaction') ?>
                                    <div id="colum-rendr_filter" class="dataTables_filter">
                                        <label><input type="search" placeholder='Search by order Id and pay date' name="search"  class="form-control"  aria-controls="transactions"></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('order_ids') ?></th>
                                        <th scope="col"><?= $this->Paginator->sort('pay_amount') ?></th>
                                        <th scope="col"><?= $this->Paginator->sort('pay_date') ?></th>
                                        <th scope="col"><?= $this->Paginator->sort('freelancer_id') ?></th>
                                        <th scope="col" class="actions"><?= __('Actions') ?></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php if(!empty($transactions)){ $i=0; foreach ($transactions as $transaction): ?>
                                    <tr>
                                        <td><?= ++$i; ?></td>
                                        <td><?= h($transaction->order_ids) ?></td>
                                        <td><?= $this->Number->format($transaction->pay_amount) ?></td>
                                        <td><?=  date('d-M-y',strtotime($transaction->pay_date)) ?></td>
                                        <td><?= $transaction->has('freelancer') ? $this->Html->link($transaction->freelancer->name, ['controller' => 'Freelancers', 'action' => 'view', $transaction->freelancer->id]) : '' ?></td>
                                        <td class="actions">
                                    <?= $this->Html->link($this->Html->tag('i', '', array('class'=>"fas fa-eye btn btn-success")), array('action' => 'view', $transaction->id),array('escape'=>false)) ?>
                                        <?= $this->Html->link($this->Html->tag('i', '', array('class'=>"feather icon-edit btn btn-primary")), array('action' => 'edit', $transaction->id),array('escape'=>false)) ?>
                                        <?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', $transaction->id),
                                            array('escape'=>false,'confirm' => __('Are you sure you want to delete # {0}?', $transaction->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> 