Esempio n. 1
0
 /**
  * @param \Nette\Application\UI\Presenter $presenter
  */
 protected function configure(\Nette\Application\UI\Presenter $presenter)
 {
     parent::configure($presenter);
     $orders = $this->ordersModel->getDriverOrders($presenter->getUser()->getId());
     $driverPlan = array();
     foreach ($orders as $temp) {
         $temp->from = $this->productsModel->getCityName($temp->from)->name;
         $temp->to = $this->productsModel->getCityName($temp->to)->name;
         $driverPlan[] = $temp;
     }
     $this->setModel($driverPlan);
     $this->setPrimaryKey($this->ordersModel->getPrimaryKeyName());
     $this->setRememberState(TRUE);
     $this->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     $this->addColumnText('car_id', 'Evidenčné číslo auta')->setSortable()->setFilterText();
     $this->addColumnText('product_id', 'ID objednávky')->setSortable()->setFilterText();
     $this->addColumnText('name', 'Názov tovaru')->setSortable()->setFilterText();
     $this->addColumnText('product_amount', 'Počet')->setSortable()->setFilterText();
     $this->addColumnDate('date', 'Dátum dovozu')->setSortable()->setFilterText();
     $this->addColumnText('from', 'Odvoz z')->setSortable()->setFilterText();
     $this->addColumnText('to', 'Dovoz do')->setSortable()->setFilterText();
     $this->addActionHref('add', '')->setDisable(function ($item) {
         if (isset($item->delivered)) {
             return true;
         }
         return false;
     })->setIcon('ok')->getElementPrototype()->setTitle('Doručené');
 }
Esempio n. 2
0
 /**
  * @param \Nette\Application\UI\Presenter $presenter
  */
 protected function configure(\Nette\Application\UI\Presenter $presenter)
 {
     parent::configure($presenter);
     $this->setModel($this->ordersModel->getOrders());
     //$this->setPrimaryKey($this->productsModel->getPrimaryKeyName());
     $this->setRememberState(TRUE);
     $this->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     $this->addColumnText('car_id', 'Evidenčné číslo auta')->setSortable()->setFilterText();
     $this->addColumnText('product_id', 'ID objednávky')->setSortable()->setFilterText();
     $this->addColumnText('name', 'Názov produktu')->setSortable()->setFilterText();
     $this->addColumnText('product_amount', 'Počet')->setSortable()->setFilterText();
     $this->addColumnDate('date', 'Dátum vyhotovenia')->setSortable()->setFilterText();
     $this->addColumnText('delivered', 'Doručené')->setSortable()->setFilterText();
 }
 /**
  * @param int $order_id
  */
 public function actionAdd($order_id)
 {
     ini_set('max_execution_time', 500);
     $data = $this->ordersModel->getOrder($order_id);
     $product = $this->productsModel->getProduct($data->product_id);
     $orders = $this->ordersModel->getOrdersProduct($data->product_id);
     $amount = $data->product_amount;
     foreach ($orders as $temp) {
         $amount += $temp->product_amount;
     }
     if ($product->amount == $amount) {
         $this->productsModel->update($data->product_id, array('status' => 2));
         mail($product->email, 'Objednavka cislo' . $product->product_id, 'Celá Vaša objednávka s číslom ' . $product->product_id . ' bola úspešne doručená.', 'From: ltranstransportcompany@gmail.com');
     } else {
         mail($product->email, 'Objednavka cislo' . $product->product_id, 'Časť Vašej objednávky s číslom ' . $product->product_id . ' a množstvom ' . $data->product_amount . ' bolo úspešne doručené.', 'From: ltranstransportcompany@gmail.com');
     }
     $this->ordersModel->update($order_id, array('delivered' => new DateTime()));
     $this->flashMessage('Objednávka bola doručená!', 'success');
     $this->redirect('Optimalization:driver');
 }