public function getTakeaway() { $this->autoRender = FALSE; $restId = parent::readCookie('cri'); if (isset($restId) and $this->request->is('ajax')) { Log::debug('Ajax request hited for takeaway'); $takeawayController = new TakeawayController(); $latestTakeaway = $takeawayController->getLatestTakeaway($restId); if ($latestTakeaway) { $this->response->body(json_encode($latestTakeaway)); } else { $this->response->body(0); } } else { $this->response->body(0); } }
public function placeOrder() { if (!$this->isLogin()) { $this->redirect('login'); } $data = explode('/', $this->request->url); Log::debug($data); $userController = new UserController(); $restaurantId = $this->readCookie('cri'); $users = $userController->getUsers($restaurantId); $menuCategoryController = new MenuCategoryController(); $categories = $menuCategoryController->getMenuCategories(); $menuController = new MenuController(); $menus = $menuController->getMenus($restaurantId); $tableId = $this->readCookie('cti'); $takeawayNo = $this->readCookie('ctn'); $deliveryNo = $this->readCookie('cdn'); $rtableController = new RTablesController(); if ($tableId) { $tableTransactionController = new TableTransactionController(); $custId = $tableTransactionController->getCurrentCustomer($tableId, $restaurantId); } else { if ($takeawayNo) { $takeawayController = new TakeawayController(); $custId = $takeawayController->getTakeawayCustomer($takeawayNo, $restaurantId); } else { if ($deliveryNo) { $deliverycontroller = new DeliveryController(); $custId = $deliverycontroller->getCurrentCustomer($deliveryNo, $restaurantId); } } } $rconfigSettingcontroller = new RConfigSettingsController(); $set = ['users' => $users, 'menus' => $menus, 'categories' => $categories, 'option' => $data[0], 'tableId' => $tableId, 'takeawayNo' => $takeawayNo, 'deliveryNo' => $deliveryNo, 'custId' => $custId, 'kot_permission' => $rconfigSettingcontroller->allow($restaurantId, KOT_CONFIG_KEY)]; if ($tableId) { $set['isOccupied'] = $rtableController->isOccupied($tableId); $set['tableNo'] = $rtableController->getBillTableNo($tableId); } $this->set($set); }
public function addTakeaway($operationData, $userInfo) { $addTakeawayRequest = UploadDTO\TakeawayUploadDto::Deserialize($operationData); $takeawayController = new TakeawayController(); $addTakeawayRequest->takeawayNo = $takeawayController->getTakeawayNo($userInfo->restaurantId); $addTakeawayRequest->userId = $userInfo->userId; $takeawayResult = $takeawayController->addTakeawayEntry($addTakeawayRequest, $userInfo); if ($takeawayResult) { $this->response->body(DTO\ErrorDto::prepareSuccessMessage($takeawayResult)); return; } $this->response->body(DTO\ErrorDto::prepareError(120)); return; }
public function getCurrentTableCustomer() { $this->autoRender = FALSE; if (!$this->isLogin()) { $this->response->body(DTO\ErrorDto::prepareError(141)); } if ($this->request->is('post')) { $restaurantId = parent::readCookie('cri'); $data = $this->request->data; if ($data['table']) { Log::debug($data); $cust = $this->getTableObj()->getCustomer($data['table'], $restaurantId); $response['custId'] = $cust; } elseif ($data['takeaway']) { $takeawayController = new TakeawayController(); $response['custId'] = $takeawayController->getTakeawayCustomer($data['takeaway'], $restaurantId); } elseif ($data['delivery']) { $deliveryController = new DeliveryController(); $response['custId'] = $deliveryController->getCurrentCustomer($data['delivery'], $restaurantId); } $this->response->body(json_encode($response)); } }