示例#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', 'dataSelect' => Utility::getTableForSelect()), 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' => 'Coupon', 'db' => 'code', 'dt' => 4, 'select' => 'code', 'prefix' => 'c', 'search' => true, 'type' => 'text'), array('title' => 'Total cost', 'db' => 'totalCost', 'dt' => 5, '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' => 6, 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
            return Utility::formatCost($d);
        }), 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-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 AjaxTableSum(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->setSumColumn(array('5', '6'));
        $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('Order Manage')));
    }
示例#2
0
 public function indexAction()
 {
     //config table
     /////column for table
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'search' => false, 'type' => 'number'), array('title' => 'Name', 'db' => 'name', 'dt' => 1, 'search' => true, 'type' => 'text'), array('title' => 'Category', 'db' => 'catId', 'dt' => 2, 'search' => false, 'type' => 'number', 'dataSelect' => Utility::getCategoryForSelect()), array('title' => 'Cost', 'db' => 'cost', 'dt' => 3, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Take Away Cost', 'db' => 'taCost', 'dt' => 4, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Action', 'db' => 'id', 'dt' => 5, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         $actionUrl = '/admin/index';
         return '
                     <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($columns, array(), 'admin/index');
     $table->setTablePrefix('m');
     $table->setExtendSQl(array(array('AND', 'm.isdelete', '=', '0')));
     $table->setAjaxCall('/admin/index');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->modelMenu);
     //end config table
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Manage Menu')));
 }
示例#3
0
 public function convertSingleToArray($data)
 {
     $menuInfo = Utility::getMenuInfo($data->getMenuId());
     $menuCostType = Utility::getMenuCostType($data->getCostType());
     $couponInfo = Utility::getCouponInfo($data->getDiscount());
     $array = array();
     $array['id'] = $data->getId();
     $array['orderid'] = 'Order #' . $data->getOrderId();
     $array['menuid'] = '<a href="/admin/index/add/' . $data->getMenuId() . '" target="_blank" >' . $menuInfo->getName() . '</a>';
     $array['quantity'] = $data->getQuantity();
     $array['menucost'] = Utility::formatCost($data->getMenuCost());
     $array['menucosttype'] = $menuCostType;
     $array['discount'] = $couponInfo->getDescription();
     $array['realcost'] = Utility::formatCost($data->getRealCost());
     return $array;
 }
示例#4
0
 public function indexAction()
 {
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'search' => false, 'type' => 'number'), array('title' => 'Name', 'db' => 'name', 'dt' => 1, 'search' => true, 'type' => 'text'), array('title' => 'Category', 'db' => 'catId', 'dt' => 2, 'search' => false, 'type' => 'number', 'dataSelect' => Utility::getCategoryForSelect()), array('title' => 'Cost', 'db' => 'cost', 'dt' => 3, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Take Away Cost', 'db' => 'taCost', 'dt' => 4, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }));
     /////end column for table
     $table = new AjaxTable($columns, array(), 'frontend/index');
     $table->setTablePrefix('m');
     $table->setExtendSQl(array(array('AND', 'm.isdelete', '=', '0')));
     $table->setAjaxCall('/frontend/index');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->modelMenu);
     //end config table
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Menu')));
 }
示例#5
0
    public function indexAction()
    {
        $currentUser = Utility::checkLogin();
        //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', 'dataSelect' => Utility::getTableForSelect()), 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' => 'Coupon', 'db' => 'code', 'dt' => 4, 'select' => 'code', 'prefix' => 'c', 'search' => true, 'type' => 'text'), array('title' => 'Total cost', 'db' => 'totalCost', 'dt' => 5, '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' => 6, 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
            return Utility::formatCost($d);
        }), 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-default btn-primary " href="' . $actionUrl . '/detail/' . $d . '"><i class="icon-external-link "></i></a>
                    ';
        }));
        /////end column for table
        $table = new AjaxTableSum(array(), array(), 'frontend/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")));
        $d = date('d', time());
        $m = date('m', time());
        $y = date('Y', time());
        $min = strtotime(' 0:0:0 ' . $d . '-' . $m . '-' . $y);
        $max = strtotime(' 23:59:59 ' . $d . '-' . $m . '-' . $y);
        $table->setExtendSQl(array(array('AND', 'o.isdelete', '=', '0'), array('AND', 'o.userId', '=', $currentUser->userId), array('AND', 'o.createDate', '>=', $min), array('AND', 'o.createDate', '<', $max)));
        $table->setSumColumn(array('5', '6'));
        $table->setAjaxCall('/frontend/order');
        $table->setActionDeleteAll('deleteall');
        $this->tableAjaxRequest($table, $columns, $this->modelOrder);
        //end config table
        return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Order')));
    }