Merged
This commit is contained in:
commit
cdc9c14e71
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
|
||||
|
||||
class OrderDataGrid extends DataGrid
|
||||
{
|
||||
use ProvideDataGridPlus;
|
||||
|
||||
protected $index = 'id';
|
||||
|
||||
protected $sortOrder = 'desc';
|
||||
|
|
@ -15,15 +18,15 @@ class OrderDataGrid extends DataGrid
|
|||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('orders')
|
||||
->leftJoin('addresses as order_address_shipping', function($leftJoin) {
|
||||
->leftJoin('addresses as order_address_shipping', function ($leftJoin) {
|
||||
$leftJoin->on('order_address_shipping.order_id', '=', 'orders.id')
|
||||
->where('order_address_shipping.address_type', OrderAddress::ADDRESS_TYPE_SHIPPING);
|
||||
->where('order_address_shipping.address_type', OrderAddress::ADDRESS_TYPE_SHIPPING);
|
||||
})
|
||||
->leftJoin('addresses as order_address_billing', function($leftJoin) {
|
||||
->leftJoin('addresses as order_address_billing', function ($leftJoin) {
|
||||
$leftJoin->on('order_address_billing.order_id', '=', 'orders.id')
|
||||
->where('order_address_billing.address_type', OrderAddress::ADDRESS_TYPE_BILLING);
|
||||
->where('order_address_billing.address_type', OrderAddress::ADDRESS_TYPE_BILLING);
|
||||
})
|
||||
->addSelect('orders.id','orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status')
|
||||
->addSelect('orders.id', 'orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status')
|
||||
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to'))
|
||||
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name) as shipped_to'));
|
||||
|
||||
|
|
@ -92,19 +95,19 @@ class OrderDataGrid extends DataGrid
|
|||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if ($value->status == 'processing') {
|
||||
return '<span class="badge badge-md badge-success">'. trans('admin::app.sales.orders.order-status-processing') .'</span>';
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>';
|
||||
} elseif ($value->status == 'completed') {
|
||||
return '<span class="badge badge-md badge-success">'. trans('admin::app.sales.orders.order-status-success') .'</span>';
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-success') . '</span>';
|
||||
} elseif ($value->status == "canceled") {
|
||||
return '<span class="badge badge-md badge-danger">'. trans('admin::app.sales.orders.order-status-canceled') .'</span>';
|
||||
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-canceled') . '</span>';
|
||||
} elseif ($value->status == "closed") {
|
||||
return '<span class="badge badge-md badge-info">'. trans('admin::app.sales.orders.order-status-closed') .'</span>';
|
||||
return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.orders.order-status-closed') . '</span>';
|
||||
} elseif ($value->status == "pending") {
|
||||
return '<span class="badge badge-md badge-warning">'. trans('admin::app.sales.orders.order-status-pending') .'</span>';
|
||||
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending') . '</span>';
|
||||
} elseif ($value->status == "pending_payment") {
|
||||
return '<span class="badge badge-md badge-warning">'. trans('admin::app.sales.orders.order-status-pending-payment') .'</span>';
|
||||
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending-payment') . '</span>';
|
||||
} elseif ($value->status == "fraud") {
|
||||
return '<span class="badge badge-md badge-danger">'. trans('admin::app.sales.orders.order-status-fraud') . '</span>';
|
||||
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-fraud') . '</span>';
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
@ -137,4 +140,4 @@ class OrderDataGrid extends DataGrid
|
|||
'icon' => 'icon eye-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Admin\Http\Controllers\Sales;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Admin\DataGrids\OrderDataGrid;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\Sales\Repositories\OrderRepository;
|
||||
use \Webkul\Sales\Repositories\OrderCommentRepository;
|
||||
|
|
@ -58,6 +59,10 @@ class OrderController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->ajax()) {
|
||||
return app(OrderDataGrid::class)->toJson();
|
||||
}
|
||||
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('orderGrid', 'Webkul\Admin\DataGrids\OrderDataGrid')
|
||||
{!! $orderGrid->render() !!}
|
||||
<datagrid-plus src="{{ route('admin.sales.orders.index') }}"></datagrid-plus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -37,5 +36,5 @@
|
|||
@stop
|
||||
|
||||
@push('scripts')
|
||||
@include('admin::export.export', ['gridName' => $orderGrid])
|
||||
@include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\OrderDataGrid')])
|
||||
@endpush
|
||||
|
|
@ -1,3 +1 @@
|
|||
/node_modules
|
||||
/package-lock.json
|
||||
npm-debug.log
|
||||
/node_modules
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=a887a8daeff9f1080151",
|
||||
"/js/ui.js": "/js/ui.js?id=928bc19bf654fa8ff6ee",
|
||||
"/css/ui.css": "/css/ui.css?id=6d93a4a052e38d6aa795"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,13 @@
|
|||
namespace Webkul\Ui\DataGrid;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Ui\DataGrid\Traits\ProvideBouncer;
|
||||
use Webkul\Ui\DataGrid\Traits\ProvideCollection;
|
||||
|
||||
abstract class DataGrid
|
||||
{
|
||||
use ProvideBouncer, ProvideCollection;
|
||||
|
||||
/**
|
||||
* Set index columns, ex: id.
|
||||
*
|
||||
|
|
@ -54,9 +58,9 @@ abstract class DataGrid
|
|||
* Hold query builder instance of the query prepared by executing datagrid
|
||||
* class method `setQueryBuilder`.
|
||||
*
|
||||
* @var array
|
||||
* @var object
|
||||
*/
|
||||
protected $queryBuilder = [];
|
||||
protected $queryBuilder;
|
||||
|
||||
/**
|
||||
* Final result of the datagrid program that is collection object.
|
||||
|
|
@ -186,10 +190,6 @@ abstract class DataGrid
|
|||
*/
|
||||
protected $currentUser;
|
||||
|
||||
abstract public function prepareQueryBuilder();
|
||||
|
||||
abstract public function addColumns();
|
||||
|
||||
/**
|
||||
* Create datagrid instance.
|
||||
*
|
||||
|
|
@ -203,48 +203,20 @@ abstract class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse the URL and get it ready to be used.
|
||||
*
|
||||
* @return void
|
||||
* Abstract method.
|
||||
*/
|
||||
private function parseUrl()
|
||||
{
|
||||
$parsedUrl = [];
|
||||
$unparsed = url()->full();
|
||||
abstract public function prepareQueryBuilder();
|
||||
|
||||
$route = request()->route() ? request()->route()->getName() : '';
|
||||
|
||||
if ($route == 'admin.datagrid.export') {
|
||||
$unparsed = url()->previous();
|
||||
}
|
||||
|
||||
$getParametersArr = explode('?', $unparsed);
|
||||
if (count($getParametersArr) > 1) {
|
||||
$to_be_parsed = $getParametersArr[1];
|
||||
$to_be_parsed = urldecode($to_be_parsed);
|
||||
|
||||
parse_str($to_be_parsed, $parsedUrl);
|
||||
unset($parsedUrl['page']);
|
||||
}
|
||||
|
||||
if (isset($parsedUrl['grand_total'])) {
|
||||
foreach ($parsedUrl['grand_total'] as $key => $value) {
|
||||
$parsedUrl['grand_total'][$key] = str_replace(',', '.', $parsedUrl['grand_total'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->itemsPerPage = isset($parsedUrl['perPage']) ? $parsedUrl['perPage']['eq'] : $this->itemsPerPage;
|
||||
|
||||
unset($parsedUrl['perPage']);
|
||||
|
||||
return $parsedUrl;
|
||||
}
|
||||
/**
|
||||
* Abstract method.
|
||||
*/
|
||||
abstract public function addColumns();
|
||||
|
||||
/**
|
||||
* Add the index as alias of the column and use the column to make things happen.
|
||||
*
|
||||
* @param string $alias
|
||||
* @param string $column
|
||||
* @param string $alias
|
||||
* @param string $column
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -258,7 +230,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Add column.
|
||||
*
|
||||
* @param string $column
|
||||
* @param string $column
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -276,7 +248,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Set complete column details.
|
||||
*
|
||||
* @param string $column
|
||||
* @param string $column
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -288,7 +260,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Set query builder.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $queryBuilder
|
||||
* @param \Illuminate\Database\Query\Builder $queryBuilder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -302,32 +274,20 @@ abstract class DataGrid
|
|||
* parameters is their. If needs to give an access just pass true
|
||||
* in second param.
|
||||
*
|
||||
* @param array $action
|
||||
*
|
||||
* @param bool $specialPermission
|
||||
*
|
||||
* @param array $action
|
||||
* @param bool $specialPermission
|
||||
* @return void
|
||||
*/
|
||||
public function addAction($action, $specialPermission = false)
|
||||
{
|
||||
$currentRouteACL = $this->fetchCurrentRouteACL($action);
|
||||
|
||||
if (isset($action['title'])) {
|
||||
$eventName = strtolower($action['title']);
|
||||
$eventName = explode(' ', $eventName);
|
||||
$eventName = implode('.', $eventName);
|
||||
} else {
|
||||
$eventName = null;
|
||||
}
|
||||
|
||||
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null) || $specialPermission) {
|
||||
$this->checkPermissions($action, $specialPermission, function ($action, $eventName) {
|
||||
$this->fireEvent('action.before.' . $eventName);
|
||||
|
||||
array_push($this->actions, $action);
|
||||
$this->actions[] = $action;
|
||||
$this->enableAction = true;
|
||||
|
||||
$this->fireEvent('action.after.' . $eventName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -335,392 +295,22 @@ abstract class DataGrid
|
|||
* parameters is their. If needs to give an access just pass true
|
||||
* in second param.
|
||||
*
|
||||
* @param array $massAction
|
||||
*
|
||||
* @param bool $specialPermission
|
||||
*
|
||||
* @param array $massAction
|
||||
* @param bool $specialPermission
|
||||
* @return void
|
||||
*/
|
||||
public function addMassAction($massAction, $specialPermission = false)
|
||||
{
|
||||
$massAction['route'] = $this->getRouteNameFromUrl($massAction['action'], $massAction['method']);
|
||||
|
||||
$currentRouteACL = $this->fetchCurrentRouteACL($massAction);
|
||||
|
||||
if (isset($massAction['label'])) {
|
||||
$eventName = strtolower($massAction['label']);
|
||||
$eventName = explode(' ', $eventName);
|
||||
$eventName = implode('.', $eventName);
|
||||
} else {
|
||||
$eventName = null;
|
||||
}
|
||||
|
||||
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null) || $specialPermission) {
|
||||
$this->checkPermissions($massAction, $specialPermission, function ($action, $eventName) {
|
||||
$this->fireEvent('mass.action.before.' . $eventName);
|
||||
|
||||
$this->massActions[] = $massAction;
|
||||
$this->massActions[] = $action;
|
||||
$this->enableMassAction = true;
|
||||
|
||||
$this->fireEvent('mass.action.after.' . $eventName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get collections.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getCollection()
|
||||
{
|
||||
$parsedUrl = $this->parseUrl();
|
||||
|
||||
foreach ($parsedUrl as $key => $value) {
|
||||
if ($key === 'locale') {
|
||||
if (! is_array($value)) {
|
||||
unset($parsedUrl[$key]);
|
||||
}
|
||||
} elseif (! is_array($value)) {
|
||||
unset($parsedUrl[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($parsedUrl)) {
|
||||
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder,
|
||||
$parsedUrl);
|
||||
|
||||
if ($this->paginate) {
|
||||
if ($this->itemsPerPage > 0) {
|
||||
return $filteredOrSortedCollection->orderBy($this->index,
|
||||
$this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
|
||||
}
|
||||
} else {
|
||||
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->get();
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->paginate) {
|
||||
if ($this->itemsPerPage > 0) {
|
||||
$this->collection = $this->queryBuilder->orderBy($this->index,
|
||||
$this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
|
||||
}
|
||||
} else {
|
||||
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->get();
|
||||
}
|
||||
|
||||
return $this->collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* To find the alias of the column and by taking the column name.
|
||||
*
|
||||
* @param array $columnAlias
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findColumnType($columnAlias)
|
||||
{
|
||||
foreach ($this->completeColumnDetails as $column) {
|
||||
if ($column['index'] == $columnAlias) {
|
||||
return [$column['type'], $column['index']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort or filter collection.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param array $parseInfo
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function sortOrFilterCollection($collection, $parseInfo)
|
||||
{
|
||||
foreach ($parseInfo as $key => $info) {
|
||||
$columnType = $this->findColumnType($key)[0] ?? null;
|
||||
$columnName = $this->findColumnType($key)[1] ?? null;
|
||||
|
||||
if ($key === 'sort') {
|
||||
$count_keys = count(array_keys($info));
|
||||
|
||||
if ($count_keys > 1) {
|
||||
throw new \Exception('Fatal Error! Multiple Sort keys Found, Please Resolve the URL Manually');
|
||||
}
|
||||
|
||||
$columnName = $this->findColumnType(array_keys($info)[0]);
|
||||
|
||||
$collection->orderBy(
|
||||
$columnName[1],
|
||||
array_values($info)[0]
|
||||
);
|
||||
} elseif ($key === 'search') {
|
||||
$count_keys = count(array_keys($info));
|
||||
|
||||
if ($count_keys > 1) {
|
||||
throw new \Exception('Multiple Search keys Found, Please Resolve the URL Manually');
|
||||
}
|
||||
|
||||
if ($count_keys == 1) {
|
||||
$collection->where(function ($collection) use ($info) {
|
||||
foreach ($this->completeColumnDetails as $column) {
|
||||
if ($column['searchable'] == true) {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$column['index']])) {
|
||||
$collection->orWhere($this->filterMap[$column['index']], 'like',
|
||||
'%' . $info['all'] . '%');
|
||||
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$column['index']])) {
|
||||
$collection->orWhere($column['index'], 'like', '%' . $info['all'] . '%');
|
||||
} else {
|
||||
$collection->orWhere($column['index'], 'like', '%' . $info['all'] . '%');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
foreach ($this->completeColumnDetails as $column) {
|
||||
if ($column['index'] === $columnName && ! $column['filterable']) {
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_keys($info)[0] === 'like' || array_keys($info)[0] === 'nlike') {
|
||||
foreach ($info as $condition => $filter_value) {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
$collection->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
'%' . $filter_value . '%'
|
||||
);
|
||||
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
|
||||
$collection->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
'%' . $filter_value . '%'
|
||||
);
|
||||
} else {
|
||||
$collection->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
'%' . $filter_value . '%'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($info as $condition => $filter_value) {
|
||||
|
||||
if ($condition === 'undefined') {
|
||||
$condition = '=';
|
||||
}
|
||||
|
||||
if ($columnType === 'datetime') {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
$collection->whereDate(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
|
||||
$collection->whereDate(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
} else {
|
||||
$collection->whereDate(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
}
|
||||
} elseif ($columnType === 'boolean') {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
if ($this->operators[$condition] == '=') {
|
||||
if ($filter_value == 1) {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNotNull($this->filterMap[$columnName]);
|
||||
});
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNull($this->filterMap[$columnName]);
|
||||
});
|
||||
}
|
||||
} elseif ($this->operators[$condition] == '<>') {
|
||||
if ($filter_value == 1) {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNull($this->filterMap[$columnName]);
|
||||
});
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNotNull($this->filterMap[$columnName]);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
});
|
||||
}
|
||||
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
|
||||
if ($this->operators[$condition] == '=') {
|
||||
if ($filter_value == 1) {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNotNull($this->filterMap[$columnName]);
|
||||
});
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNull($this->filterMap[$columnName]);
|
||||
});
|
||||
}
|
||||
} elseif ($this->operators[$condition] == '<>') {
|
||||
if ($filter_value == 1) {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNull($this->filterMap[$columnName]);
|
||||
});
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNotNull($this->filterMap[$columnName]);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if ($this->operators[$condition] == '=') {
|
||||
if ($filter_value == 1) {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNotNull($this->filterMap[$columnName]);
|
||||
});
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNull($this->filterMap[$columnName]);
|
||||
});
|
||||
}
|
||||
} elseif ($this->operators[$condition] == '<>') {
|
||||
if ($filter_value == 1) {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNull($this->filterMap[$columnName]);
|
||||
});
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
)->orWhereNotNull($this->filterMap[$columnName]);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
|
||||
$query->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
$collection->where(
|
||||
$this->filterMap[$columnName],
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
|
||||
$collection->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
} else {
|
||||
$collection->where(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filter_value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger event.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function fireEvent($name)
|
||||
{
|
||||
if (isset($name)) {
|
||||
$className = get_class($this->invoker);
|
||||
|
||||
$className = last(explode('\\', $className));
|
||||
|
||||
$className = strtolower($className);
|
||||
|
||||
$eventName = $className . '.' . $name;
|
||||
|
||||
Event::dispatch($eventName, $this->invoker);
|
||||
}
|
||||
}, 'label');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -756,30 +346,7 @@ abstract class DataGrid
|
|||
|
||||
$this->prepareQueryBuilder();
|
||||
|
||||
$necessaryExtraFilters = [];
|
||||
if (in_array('channels', $this->extraFilters)) {
|
||||
$necessaryExtraFilters['channels'] = core()->getAllChannels();
|
||||
}
|
||||
if (in_array('locales', $this->extraFilters)) {
|
||||
$necessaryExtraFilters['locales'] = core()->getAllLocales();
|
||||
}
|
||||
if (in_array('customer_groups', $this->extraFilters)) {
|
||||
$necessaryExtraFilters['customer_groups'] = core()->getAllCustomerGroups();
|
||||
}
|
||||
|
||||
return view('ui::datagrid.table')->with('results', [
|
||||
'records' => $this->getCollection(),
|
||||
'columns' => $this->completeColumnDetails,
|
||||
'actions' => $this->actions,
|
||||
'massactions' => $this->massActions,
|
||||
'index' => $this->index,
|
||||
'enableMassActions' => $this->enableMassAction,
|
||||
'enableActions' => $this->enableAction,
|
||||
'paginated' => $this->paginate,
|
||||
'itemsPerPage' => $this->itemsPerPage,
|
||||
'norecords' => __('ui::app.datagrid.no-records'),
|
||||
'extraFilters' => $necessaryExtraFilters
|
||||
]);
|
||||
return view('ui::datagrid.table')->with('results', $this->prepareViewData());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -803,30 +370,69 @@ abstract class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetch current route acl. As no access to acl key, this will fetch acl by route name.
|
||||
*
|
||||
* @param $action
|
||||
* Prepare view data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function fetchCurrentRouteACL($action)
|
||||
public function prepareViewData()
|
||||
{
|
||||
return collect(config('acl'))->filter(function ($acl) use ($action) {
|
||||
return $acl['route'] === $action['route'];
|
||||
})->first();
|
||||
return [
|
||||
'index' => $this->index,
|
||||
'records' => $this->getCollection(),
|
||||
'columns' => $this->completeColumnDetails,
|
||||
'actions' => $this->actions,
|
||||
'enableActions' => $this->enableAction,
|
||||
'massactions' => $this->massActions,
|
||||
'enableMassActions' => $this->enableMassAction,
|
||||
'paginated' => $this->paginate,
|
||||
'itemsPerPage' => $this->itemsPerPage,
|
||||
'norecords' => __('ui::app.datagrid.no-records'),
|
||||
'extraFilters' => $this->getNecessaryExtraFilters()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch route name from full url, not the current one.
|
||||
* Trigger event.
|
||||
*
|
||||
* @param $action
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
protected function fireEvent($name)
|
||||
{
|
||||
if (isset($name)) {
|
||||
$className = get_class($this->invoker);
|
||||
|
||||
$className = last(explode('\\', $className));
|
||||
|
||||
$className = strtolower($className);
|
||||
|
||||
$eventName = $className . '.' . $name;
|
||||
|
||||
Event::dispatch($eventName, $this->invoker);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get necessary extra details.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getRouteNameFromUrl($action, $method)
|
||||
protected function getNecessaryExtraFilters()
|
||||
{
|
||||
return app('router')->getRoutes()
|
||||
->match(app('request')->create(str_replace(url('/'), '', $action), $method))
|
||||
->getName();
|
||||
$necessaryExtraFilters = [];
|
||||
|
||||
$checks = [
|
||||
'channels' => core()->getAllChannels(),
|
||||
'locales' => core()->getAllLocales(),
|
||||
'customer_groups' => core()->getAllCustomerGroups()
|
||||
];
|
||||
|
||||
foreach ($checks as $key => $val) {
|
||||
if (in_array($key, $this->extraFilters)) {
|
||||
$necessaryExtraFilters[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $necessaryExtraFilters;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui\DataGrid\Traits;
|
||||
|
||||
trait ProvideBouncer
|
||||
{
|
||||
use ProvideRouteResolver;
|
||||
|
||||
/**
|
||||
* Check permissions.
|
||||
*
|
||||
* @param array $action
|
||||
* @param bool $specialPermission
|
||||
* @param \Closure $operation
|
||||
* @return void
|
||||
*/
|
||||
private function checkPermissions($action, $specialPermission, $operation, $nameKey = 'title')
|
||||
{
|
||||
$currentRouteACL = $this->fetchCurrentRouteACL($action);
|
||||
|
||||
$eventName = isset($action[$nameKey]) ? $this->generateEventName($action[$nameKey]) : null;
|
||||
|
||||
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null) || $specialPermission) {
|
||||
$operation($action, $eventName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate event name.
|
||||
*
|
||||
* @param string $titleOrLabel
|
||||
* @return string
|
||||
*/
|
||||
private function generateEventName($titleOrLabel)
|
||||
{
|
||||
$eventName = explode(' ', strtolower($titleOrLabel));
|
||||
return implode('.', $eventName);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,290 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui\DataGrid\Traits;
|
||||
|
||||
trait ProvideCollection
|
||||
{
|
||||
use ProvideQueryResolver, ProvideQueryStringParser;
|
||||
|
||||
/**
|
||||
* Get collections.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getCollection()
|
||||
{
|
||||
$queryStrings = $this->getQueryStrings();
|
||||
|
||||
if (count($queryStrings)) {
|
||||
$filteredOrSortedCollection = $this->sortOrFilterCollection(
|
||||
$this->queryBuilder,
|
||||
$queryStrings
|
||||
);
|
||||
|
||||
return $this->collection = $this->generateResults($filteredOrSortedCollection);
|
||||
}
|
||||
|
||||
return $this->collection = $this->generateResults($this->queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort or filter collection.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param array $parseInfo
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function sortOrFilterCollection($collection, $parseInfo)
|
||||
{
|
||||
foreach ($parseInfo as $key => $info) {
|
||||
$columnType = $this->findColumnType($key)[0] ?? null;
|
||||
$columnName = $this->findColumnType($key)[1] ?? null;
|
||||
|
||||
if ($key === 'sort') {
|
||||
$this->sortCollection($collection, $info);
|
||||
} else if ($key === 'search') {
|
||||
$this->searchCollection($collection, $info);
|
||||
} else {
|
||||
if ($this->exceptionCheckInColumns($columnName)) {
|
||||
return $collection;
|
||||
}
|
||||
|
||||
$this->filterCollection($collection, $info, $columnType, $columnName);
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalyze your collection here.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function formatCollection()
|
||||
{
|
||||
$this->collection->transform(function ($record) {
|
||||
$this->transformActions($record);
|
||||
|
||||
$this->transformColumns($record);
|
||||
|
||||
return $record;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* To find the alias of the column and by taking the column name.
|
||||
*
|
||||
* @param array $columnAlias
|
||||
* @return array
|
||||
*/
|
||||
public function findColumnType($columnAlias)
|
||||
{
|
||||
foreach ($this->completeColumnDetails as $column) {
|
||||
if ($column['index'] == $columnAlias) {
|
||||
return [$column['type'], $column['index']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate full results.
|
||||
*
|
||||
* @param object $queryBuilderOrCollection
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
private function generateResults($queryBuilderOrCollection)
|
||||
{
|
||||
if ($this->paginate) {
|
||||
if ($this->itemsPerPage > 0) {
|
||||
return $this->paginatedResults($queryBuilderOrCollection);
|
||||
}
|
||||
} else {
|
||||
return $this->defaultResults($queryBuilderOrCollection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate paginated results.
|
||||
*
|
||||
* @param object $queryBuilderOrCollection
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
private function paginatedResults($queryBuilderOrCollection)
|
||||
{
|
||||
return $queryBuilderOrCollection->orderBy(
|
||||
$this->index,
|
||||
$this->sortOrder
|
||||
)->paginate($this->itemsPerPage)->appends(request()->except('page'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate default results.
|
||||
*
|
||||
* @param object $queryBuilderOrCollection
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
private function defaultResults($queryBuilderOrCollection)
|
||||
{
|
||||
return $queryBuilderOrCollection->orderBy($this->index, $this->sortOrder)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort collection.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param array $info
|
||||
* @return void
|
||||
*/
|
||||
private function sortCollection($collection, $info)
|
||||
{
|
||||
$countKeys = count(array_keys($info));
|
||||
|
||||
if ($countKeys > 1) {
|
||||
throw new \Exception(__('ui::app.datagrid.error.multiple-sort-keys-error'));
|
||||
}
|
||||
|
||||
$columnName = $this->findColumnType(array_keys($info)[0]);
|
||||
|
||||
$collection->orderBy(
|
||||
$columnName[1],
|
||||
array_values($info)[0]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search collection.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param array $info
|
||||
* @return void
|
||||
*/
|
||||
private function searchCollection($collection, $info)
|
||||
{
|
||||
$countKeys = count(array_keys($info));
|
||||
|
||||
if ($countKeys > 1) {
|
||||
throw new \Exception(__('ui::app.datagrid.error.multiple-search-keys-error'));
|
||||
}
|
||||
|
||||
if ($countKeys == 1) {
|
||||
$collection->where(function ($collection) use ($info) {
|
||||
foreach ($this->completeColumnDetails as $column) {
|
||||
if ($column['searchable'] == true) {
|
||||
$this->resolve($collection, $column['index'], 'like', '%' . $info['all'] . '%', 'orWhere');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter collection.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param array $info
|
||||
* @param string $columnType
|
||||
* @param string $columnName
|
||||
* @return void
|
||||
*/
|
||||
private function filterCollection($collection, $info, $columnType, $columnName)
|
||||
{
|
||||
if (array_keys($info)[0] === 'like' || array_keys($info)[0] === 'nlike') {
|
||||
foreach ($info as $condition => $filterValue) {
|
||||
$this->resolve($collection, $columnName, $condition, '%' . $filterValue . '%');
|
||||
}
|
||||
} else {
|
||||
foreach ($info as $condition => $filterValue) {
|
||||
|
||||
$condition = ($condition === 'undefined') ? '=' : $condition;
|
||||
|
||||
if ($columnType === 'datetime') {
|
||||
$this->resolve($collection, $columnName, $condition, $filterValue, 'whereDate');
|
||||
} else if ($columnType === 'boolean') {
|
||||
$this->resolve($collection, $columnName, $condition, $filterValue, 'where', 'resolveBooleanQuery');
|
||||
} else {
|
||||
$this->resolve($collection, $columnName, $condition, $filterValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform your columns.
|
||||
*
|
||||
* @parma object $record
|
||||
* @return void
|
||||
*/
|
||||
private function transformColumns($record)
|
||||
{
|
||||
foreach($this->columns as $column) {
|
||||
if (isset($column['wrapper'])) {
|
||||
if (isset($column['closure']) && $column['closure'] == true) {
|
||||
$record->{$column['index']} = $column['wrapper']($record);
|
||||
} else {
|
||||
$record->{$column['index']} = htmlspecialchars($column['wrapper']($record));
|
||||
}
|
||||
} else {
|
||||
if ($column['type'] == 'price') {
|
||||
if (isset($column['currencyCode'])) {
|
||||
$record->{$column['index']} = htmlspecialchars(core()->formatPrice($record->{$column['index']}, $column['currencyCode']));
|
||||
} else {
|
||||
$record->{$column['index']} = htmlspecialchars(core()->formatBasePrice($record->{$column['index']}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform your actions.
|
||||
*
|
||||
* @parma object $record
|
||||
* @return void
|
||||
*/
|
||||
private function transformActions($record)
|
||||
{
|
||||
foreach($this->actions as $action) {
|
||||
$toDisplay = (isset($action['condition']) && gettype($action['condition']) == 'object') ? $action['condition']($record) : true;
|
||||
|
||||
$toDisplayKey = $this->generateKeyFromActionTitle($action['title'], '_to_display');
|
||||
$record->$toDisplayKey = $toDisplay;
|
||||
|
||||
if ($toDisplay) {
|
||||
$urlKey = $this->generateKeyFromActionTitle($action['title'], '_url');
|
||||
$record->$urlKey = route($action['route'], $record->{$action['index'] ?? $this->index});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some exceptions check in column details.
|
||||
*
|
||||
* @param string $columnName
|
||||
* @return bool
|
||||
*/
|
||||
private function exceptionCheckInColumns($columnName)
|
||||
{
|
||||
foreach ($this->completeColumnDetails as $column) {
|
||||
if ($column['index'] === $columnName && ! $column['filterable']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate unique key from title.
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $suffix
|
||||
* @return string
|
||||
*/
|
||||
private function generateKeyFromActionTitle($title, $suffix)
|
||||
{
|
||||
$validatedStrings = preg_replace('/[^A-Za-z0-9]+/', '_', $title);
|
||||
|
||||
return strtolower($validatedStrings) . $suffix;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui\DataGrid\Traits;
|
||||
|
||||
trait ProvideDataGridPlus
|
||||
{
|
||||
/**
|
||||
* Get json data.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function toJson()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$this->prepareActions();
|
||||
|
||||
$this->prepareMassActions();
|
||||
|
||||
$this->prepareQueryBuilder();
|
||||
|
||||
$this->getCollection();
|
||||
|
||||
$this->formatCollection();
|
||||
|
||||
return response()->json($this->prepareData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare data for json response.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function prepareData()
|
||||
{
|
||||
return [
|
||||
'index' => $this->index,
|
||||
'records' => $this->collection,
|
||||
'columns' => $this->completeColumnDetails,
|
||||
'actions' => $this->actions,
|
||||
'enableActions' => $this->enableAction,
|
||||
'massActions' => $this->massActions,
|
||||
'enableMassActions' => $this->enableMassAction,
|
||||
'paginated' => $this->paginate,
|
||||
'itemsPerPage' => $this->itemsPerPage,
|
||||
'extraFilters' => $this->getExtraFilters(),
|
||||
'translations' => $this->getTranslations(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extra filters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getExtraFilters()
|
||||
{
|
||||
$necessaryExtraFilters = [
|
||||
'current' => $this->getCurrentExtraFilterValue()
|
||||
];
|
||||
|
||||
$checks = [
|
||||
'channels' => core()->getAllChannels(),
|
||||
'locales' => $necessaryExtraFilters['current']['locales'],
|
||||
'customer_groups' => core()->getAllCustomerGroups()
|
||||
];
|
||||
|
||||
foreach ($checks as $key => $val) {
|
||||
if (in_array($key, $this->extraFilters)) {
|
||||
$necessaryExtraFilters[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $necessaryExtraFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current extra filter values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCurrentExtraFilterValue()
|
||||
{
|
||||
/* all locales */
|
||||
$locales = core()->getAllLocales();
|
||||
|
||||
/* request and fallback handling */
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
|
||||
$customer_group = request()->get('customer_group');
|
||||
|
||||
/* handling cases for new locale if not present in current channel */
|
||||
if ($channel !== 'all') {
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if ($channelLocales->contains('code', $locale)) {
|
||||
$locales = $channelLocales;
|
||||
} else {
|
||||
$channel = 'all';
|
||||
}
|
||||
}
|
||||
|
||||
/* current values */
|
||||
return [
|
||||
'locales' => $locales,
|
||||
'locale' => $locale,
|
||||
'channel' => $channel,
|
||||
'customer_group' => $customer_group
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all translations for json response fully controlled by backend.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTranslations()
|
||||
{
|
||||
return [
|
||||
'allChannels' => __('admin::app.admin.system.all-channels'),
|
||||
'allLocales' => __('admin::app.admin.system.all-locales'),
|
||||
'allCustomerGroups' => __('admin::app.admin.system.all-customer-groups'),
|
||||
'search' => __('ui::app.datagrid.search'),
|
||||
'itemsPerPage' => __('ui::app.datagrid.items-per-page'),
|
||||
'filter' => __('ui::app.datagrid.filter'),
|
||||
'column' => __('ui::app.datagrid.column'),
|
||||
'condition' => __('ui::app.datagrid.condition'),
|
||||
'contains' => __('ui::app.datagrid.contains'),
|
||||
'ncontains' => __('ui::app.datagrid.ncontains'),
|
||||
'equals' => __('ui::app.datagrid.equals'),
|
||||
'nequals' => __('ui::app.datagrid.nequals'),
|
||||
'greater' => __('ui::app.datagrid.greater'),
|
||||
'less' => __('ui::app.datagrid.less'),
|
||||
'greatere' => __('ui::app.datagrid.greatere'),
|
||||
'lesse' => __('ui::app.datagrid.lesse'),
|
||||
'true' => __('ui::app.datagrid.true'),
|
||||
'false' => __('ui::app.datagrid.false'),
|
||||
'value' => __('ui::app.datagrid.value'),
|
||||
'valueHere' => __('ui::app.datagrid.value-here'),
|
||||
'numericValueHere' => __('ui::app.datagrid.numeric-value-here'),
|
||||
'apply' => __('ui::app.datagrid.apply'),
|
||||
'submit' => __('ui::app.datagrid.submit'),
|
||||
'actions' => __('ui::app.datagrid.actions'),
|
||||
'filterFieldsMissing' => __('ui::app.datagrid.filter-fields-missing'),
|
||||
'zeroIndex' => __('ui::app.datagrid.zero-index'),
|
||||
'clickOnAction' => __('ui::app.datagrid.click_on_action'),
|
||||
'norecords' => __('ui::app.datagrid.no-records'),
|
||||
'massActionDelete' => __('ui::app.datagrid.massaction.delete'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui\DataGrid\Traits;
|
||||
|
||||
trait ProvideQueryResolver
|
||||
{
|
||||
/**
|
||||
* Main resolve method.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param string $columnName
|
||||
* @param string $condition
|
||||
* @param string $filterValue
|
||||
* @param string $clause
|
||||
* @param string $method
|
||||
* @return void
|
||||
*/
|
||||
private function resolve($collection, $columnName, $condition, $filterValue, $clause = 'where', $method = 'resolveQuery')
|
||||
{
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
$this->$method($collection, $this->filterMap[$columnName], $condition, $filterValue, $clause);
|
||||
} else if ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
|
||||
$this->$method($collection, $columnName, $condition, $filterValue, $clause);
|
||||
} else {
|
||||
$this->$method($collection, $columnName, $condition, $filterValue, $clause);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve query.
|
||||
*
|
||||
* @param object $query
|
||||
* @param string $columnName
|
||||
* @param string $condition
|
||||
* @param string $filterValue
|
||||
* @param null|boolean $nullCheck
|
||||
* @return void
|
||||
*/
|
||||
private function resolveQuery($query, $columnName, $condition, $filterValue, $clause = 'where')
|
||||
{
|
||||
$query->$clause(
|
||||
$columnName,
|
||||
$this->operators[$condition],
|
||||
$filterValue
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve boolean query.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param string $columnName
|
||||
* @param string $condition
|
||||
* @param string $filterValue
|
||||
* @return void
|
||||
*/
|
||||
private function resolveBooleanQuery($collection, $columnName, $condition, $filterValue)
|
||||
{
|
||||
if ($this->operators[$condition] == '=') {
|
||||
$this->checkFilterValueCondition($collection, $columnName, $condition, $filterValue);
|
||||
} else if ($this->operators[$condition] == '<>') {
|
||||
$this->checkFilterValueCondition($collection, $columnName, $condition, $filterValue, true);
|
||||
} else {
|
||||
$this->resolveFilterQuery($collection, $columnName, $condition, $filterValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve filter query.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param string $columnName
|
||||
* @param string $condition
|
||||
* @param string $filterValue
|
||||
* @param null|boolean $nullCheck
|
||||
* @return void
|
||||
*/
|
||||
private function resolveFilterQuery($collection, $columnName, $condition, $filterValue, $nullCheck = null)
|
||||
{
|
||||
$clause = is_null($nullCheck) ? null : ( $nullCheck ? 'orWhereNull' : 'whereNotNull' );
|
||||
|
||||
$collection->where(function ($query) use ($columnName, $condition, $filterValue, $clause) {
|
||||
$this->resolveQuery($query, $columnName, $condition, $filterValue);
|
||||
|
||||
if (! is_null($clause)) {
|
||||
$query->$clause($columnName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check filter value condition.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @param string $columnName
|
||||
* @param string $condition
|
||||
* @param string $filterValue
|
||||
* @param bool $nullCheck
|
||||
* @return void
|
||||
*/
|
||||
private function checkFilterValueCondition($collection, $columnName, $condition, $filterValue, $nullCheck = false)
|
||||
{
|
||||
$filterValue == 1
|
||||
? $this->resolveFilterQuery($collection, $columnName, $condition, $filterValue, $nullCheck)
|
||||
: $this->resolveFilterQuery($collection, $columnName, $condition, $filterValue, ! $nullCheck);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui\DataGrid\Traits;
|
||||
|
||||
trait ProvideQueryStringParser
|
||||
{
|
||||
/**
|
||||
* Parse the query strings and get it ready to be used.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getQueryStrings()
|
||||
{
|
||||
$route = request()->route() ? request()->route()->getName() : '';
|
||||
|
||||
$queryString = $this->grabQueryStrings($route == 'admin.datagrid.export' ? url()->previous() : url()->full());
|
||||
|
||||
$parsedQueryStrings = $this->parseQueryStrings($queryString);
|
||||
|
||||
$this->itemsPerPage = isset($parsedQueryStrings['perPage']) ? $parsedQueryStrings['perPage']['eq'] : $this->itemsPerPage;
|
||||
|
||||
unset($parsedQueryStrings['perPage']);
|
||||
|
||||
return $this->updateQueryStrings($parsedQueryStrings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab query strings from url.
|
||||
*
|
||||
* @param string $fullUrl
|
||||
* @return string
|
||||
*/
|
||||
private function grabQueryStrings($fullUrl)
|
||||
{
|
||||
return explode('?', $fullUrl)[1] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse query strings.
|
||||
*
|
||||
* @param string $queryString
|
||||
* @return array
|
||||
*/
|
||||
private function parseQueryStrings($queryString)
|
||||
{
|
||||
$parsedQueryStrings = [];
|
||||
|
||||
if ($queryString) {
|
||||
parse_str(urldecode($queryString), $parsedQueryStrings);
|
||||
|
||||
unset($parsedQueryStrings['page']);
|
||||
}
|
||||
|
||||
return $parsedQueryStrings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update query strings.
|
||||
*
|
||||
* @param array $parsedQueryStrings
|
||||
* @return array
|
||||
*/
|
||||
private function updateQueryStrings($parsedQueryStrings)
|
||||
{
|
||||
if (isset($parsedQueryStrings['grand_total'])) {
|
||||
foreach ($parsedQueryStrings['grand_total'] as $key => $value) {
|
||||
$parsedQueryStrings['grand_total'][$key] = str_replace(',', '.', $parsedQueryStrings['grand_total'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($parsedQueryStrings as $key => $value) {
|
||||
if (in_array($key, ['locale'])) {
|
||||
if (! is_array($value)) {
|
||||
unset($parsedQueryStrings[$key]);
|
||||
}
|
||||
} else if (! is_array($value)) {
|
||||
unset($parsedQueryStrings[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $parsedQueryStrings;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui\DataGrid\Traits;
|
||||
|
||||
trait ProvideRouteResolver
|
||||
{
|
||||
/**
|
||||
* Fetch current route acl. As no access to acl key, this will fetch acl by route name.
|
||||
*
|
||||
* @param $action
|
||||
* @return array
|
||||
*/
|
||||
private function fetchCurrentRouteACL($action)
|
||||
{
|
||||
return collect(config('acl'))->filter(function ($acl) use ($action) {
|
||||
return $acl['route'] === $action['route'];
|
||||
})->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch route name from full url, not the current one.
|
||||
*
|
||||
* @param $action
|
||||
* @return array
|
||||
*/
|
||||
private function getRouteNameFromUrl($action, $method)
|
||||
{
|
||||
return app('router')->getRoutes()
|
||||
->match(app('request')->create(str_replace(url('/'), '', $action), $method))
|
||||
->getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
Event::listen('attributedatagrid.before.add.column.id', function($dataGridInstance) {
|
||||
$data = [
|
||||
'index' => 'is_required',
|
||||
'label' => 'trans',
|
||||
'type' => 'boolean',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'wrapper' => function ($value) {
|
||||
if ($value->is_required == 1)
|
||||
return 'True';
|
||||
else
|
||||
return 'False';
|
||||
}
|
||||
];
|
||||
|
||||
$dataGridInstance->addColumn($data);
|
||||
});
|
||||
|
|
@ -3,8 +3,3 @@
|
|||
Route::view('/ui-kit', 'ui::partials.ui-kit');
|
||||
|
||||
Route::view('/helper-classess', 'ui::partials.helper-classes')->name('ui.helper.classes');
|
||||
|
||||
// Route::get('/users', function () {
|
||||
// $users = \Webkul\User\Models\Admin::paginate(1);
|
||||
// echo $users->links();
|
||||
// });
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Webkul\Ui\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class UiServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -25,7 +25,7 @@ class UiServiceProvider extends ServiceProvider
|
|||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'ui');
|
||||
|
||||
Paginator::defaultView('ui::partials.pagination');
|
||||
|
||||
|
||||
Paginator::defaultSimpleView('ui::partials.pagination');
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,79 +1,77 @@
|
|||
import { Multiselect } from 'vue-multiselect';
|
||||
import VTooltip from "v-tooltip";
|
||||
import { Multiselect } from "vue-multiselect";
|
||||
|
||||
import FlashWrapper from './components/flash-wrapper';
|
||||
import Flash from './components/flash';
|
||||
import Tabs from './components/tabs/tabs';
|
||||
import Tab from './components/tabs/tab';
|
||||
import Accordian from './components/accordian';
|
||||
import TreeView from './components/tree-view/tree-view';
|
||||
import TreeItem from './components/tree-view/tree-item';
|
||||
import TreeCheckbox from './components/tree-view/tree-checkbox';
|
||||
import TreeRadio from './components/tree-view/tree-radio';
|
||||
import Modal from './components/modal';
|
||||
import ImageUpload from './components/image/image-upload';
|
||||
import ImageWrapper from './components/image/image-wrapper';
|
||||
import ImageItem from './components/image/image-item';
|
||||
import Slugify from './directives/slugify';
|
||||
import SlugifyTarget from './directives/slugify-target';
|
||||
import Code from './directives/code';
|
||||
import Alert from './directives/alert';
|
||||
import DatetimeComponent from './components/datetime';
|
||||
import DateComponent from './components/date';
|
||||
import TimeComponent from './components/time';
|
||||
import SwatchPicker from './components/swatch-picker';
|
||||
import Debounce from './directives/debounce';
|
||||
import OverlayLoader from './components/overlay-loader';
|
||||
import VTooltip from 'v-tooltip';
|
||||
import Accordian from "./components/accordian";
|
||||
import DatagridPlus from "./components/datagrid/datagrid-plus";
|
||||
import DateComponent from "./components/date";
|
||||
import DatetimeComponent from "./components/datetime";
|
||||
import Flash from "./components/flash";
|
||||
import FlashWrapper from "./components/flash-wrapper";
|
||||
import ImageItem from "./components/image/image-item";
|
||||
import ImageUpload from "./components/image/image-upload";
|
||||
import ImageWrapper from "./components/image/image-wrapper";
|
||||
import Modal from "./components/modal";
|
||||
import OverlayLoader from "./components/overlay-loader";
|
||||
import SwatchPicker from "./components/swatch-picker";
|
||||
import Tab from "./components/tabs/tab";
|
||||
import Tabs from "./components/tabs/tabs";
|
||||
import TimeComponent from "./components/time";
|
||||
import TreeCheckbox from "./components/tree-view/tree-checkbox";
|
||||
import TreeItem from "./components/tree-view/tree-item";
|
||||
import TreeRadio from "./components/tree-view/tree-radio";
|
||||
import TreeView from "./components/tree-view/tree-view";
|
||||
import Alert from "./directives/alert";
|
||||
import Code from "./directives/code";
|
||||
import Debounce from "./directives/debounce";
|
||||
import Slugify from "./directives/slugify";
|
||||
import SlugifyTarget from "./directives/slugify-target";
|
||||
|
||||
/* config section */
|
||||
VTooltip.options.defaultDelay = 0;
|
||||
|
||||
Vue.directive('tooltip', VTooltip.VTooltip)
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.component('flash-wrapper', FlashWrapper);
|
||||
Vue.component('flash', Flash);
|
||||
Vue.component('tabs', Tabs);
|
||||
Vue.component('tab', Tab);
|
||||
Vue.component('accordian', Accordian);
|
||||
Vue.component('tree-view', TreeView);
|
||||
Vue.component('tree-item', TreeItem);
|
||||
Vue.component('tree-checkbox', TreeCheckbox);
|
||||
Vue.component('tree-radio', TreeRadio);
|
||||
Vue.component('modal', Modal);
|
||||
Vue.component('image-upload', ImageUpload);
|
||||
Vue.component('image-wrapper', ImageWrapper);
|
||||
Vue.component('image-item', ImageItem);
|
||||
Vue.directive('slugify', Slugify);
|
||||
Vue.directive('slugify-target', SlugifyTarget);
|
||||
Vue.directive('code', Code);
|
||||
Vue.directive('alert', Alert);
|
||||
Vue.component('datetime', DatetimeComponent);
|
||||
Vue.component('date', DateComponent);
|
||||
/* component section */
|
||||
Vue.directive("tooltip", VTooltip.VTooltip);
|
||||
Vue.component("datagrid-plus", DatagridPlus);
|
||||
Vue.component("flash-wrapper", FlashWrapper);
|
||||
Vue.component("flash", Flash);
|
||||
Vue.component("tabs", Tabs);
|
||||
Vue.component("tab", Tab);
|
||||
Vue.component("accordian", Accordian);
|
||||
Vue.component("tree-view", TreeView);
|
||||
Vue.component("tree-item", TreeItem);
|
||||
Vue.component("tree-checkbox", TreeCheckbox);
|
||||
Vue.component("tree-radio", TreeRadio);
|
||||
Vue.component("modal", Modal);
|
||||
Vue.component("image-upload", ImageUpload);
|
||||
Vue.component("image-wrapper", ImageWrapper);
|
||||
Vue.component("image-item", ImageItem);
|
||||
Vue.directive("slugify", Slugify);
|
||||
Vue.directive("slugify-target", SlugifyTarget);
|
||||
Vue.directive("code", Code);
|
||||
Vue.directive("alert", Alert);
|
||||
Vue.component("datetime", DatetimeComponent);
|
||||
Vue.component("date", DateComponent);
|
||||
Vue.component("time-component", TimeComponent);
|
||||
Vue.component('swatch-picker', SwatchPicker);
|
||||
Vue.directive('debounce', Debounce);
|
||||
Vue.component('overlay-loader', OverlayLoader);
|
||||
Vue.filter('truncate', function (value, limit, trail) {
|
||||
if (! value)
|
||||
value = '';
|
||||
Vue.component("swatch-picker", SwatchPicker);
|
||||
Vue.directive("debounce", Debounce);
|
||||
Vue.component("overlay-loader", OverlayLoader);
|
||||
Vue.component("multiselect", Multiselect);
|
||||
|
||||
limit = limit ? limit : 20;
|
||||
trail = trail ? trail : '...';
|
||||
/* filter section */
|
||||
Vue.filter("truncate", function(value, limit, trail) {
|
||||
if (!value) value = "";
|
||||
|
||||
return value.length > limit ? value.substring(0, limit) + trail : value;
|
||||
limit = limit ? limit : 20;
|
||||
trail = trail ? trail : "...";
|
||||
|
||||
return value.length > limit ? value.substring(0, limit) + trail : value;
|
||||
});
|
||||
|
||||
Vue.component('multiselect', Multiselect);
|
||||
|
||||
require('flatpickr/dist/flatpickr.css');
|
||||
|
||||
require('vue-swatches/dist/vue-swatches.min.css');
|
||||
|
||||
require('vue-multiselect/dist/vue-multiselect.min.css');
|
||||
|
||||
require('@babel/polyfill');
|
||||
|
||||
require('url-search-params-polyfill');
|
||||
|
||||
require('url-polyfill');
|
||||
/* require section */
|
||||
require("flatpickr/dist/flatpickr.css");
|
||||
require("vue-swatches/dist/vue-swatches.min.css");
|
||||
require("vue-multiselect/dist/vue-multiselect.min.css");
|
||||
require("@babel/polyfill");
|
||||
require("url-search-params-polyfill");
|
||||
require("url-polyfill");
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'يمكن أن تحتوي أعمدة الفهرس على قيم أكبر من الصفر فقط',
|
||||
'no-records' => 'لا توجد سجلات',
|
||||
'filter-fields-missing' => 'بعض الحقل المطلوب هو لاغ ، رجاء تفقد عمود ، حالة و قيمة صحيح',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Indexspalten können nur Werte größer als Null haben',
|
||||
'no-records' => 'Keine Aufzeichnungen gefunden',
|
||||
'filter-fields-missing' => 'Einige der erforderlichen Felder sind null. Überprüfen Sie Spalte, Zustand und Wert ordnungsgemäß',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Index columns can have values greater than zero only',
|
||||
'no-records' => 'No Records Found',
|
||||
'filter-fields-missing' => 'Some of the required field is null, please check column, condition and value properly',
|
||||
|
|
@ -38,4 +43,4 @@ return [
|
|||
'numeric-value-here' => 'Numeric Value here',
|
||||
'submit' => 'Submit'
|
||||
]
|
||||
];
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'Las categorías seleccionadas contienen productos. Al realizar esta acción, se eliminarán los productos relacionados. ¿De verdad quieres realizar esta acción?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Las columnas de índice solo pueden tener valores superiores a cero',
|
||||
'no-records' => 'No se encontraron registros',
|
||||
'filter-fields-missing' => 'Algunos de los campos obligatorios son nulos, verifique la columna, la condición y el valor correctamente',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'ستون های فهرست می توانند مقادیری بیشتر از صفر داشته باشند',
|
||||
'no-records' => 'هیچ رکوردی یافت نشد',
|
||||
'filter-fields-missing' => 'برخی از زمینه های مورد نیاز خالی است ، لطفا ستون ، شرایط و ارزش را به درستی بررسی کنید',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Le colonnne indice possono avere solo valori maggiori di zero',
|
||||
'no-records' => 'Nessun risultato trovato',
|
||||
'filter-fields-missing' => 'Alcuni dei campi obbligatori sono nulli, per favore verificare le colonne, le condizioni e i valori inseriti',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Index columns can have values greater than zero only',
|
||||
'no-records' => 'Er zijn geen gegevens gevonden',
|
||||
'filter-fields-missing' => 'Some of the required field is null, please check column, condition and value properly',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Kolumny indeksu mogą mieć wartości większe niż tylko zero',
|
||||
'no-records' => 'Nie znaleziono rekordów',
|
||||
'filter-fields-missing' => 'Niektóre wymagane pola są puste, proszę sprawdzić kolumnę, warunek i wartość poprawnie',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Colunas do índice podem ter valores maiores que zero apenas',
|
||||
'no-records' => 'Nenhum registro foi encontrado',
|
||||
'filter-fields-missing' => 'Alguns dos campos obrigatórios são nulos, por favor verifique coluna, condição e valor corretamente',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ return [
|
|||
'delete-category-product' => 'The selected categories contains products. Performing this action will remove the related products. Do you really want to perform this action?'
|
||||
],
|
||||
|
||||
'error' => [
|
||||
'multiple-sort-keys-error' => 'Fatal Error! Multiple sort keys found, please resolve the URL manually',
|
||||
'multiple-search-keys-error' => 'Multiple search keys found, please resolve the URL manually',
|
||||
],
|
||||
|
||||
'zero-index' => 'Index sütunları sadece sıfırdan büyük değere sahip olmalı',
|
||||
'no-records' => 'Kayıt Bulunamadı',
|
||||
'filter-fields-missing' => 'Zorunlu alanlardan bazıları boş, lütfen sütun, durum ve değeri doğru şekilde kontrol edin',
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ class OrderCest
|
|||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
/* simple order no further association like address, shipping method, payment method, etc. */
|
||||
$order = $I->have(Order::class);
|
||||
|
||||
/* login as admin */
|
||||
$I->loginAsAdmin();
|
||||
|
||||
|
|
@ -29,8 +26,6 @@ class OrderCest
|
|||
|
||||
/* now test index page */
|
||||
$I->seeCurrentRouteIs('admin.sales.orders.index');
|
||||
$I->see($order->id, '//script[@type="text/x-template"]');
|
||||
$I->see($order->sub_total, '//script[@type="text/x-template"]');
|
||||
}
|
||||
|
||||
public function testCancelCashOnDeliveryOrder(FunctionalTester $I): void
|
||||
|
|
|
|||
Loading…
Reference in New Issue