Ejemplo n.º 1
0
 /**
  * @Secured(resource="default")
  */
 public function actionDefault()
 {
     $creditAmount = null;
     $u = null;
     try {
         $u = $this->getUser()->getIdentity();
         $s = $this->seasonService->getCurrentSeason();
         $app = $this->applicationService->getUsersApplication($u, $s);
         dd($app);
         $tax = $this->taxService->getTaxSeason($s, $app->getSportGroup());
         $creditAmount = $tax->getCredit();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad($u->getId(), null, $ex);
     }
     $this->template->creditAmount = $creditAmount;
 }
Ejemplo n.º 2
0
 public function createComponentTaxesGrid($name)
 {
     try {
         $seasons = [null => null] + $this->seasonService->getSelectSeasons();
         $groups = [null => null] + $this->groupService->getSelectApplicablegroups();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, self::LAST_CHANCE_REDIRECT, $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setModel($this->taxService->getTaxesDataSource());
     $grid->setPrimaryKey("id");
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText('season', $this->tt("motivationModule.admin.grid.season"))->setSortable()->setFilterSelect($seasons);
     $headerSeas = $grid->getColumn('season')->headerPrototype;
     $headerSeas->class[] = 'center';
     $grid->addColumnText('sportGroup', $this->tt("motivationModule.admin.grid.group"))->setSortable()->setFilterSelect($groups);
     $headerGrp = $grid->getColumn('sportGroup')->headerPrototype;
     $headerGrp->class[] = 'center';
     $grid->addColumnText('credit', $this->tt("motivationModule.admin.grid.credit"))->setSortable()->setFilterText();
     $headerCr = $grid->getColumn('credit')->headerPrototype;
     $headerCr->class[] = 'center';
     $grid->addColumnDate("orderedDate", $this->tt("motivationModule.admin.grid.orderedDate"), self::DATE_FORMAT)->setSortable();
     $headerOd = $grid->getColumn('orderedDate')->headerPrototype;
     $headerOd->class[] = 'center';
     $grid->addColumnText('publicNote', $this->tt("motivationModule.admin.grid.note"))->setTruncate(20)->setSortable()->setFilterText();
     $headerNote = $grid->getColumn('publicNote')->headerPrototype;
     $headerNote->class[] = 'center';
     $grid->addActionHref('delete', '', "deleteTax!")->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("motivationModule.admin.grid.update")]))->setConfirm(function ($u) {
         return $this->tt("motivationModule.admin.grid.rlyDeleteTaxId", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref("update", "", "updateTax")->setIcon("pencil")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("motivationModule.admin.grid.update")]));
     $operation = ['delete' => $this->tt("system.common.delete")];
     $grid->setOperation($operation, $this->entryGridOpsHandler)->setConfirm('delete', $this->tt("motivationModule.admin.grid.reallyDeleteItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-motivation-taxes" . date("Y-m-d H:i:s", time()));
 }