/**
  * @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é');
 }
 /**
  * @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 \Nette\Application\UI\Presenter $presenter
  */
 protected function configure(\Nette\Application\UI\Presenter $presenter)
 {
     parent::configure($presenter);
     $this->setModel($this->carsModel->getAllCars());
     $this->setPrimaryKey($this->carsModel->getPrimaryKeyName());
     $this->setRememberState(TRUE);
     $this->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     $this->addColumnText('car_id', 'Evidenčné číslo')->setSortable()->setFilterText();
     $this->addColumnText('user_id', 'ID šoféra')->setSortable()->setFilterText();
     $this->addColumnText('fullname', 'Meno šoféra')->setSortable()->setFilterText();
     $this->addColumnText('weight', 'Maximálna váha')->setSortable()->setFilterText();
     $this->addColumnText('size', 'Maximálna veľkosť')->setSortable()->setFilterText();
     $this->addActionHref('edit', '')->setIcon('pencil')->getElementPrototype()->setTitle('Upraviť');
     $this->addActionHref('editDriver', '')->setIcon('user')->getElementPrototype()->setTitle('Upraviť sofera');
     $this->addActionHref('delete', '', 'delete!')->setIcon('trash icon-white')->setConfirm('Naozaj chcete odstrániť záznam?')->setElementPrototype(Html::el('a')->addClass('btn btn-danger btn-mini')->setTitle('Zmazať'));
 }
 /**
  * @param \Nette\Application\UI\Presenter $presenter
  */
 protected function configure(\Nette\Application\UI\Presenter $presenter)
 {
     parent::configure($presenter);
     $this->setModel($this->usersModel->getAllUsers());
     $this->setPrimaryKey($this->usersModel->getPrimaryKeyName());
     $this->setRememberState(TRUE);
     $this->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     $this->addColumnText('name', 'Meno')->setSortable()->setFilterText();
     $this->addColumnText('surname', 'Priezvisko')->setSortable()->setFilterText();
     $this->addColumnText('personal_id', 'Rodné číslo')->setSortable()->setFilterText();
     $this->addColumnEmail('email', 'Email')->setSortable()->setFilterText();
     $this->addColumnText('address', 'Adresa')->setSortable()->setFilterText();
     $this->addColumnDate('employed_from', 'Zamestnaný od')->setSortable()->setFilterText();
     $this->addColumnDate('employed_to', 'Zamestnaný do')->setSortable()->setFilterText();
     $this->addColumnText('role_name', 'Rola')->setSortable()->setFilterText();
     $this->addActionHref('edit', '')->setIcon('pencil')->getElementPrototype()->setTitle('Upraviť');
     $this->addActionHref('delete', '', 'delete!')->setIcon('trash icon-white')->setConfirm('Naozaj chcete odstrániť záznam?')->setElementPrototype(Html::el('a')->addClass('btn btn-danger btn-mini')->setTitle('Zmazať'));
 }
 /**
  * @param \Nette\Application\UI\Presenter $presenter
  */
 protected function configure(\Nette\Application\UI\Presenter $presenter)
 {
     parent::configure($presenter);
     if (isset($_SESSION['data'])) {
         $this->setModel($_SESSION['data']);
     } else {
         $this->setModel(array());
     }
     $this->setDefaultPerPage(500);
     //$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('car_free_size', 'Voľná kapacita')->setSortable()->setFilterText();
     $this->addColumnText('car_free_weight', 'Voľná kapacita')->setSortable()->setFilterText();
     $this->addColumnText('product_id', 'ID produktu')->setSortable()->setFilterText();
     $this->addColumnText('product_name', 'Názov produktu')->setSortable()->setFilterText();
     $this->addColumnText('product_amount', 'Počet produktu')->setSortable()->setFilterText();
 }
 /**
  * @param \Nette\Application\UI\Presenter $presenter
  */
 protected function configure(\Nette\Application\UI\Presenter $presenter)
 {
     parent::configure($presenter);
     if ($presenter->getUser()->isInRole(3)) {
         $products = $this->productsModel->getAllUserProducts($this->user);
         $temp = array();
         foreach ($products as $product) {
             $product->from = $this->productsModel->getCityName($product->from)->name;
             $product->to = $this->productsModel->getCityName($product->to)->name;
             $product->size = $product->size . ' m³';
             $product->weight = $product->weight . ' kg';
             $product->price = $product->price . ' €';
             if ($product->status) {
                 $product->status = 'Odoslaný';
             } else {
                 $product->status = 'Nespracovaný';
             }
             $temp[] = $product;
         }
         $this->setModel($temp);
     } else {
         $products = $this->productsModel->getAllProducts();
         foreach ($products as $product) {
             $product->from = $this->productsModel->getCityName($product->from)->name;
             $product->to = $this->productsModel->getCityName($product->to)->name;
             $product->size = $product->size . ' m³';
             $product->weight = $product->weight . ' kg';
             $product->price = $product->price . ' €';
             if ($product->status == 0) {
                 $product->status = 'Nespracovaná';
             } else {
                 if ($product->status == 1) {
                     $product->status = 'Odoslaná';
                 } else {
                     if ($product->status == 2) {
                         $product->status = 'Doručená';
                     }
                 }
             }
             $temp[] = $product;
         }
         $this->setModel($temp);
     }
     $this->setPrimaryKey($this->productsModel->getPrimaryKeyName());
     $this->setRememberState(TRUE);
     $this->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     $this->addColumnText('product_id', 'ID')->setSortable()->setFilterText();
     $this->addColumnText('name', 'Názov')->setSortable()->setFilterText();
     $this->addColumnText('amount', 'Počet')->setSortable()->setFilterText();
     $this->addColumnText('weight', 'Váha')->setSortable()->setFilterText();
     $this->addColumnText('size', 'Veľkosť')->setSortable()->setFilterText();
     $this->addColumnText('from', 'Odvoz z mesta')->setSortable()->setFilterText();
     $this->addColumnText('to', 'Odvoz do mesta')->setSortable()->setFilterText();
     $this->addColumnDate('date', 'Dátum prepravy')->setSortable()->setFilterText();
     $this->addColumnText('priority', 'Priorita')->setSortable()->setFilterText();
     $this->addColumnText('price', 'Cena')->setSortable()->setFilterText();
     $this->addColumnText('status', 'Status')->setSortable()->setFilterText();
     $this->addActionHref('edit', '')->setDisable(function ($item) {
         if ($item->date > new \Dibi\DateTime() && $item->status == 'Nespracovaná') {
             return false;
         }
         return true;
     })->setIcon('pencil')->getElementPrototype()->setTitle('Upraviť');
     $this->addActionHref('delete', '', 'delete!')->setDisable(function ($item) {
         if ($item->date > new \Dibi\DateTime() && $item->status == 'Nespracovaná') {
             return false;
         }
         return true;
     })->setIcon('trash icon-white')->setConfirm('Naozaj chcete odstrániť záznam?')->setElementPrototype(Html::el('a')->addClass('btn btn-danger btn-mini')->setTitle('Zmazať'));
 }