Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function getRowActions(Collection $collection)
 {
     $editAction = new ActionColumn();
     $editAction->setIcon('edit')->setTitle('Edit Tax Rate')->setRoute('_edit_tax_rate');
     $deleteAction = new ActionColumn();
     $deleteAction->setIcon('times')->setTitle('Delete Tax')->setRoute('_delete_tax_rate')->setConfirm('Are you sure you want to delete this tax method?')->setAttributes(array('class' => 'delete-tax'))->setClass('danger');
     $collection->add($editAction);
     $collection->add($deleteAction);
     return $collection;
 }
Esempio n. 2
0
 /**
  * @param GridInterface|string $grid
  *
  * @return $this
  *
  * @throws \Exception
  */
 public function create($grid)
 {
     if ($grid instanceof GridCollection) {
         $this->collection = $grid;
         $activeGrid = $this->request->query->get('grid');
         $this->collection->setActive($activeGrid);
         $grid = $this->collection->getGrid($activeGrid)['grid'];
     }
     if (is_string($grid)) {
         $grid = $this->container->get($grid);
     }
     if (!$grid instanceof GridInterface) {
         throw new \Exception('Grid needs to implement GridInterface');
     }
     $this->entity = $grid;
     $source = $grid->getSource();
     $this->filters = new Filters($this->request->get('filter'));
     $grid->getFilters($this->filters);
     $searchString = $this->request->get('search');
     $source->manipulateQuery(function (QueryBuilder $queryBuilder) use($grid, $searchString) {
         if ($this->filters->isFilterActive()) {
             $filter = $this->filters->getActiveFilter();
             $filter($queryBuilder);
         }
         if (!empty($searchString)) {
             $this->searchString = $searchString;
             $grid->search($queryBuilder, $searchString);
         }
     });
     // Attach the source to the grid
     $this->setSource($source);
     $grid->getRowActions($collection = new Collection());
     if (!$collection->isEmpty()) {
         $actionsRow = $this->getActionColumn($collection);
         $this->addColumn($actionsRow, 100);
     }
     $massActions = $grid->getMassActions();
     array_walk($massActions, array($this, 'addMassAction'));
     $this->createHash();
     $requestData = $this->request->get($this->getHash());
     if (1 === count($requestData) && isset($requestData[self::REQUEST_QUERY_MASS_ACTION_ALL_KEYS_SELECTED]) && $requestData[self::REQUEST_QUERY_MASS_ACTION_ALL_KEYS_SELECTED] === '0') {
         $this->request->request->remove($this->getHash());
     }
     return $this;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function getRowActions(Collection $collection)
 {
     $viewAction = new ActionColumn();
     $viewAction->setIcon('eye')->setTitle('client.grid.actions.view')->setRoute('_clients_view')->setClass('primary');
     $editAction = new ActionColumn();
     $editAction->setIcon('edit')->setTitle('client.grid.actions.edit')->setRoute('_clients_edit')->setClass('info');
     $collection->add($viewAction);
     $collection->add($editAction);
     return $collection;
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function getRowActions(Collection $collection)
 {
     $viewAction = new ActionColumn();
     $viewAction->setIcon('eye')->setTitle('invoice.action.view')->setRoute('_invoices_view');
     $editAction = new ActionColumn();
     $editAction->setIcon('edit')->setTitle('invoice.action.edit')->setRoute('_invoices_edit')->setCallback(function (RowAction $rowAction, Row $row) {
         if (Graph::STATUS_PAID !== $row->getField('status')) {
             return $rowAction;
         }
     });
     $payAction = new ActionColumn();
     $payAction->setIcon('credit-card')->setTitle('invoice.action.pay_now')->setRoute('_payments_create')->setRouteParams(array('uuid'))->setCallback(function (RowAction $rowAction, Row $row) {
         if (Graph::STATUS_PENDING !== $row->getField('status')) {
             return;
         }
         return $rowAction;
     });
     $collection->add($viewAction);
     $collection->add($editAction);
     $collection->add($payAction);
 }
Esempio n. 5
0
 /**
  * {@inheritdoc}
  */
 public function getRowActions(Collection $collection)
 {
     $viewAction = new ActionColumn();
     $viewAction->setIcon('eye')->setTitle('invoice.action.view')->setRoute('_invoices_view');
     $editAction = new ActionColumn();
     $editAction->setIcon('edit')->setTitle('invoice.action.edit')->setRoute('_invoices_edit');
     $collection->add($viewAction);
     $collection->add($editAction);
 }