Exemplo n.º 1
0
    public function selectForSearch($data)
    {
        $searchResult = parent::selectForSearch($data);
        foreach ($searchResult as $row) {
            $newResultLine = new stdclass();
            ob_start();
            ?>
                <div class="text-center">
                    <a href="<?php 
            echo Config::read('page.url.order.detail') . '/' . $row->id;
            ?>
" class="btn btn-default btn-sm"><i class="fa fa-edit"></i> Detalhes</a>
            <?php 
            if ($row->status == Config::read('order.status')['new'] && $this->type == 'myPurchases') {
                ?>
                    
                    <a href="<?php 
                echo Config::read('page.url.order.pay') . '/' . $row->id;
                ?>
" class="btn btn-default btn-sm"><i class="fa fa-money"></i> Pagar</a>
            <?php 
            }
            ?>
                </div>
            <?php 
            $newResultLine->action = ob_get_clean();
            $newResultLine->code = $row->id;
            $newResultLine->date = $row->date;
            // Detalhes do produto
            ob_start();
            ?>
                <a href="<?php 
            echo Config::read('page.url.product.detail') . '/' . $row->product;
            ?>
">
                    <div class="row">
                        <div class="col-xs-2">
            <?php 
            if ($row->photos[0]) {
                ?>
                            <img style="width:100px;" src="<?php 
                echo Config::read('url.photos') . '/' . $row->album . '/small-' . $row->photos[0]->url;
                ?>
" draggable="false">
            <?php 
            }
            ?>
                        </div>
                        <div class="col-xs-10">
                            <h4><?php 
            echo $row->productName;
            ?>
</h4>
                            <p><?php 
            echo $row->productText;
            ?>
</p>
                        </div>
                    </div>
                </a>
            <?php 
            $newResultLine->product = ob_get_clean();
            // Comprador ou Vendedor?
            switch ($this->type) {
                case 'mySales':
                    $newResultLine->person = $row->buyerName;
                    break;
                case 'myPurchases':
                    $newResultLine->person = $row->vendorName;
                    break;
                default:
                    $newResultLine->person = "&nbsp;";
                    break;
            }
            // Status do produto
            $newResultLine->status = '<span class="label label-' . Config::read('order.status.state')[array_search($row->status, Config::read('order.status'))] . '">' . $row->statusText . '</span>';
            $result[] = $newResultLine;
        }
        return $result;
    }