Datagrid Issue Fixed In Shops

This commit is contained in:
devansh bawari 2021-02-11 10:45:10 +05:30
parent bb0ee2d554
commit 15369d7a86
2 changed files with 19 additions and 10 deletions

View File

@ -2,8 +2,8 @@
namespace Webkul\Shop\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
class OrderDataGrid extends DataGrid
{
@ -80,12 +80,13 @@ class OrderDataGrid extends DataGrid
]);
}
public function prepareActions() {
public function prepareActions()
{
$this->addAction([
'type' => 'View',
'method' => 'GET',
'route' => 'customer.orders.view',
'icon' => 'icon eye-icon',
]);
], true);
}
}

View File

@ -298,13 +298,17 @@ abstract class DataGrid
}
/**
* Add action.
* Add action. Some datagrids are used in shops also. So extra
* parameters is their. If needs to give an access just pass true
* in second param.
*
* @param array $action
* @param array $action
*
* @param bool $specialPermission
*
* @return void
*/
public function addAction($action)
public function addAction($action, $specialPermission = false)
{
$currentRouteACL = $this->fetchCurrentRouteACL($action);
@ -316,7 +320,7 @@ abstract class DataGrid
$eventName = null;
}
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null)) {
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null) || $specialPermission) {
$this->fireEvent('action.before.' . $eventName);
array_push($this->actions, $action);
@ -327,13 +331,17 @@ abstract class DataGrid
}
/**
* Add mass action.
* Add mass action. Some datagrids are used in shops also. So extra
* parameters is their. If needs to give an access just pass true
* in second param.
*
* @param array $massAction
*
* @param bool $specialPermission
*
* @return void
*/
public function addMassAction($massAction)
public function addMassAction($massAction, $specialPermission = false)
{
$massAction['route'] = $this->getRouteNameFromUrl($massAction['action'], $massAction['method']);
@ -347,7 +355,7 @@ abstract class DataGrid
$eventName = null;
}
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null)) {
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null) || $specialPermission) {
$this->fireEvent('mass.action.before.' . $eventName);
$this->massActions[] = $massAction;