Ejemplo n.º 1
0
 public function indexAction()
 {
     //config table
     /////column for table
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number'), array('title' => 'Table', 'db' => 'name', 'dt' => 1, 'select' => 'name', 'prefix' => 't', 'search' => true, 'type' => 'text'), array('title' => 'User Name', 'db' => 'userName', 'dt' => 2, 'select' => 'userName', 'prefix' => 'u', 'search' => true, 'type' => 'text'), array('title' => 'Create Date', 'db' => 'createDate', 'dt' => 3, 'select' => 'createDate', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         return date('d-m-Y h:i:s', $d);
     }), array('title' => 'Total Cost', 'db' => 'totalCost', 'dt' => 4, 'select' => 'totalCost', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Total Real Cost', 'db' => 'totalRealCost', 'select' => 'totalRealCost', 'prefix' => 'o', 'dt' => 5, 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Coupon', 'db' => 'code', 'dt' => 6, 'select' => 'code', 'prefix' => 'c', 'search' => true, 'type' => 'text'), array('title' => 'Action', 'db' => 'orderId', 'dt' => 7, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         $actionUrl = '/admin/order';
         return '
                     <a class="btn-xs action action-detail btn btn-info btn-default" href="' . $actionUrl . '/detail/' . $d . '"><i class="icon-info"></i></a>
                     <a class="btn-xs action action-detail btn btn-success btn-default" href="' . $actionUrl . '/add/' . $d . '"><i class="icon-edit"></i></a>
                     <a data-id="' . $d . '" id="' . $d . '" data-link="' . $actionUrl . '" class="btn-xs action action-detail btn btn-danger  btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a>
                 ';
     }));
     /////end column for table
     $table = new AjaxTable(array(), array(), 'admin/order');
     $table->setTableColumns($columns);
     $table->setTablePrefix('o');
     $table->setExtendJoin(array(array(" Admin\\Entity\\User", "u", "WITH", "u.id = o.userId "), array(" Admin\\Entity\\Managetable", "t", "WITH", "t.id = o.tableId "), array(" Admin\\Entity\\Coupon", "c", "WITH", "c.id = o.couponId ")));
     $table->setExtendSQl(array(array('AND', 'o.isdelete', '=', '0')));
     $table->setAjaxCall('/admin/order');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->modelOrder);
     //end config table
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Manage Order')));
 }
 public function managerInOutAction()
 {
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number'), array('title' => 'Store Name', 'db' => 'menuStoreId', 'dt' => 1, 'select' => 'menuStoreId', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         $storeInfo = Utility::getMainStoreInfo($d);
         return $storeInfo->getName();
     }), array('title' => 'Action', 'db' => 'action', 'dt' => 2, 'select' => 'action', 'prefix' => 'o', 'search' => true, 'type' => 'text'), array('title' => 'Quantity', 'db' => 'quantity', 'dt' => 3, 'select' => 'quantity', 'prefix' => 'o', 'search' => true, 'type' => 'text'), array('title' => 'Cost', 'db' => 'cost', 'dt' => 4, 'select' => 'cost', 'prefix' => 'o', 'search' => true, 'type' => 'text'), array('title' => 'Note', 'db' => 'note', 'dt' => 5, 'select' => 'note', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         $note = TransactionUtility::getStoreItemInOrder($d);
         if ($note == '') {
             $note = $d;
         }
         return $note;
     }), array('title' => 'Action', 'db' => 'orderId', 'dt' => 6, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         $actionUrl = '/admin/menustoremain';
         return '
                     <a class="btn-xs action action-detail btn btn-info btn-default" href="' . $actionUrl . '/detail/' . $d . '"><i class="icon-info-sign"></i></a>
                     <a class="btn-xs action action-detail btn btn-success btn-default" href="' . $actionUrl . '/add/' . $d . '"><i class="icon-edit"></i></a>
                     <a data-id="' . $d . '" id="' . $d . '" data-link="' . $actionUrl . '" class="btn-xs action action-detail btn btn-danger  btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a>
                 ';
     }));
     /////end column for table
     $table = new AjaxTable(array(), array(), 'admin/menustoremain/managerinout');
     $table->setTableColumns($columns);
     $table->setTablePrefix('o');
     $table->setAjaxCall('/admin/menustoremain/managerinout');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->transactionModel);
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Manage Import/Export')));
 }