Skip to content

Commit

Permalink
Feature/ Compatibility with ui 2.0 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibelar authored Feb 20, 2020
1 parent c10254d commit ed2d51a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"license": "MIT",
"autoload": {
"psr-4": {"atk4\\invoice\\":"src/"}
},
"require": {
"atk4/ui": "^2.0"
}
}
10 changes: 4 additions & 6 deletions src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public function init()
{
parent::init();

$this->app->useSuiVue();

if (!$this->grid) {
$this->grid = new Grid(['paginator' => ['urlTrigger' => 'p'], 'sortTrigger' => 'sortBy']);
}
Expand Down Expand Up @@ -81,16 +79,16 @@ public function displayInvoices()
$g->quickSearch->useAjax = false;
$g->quickSearch->initValue = $this->search;

$g->addAction(['icon' => 'edit'], $this->jsIIF($this->invoicePage->getURL()));
$g->addActionButton(['icon' => 'edit'], $this->jsIIF($this->invoicePage->getURL()));

if ($this->hasPayment) {
$g->addAction(['icon' => 'dollar sign'], $this->jsIIF($this->paymentPage->getURL()));
$g->addActionButton(['icon' => 'dollar sign'], $this->jsIIF($this->paymentPage->getURL()));
}

$g->addAction(['icon' => 'print'], $this->jsIIF($this->printPage->getURL('popup')));
$g->addActionButton(['icon' => 'print'], $this->jsIIF($this->printPage->getURL('popup')));


$g->addAction(['icon' => 'trash'], function ($jschain, $id) {
$g->addActionButton(['icon' => 'trash'], function ($jschain, $id) {
$this->model->load($id)->delete();

return $jschain->closest('tr')->transition('fade left');
Expand Down
6 changes: 3 additions & 3 deletions src/InvoiceMgr.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ public function init()
// Add payment table.
$g = $page->add('Table');
$g->setModel($this->paymentModel);
$actions = $g->addColumn(null, 'Actions');
$actions->addAction(['icon' => 'edit'], $this->invoice->jsIIF($paymentEdit->getURL(), 'pId'));
$actions->addAction(['icon' => 'trash'], function ($js, $id) use ($g, $seg){
$actions = $g->addColumn(null, 'ActionButtons');
$actions->addButton(['icon' => 'edit'], $this->invoice->jsIIF($paymentEdit->getURL(), 'pId'));
$actions->addButton(['icon' => 'trash'], function ($js, $id) use ($g, $seg){
$g->model->load($id)->delete();

return [$js->closest('tr')->transition('fade left'), $seg->jsReload()];
Expand Down

0 comments on commit ed2d51a

Please sign in to comment.