Merge branch 'master' into datagrid-enhancement-v2
This commit is contained in:
commit
fb9aa0a52a
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Customer\Models\CustomerAddress;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
|
||||
|
||||
class AddressDataGrid extends DataGrid
|
||||
|
|
@ -27,16 +27,16 @@ class AddressDataGrid extends DataGrid
|
|||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* CustomerRepository $customerRepository
|
||||
* Customer repository instance.
|
||||
*
|
||||
* @var object
|
||||
* @var \Webkul\Customer\Repositories\CustomerRepository
|
||||
*/
|
||||
protected $customerRepository;
|
||||
|
||||
/**
|
||||
* Create a new datagrid instance.
|
||||
*
|
||||
* @param Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CustomerRepository $customerRepository)
|
||||
|
|
@ -148,8 +148,7 @@ class AddressDataGrid extends DataGrid
|
|||
'type' => 'boolean',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($row) {
|
||||
'closure' => function ($row) {
|
||||
if ($row->default_address == 1) {
|
||||
return '<span class="badge badge-md badge-success"">' . trans('admin::app.customers.addresses.yes') . '</span>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class AttributeDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Set index columns, ex: id.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Default sort order of datagrid.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('attributes')
|
||||
|
|
@ -24,6 +39,11 @@ class AttributeDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -68,7 +88,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'type' => 'boolean',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->is_required == 1) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
|
|
@ -84,7 +104,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->is_unique == 1) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
|
|
@ -100,7 +120,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->value_per_locale == 1) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
|
|
@ -116,7 +136,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->value_per_channel == 1) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
|
|
@ -126,6 +146,11 @@ class AttributeDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -143,6 +168,11 @@ class AttributeDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare mass actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CampaignDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Set index columns, ex: id.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Default sort order of datagrid.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('marketing_campaigns')->addSelect('id', 'name', 'subject', 'status');
|
||||
|
|
@ -20,6 +35,11 @@ class CampaignDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -56,7 +76,7 @@ class CampaignDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
|
|
@ -66,6 +86,11 @@ class CampaignDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -83,4 +108,4 @@ class CampaignDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CartRuleCouponsDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('cart_rules')
|
||||
|
|
@ -20,6 +35,11 @@ class CartRuleCouponsDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -65,7 +85,7 @@ class CartRuleCouponsDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->end_other_rules == 1) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,20 +7,49 @@ use Illuminate\Support\Facades\DB;
|
|||
|
||||
class CartRuleDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Set index columns, ex: id.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Default sort order of datagrid.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Customer group.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $customer_group = 'all';
|
||||
|
||||
/**
|
||||
* Channel.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $channel = 'all';
|
||||
|
||||
/** @var string[] contains the keys for which extra filters to show */
|
||||
/**
|
||||
* Contains the keys for which extra filters to show.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $extraFilters = [
|
||||
'channels',
|
||||
'customer_groups',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new datagrid instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
@ -30,6 +59,11 @@ class CartRuleDataGrid extends DataGrid
|
|||
$this->channel = core()->getRequestedChannelCode(false) ?? 'all';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('cart_rules')
|
||||
|
|
@ -37,8 +71,15 @@ class CartRuleDataGrid extends DataGrid
|
|||
$leftJoin->on('cart_rule_coupons.cart_rule_id', '=', 'cart_rules.id')
|
||||
->where('cart_rule_coupons.is_primary', 1);
|
||||
})
|
||||
->addSelect('cart_rules.id', 'name', 'cart_rule_coupons.code as coupon_code',
|
||||
'status', 'starts_from', 'ends_till', 'sort_order');
|
||||
->addSelect(
|
||||
'cart_rules.id',
|
||||
'name',
|
||||
'cart_rule_coupons.code as coupon_code',
|
||||
'status',
|
||||
'starts_from',
|
||||
'ends_till',
|
||||
'sort_order'
|
||||
);
|
||||
|
||||
$this->addFilter('id', 'cart_rules.id');
|
||||
$this->addFilter('coupon_code', 'cart_rule_coupons.code');
|
||||
|
|
@ -50,6 +91,7 @@ class CartRuleDataGrid extends DataGrid
|
|||
'=',
|
||||
'cart_rules.id'
|
||||
);
|
||||
|
||||
$queryBuilder->where('cart_rule_customer_groups.customer_group_id', $this->customer_group);
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +100,9 @@ class CartRuleDataGrid extends DataGrid
|
|||
'cart_rule_channels',
|
||||
'cart_rule_channels.cart_rule_id',
|
||||
'=',
|
||||
'cart_rules.id');
|
||||
'cart_rules.id'
|
||||
);
|
||||
|
||||
$queryBuilder->where('cart_rule_channels.channel_id', $this->channel);
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +111,11 @@ class CartRuleDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -121,7 +170,7 @@ class CartRuleDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else if ($value->status == 0) {
|
||||
|
|
@ -142,6 +191,11 @@ class CartRuleDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -164,6 +218,5 @@ class CartRuleDataGrid extends DataGrid
|
|||
'route' => 'admin.cart-rules.delete',
|
||||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CatalogRuleDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('catalog_rules')
|
||||
|
|
@ -22,6 +37,11 @@ class CatalogRuleDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -67,7 +87,7 @@ class CatalogRuleDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
|
|
@ -86,6 +106,11 @@ class CatalogRuleDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
|
|||
|
|
@ -8,12 +8,32 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CategoryDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'category_id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Locale.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $locale = 'all';
|
||||
|
||||
/**
|
||||
* Create a new datagrid instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
@ -21,6 +41,11 @@ class CategoryDataGrid extends DataGrid
|
|||
$this->locale = core()->getRequestedLocaleCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
if ($this->locale === 'all') {
|
||||
|
|
@ -30,11 +55,17 @@ class CategoryDataGrid extends DataGrid
|
|||
}
|
||||
|
||||
$queryBuilder = DB::table('categories as cat')
|
||||
->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale',
|
||||
DB::raw('COUNT(DISTINCT ' . DB::getTablePrefix() . 'pc.product_id) as count'))
|
||||
->leftJoin('category_translations as ct', function($leftJoin) use($whereInLocales) {
|
||||
->select(
|
||||
'cat.id as category_id',
|
||||
'ct.name',
|
||||
'cat.position',
|
||||
'cat.status',
|
||||
'ct.locale',
|
||||
DB::raw('COUNT(DISTINCT ' . DB::getTablePrefix() . 'pc.product_id) as count')
|
||||
)
|
||||
->leftJoin('category_translations as ct', function ($leftJoin) use ($whereInLocales) {
|
||||
$leftJoin->on('cat.id', '=', 'ct.category_id')
|
||||
->whereIn('ct.locale', $whereInLocales);
|
||||
->whereIn('ct.locale', $whereInLocales);
|
||||
})
|
||||
->leftJoin('product_categories as pc', 'cat.id', '=', 'pc.category_id')
|
||||
->groupBy('cat.id', 'ct.locale',);
|
||||
|
|
@ -46,6 +77,11 @@ class CategoryDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -82,7 +118,7 @@ class CategoryDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
|
|
@ -101,6 +137,11 @@ class CategoryDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -126,4 +167,4 @@ class CategoryDataGrid extends DataGrid
|
|||
'method' => 'POST',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,32 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CustomerDataGrid extends DataGrid
|
||||
{
|
||||
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'customer_id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Items per page.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $itemsPerPage = 10;
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customers')
|
||||
|
|
@ -31,6 +50,11 @@ class CustomerDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -76,9 +100,8 @@ class CustomerDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => false,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($row) {
|
||||
if (! $row->phone) {
|
||||
'closure' => function ($row) {
|
||||
if (!$row->phone) {
|
||||
return '-';
|
||||
} else {
|
||||
return $row->phone;
|
||||
|
|
@ -93,9 +116,8 @@ class CustomerDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => false,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($row) {
|
||||
if (! $row->gender) {
|
||||
'closure' => function ($row) {
|
||||
if (!$row->gender) {
|
||||
return '-';
|
||||
} else {
|
||||
return $row->gender;
|
||||
|
|
@ -110,17 +132,21 @@ class CustomerDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($row) {
|
||||
'closure' => function ($row) {
|
||||
if ($row->status == 1) {
|
||||
return '<span class="badge badge-md badge-success">'. trans('admin::app.customers.customers.active') .'</span>';
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.customers.customers.active') . '</span>';
|
||||
} else {
|
||||
return '<span class="badge badge-md badge-danger">'. trans('admin::app.customers.customers.inactive') .'</span>';
|
||||
return '<span class="badge badge-md badge-danger">' . trans('admin::app.customers.customers.inactive') . '</span>';
|
||||
}
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -145,6 +171,11 @@ class CustomerDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare mass actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
|
|
@ -165,4 +196,4 @@ class CustomerDataGrid extends DataGrid
|
|||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,31 +3,45 @@
|
|||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
|
||||
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
|
||||
class CustomerOrderDataGrid extends DataGrid
|
||||
{
|
||||
use ProvideDataGridPlus;
|
||||
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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'))
|
||||
->where('orders.customer_id', request('id'));
|
||||
|
|
@ -40,6 +54,11 @@ class CustomerOrderDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -93,28 +112,32 @@ class CustomerOrderDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'closure' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => 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>';
|
||||
}
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -124,4 +147,4 @@ class CustomerOrderDataGrid extends DataGrid
|
|||
'icon' => 'icon eye-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CustomerReviewDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'product_review_id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('product_reviews as pr')
|
||||
|
|
@ -27,6 +42,11 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -82,8 +102,7 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->product_review_status == 'approved') {
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.datagrid.approved') . '</span>';
|
||||
} elseif ($value->product_review_status == "pending") {
|
||||
|
|
@ -104,6 +123,11 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -121,6 +145,11 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare mass actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
|
|
@ -142,4 +171,4 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,9 +84,8 @@ class CustomersInvoicesDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'closure' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
return '<a href="' . route('admin.sales.orders.view', $value->order_id) . '">' . $value->order_id . '</a>';
|
||||
}
|
||||
]);
|
||||
|
|
@ -106,9 +105,8 @@ class CustomersInvoicesDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'closure' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->state == 'paid') {
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.invoices.status-paid') . '</span>';
|
||||
} elseif ($value->state == 'pending' || $value->state == 'pending_payment') {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class EmailTemplateDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('marketing_templates')->addSelect('id', 'name', 'status');
|
||||
|
|
@ -20,6 +35,11 @@ class EmailTemplateDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -47,7 +67,7 @@ class EmailTemplateDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 'active') {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else if ($value->status == 'inactive') {
|
||||
|
|
@ -59,6 +79,11 @@ class EmailTemplateDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -76,4 +101,4 @@ class EmailTemplateDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class InventorySourcesDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status');
|
||||
|
|
@ -20,6 +35,11 @@ class InventorySourcesDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -65,7 +85,7 @@ class InventorySourcesDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
|
|
@ -75,6 +95,11 @@ class InventorySourcesDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -92,4 +117,4 @@ class InventorySourcesDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class LocalesDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name', 'direction');
|
||||
|
|
@ -18,6 +33,11 @@ class LocalesDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -54,8 +74,7 @@ class LocalesDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->direction == 'ltr') {
|
||||
return trans('admin::app.datagrid.ltr');
|
||||
} else {
|
||||
|
|
@ -65,6 +84,11 @@ class LocalesDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -82,4 +106,4 @@ class LocalesDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,27 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class NewsLetterDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
|
||||
|
||||
$queryBuilder = DB::table('subscribers_list')->select('subscribers_list.id', 'subscribers_list.is_subscribed as status', 'subscribers_list.email');
|
||||
|
||||
$this->addFilter('status', 'subscribers_list.is_subscribed');
|
||||
|
|
@ -22,6 +35,11 @@ class NewsLetterDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -40,7 +58,7 @@ class NewsLetterDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status === 1) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
|
|
@ -59,6 +77,11 @@ class NewsLetterDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -76,4 +99,4 @@ class NewsLetterDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,25 @@ class OrderDataGrid extends DataGrid
|
|||
{
|
||||
use ProvideDataGridPlus;
|
||||
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('orders')
|
||||
|
|
@ -38,6 +53,11 @@ class OrderDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -91,9 +111,8 @@ class OrderDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'closure' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 'processing') {
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>';
|
||||
} elseif ($value->status == 'completed') {
|
||||
|
|
@ -131,6 +150,11 @@ class OrderDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class OrderInvoicesDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$dbPrefix = DB::getTablePrefix();
|
||||
|
|
@ -28,6 +43,11 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -72,9 +92,8 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'closure' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->state == 'paid') {
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.invoices.status-paid') . '</span>';
|
||||
} elseif ($value->state == 'pending' || $value->state == 'pending_payment') {
|
||||
|
|
@ -86,9 +105,13 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
}
|
||||
},
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -98,4 +121,4 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
'icon' => 'icon eye-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ class ProductDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
|
|
@ -247,8 +247,7 @@ class ProductDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => false,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($row) {
|
||||
'closure' => function ($row) {
|
||||
if (is_null($row->quantity)) {
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class TaxRateDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'zip_code', 'zip_from', 'zip_to', 'tax_rate');
|
||||
|
|
@ -18,6 +33,11 @@ class TaxRateDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -45,7 +65,7 @@ class TaxRateDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if (empty($value->state)) {
|
||||
return '*';
|
||||
} else {
|
||||
|
|
@ -100,6 +120,11 @@ class TaxRateDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -116,4 +141,4 @@ class TaxRateDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class UserDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'user_id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('admins as u')
|
||||
|
|
@ -25,6 +40,11 @@ class UserDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -52,7 +72,7 @@ class UserDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
|
|
@ -80,6 +100,11 @@ class UserDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
@ -96,4 +121,4 @@ class UserDataGrid extends DataGrid
|
|||
'icon' => 'icon trash-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class DownloadableProductDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('downloadable_link_purchased')
|
||||
|
|
@ -28,6 +43,11 @@ class DownloadableProductDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -46,8 +66,7 @@ class DownloadableProductDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 'pending' || $value->status == 'expired' || $value->invoice_state !== 'paid') {
|
||||
return $value->product_name;
|
||||
} else {
|
||||
|
|
@ -72,8 +91,7 @@ class DownloadableProductDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 'pending') {
|
||||
return trans('shop::app.customer.account.downloadable_products.pending');
|
||||
} elseif ($value->status == 'available') {
|
||||
|
|
@ -91,9 +109,8 @@ class DownloadableProductDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => false,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if (! $value->download_bought) {
|
||||
'closure' => function ($value) {
|
||||
if (!$value->download_bought) {
|
||||
return trans('shop::app.customer.account.downloadable_products.unlimited');
|
||||
}
|
||||
|
||||
|
|
@ -101,4 +118,4 @@ class DownloadableProductDataGrid extends DataGrid
|
|||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Illuminate\Support\Facades\DB;
|
|||
|
||||
class OrderDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('orders as order')
|
||||
|
|
@ -20,6 +35,11 @@ class OrderDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -47,7 +67,7 @@ class OrderDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
return core()->formatPrice($value->grand_total, $value->order_currency_code);
|
||||
},
|
||||
]);
|
||||
|
|
@ -58,8 +78,7 @@ class OrderDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 'processing') {
|
||||
return '<span class="badge badge-md badge-success">' . trans('shop::app.customer.account.order.index.processing') . '</span>';
|
||||
} elseif ($value->status == 'completed') {
|
||||
|
|
@ -80,6 +99,11 @@ class OrderDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Set index columns, ex: id.
|
||||
*
|
||||
* @var int
|
||||
* @var string
|
||||
*/
|
||||
protected $index;
|
||||
|
||||
|
|
@ -232,8 +232,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Add column.
|
||||
*
|
||||
* @param string $column
|
||||
*
|
||||
* @param array $column
|
||||
* @return void
|
||||
*/
|
||||
public function addColumn($column)
|
||||
|
|
@ -252,8 +251,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Set complete column details.
|
||||
*
|
||||
* @param string $column
|
||||
*
|
||||
* @param array $column
|
||||
* @return void
|
||||
*/
|
||||
public function setCompleteColumnDetails($column)
|
||||
|
|
@ -264,8 +262,7 @@ abstract class DataGrid
|
|||
/**
|
||||
* Set query builder.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $queryBuilder
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $queryBuilder
|
||||
* @return void
|
||||
*/
|
||||
public function setQueryBuilder($queryBuilder)
|
||||
|
|
|
|||
|
|
@ -218,17 +218,30 @@ trait ProvideCollection
|
|||
/**
|
||||
* Transform your columns.
|
||||
*
|
||||
* @parma object $record
|
||||
* @param 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));
|
||||
$supportedClosureKey = ['wrapper', 'closure'];
|
||||
|
||||
$isClosure = ! empty(array_intersect($supportedClosureKey, array_keys($column)));
|
||||
|
||||
if ($isClosure) {
|
||||
/**
|
||||
* @deprecated $column['wrapper']
|
||||
*
|
||||
* Use $column['closure'] instead. `wrapper` key will get removed in the later version.
|
||||
*/
|
||||
if (isset($column['wrapper']) && gettype($column['wrapper']) === 'object' && $column['wrapper'] instanceof \Closure) {
|
||||
if (isset($column['closure']) && $column['closure'] == true) {
|
||||
$record->{$column['index']} = $column['wrapper']($record);
|
||||
} else {
|
||||
$record->{$column['index']} = htmlspecialchars($column['wrapper']($record));
|
||||
}
|
||||
} else if (isset($column['closure']) && gettype($column['closure']) === 'object' && $column['closure'] instanceof \Closure) {
|
||||
$record->{$column['index']} = $column['closure']($record);
|
||||
}
|
||||
} else {
|
||||
if ($column['type'] == 'price') {
|
||||
|
|
@ -237,6 +250,8 @@ trait ProvideCollection
|
|||
} else {
|
||||
$record->{$column['index']} = htmlspecialchars(core()->formatBasePrice($record->{$column['index']}));
|
||||
}
|
||||
} else {
|
||||
$record->{$column['index']} = htmlspecialchars($record->{$column['index']});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,26 @@
|
|||
$columnIndex = explode('.', $column['index']);
|
||||
|
||||
$columnIndex = end($columnIndex);
|
||||
|
||||
$supportedClosureKey = ['wrapper', 'closure'];
|
||||
|
||||
$isClosure = ! empty(array_intersect($supportedClosureKey, array_keys($column)));
|
||||
@endphp
|
||||
|
||||
@if (isset($column['wrapper']))
|
||||
@if (isset($column['closure']) && $column['closure'] == true)
|
||||
<td data-value="{{ $column['label'] }}">{!! $column['wrapper']($record) !!}</td>
|
||||
@else
|
||||
<td data-value="{{ $column['label'] }}">{{ $column['wrapper']($record) }}</td>
|
||||
@if ($isClosure)
|
||||
{{--
|
||||
Depereciation Notice:
|
||||
The following key i.e. `wrapper` will remove in the later version. Use only `closure`
|
||||
key to manipulate the column. This will only hit the raw html.
|
||||
--}}
|
||||
@if (isset($column['wrapper']) && gettype($column['wrapper']) === 'object' && $column['wrapper'] instanceof \Closure)
|
||||
@if (isset($column['closure']) && $column['closure'] == true)
|
||||
<td data-value="{{ $column['label'] }}">{!! $column['wrapper']($record) !!}</td>
|
||||
@else
|
||||
<td data-value="{{ $column['label'] }}">{{ $column['wrapper']($record) }}</td>
|
||||
@endif
|
||||
@elseif (isset($column['closure']) && gettype($column['closure']) === 'object' && $column['closure'] instanceof \Closure)
|
||||
<td data-value="{{ $column['label'] }}">{!! $column['closure']($record) !!}</td>
|
||||
@endif
|
||||
@else
|
||||
@if ($column['type'] == 'price')
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class CategoryDataGrid extends DataGrid
|
||||
{
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'category_menu_id';
|
||||
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$defaultChannel = core()->getCurrentChannel();
|
||||
|
|
@ -18,18 +33,21 @@ class CategoryDataGrid extends DataGrid
|
|||
$queryBuilder = DB::table('velocity_category as v_cat')
|
||||
->select('v_cat.id as category_menu_id', 'v_cat.category_id', 'ct.name', 'v_cat.icon', 'v_cat.tooltip', 'v_cat.status')
|
||||
->leftJoin('categories as c', 'c.id', '=', 'v_cat.category_id')
|
||||
->leftJoin('category_translations as ct', function($leftJoin) {
|
||||
->leftJoin('category_translations as ct', function ($leftJoin) {
|
||||
$leftJoin->on('c.id', '=', 'ct.category_id')
|
||||
->where('ct.locale', app()->getLocale());
|
||||
->where('ct.locale', app()->getLocale());
|
||||
})
|
||||
->where('c.parent_id', $defaultChannel->root_category_id)
|
||||
->groupBy('v_cat.id');
|
||||
|
||||
// $this->addFilter('content_id', 'con.id');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -57,9 +75,8 @@ class CategoryDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($row) {
|
||||
return '<span class="wk-icon '.$row->icon.'"></span>';
|
||||
'closure' => function ($row) {
|
||||
return '<span class="wk-icon ' . $row->icon . '"></span>';
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
@ -70,9 +87,8 @@ class CategoryDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function($row) {
|
||||
if ( $row->status ) {
|
||||
'closure' => function ($row) {
|
||||
if ($row->status) {
|
||||
return '<span class="badge badge-md badge-success">Enabled</span>';
|
||||
} else {
|
||||
return '<span class="badge badge-md badge-danger">Disabled</span>';
|
||||
|
|
@ -81,7 +97,13 @@ class CategoryDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
'title' => trans('ui::app.datagrid.edit'),
|
||||
'type' => 'Edit',
|
||||
|
|
@ -100,6 +122,11 @@ class CategoryDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare mass actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
|
|
|
|||
|
|
@ -7,17 +7,32 @@ use Webkul\Ui\DataGrid\DataGrid;
|
|||
|
||||
class ContentDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'content_id'; //the column that needs to be treated as index column
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $index = 'content_id';
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
/**
|
||||
* Sort order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
/**
|
||||
* Prepare query builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('velocity_contents as con')
|
||||
->select('con.id as content_id', 'con_trans.title', 'con.position', 'con.content_type', 'con.status')
|
||||
->leftJoin('velocity_contents_translations as con_trans', function($leftJoin) {
|
||||
->leftJoin('velocity_contents_translations as con_trans', function ($leftJoin) {
|
||||
$leftJoin->on('con.id', '=', 'con_trans.content_id')
|
||||
->where('con_trans.locale', app()->getLocale());
|
||||
->where('con_trans.locale', app()->getLocale());
|
||||
})
|
||||
->groupBy('con.id');
|
||||
|
||||
|
|
@ -27,6 +42,11 @@ class ContentDataGrid extends DataGrid
|
|||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add columns.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -63,7 +83,7 @@ class ContentDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
return 'Active';
|
||||
} else {
|
||||
|
|
@ -79,7 +99,7 @@ class ContentDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'filterable' => false,
|
||||
'wrapper' => function($value) {
|
||||
'closure' => function ($value) {
|
||||
if ($value->content_type == 'category') {
|
||||
return 'Category Slug';
|
||||
} elseif ($value->content_type == 'link') {
|
||||
|
|
@ -93,7 +113,13 @@ class ContentDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
/**
|
||||
* Prepare actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
'title' => trans('ui::app.datagrid.edit'),
|
||||
'type' => 'Edit',
|
||||
|
|
@ -112,6 +138,11 @@ class ContentDataGrid extends DataGrid
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare mass actions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
|
|
|
|||
Loading…
Reference in New Issue