Merge pull request #9 from bagisto/master

syncing master with Bagisto's master
This commit is contained in:
Prashant Singh 2019-01-25 04:46:41 +00:00 committed by GitHub
commit 1fd1cb2a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
109 changed files with 996 additions and 1337 deletions

View File

@ -6,18 +6,19 @@
<a href="https://packagist.org/packages/bagisto/bagisto"><img src="https://poser.pugx.org/bagisto/bagisto/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/bagisto/bagisto"><img src="https://poser.pugx.org/bagisto/bagisto/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/bagisto/bagisto"><img src="https://poser.pugx.org/bagisto/bagisto/license.svg" alt="License"></a>
<a href="#backers"><img src="https://opencollective.com/bagisto/backers/badge.svg" alt="Backers on Open Collective"></a>
<a href="#sponsors"><img src="https://opencollective.com/bagisto/sponsors/badge.svg" alt="Sponsors on Open Collective"></a>
</p>
# Topics
1. ### Introduction
2. ### Requirements
3. ### Installation
4. ### Configuration
5. ### Migration Guides
6. ### License
1. ### [Introduction](#1-introduction-)
2. ### [Requirements](#2-requirements-)
3. ### [Configuration](#3-configuration-)
4. ### [Installation](#4-installation-)
5. ### [License](#5-license-)
6. ### [Miscellaneous](#6-miscellaneous-)
### 1. Introduction:
### 1. Introduction <a name="#1-introduction-"></a>:
[Bagisto](https://www.bagisto.com) is a hand tailored E-Commerce framework designed on some of the hottest opensource technologies
such as [Laravel](https://laravel.com) a [PHP](https://secure.php.net/) framework, [Vue.js](https://vuejs.org)
@ -48,7 +49,7 @@ It packs in lots of demanding features that allows your business to scale in no
Dev guys can take advantage of two of the hottest frameworks used in this project Laravel and Vue.js, both of these frameworks have been used in Bagisto.
Bagisto is using power of both of these frameworks and making best out of it out of the box.
### 2. Requirements:
### 2. Requirements <a name="#requirements"></a>:
* **OS**: Ubuntu 16.04 LTS or higher.
* **SERVER**: Apache 2 or NGINX
@ -59,7 +60,7 @@ Bagisto is using power of both of these frameworks and making best out of it out
* **Node**: 8.11.3 LTS or higher.
* **Composer**: 1.6.5 or higher.
### 3. Configuration:
### 3. Configuration <a name="#configuration"></a>:
**Run this Command** to download the project on to your local machine or server:
@ -85,7 +86,7 @@ Although you have to set the mailer variables also for full functioning of your
default.
### 4. Installation:
### 4. Installation <a name="#installation"></a>:
**Run these Commands Below**
@ -125,8 +126,36 @@ email:admin@example.com
password:admin123
~~~
### 5. License
### 5. License <a name="#license"></a>:
Bagisto is a truly opensource E-Commerce framework which will always be free under the [MIT License](https://github.com/bagisto/bagisto/blob/master/LICENSE).
### Coming Soon:
-> API support for core packages and numerous fixes.
### 6. Miscellaneous <a name="#miscellaneous"></a>:
#### Contributors
This project exists thanks to all the people who contribute.
<a href="https://github.com/bagisto/bagisto/graphs/contributors"><img src="https://opencollective.com/bagisto/contributors.svg?width=890&button=false" /></a>
#### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/bagisto#backer)]
<a href="https://opencollective.com/bagisto#backers" target="_blank"><img src="https://opencollective.com/bagisto/backers.svg?width=890"></a>
#### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/bagisto#sponsor)]
<a href="https://opencollective.com/bagisto/sponsor/0/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/1/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/2/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/3/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/4/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/5/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/6/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/7/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/8/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/bagisto/sponsor/9/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/9/avatar.svg"></a>

View File

@ -3,6 +3,7 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
@ -13,6 +14,7 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
Schema::defaultStringLength(191);
}
/**

View File

@ -1,90 +0,0 @@
<?php
return [
/**
* Default Select Value
*/
'default_index' => 'id',
/**
* Default OrderBy
*
* * Accepted Values = Array
*/
'order' => [
'default' => 'descending',
'descending' => 'desc',
'ascending' => 'asc'
],
/**
* Select distinct records only
*
* Accepted Values = True || False
*/
'distinct' => true,
/**
* Default pagination
*
* Accepted Value = integer
*/
'paginate' => false,
'operators' => [
'eq' => "=",
'lt' => "<",
'gt' => ">",
'lte' => "<=",
'gte' => ">=",
'neqs' => "<>",
'neqn' => "!=",
'eqo' => "<=>",
'like' => "like",
'blike' => "like binary",
'nlike' => "not like",
'ilike' => "ilike",
'and' => "&",
'bor' => "|",
'regex' => "regexp",
'notregex' => "not regexp",
// 14 => "^",
// 15 => "<<",
// 16 => ">>",
// 17 => "rlike",
// 20 => "~",
// 21 => "~*",
// 22 => "!~",
// 23 => "!~*",
// 24 => "similar to",
// 25 => "not similar to",
// 26 => "not ilike",
// 27 => "~~*",
// 28 => "!~~*"
],
'bindings' => [
0 => "select",
1 => "from",
2 => "join",
3 => "where",
4 => "having",
5 => "order",
6 => "union"
],
'selectcomponents' => [
0 => "aggregate",
1 => "columns",
2 => "from",
3 => "joins",
4 => "wheres",
5 => "groups",
6 => "havings",
7 => "orders",
8 => "limit",
9 => "offset",
10 => "lock"
]
];

View File

@ -7,7 +7,8 @@
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"postinstall": "opencollective-postinstall"
},
"devDependencies": {
"axios": "^0.18",
@ -18,5 +19,13 @@
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"vue": "^2.5.7"
},
"dependencies": {
"opencollective-postinstall": "^2.0.1",
"opencollective": "^1.0.3"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/bagisto"
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77",
"/js/admin.js": "/js/admin.js?id=da5ebef9c25a064e7ed6",
"/css/admin.css": "/css/admin.css?id=3e790c2215bf5c60ac21"
}

View File

@ -13,14 +13,17 @@ use DB;
*/
class AttributeDataGrid extends DataGrid
{
protected $itemsPerPage = 5; //overriding the default items per page
protected $paginate = true;
protected $itemsPerPage = 10; //overriding the default items per page
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('attributes')->select('id')->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
$queryBuilder = DB::table('attributes')
->select('id')
->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
$this->setQueryBuilder($queryBuilder);
}
@ -33,7 +36,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -42,7 +44,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -51,7 +52,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -60,7 +60,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -69,9 +68,8 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->is_required == 1)
return 'True';
else
return 'False';
@ -84,9 +82,8 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->is_unique == 1)
return 'True';
else
return 'False';
@ -99,9 +96,8 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->value_per_locale == 1)
return 'True';
else
return 'False';
@ -114,9 +110,8 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->value_per_channel == 1)
return 'True';
else
return 'False';

View File

@ -13,7 +13,9 @@ use DB;
*/
class AttributeFamilyDataGrid extends DataGrid
{
protected $itemsPerPage = 5;
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id'; //the column that needs to be treated as index column
@ -32,7 +34,6 @@ class AttributeFamilyDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -41,7 +42,6 @@ class AttributeFamilyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -50,7 +50,6 @@ class AttributeFamilyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
@ -68,22 +67,4 @@ class AttributeFamilyDataGrid extends DataGrid
'icon' => 'icon trash-icon'
]);
}
public function prepareMassActions() {
// $this->prepareMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.familites.massdelete'),
// 'method' => 'DELETE'
// ]);
// $this->prepareMassAction([
// 'type' => 'update',
// 'action' => route('admin.catalog.familites.massupdate'),
// 'method' => 'PUT',
// 'options' => [
// 0 => true,
// 1 => false,
// ]
// ]);
}
}

View File

@ -13,11 +13,19 @@ use DB;
*/
class CategoryDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'category_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('categories as cat')->select('cat.id as category_id', 'ct.name as category_name', 'cat.position as category_position', 'cat.status as category_status', 'ct.locale as category_locale')->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
$queryBuilder = DB::table('categories as cat')
->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale')
->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
$this->addFilter('category_id', 'cat.id');
$this->setQueryBuilder($queryBuilder);
}
@ -30,36 +38,32 @@ class CategoryDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'category_name',
'index' => 'name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'category_position',
'index' => 'position',
'label' => trans('admin::app.datagrid.position'),
'type' => 'string',
'searchable' => true,
'searchable' => false,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'category_status',
'index' => 'status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'sortable' => true,
'searchable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->status == 1)
return 'Active';
else
return 'Inactive';
@ -67,25 +71,24 @@ class CategoryDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'category_locale',
'index' => 'locale',
'label' => trans('admin::app.datagrid.locale'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px'
'searchable' => true,
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.catalog.products.edit',
'route' => 'admin.catalog.categories.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.catalog.products.delete',
'route' => 'admin.catalog.categories.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon'
]);

View File

@ -13,6 +13,10 @@ use DB;
*/
class ChannelDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +50,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -57,7 +58,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class CurrencyDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class CurrencyDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class CurrencyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +50,6 @@ class CurrencyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,13 +13,20 @@ use DB;
*/
class CustomerDataGrid extends DataGrid
{
protected $itemsPerPage = 5;
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'customer_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('customers')->addSelect('customers.id as customer_id', 'customers.email as customer_email', 'customer_groups.name as customer_group_name')->addSelect(DB::raw('CONCAT(customers.first_name, " ", customers.last_name) as customer_full_name'))->leftJoin('customer_groups', 'customers.customer_group_id', '=', 'customer_groups.id');
$queryBuilder = DB::table('customers as custs')
->addSelect('custs.id as customer_id', 'custs.email', 'cg.name')
->addSelect(DB::raw('CONCAT(custs.first_name, " ", custs.last_name) as full_name'))->leftJoin('customer_groups as cg', 'custs.customer_group_id', '=', 'cg.id');
$this->addFilter('customer_id', 'custs.id');
$this->addFilter('full_name', DB::raw('CONCAT(custs.first_name, " ", custs.last_name)'));
$this->setQueryBuilder($queryBuilder);
}
@ -32,34 +39,30 @@ class CustomerDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'customer_full_name',
'index' => 'full_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'customer_email',
'index' => 'email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'customer_group_name',
'index' => 'name',
'label' => trans('admin::app.datagrid.group'),
'type' => 'string',
'searchable' => false,
'sortable' => true,
'width' => '100px'
]);
}
@ -76,22 +79,4 @@ class CustomerDataGrid extends DataGrid
'icon' => 'icon trash-icon'
]);
}
public function prepareMassActions() {
// $this->prepareMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.products.massdelete'),
// 'method' => 'DELETE'
// ]);
// $this->prepareMassAction([
// 'type' => 'update',
// 'action' => route('admin.catalog.products.massupdate'),
// 'method' => 'PUT',
// 'options' => [
// 0 => true,
// 1 => false,
// ]
// ]);
}
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class CustomerGroupDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class CustomerGroupDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class CustomerGroupDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,11 +13,20 @@ use DB;
*/
class CustomerReviewDataGrid extends DataGrid
{
protected $index = 'product_review_id'; //the column that needs to be treated as index column
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'product_review_id'; //column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('product_reviews as pr')->addSelect('pr.id as product_review_id', 'pr.title as product_review_title', 'pr.comment as product_review_comment', 'pg.name as product_review_name', 'pr.status as product_review_status')->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id');
$queryBuilder = DB::table('product_reviews as pr')
->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id')
->addSelect('pr.id as product_review_id', 'pr.title', 'pr.comment', 'pg.name', 'pr.status as product_review_status');
$this->addFilter('product_review_id', 'pr.id');
$this->addFilter('product_review_status', 'pr.status');
$this->setQueryBuilder($queryBuilder);
}
@ -30,46 +39,42 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'product_review_title',
'index' => 'title',
'label' => trans('admin::app.datagrid.title'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'product_review_comment',
'index' => 'comment',
'label' => trans('admin::app.datagrid.comment'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'product_review_name',
'index' => 'name',
'label' => trans('admin::app.datagrid.product-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'product_review_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'closure' => true,
'wrapper' => function ($value) {
if ($value == 'approved')
if ($value->product_review_status == 'approved')
return '<span class="badge badge-md badge-success">Approved</span>';
else if ($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';

View File

@ -13,11 +13,17 @@ use DB;
*/
class ExchangeRatesDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'currency_exch_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id as currency_exch_id', 'curr.name as currency_exch_name', 'cer.rate as currency_exch_rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id as currency_exch_id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
$this->addFilter('currency_exch_id', 'cer.id');
$this->setQueryBuilder($queryBuilder);
}
@ -30,25 +36,22 @@ class ExchangeRatesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'currency_exch_name',
'index' => 'name',
'label' => trans('admin::app.datagrid.currency-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'currency_exch_rate',
'index' => 'rate',
'label' => trans('admin::app.datagrid.exch-rate'),
'type' => 'string',
'type' => 'number',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
@ -66,22 +69,4 @@ class ExchangeRatesDataGrid extends DataGrid
'icon' => 'icon trash-icon'
]);
}
public function prepareMassActions() {
// $this->prepareMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.products.massdelete'),
// 'method' => 'DELETE'
// ]);
// $this->prepareMassAction([
// 'type' => 'update',
// 'action' => route('admin.catalog.products.massupdate'),
// 'method' => 'PUT',
// 'options' => [
// 0 => true,
// 1 => false,
// ]
// ]);
}
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class InventorySourcesDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +50,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -57,7 +58,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -66,9 +66,8 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->status == 1)
return 'Active';
else
return 'Inactive';

View File

@ -13,6 +13,10 @@ use DB;
*/
class LocalesDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class LocalesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class LocalesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +50,6 @@ class LocalesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class NewsLetterDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -30,18 +34,16 @@ class NewsLetterDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'is_subscribed',
'label' => trans('admin::app.datagrid.subscribed'),
'type' => 'string',
'searchable' => true,
'searchable' => false,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->is_subscribed == 1)
return 'True';
else
return 'False';
@ -54,7 +56,6 @@ class NewsLetterDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,11 +13,17 @@ use DB;
*/
class OrderDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('orders')->select('id', 'base_grand_total', 'grand_total', 'created_at', 'channel_name', 'status')->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as full_name'));
$queryBuilder = DB::table('orders')->select('id', 'base_sub_total', 'base_grand_total', 'created_at', 'channel_name', 'status')->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as full_name'));
$this->addFilter('full_name', DB::raw('CONCAT(customer_first_name, " ", customer_last_name)'));
$this->setQueryBuilder($queryBuilder);
}
@ -30,40 +36,30 @@ class OrderDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'base_sub_total',
'label' => trans('admin::app.datagrid.sub-total'),
'type' => 'price',
'searchable' => false,
'sortable' => true,
]);
$this->addColumn([
'index' => 'base_grand_total',
'label' => trans('admin::app.datagrid.base-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function ($value) {
return core()->formatBasePrice($value);
}
]);
$this->addColumn([
'index' => 'grand_total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'string',
'searchable' => true,
'type' => 'price',
'searchable' => false,
'sortable' => true,
'width' => '100px',
'wrapper' => function ($value) {
return core()->formatBasePrice($value);
}
]);
$this->addColumn([
'index' => 'created_at',
'label' => trans('admin::app.datagrid.order-date'),
'type' => 'string',
'type' => 'datetime',
'sortable' => true,
'searchable' => true,
'width' => '100px',
'searchable' => false,
]);
$this->addColumn([
@ -71,8 +67,7 @@ class OrderDataGrid extends DataGrid
'label' => trans('admin::app.datagrid.channel-name'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
'width' => '100px'
'searchable' => true,
]);
$this->addColumn([
@ -80,23 +75,22 @@ class OrderDataGrid extends DataGrid
'label' => trans('admin::app.datagrid.status'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'searchable' => true,
'closure' => true,
'wrapper' => function ($value) {
if ($value == 'processing')
if ($value->status == 'processing')
return '<span class="badge badge-md badge-success">Processing</span>';
else if ($value == 'completed')
else if ($value->status == 'completed')
return '<span class="badge badge-md badge-success">Completed</span>';
else if ($value == "canceled")
else if ($value->status == "canceled")
return '<span class="badge badge-md badge-danger">Canceled</span>';
else if ($value == "closed")
else if ($value->status == "closed")
return '<span class="badge badge-md badge-info">Closed</span>';
else if ($value == "pending")
else if ($value->status == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
else if ($value == "pending_payment")
else if ($value->status == "pending_payment")
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
else if ($value == "fraud")
else if ($value->status == "fraud")
return '<span class="badge badge-md badge-danger">Fraud</span>';
}
]);
@ -105,9 +99,8 @@ class OrderDataGrid extends DataGrid
'index' => 'full_name',
'label' => trans('admin::app.datagrid.billed-to'),
'type' => 'string',
'searchable' => false,
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
@ -118,12 +111,4 @@ class OrderDataGrid extends DataGrid
'icon' => 'icon eye-icon'
]);
}
public function prepareMassActions() {
// $this->addMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.attributes.massdelete'),
// 'method' => 'DELETE'
// ]);
}
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class OrderInvoicesDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -30,25 +34,22 @@ class OrderInvoicesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'order_id',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => false,
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'grand_total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'string',
'type' => 'price',
'searchable' => true,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -57,7 +58,6 @@ class OrderInvoicesDataGrid extends DataGrid
'type' => 'datetime',
'searchable' => true,
'sortable' => true,
'width' => '100px',
]);
}
@ -68,12 +68,4 @@ class OrderInvoicesDataGrid extends DataGrid
'icon' => 'icon eye-icon'
]);
}
public function prepareMassActions() {
// $this->addMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.attributes.massdelete'),
// 'method' => 'DELETE'
// ]);
}
}

View File

@ -13,11 +13,27 @@ use DB;
*/
class OrderShipmentsDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'shipment_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('shipments as ship')->select('ship.id as shipment_id', 'ship.order_id as shipment_order_id', 'ship.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as orderdate', 'ship.created_at as shipment_created_at')->addSelect(DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name) as custname'))->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id');
$queryBuilder = DB::table('shipments as ship')
->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')
->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id')
->select('ship.id as shipment_id', 'ship.order_id as shipment_order_id', 'ship.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as orderdate', 'ship.created_at as shipment_created_at')
->addSelect(DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name) as custname'));
$this->addFilter('shipment_id', 'ship.id');
$this->addFilter('shipment_order_id', 'ship.order_id');
$this->addFilter('shipment_total_qty', 'ship.total_qty');
$this->addFilter('inventory_source_name', 'is.name');
$this->addFilter('orderdate', 'ors.created_at');
$this->addFilter('shipment_created_at', 'ship.created_at');
$this->addFilter('custname', DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name)'));
$this->setQueryBuilder($queryBuilder);
}
@ -30,25 +46,22 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'shipment_order_id',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => false,
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'shipment_total_qty',
'label' => trans('admin::app.datagrid.total-qty'),
'type' => 'number',
'searchable' => true,
'searchable' => false,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -57,7 +70,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -65,8 +77,7 @@ class OrderShipmentsDataGrid extends DataGrid
'label' => trans('admin::app.datagrid.order-date'),
'type' => 'datetime',
'sortable' => true,
'searchable' => true,
'width' => '100px'
'searchable' => false,
]);
$this->addColumn([
@ -75,7 +86,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'datetime',
'sortable' => true,
'searchable' => false,
'width' => '100px'
]);
$this->addColumn([
@ -83,8 +93,7 @@ class OrderShipmentsDataGrid extends DataGrid
'label' => trans('admin::app.datagrid.shipment-to'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
'width' => '100px'
'searchable' => true,
]);
}

View File

@ -13,11 +13,21 @@ use DB;
*/
class ProductDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'product_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('products_grid')->addSelect('products_grid.product_id as product_id', 'products_grid.sku as product_sku', 'products_grid.name as product_name', 'products.type as product_type', 'products_grid.status as product_status', 'products_grid.price as product_price', 'products_grid.quantity as product_quantity')->leftJoin('products', 'products_grid.product_id', '=', 'products.id');
$queryBuilder = DB::table('products_grid as pg')
->leftJoin('products as pr', 'pg.product_id', '=', 'pr.id')
->addSelect('pg.product_id as product_id', 'pg.sku as product_sku', 'pg.name', 'pr.type as product_type', 'pg.status', 'pg.price', 'pg.quantity');
$this->addFilter('product_id', 'pg.product_id');
$this->addFilter('product_sku', 'pg.sku');
$this->addFilter('product_type', 'pr.type');
$this->setQueryBuilder($queryBuilder);
}
@ -30,7 +40,7 @@ class ProductDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
// 'width' => '40px'
]);
$this->addColumn([
@ -39,16 +49,16 @@ class ProductDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
'index' => 'product_name',
'index' => 'name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
@ -57,18 +67,18 @@ class ProductDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
'index' => 'product_status',
'index' => 'status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
// 'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
if ($value->status == 1)
return 'Active';
else
return 'Inactive';
@ -76,24 +86,21 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'product_price',
'index' => 'price',
'label' => trans('admin::app.datagrid.price'),
'type' => 'number',
'type' => 'price',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
return core()->formatBasePrice($value);
}
// 'width' => '100px'
]);
$this->addColumn([
'index' => 'product_quantity',
'index' => 'quantity',
'label' => trans('admin::app.datagrid.qty'),
'type' => 'number',
'sortable' => true,
'searchable' => false,
'width' => '100px'
// 'width' => '100px'
]);
}
@ -110,6 +117,8 @@ class ProductDataGrid extends DataGrid
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon'
]);
$this->enableAction = true;
}
public function prepareMassActions() {
@ -130,5 +139,7 @@ class ProductDataGrid extends DataGrid
'Inactive' => 0
]
]);
$this->enableMassAction = true;
}
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class RolesDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -39,7 +43,6 @@ class RolesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +51,6 @@ class RolesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,11 +13,19 @@ use DB;
*/
class SliderDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'slider_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.id as slider_id', 'sl.title as slider_title', 'ch.name as channel_name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.id as slider_id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=',
'ch.id');
$this->addFilter('slider_id', 'sl.id');
$this->addFilter('channel_name', 'ch.name');
$this->setQueryBuilder($queryBuilder);
}
@ -30,25 +38,22 @@ class SliderDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'slider_title',
'index' => 'title',
'label' => trans('admin::app.datagrid.title'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'channel_name',
'index' => 'name',
'label' => trans('admin::app.datagrid.channel-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
@ -65,22 +70,4 @@ class SliderDataGrid extends DataGrid
'icon' => 'icon trash-icon'
]);
}
public function prepareMassActions() {
// $this->prepareMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.products.massdelete'),
// 'method' => 'DELETE'
// ]);
// $this->prepareMassAction([
// 'type' => 'update',
// 'action' => route('admin.catalog.products.massupdate'),
// 'method' => 'PUT',
// 'options' => [
// 0 => true,
// 1 => false,
// ]
// ]);
}
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class TaxCategoryDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class TaxCategoryDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class TaxCategoryDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +50,6 @@ class TaxCategoryDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,6 +13,10 @@ use DB;
*/
class TaxRateDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id';
public function prepareQueryBuilder()
@ -30,7 +34,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,7 +42,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -48,7 +50,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -57,7 +58,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -66,7 +66,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -13,11 +13,19 @@ use DB;
*/
class UserDataGrid extends DataGrid
{
protected $paginate = true;
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'user_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('admins as u')->addSelect('u.id as user_id', 'u.name as user_name', 'u.status as user_status', 'u.email as user_email', 'ro.name as role_name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id');
$queryBuilder = DB::table('admins as u')->addSelect('u.id as user_id', 'u.name as user_name', 'u.status', 'u.email', 'ro.name as role_name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id');
$this->addFilter('user_id', 'u.id');
$this->addFilter('user_name', 'u.name');
$this->addFilter('role_name', 'ro.name');
$this->setQueryBuilder($queryBuilder);
}
@ -30,7 +38,6 @@ class UserDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -39,18 +46,16 @@ class UserDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'user_status',
'index' => 'status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1) {
if ($value->status == 1) {
return 'Active';
} else {
return 'Inactive';
@ -59,12 +64,19 @@ class UserDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'user_email',
'index' => 'email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'role_name',
'label' => trans('admin::app.datagrid.role'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
]);
}
@ -75,22 +87,4 @@ class UserDataGrid extends DataGrid
'icon' => 'icon pencil-lg-icon'
]);
}
public function prepareMassActions() {
// $this->prepareMassAction([
// 'type' => 'delete',
// 'action' => route('admin.catalog.products.massdelete'),
// 'method' => 'DELETE'
// ]);
// $this->prepareMassAction([
// 'type' => 'update',
// 'action' => route('admin.catalog.products.massupdate'),
// 'method' => 'PUT',
// 'options' => [
// 0 => true,
// 1 => false,
// ]
// ]);
}
}

View File

@ -3,6 +3,7 @@
namespace Webkul\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Category\Database\Seeders\DatabaseSeeder as CategorySeeder;
use Webkul\Attribute\Database\Seeders\DatabaseSeeder as AttributeSeeder;
use Webkul\Core\Database\Seeders\DatabaseSeeder as CoreSeeder;
use Webkul\User\Database\Seeders\DatabaseSeeder as UserSeeder;
@ -18,6 +19,7 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(CategorySeeder::class);
$this->call(CoreSeeder::class);
$this->call(InventorySeeder::class);
$this->call(AttributeSeeder::class);

View File

@ -41,10 +41,21 @@ class DataGridExport implements FromView, ShouldAutoSize
public function view(): View
{
$pagination = false;
$results = [];
$columns = [];
foreach($this->gridData as $key => $data) {
if ($key == 'collection') {
$results = $data['data'];
}
if ($key == 'columns') {
$columns = $data;
}
}
return view('admin::export.export', [
'results' => $this->gridData->render($pagination)->results,
'columns' => $this->gridData->render($pagination)->columns,
'results' => $results,
'columns' => $columns,
]);
}
}

View File

@ -139,7 +139,7 @@ class ConfigurationController extends Controller
Event::fire('core.configuration.save.after');
session()->flash('success', 'Shipping Method is created successfully');
session()->flash('success', trans('admin::app.configuration.save-message'));
return redirect()->back();
}

View File

@ -117,7 +117,7 @@ class CustomerController extends Controller
$this->customer->create($data);
session()->flash('success', trans('admin::app.customers.customers.created'));
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer']));
return redirect()->route($this->_config['redirect']);
}
@ -160,7 +160,7 @@ class CustomerController extends Controller
$this->customer->update(request()->all(),$id);
session()->flash('success', trans('admin::app.customers.customers.updated'));
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));
return redirect()->route($this->_config['redirect']);
}
@ -175,7 +175,7 @@ class CustomerController extends Controller
{
$this->customer->delete($id);
session()->flash('success', trans('admin::app.customers.customers.deleted'));
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer']));
return redirect()->back();
}

View File

@ -81,7 +81,7 @@ class CustomerGroupController extends Controller
$this->customerGroup->create($data);
session()->flash('success', trans('admin::app.customers.customers.group-created'));
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
return redirect()->route($this->_config['redirect']);
}
@ -114,7 +114,7 @@ class CustomerGroupController extends Controller
$this->customerGroup->update(request()->all(),$id);
session()->flash('success', trans('admin::app.customers.customers.group-updated'));
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer Group']));
return redirect()->route($this->_config['redirect']);
}
@ -132,7 +132,7 @@ class CustomerGroupController extends Controller
if ($group->is_user_defined == 0) {
session()->flash('warning', trans('admin::app.customers.customers.group-default'));
} else {
session()->flash('success', trans('admin::app.customers.customers.group-deleted'));
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer Group']));
$this->customerGroup->delete($id);
}

View File

@ -32,9 +32,13 @@ class ExportController extends Controller
*/
public function export()
{
$results = unserialize(request()->all()['gridData']);
$results = request()->all()['gridData'];
$file_name = class_basename($results);
$data = json_decode($results, true);
$results = (object) $data;
$file_name = request()->all()['file_name'];
if (request()->all()['format'] == 'csv') {
return Excel::download(new DataGridExport($results), $file_name.'.csv');

View File

@ -157,12 +157,11 @@ class ShipmentController extends Controller
? $orderItem->child->product
: $orderItem->product;
$inventory = $product->inventories()
$availableQty = $product->inventories()
->where('inventory_source_id', $data['shipment']['source'])
->where('vendor_id', 0)
->first();
->sum('qty');
if ($orderItem->qty_to_ship < $qty || $inventory->qty < $qty) {
if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) {
return false;
}

View File

@ -266,6 +266,6 @@ class Product {
}
public function findRepeated() {
//find if there is duplicacy in the products grid here
}
}

View File

@ -16,9 +16,9 @@ class EventServiceProvider extends ServiceProvider
{
Event::listen('checkout.order.save.after', 'Webkul\Admin\Listeners\Order@sendNewOrderMail');
Event::listen('checkout.invoice.save.after', 'Webkul\Admin\Listeners\Order@sendNewInvoiceMail');
Event::listen('sales.invoice.save.after', 'Webkul\Admin\Listeners\Order@sendNewInvoiceMail');
Event::listen('checkout.invoice.save.after', 'Webkul\Admin\Listeners\Order@sendNewShipmentMail');
Event::listen('sales.shipment.save.after', 'Webkul\Admin\Listeners\Order@sendNewShipmentMail');
Event::listen('checkout.order.save.after', 'Webkul\Admin\Listeners\Order@updateProductInventory');

View File

@ -5,6 +5,8 @@ require("./bootstrap");
Vue.use(VeeValidate);
window.eventBus = new Vue();
$(document).ready(function () {
Vue.config.ignoredElements = [
'option-wrapper',

View File

@ -69,7 +69,7 @@ return [
'sliders' => 'Sliders',
'taxes' => 'Taxes',
'tax-categories' => 'Tax Categories',
'tax-rates' => 'Tax Rates'
'tax-rates' => 'Tax Rates',
],
'dashboard' => [
@ -143,7 +143,9 @@ return [
'identifier' => 'Identifier',
'state' => 'State',
'country' => 'Country',
'tax-rate' => 'Rate'
'tax-rate' => 'Rate',
'role' => 'Role',
'sub-total' => 'Sub Total'
],
'account' => [
@ -212,7 +214,7 @@ return [
'confirm-delete-title' => 'Confirm password before delete',
'delete-last' => 'At least one admin is required.',
'delete-success' => 'Success! User deleted',
'incorrect-password' => 'The password you entered is incorrect'
'incorrect-password' => 'The password you entered is incorrect',
],
'sessions' => [
@ -443,6 +445,7 @@ return [
'configuration' => [
'title' => 'Configuration',
'save-btn-title' => 'Save',
'save-message' => 'Configuration saved successfully',
'tax-categories' => [
'title' => 'Tax Categories',
@ -683,12 +686,6 @@ return [
'male' => 'Male',
'female' => 'Female',
'phone' => 'Phone',
'created' => 'Customer created successfully.',
'updated' => 'Customer updated successfully.',
'deleted' => 'Customer deleted successfully.',
'group-created' => 'Customer Group created successfully.',
'group-updated' => 'Customer Group updated successfully.',
'group-deleted' => 'Customer Group deleted successfully.',
'group-default' => 'Cannot delete the default group.',
],
'reviews' => [
@ -749,5 +746,15 @@ return [
'download' => 'Download',
'csv' => 'CSV',
'xls' => 'XLS'
]
],
'response' => [
'create-success' => ':name created successfully.',
'update-success' => ':name updated successfully.',
'delete-success' => ':name deleted successfully.',
'last-delete-error' => 'At least one :name is required.',
'user-define-error' => 'Can not delete system :name',
'attribute-error' => ':name is used in configurable products.',
'attribute-product-error' => ':name is used in products.'
],
];

View File

@ -21,20 +21,20 @@
</div>
<div class="page-content">
<div class="form-container">
@csrf()
<input name="_method" type="hidden" value="PUT">
<accordian :title="'{{ __('admin::app.catalog.families.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<input type="text" v-validate="'required'" name="code" class="control" id="code" value="{{ $attributeFamily->code }}" disabled="disabled" data-vv-as="&quot;{{ __('admin::app.catalog.families.code') }}&quot;" v-code/>
<input type="hidden" name="code" value="{{ $attributeFamily->code }}"/>
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
</div>
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.catalog.families.name') }}</label>
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $attributeFamily->name }}" data-vv-as="&quot;{{ __('admin::app.catalog.families.name') }}&quot;"/>
@ -173,7 +173,7 @@
</div>
</accordian>
</script>
<script>
var groups = @json($attributeFamily->attribute_groups);
var custom_attributes = @json($custom_attributes);
@ -215,7 +215,7 @@
groups.push(this.group);
groups = this.sortGroups();
this.group = {'groupName': '', 'position': '', 'custom_attributes': []};
this.$parent.closeModal();
@ -272,7 +272,7 @@
addAttributes (groupIndex, attributeIds) {
attributeIds.forEach(function(attributeId) {
var attribute = this.custom_attributes.filter(attribute => attribute.id == attributeId)
this.groups[groupIndex].custom_attributes.push(attribute[0]);
let index = this.custom_attributes.indexOf(attribute[0])
@ -323,7 +323,7 @@
$(e.target).prev().find('li input').each(function() {
var attributeId = $(this).val();
if ($(this).is(':checked')) {
attributeIds.push(attributeId);
@ -342,4 +342,4 @@
}
});
</script>
@endpush
@endpush

View File

@ -7,7 +7,7 @@
$qty = 0;
foreach ($product->inventories as $inventory) {
if ($inventory->inventory_source_id == $inventorySource->id && ! $inventory->vendor_id) {
if ($inventory->inventory_source_id == $inventorySource->id) {
$qty = $inventory->qty;
break;
}

View File

@ -325,7 +325,7 @@
sourceInventoryQty (inventorySourceId) {
var inventories = this.variant.inventories.filter(function(inventory) {
return inventorySourceId === inventory.inventory_source_id && !inventory.vendor_id;
return inventorySourceId === inventory.inventory_source_id;
})
if (inventories.length)

View File

@ -21,7 +21,6 @@
$class = app(current($temp));
$method = end($temp);
$value = $class->$method();
$selectedOption = core()->getConfigData($name) ?? '';
}
$channel_locale = [];
@ -40,7 +39,7 @@
<label for="{{ $name }}" {{ !isset($field['validation']) || strpos('required', $field['validation']) < 0 ? '' : 'class=required' }}>
{{ $field['title'] }}
{{ trans($field['title']) }}
@if (count($channel_locale))
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
@ -60,11 +59,17 @@
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" data-vv-as="&quot;{{ $field['name'] }}&quot;" >
<?php
$selectedOption = core()->getConfigData($name) ?? '';
?>
@if (isset($field['repository']))
@foreach ($value as $option)
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
{{ $option['name'] }}
@foreach ($value as $key => $option)
<option value="{{ $value[$key] }}" {{ $value[$key] == $selectedOption ? 'selected' : ''}}>
{{ trans($value[$key]) }}
</option>
@endforeach
@else
@foreach ($field['options'] as $option)
@ -74,12 +79,10 @@
} else {
$value = $option['value'];
}
$selectedOption = core()->getConfigData($name) ?? '';
?>
<option value="{{ $value }}" {{ $value == $selectedOption ? 'selected' : ''}}>
{{ $option['title'] }}
{{ trans($option['title']) }}
</option>
@endforeach
@endif
@ -90,23 +93,33 @@
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}][]" data-vv-as="&quot;{{ $field['name'] }}&quot;" multiple>
@foreach ($field['options'] as $option)
<?php
$selectedOption = core()->getConfigData($name) ?? '';
?>
<?php
if ($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
}
@if (isset($field['repository']))
@foreach ($value as $key => $option)
$selectedOption = core()->getConfigData($name) ?? '';
?>
<option value="{{ $value[$key] }}" {{ in_array($value[$key], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ trans($value[$key]) }}
</option>
<option value="{{ $value }}" {{ in_array($option['value'], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
@endforeach
@else
@foreach ($field['options'] as $option)
<?php
if ($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
}
?>
@endforeach
<option value="{{ $value }}" {{ in_array($option['value'], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
@endforeach
@endif
</select>

View File

@ -12,12 +12,12 @@
<h1>{{ __('admin::app.customers.customers.title') }}</h1>
</div>
<div class="page-action">
{{-- <div class="export" @click="showModal('downloadDataGrid')">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span >
{{ __('admin::app.export.export') }}
</span>
</div> --}}
</div>
<a href="{{ route('admin.customer.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.customers.add-title') }}
@ -25,32 +25,36 @@
</div>
</div>
<div class="page-content">
@inject('customer','Webkul\Admin\DataGrids\CustomerDataGrid')
{!! $customer->render() !!}
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<input type="hidden" name="gridData" value="{{serialize($customer)}}">
<?php
$data = json_encode((array) $customer);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Customer">
<div class="control-group">
<label for="format" class="required">
@ -81,7 +85,7 @@
}
}
});
</script> --}}
</script>
@endpush

View File

@ -2,7 +2,7 @@
<thead>
<tr>
@foreach ($columns as $column)
<th>{{ $column->label }}</th>
<th>{{ $column['label'] }}</th>
@endforeach
</tr>
</thead>
@ -10,7 +10,7 @@
@foreach ($results as $result)
<tr>
@foreach ($columns as $column)
<td class="">{!! $column->render($result) !!}</td>
<td class="">{{ $result[$column['index']] }} </td>
@endforeach
</tr>
@endforeach

View File

@ -11,14 +11,14 @@
<h1>{{ __('admin::app.sales.invoices.title') }}</h1>
</div>
{{-- <div class="page-action">
<div class="page-action">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span>
{{ __('admin::app.export.export') }}
</span>
</div>
</div> --}}
</div>
</div>
<div class="page-content">
@ -27,25 +27,30 @@
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<input type="hidden" name="gridData" value="{{serialize($orderInvoicesGrid)}}">
<?php
$data = json_encode((array) $orderInvoicesGrid);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Invoice">
<div class="control-group">
<label for="format" class="required">
@ -76,6 +81,6 @@
}
}
});
</script> --}}
</script>
@endpush

View File

@ -11,14 +11,14 @@
<h1>{{ __('admin::app.sales.orders.title') }}</h1>
</div>
{{-- <div class="page-action">
<div class="page-action">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span>
{{ __('admin::app.export.export') }}
</span>
</div>
</div> --}}
</div>
</div>
<div class="page-content">
@ -27,25 +27,30 @@
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<input type="hidden" name="gridData" value="{{serialize($orderGrid)}}">
<?php
$data = json_encode((array) $orderGrid);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Order">
<div class="control-group">
<label for="format" class="required">
@ -65,7 +70,7 @@
</button>
</form>
</script> --}}
</script>
<script>
Vue.component('export-form', {

View File

@ -312,9 +312,8 @@
$product = $item->type == 'configurable' ? $item->child->product : $item->product;
foreach ($product->inventories as $inventory) {
if ($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
$sourceQty = $inventory->qty;
break;
if ($inventory->inventory_source_id == $inventorySource->id) {
$sourceQty += $inventory->qty;
}
}
?>

View File

@ -11,14 +11,14 @@
<h1>{{ __('admin::app.sales.shipments.title') }}</h1>
</div>
{{-- <div class="page-action">
<div class="page-action">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span>
{{ __('admin::app.export.export') }}
</span>
</div>
</div> --}}
</div>
</div>
<div class="page-content">
@ -27,25 +27,30 @@
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<input type="hidden" name="gridData" value="{{serialize($orderShipmentsGrid)}}">
<?php
$data = json_encode((array) $orderShipmentsGrid);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Shipment">
<div class="control-group">
<label for="format" class="required">
@ -76,6 +81,6 @@
}
}
});
</script> --}}
</script>
@endpush

View File

@ -5,7 +5,7 @@ namespace Webkul\Attribute\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
use Event;
/**
* Catalog attribute controller
@ -77,6 +77,8 @@ class AttributeController extends Controller
$attribute = $this->attribute->create(request()->all());
Event::fire('after.attribute.created', $attribute);
session()->flash('success', 'Attribute created successfully.');
return redirect()->route($this->_config['redirect']);
@ -112,6 +114,8 @@ class AttributeController extends Controller
$attribute = $this->attribute->update(request()->all(), $id);
Event::fire('after.attribute.updated', $attribute);
session()->flash('success', 'Attribute updated successfully.');
return redirect()->route($this->_config['redirect']);
@ -127,15 +131,17 @@ class AttributeController extends Controller
{
$attribute = $this->attribute->findOrFail($id);
if (!$attribute->is_user_defined) {
session()->flash('error', 'Can not delete system attribute.');
if(!$attribute->is_user_defined) {
session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'attribute']));
} else {
try {
$this->attribute->delete($id);
session()->flash('success', 'Attribute deleted successfully.');
Event::fire(after.attribute.deleted, $attribute);
} catch(\Exception $e) {
session()->flash('error', 'Attribute is used in configurable products.');
session()->flash('error', trans('admin::app.response.attribute-error', ['name' => 'Attribute']));
}
}

View File

@ -82,7 +82,7 @@ class AttributeFamilyController extends Controller
$attributeFamily = $this->attributeFamily->create(request()->all());
session()->flash('success', 'Family created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Family']));
return redirect()->route($this->_config['redirect']);
}
@ -119,7 +119,7 @@ class AttributeFamilyController extends Controller
$attributeFamily = $this->attributeFamily->update(request()->all(), $id);
session()->flash('success', 'Family updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Family']));
return redirect()->route($this->_config['redirect']);
}
@ -135,13 +135,13 @@ class AttributeFamilyController extends Controller
$attributeFamily = $this->attributeFamily->find($id);
if ($this->attributeFamily->count() == 1) {
session()->flash('error', 'At least one family is required.');
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Family']));
} else if ($attributeFamily->products()->count()) {
session()->flash('error', 'Attribute family is used in products.');
session()->flash('error', trans('admin::app.response.attribute-product-error', ['name' => 'Attribute family']));
} else {
$this->attributeFamily->delete($id);
session()->flash('success', 'Family deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Family']));
}
return redirect()->back();

View File

@ -15,23 +15,11 @@ class CategoryTableSeeder extends Seeder
$now = Carbon::now();
DB::table('categories')->insert([
['id' => '1','position' => '1','image' => NULL,'status' => '1','_lft' => '1','_rgt' => '14','parent_id' => NULL, 'created_at' => $now, 'updated_at' => $now],
['id' => '2','position' => '1','image' => NULL,'status' => '1','_lft' => '2','_rgt' => '7','parent_id' => '1', 'created_at' => $now, 'updated_at' => $now],
['id' => '3','position' => '2','image' => NULL,'status' => '1','_lft' => '8','_rgt' => '13','parent_id' => '1', 'created_at' => $now, 'updated_at' => $now],
['id' => '4','position' => '1','image' => NULL,'status' => '1','_lft' => '5','_rgt' => '6','parent_id' => '2', 'created_at' => $now, 'updated_at' => $now],
['id' => '5','position' => '2','image' => NULL,'status' => '1','_lft' => '3','_rgt' => '4','parent_id' => '2', 'created_at' => $now, 'updated_at' => $now],
['id' => '6','position' => '1','image' => NULL,'status' => '1','_lft' => '9','_rgt' => '10','parent_id' => '3', 'created_at' => $now, 'updated_at' => $now],
['id' => '7','position' => '2','image' => NULL,'status' => '1','_lft' => '11','_rgt' => '12','parent_id' => '3', 'created_at' => $now, 'updated_at' => $now]
['id' => '1','position' => '1','image' => NULL,'status' => '1','_lft' => '1','_rgt' => '14','parent_id' => NULL, 'created_at' => $now, 'updated_at' => $now]
]);
DB::table('category_translations')->insert([
['id' => '1','name' => 'Root','slug' => 'root','description' => 'Root','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '1','locale' => 'en'],
['id' => '2','name' => 'Women','slug' => 'women','description' => 'Women','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '2','locale' => 'en'],
['id' => '3','name' => 'Men','slug' => 'men','description' => 'Men','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '3','locale' => 'en'],
['id' => '4','name' => 'Tops','slug' => 'tops-women','description' => 'Tops','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '4','locale' => 'en'],
['id' => '5','name' => 'Bottoms','slug' => 'bottoms-women','description' => 'Bottoms','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '5','locale' => 'en'],
['id' => '6','name' => 'Tops','slug' => 'tops-men','description' => 'Tops','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '6','locale' => 'en'],
['id' => '7','name' => 'Bottoms','slug' => 'bottoms-men','description' => 'Bottoms','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '7','locale' => 'en']
['id' => '1','name' => 'Root','slug' => 'root','description' => 'Root','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '1','locale' => 'en']
]);
}
}

View File

@ -78,7 +78,7 @@ class CategoryController extends Controller
$category = $this->category->create(request()->all());
session()->flash('success', 'Category created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Category']));
return redirect()->route($this->_config['redirect']);
}
@ -121,7 +121,7 @@ class CategoryController extends Controller
$this->category->update(request()->all(), $id);
session()->flash('success', 'Category updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Category']));
return redirect()->route($this->_config['redirect']);
}
@ -140,7 +140,7 @@ class CategoryController extends Controller
Event::fire('catalog.category.delete.after', $id);
session()->flash('success', 'Category deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Category']));
return redirect()->back();
}

View File

@ -15,6 +15,7 @@ class ChannelTableSeeder extends Seeder
'id' => 1,
'code' => 'default',
'name' => 'Default',
'root_category_id' => 1,
'home_page_content' => '<p>@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")</p><div style="width: 100%; float: left; padding: 0 18px; margin-bottom: 40px;"><div style="width: 60%; float: left;"><img src="themes/default/assets/images/1.png" /></div><div style="width: 40%; float: left;"><img src="themes/default/assets/images/2.png" /> <img style="margin-top: 36px;" src="themes/default/assets/images/3.png" /></div></div>',
'footer_content' => '<div class="list-container"><span class="list-heading">Quick Links</span><ul class="list-group"><li><a href="#">About Us</a></li><li><a href="#">Return Policy</a></li><li><a href="#">Refund Policy</a></li><li><a href="#">Terms and conditions</a></li><li><a href="#">Terms of Use</a></li><li><a href="#">Contact Us</a></li></ul></div><div class="list-container"><span class="list-heading">Connect With Us</span><ul class="list-group"><li><a href="#"><span class="icon icon-facebook"></span>Facebook </a></li><li><a href="#"><span class="icon icon-twitter"></span> Twitter </a></li><li><a href="#"><span class="icon icon-instagram"></span> Instagram </a></li><li><a href="#"> <span class="icon icon-google-plus"></span>Google+ </a></li><li><a href="#"> <span class="icon icon-linkedin"></span>LinkedIn </a></li></ul></div>',
'name' => 'Default',

View File

@ -88,7 +88,7 @@ class ChannelController extends Controller
Event::fire('core.channel.create.after', $channel);
session()->flash('success', 'Channel created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Channel']));
return redirect()->route($this->_config['redirect']);
}
@ -134,7 +134,7 @@ class ChannelController extends Controller
Event::fire('core.channel.update.after', $channel);
session()->flash('success', 'Channel updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Channel']));
return redirect()->route($this->_config['redirect']);
}
@ -156,7 +156,7 @@ class ChannelController extends Controller
Event::fire('core.channel.delete.after', $id);
session()->flash('success', 'Channel deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Channel']));
}
return redirect()->back();

View File

@ -81,7 +81,7 @@ class CurrencyController extends Controller
Event::fire('core.currency.create.after', $currency);
session()->flash('success', 'Currency created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Currency']));
return redirect()->route($this->_config['redirect']);
}
@ -119,7 +119,7 @@ class CurrencyController extends Controller
Event::fire('core.currency.update.after', $currency);
session()->flash('success', 'Currency updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Currency']));
return redirect()->route($this->_config['redirect']);
}
@ -139,10 +139,10 @@ class CurrencyController extends Controller
Event::fire('core.currency.delete.after', $id);
if ($result)
session()->flash('success', 'Currency deleted successfully.');
if($result)
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Currency']));
else
session()->flash('error', 'At least one currency is required.');
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Currency']));
} catch (\Exception $e) {
session()->flash('error', $e->getMessage());
}

View File

@ -94,7 +94,7 @@ class ExchangeRateController extends Controller
Event::fire('core.exchange_rate.create.after', $exchangeRate);
session()->flash('success', 'Exchange rate created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Exchange rate']));
return redirect()->route($this->_config['redirect']);
}
@ -134,7 +134,7 @@ class ExchangeRateController extends Controller
Event::fire('core.exchange_rate.update.after', $exchangeRate);
session()->flash('success', 'Exchange rate updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Exchange rate']));
return redirect()->route($this->_config['redirect']);
}
@ -147,8 +147,8 @@ class ExchangeRateController extends Controller
*/
public function destroy($id)
{
if ($this->exchangeRate->count() == 1) {
session()->flash('error', 'At least one Exchange rate is required.');
if($this->exchangeRate->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Exchange rate']));
} else {
Event::fire('core.exchange_rate.delete.before', $id);
@ -156,7 +156,7 @@ class ExchangeRateController extends Controller
Event::fire('core.exchange_rate.delete.after', $id);
session()->flash('success', 'Exchange rate deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Exchange rate']));
}
return redirect()->back();

View File

@ -81,7 +81,7 @@ class LocaleController extends Controller
Event::fire('core.locale.create.after', $locale);
session()->flash('success', 'Locale created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Locale']));
return redirect()->route($this->_config['redirect']);
}
@ -119,7 +119,7 @@ class LocaleController extends Controller
Event::fire('core.locale.update.after', $locale);
session()->flash('success', 'Locale updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Locale']));
return redirect()->route($this->_config['redirect']);
}
@ -132,8 +132,8 @@ class LocaleController extends Controller
*/
public function destroy($id)
{
if ($this->locale->count() == 1) {
session()->flash('error', 'At least one locale is required.');
if($this->locale->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Locale']));
} else {
Event::fire('core.locale.delete.before', $id);
@ -141,7 +141,7 @@ class LocaleController extends Controller
Event::fire('core.locale.delete.after', $id);
session()->flash('success', 'Locale deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Locale']));
}
return redirect()->back();

View File

@ -88,12 +88,12 @@ class AddressController extends Controller
$data['default_address'] = 1;
}
if ($this->address->create($data)) {
session()->flash('success', 'Address have been successfully added.');
if($this->address->create($data)) {
session()->flash('success', trans('shop::app.customer.account.address.create.success'));
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Address cannot be added.');
session()->flash('error', trans('shop::app.customer.account.address.create.error'));
return redirect()->back();
}
@ -131,7 +131,7 @@ class AddressController extends Controller
$this->address->update($data, $id);
Session()->flash('success','Address Updated Successfully.');
session()->flash('success', trans('shop::app.customer.account.address.edit.success'));
return redirect()->route('customer.address.index');
}
@ -150,7 +150,7 @@ class AddressController extends Controller
if ($address = $this->address->find($id)) {
$address->update(['default_address' => 1]);
} else {
session()->flash('success', 'Default Cannot Be Address Changed');
session()->flash('success', trans('shop::app.customer.account.address.index.default-delete'));
}
return redirect()->back();
@ -167,7 +167,7 @@ class AddressController extends Controller
{
$this->address->delete($id);
session()->flash('success', trans('shop::app.address.delete.success'));
session()->flash('success', trans('shop::app.customer.account.address.delete.success'));
return redirect()->back();
}

View File

@ -21,7 +21,7 @@ class InventorySourceController extends Controller
* @var array
*/
protected $_config;
/**
* InventorySourceRepository object
*
@ -92,7 +92,7 @@ class InventorySourceController extends Controller
Event::fire('inventory.inventory_source.create.after', $inventorySource);
session()->flash('success', 'Inventory source created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Inventory source']));
return redirect()->route($this->_config['redirect']);
}
@ -142,7 +142,7 @@ class InventorySourceController extends Controller
Event::fire('inventory.inventory_source.update.after', $inventorySource);
session()->flash('success', 'Inventory source updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Inventory source']));
return redirect()->route($this->_config['redirect']);
}
@ -155,8 +155,8 @@ class InventorySourceController extends Controller
*/
public function destroy($id)
{
if ($this->inventorySource->count() == 1) {
session()->flash('error', 'At least one inventory source is required.');
if($this->inventorySource->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Inventory source']));
} else {
Event::fire('inventory.inventory_source.delete.before', $id);
@ -164,7 +164,7 @@ class InventorySourceController extends Controller
Event::fire('inventory.inventory_source.delete.after', $id);
session()->flash('success', 'Inventory source deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Inventory source']));
}
return redirect()->back();

View File

@ -111,6 +111,8 @@ class ProductController extends Controller
{
$families = $this->attributeFamily->all();
$configurableFamily = null;
if ($familyId = request()->get('family')) {
$configurableFamily = $this->attributeFamily->find($familyId);
}
@ -143,7 +145,7 @@ class ProductController extends Controller
$product = $this->product->create(request()->all());
session()->flash('success', 'Product created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Product']));
return redirect()->route($this->_config['redirect'], ['id' => $product->id]);
}
@ -176,7 +178,7 @@ class ProductController extends Controller
{
$product = $this->product->update(request()->all(), $id);
session()->flash('success', 'Product updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Product']));
return redirect()->route($this->_config['redirect']);
}
@ -191,7 +193,7 @@ class ProductController extends Controller
{
$this->product->delete($id);
session()->flash('success', 'Product deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Product']));
return redirect()->back();
}

View File

@ -0,0 +1,45 @@
<?php
namespace Webkul\Product\Listeners;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
/**
* Products Flat Event handler
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ProductsFlat
{
/**
* After the attribute is created
*
* @return void
*/
public function afterAttributeCreated($attribute)
{
return true;
dd('after attribute is created');
}
/**
* After the attribute is updated
*
* @return void
*/
public function afterAttributeUpdated($attribute)
{
return true;
dd('after attribute is updated', $attribute);
}
public function afterAttributeDeleted()
{
return true;
dd('after attribute is deleted');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Webkul\Product\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
Event::listen('after.attribute.updated', 'Webkul\Product\Listeners\ProductsFlat@afterAttributeUpdated');
Event::listen('after.attribute.created', 'Webkul\Product\Listeners\ProductsFlat@afterAttributeCreated');
Event::listen('after.attribute.deleted', 'Webkul\Product\Listeners\ProductsFlat@afterAttributeDeleted');
}
}

View File

@ -3,6 +3,7 @@
namespace Webkul\Product\Providers;
use Illuminate\Support\ServiceProvider;
use Webkul\Product\Providers\EventServiceProvider;
use Illuminate\Routing\Router;
use Webkul\Product\Models\Product;
@ -16,6 +17,8 @@ class ProductServiceProvider extends ServiceProvider
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app->register(EventServiceProvider::class);
}
/**

View File

@ -18,7 +18,7 @@ class CreateOrderPaymentTable extends Migration
$table->string('method');
$table->string('method_title')->nullable();
$table->integer('order_id')->nullable()->unsigned();
$table->foreign('order_id')->references('id')->on('orders');
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -121,6 +121,8 @@ class OrderRepository extends Repository
if (! $order->canCancel())
return false;
Event::fire('sales.order.cancel.before', $order);
foreach ($order->items as $item) {
if ($item->qty_to_cancel) {
$this->orderItem->returnQtyToProductInventory($item);
@ -133,6 +135,8 @@ class OrderRepository extends Repository
$this->updateOrderStatus($order);
Event::fire('sales.order.cancel.after', $order);
return true;
}

View File

@ -29,6 +29,9 @@ class ShipmentItemRepository extends Repository
*/
public function updateProductInventory($data)
{
if (! $data['product'])
return;
$orderedInventory = $data['product']->ordered_inventories()
->where('channel_id', $data['shipment']->order->channel->id)
->first();
@ -54,6 +57,9 @@ class ShipmentItemRepository extends Repository
->where('inventory_source_id', $data['shipment']->inventory_source_id)
->first();
if (!$inventory)
return;
if (($qty = $inventory->qty - $data['qty']) < 0) {
$qty = 0;
}

View File

@ -106,6 +106,9 @@ class ShipmentRepository extends Repository
$orderItem = $this->orderItem->find($itemId);
if ($qty > $orderItem->qty_to_ship)
$qty = $orderItem->qty_to_ship;
$totalQty += $qty;
$shipmentItem = $this->shipmentItem->create([

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=dc2ea56a854d779e7089",
"/css/shop.css": "/css/shop.css?id=7a0ee09c1b127c0490e0"
"/js/shop.js": "/js/shop.js?id=e25827d4b84cbe5d76fb",
"/css/shop.css": "/css/shop.css?id=064ee767a010fa58727e"
}

View File

@ -89,21 +89,28 @@ class CartController extends Controller
*/
public function add($id)
{
Event::fire('checkout.cart.add.before', $id);
try {
Event::fire('checkout.cart.add.before', $id);
$result = Cart::add($id, request()->except('_token'));
$result = Cart::add($id, request()->except('_token'));
Event::fire('checkout.cart.add.after', $result);
Event::fire('checkout.cart.add.after', $result);
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
} else {
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
} else {
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
}
Cart::collectTotals();
return redirect()->route($this->_config['redirect']);
} catch(\Exception $e) {
session()->flash('error', trans($e->getMessage()));
return redirect()->back();
}
Cart::collectTotals();
return redirect()->back();
}
/**
@ -176,10 +183,15 @@ class CartController extends Controller
public function buyNow($id)
{
Event::fire('checkout.cart.add.before', $id);
$result = Cart::proceedToBuyNow($id);
Event::fire('checkout.cart.add.after', $result);
Cart::collectTotals();
if (! $result) {
return redirect()->back();
} else {

View File

@ -92,7 +92,7 @@ class ReviewController extends Controller
$this->productReview->create($data);
session()->flash('success', 'Review submitted successfully.');
session()->flash('success', trans('shop::app.response.submit-success', ['name' => 'Product Review']));
return redirect()->route($this->_config['redirect']);
}
@ -119,7 +119,7 @@ class ReviewController extends Controller
{
$this->productReview->delete($id);
session()->flash('success', 'Product Review Successfully Deleted');
session()->flash('success', trans('shop::app.response.delete-success', ['name' => 'Product Review']));
return redirect()->back();
}

View File

@ -41,7 +41,9 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
])->name('shop.checkout.cart.index');
//Cart Items Add
Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->name('cart.add');
Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->defaults('_config',[
'redirect' => 'shop.checkout.cart.index'
])->name('cart.add');
//Cart Items Add Configurable for more
Route::get('checkout/cart/addconfigurable/{slug}', 'Webkul\Shop\Http\Controllers\CartController@addConfigurable')->name('cart.add.configurable');

View File

@ -7,6 +7,8 @@ require("./bootstrap");
Vue.use(VeeValidate);
Vue.prototype.$http = axios
window.eventBus = new Vue();
Vue.component("category-nav", require("./components/category-nav.vue"));
Vue.component("category-item", require("./components/category-item.vue"));
Vue.component("image-slider", require("./components/image-slider.vue"));

View File

@ -3068,36 +3068,9 @@ section.review {
.account-items-list , .edit-form {
margin-top: 20px;
.table {
display: none;
}
.responsive-empty {
display: block;
}
.responsive-table {
border: 1px solid $border-color;
margin-top: 5px;
width: 100%;
display: block;
tbody td {
padding: 8px 5px;
&:first-child {
width: 25%;
}
&:last-child {
padding-left: 10px;
}
}
}
}
.account-items-list.table {
display: none;
}
.control-group .control {
@ -3217,29 +3190,6 @@ section.review {
}
}
.table{
display: none;
}
.responsive-table {
border: 1px solid $border-color;
margin-top: 5px;
width: 100%;
display: block;
tbody td {
padding: 8px 5px;
&:first-child {
width: 35%;
}
&:last-child {
padding-left: 10px;
}
}
}
.totals {
.sale-summary {
width: 100%;

View File

@ -191,7 +191,8 @@ return [
'make-default' => 'Make Default',
'default' => 'Default',
'contact' => 'Contact',
'confirm-delete' => 'Do you really want to delete this address?'
'confirm-delete' => 'Do you really want to delete this address?',
'default-delete' => 'Default Address Cannot Be Changed'
],
'create' => [
@ -205,13 +206,16 @@ return [
'city' => 'City',
'postcode' => 'Postal Code',
'phone' => 'Phone',
'submit' => 'Save Address'
'submit' => 'Save Address',
'success' => 'Address have been successfully added.',
'error' => 'Address cannot be added.'
],
'edit' => [
'page-title' => 'Customer - Edit Address',
'title' => 'Edit Address',
'submit' => 'Save Address'
'submit' => 'Save Address',
'success' => 'Address Updated Successfully.'
],
'delete' => [
'success' => 'Address Successfully Deleted',
@ -480,5 +484,12 @@ return [
'webkul' => [
'copy-right' => '© Copyright 2018 Webkul Software, All rights reserved'
]
],
'response' => [
'create-success' => ':name created successfully.',
'update-success' => ':name updated successfully.',
'delete-success' => ':name deleted successfully.',
'submit-success' => ':name submitted successfully.'
],
];

View File

@ -33,16 +33,28 @@
<div class="item-details">
{!! view_render_event('bagisto.shop.checkout.cart.item.name.before', ['item' => $item]) !!}
<div class="item-title">
<a href="{{ url()->to('/').'/products/'.$item->product->url_key }}">
{{ $item->product->name }}
</a>
</div>
{!! view_render_event('bagisto.shop.checkout.cart.item.name.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart.item.price.before', ['item' => $item]) !!}
<div class="price">
{{ core()->currency($item->base_price) }}
</div>
{!! view_render_event('bagisto.shop.checkout.cart.item.price.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart.item.options.before', ['item' => $item]) !!}
@if ($item->type == 'configurable')
<div class="summary">
@ -51,6 +63,12 @@
</div>
@endif
{!! view_render_event('bagisto.shop.checkout.cart.item.options.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart.item.quantity.before', ['item' => $item]) !!}
<div class="misc">
<div class="control-group" :class="[errors.has('qty[{{$item->id}}]') ? 'has-error' : '']">
<div class="wrap">
@ -76,6 +94,8 @@
@endauth
</div>
{!! view_render_event('bagisto.shop.checkout.cart.item.quantity.after', ['item' => $item]) !!}
@if (! cart()->isItemHaveQuantity($item))
<div class="error-message mt-15">
* {{ __('shop::app.checkout.cart.quantity-error') }}
@ -87,6 +107,8 @@
@endforeach
</div>
{!! view_render_event('bagisto.shop.checkout.cart.controls.after', ['cart' => $cart]) !!}
<div class="misc-controls">
<a href="{{ route('shop.home.index') }}" class="link">{{ __('shop::app.checkout.cart.continue-shopping') }}</a>
@ -102,11 +124,17 @@
@endif
</div>
</div>
{!! view_render_event('bagisto.shop.checkout.cart.controls.after', ['cart' => $cart]) !!}
</form>
</div>
<div class="right-side">
{!! view_render_event('bagisto.shop.checkout.cart.summary.after', ['cart' => $cart]) !!}
@include('shop::checkout.total.summary', ['cart' => $cart])
{!! view_render_event('bagisto.shop.checkout.cart.summary.after', ['cart' => $cart]) !!}
</div>
</div>

View File

@ -22,42 +22,63 @@
<div class="dropdown-header">
<p class="heading">
{{ __('shop::app.checkout.cart.cart-subtotal') }} -
{!! view_render_event('bagisto.shop.checkout.cart-mini.subtotal.before', ['cart' => $cart]) !!}
{{ core()->currency($cart->base_sub_total) }}
{!! view_render_event('bagisto.shop.checkout.cart-mini.subtotal.after', ['cart' => $cart]) !!}
</p>
</div>
<div class="dropdown-content">
@foreach ($items as $item)
{{-- @if ($item->type == "configurable") --}}
<div class="item">
<div class="item-image" >
<?php
if ($item->type == "configurable")
$images = $productImageHelper->getProductBaseImage($item->child->product);
else
$images = $productImageHelper->getProductBaseImage($item->product);
?>
<img src="{{ $images['small_image_url'] }}" />
</div>
<div class="item-details">
{{-- @if ($item->type == "configurable")
<div class="item-name">{{ $item->child->name }}</div>
@else --}}
<div class="item-name">{{ $item->name }}</div>
{{-- @endif --}}
@if ($item->type == "configurable")
<div class="item-options">
{{ trim(Cart::getProductAttributeOptionDetails($item->child->product)['html']) }}
</div>
@endif
<div class="item-price">{{ core()->currency($item->base_total) }}</div>
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
</div>
<div class="item">
<div class="item-image" >
<?php
if ($item->type == "configurable")
$images = $productImageHelper->getProductBaseImage($item->child->product);
else
$images = $productImageHelper->getProductBaseImage($item->product);
?>
<img src="{{ $images['small_image_url'] }}" />
</div>
<div class="item-details">
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.name.before', ['item' => $item]) !!}
<div class="item-name">{{ $item->name }}</div>
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.name.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.options.before', ['item' => $item]) !!}
@if ($item->type == "configurable")
<div class="item-options">
{{ trim(Cart::getProductAttributeOptionDetails($item->child->product)['html']) }}
</div>
@endif
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.options.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.price.before', ['item' => $item]) !!}
<div class="item-price">{{ core()->currency($item->base_total) }}</div>
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.price.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.quantity.before', ['item' => $item]) !!}
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.quantity.after', ['item' => $item]) !!}
</div>
</div>
@endforeach
</div>

View File

@ -61,10 +61,17 @@
<div class="item-details">
{!! view_render_event('bagisto.shop.checkout.name.before', ['item' => $item]) !!}
<div class="item-title">
{{ $product->name }}
</div>
{!! view_render_event('bagisto.shop.checkout.name.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.price.before', ['item' => $item]) !!}
<div class="row">
<span class="title">
{{ __('shop::app.checkout.onepage.price') }}
@ -74,6 +81,11 @@
</span>
</div>
{!! view_render_event('bagisto.shop.checkout.price.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.quantity.before', ['item' => $item]) !!}
<div class="row">
<span class="title">
{{ __('shop::app.checkout.onepage.quantity') }}
@ -83,13 +95,19 @@
</span>
</div>
{!! view_render_event('bagisto.shop.checkout.quantity.after', ['item' => $item]) !!}
@if ($product->type == 'configurable')
{!! view_render_event('bagisto.shop.checkout.options.after', ['item' => $item]) !!}
<div class="summary" >
{{ Cart::getProductAttributeOptionDetails($item->child->product)['html'] }}
</div>
{!! view_render_event('bagisto.shop.checkout.options.after', ['item' => $item]) !!}
@endif
</div>

View File

@ -39,20 +39,20 @@
@foreach ($orders as $order)
<tr>
<td>
<td data-value="{{ __('shop::app.customer.account.order.index.order_id') }}">
<a href="{{ route('customer.orders.view', $order->id) }}">
#{{ $order->id }}
</a>
</td>
<td>{{ core()->formatDate($order->created_at, 'd M Y') }}</td>
<td data-value="{{ __('shop::app.customer.account.order.index.date') }}">{{ core()->formatDate($order->created_at, 'd M Y') }}</td>
<td>
<td data-value="{{ __('shop::app.customer.account.order.index.total') }}">
{{ core()->formatPrice($order->grand_total, $order->order_currency_code) }}
</td>
<td>
@if ($order->status == 'processing')
<td data-value="{{ __('shop::app.customer.account.order.index.status') }}">
@if($order->status == 'processing')
<span class="badge badge-md badge-success">Processing</span>
@elseif ($order->status == 'completed')
<span class="badge badge-md badge-success">Completed</span>
@ -81,46 +81,7 @@
</table>
</div>
@foreach ($orders as $order)
<table class="responsive-table">
<tbody>
<tr>
<td>
{{ __('shop::app.customer.account.order.index.order_id') }}
</td>
<td>
<a href="{{ route('customer.orders.view', $order->id) }}">
#{{ $order->id }}
</a>
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.index.date') }}
</td>
<td>{{ core()->formatDate($order->created_at, 'd M Y') }}</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.index.total') }}
</td>
<td>
{{ core()->formatPrice($order->grand_total, $order->order_currency_code) }}
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.index.status') }}
</td>
<td>
<span class="order-status {{ $order->status }}">{{ $order->status_label }}</span>
</td>
</tr>
</tbody>
</table>
@endforeach
@if (! $orders->count())
@if (!$orders->count())
<div class="responsive-empty">{{ __('admin::app.common.no-result-found') }}</div>
@endif

View File

@ -65,12 +65,12 @@
@foreach ($order->items as $item)
<tr>
<td>
<td data-value="{{ __('shop::app.customer.account.order.view.SKU') }}">
{{ $item->type == 'configurable' ? $item->child->sku : $item->sku }}
</td>
<td>{{ $item->name }}</td>
<td>{{ core()->formatPrice($item->price, $order->order_currency_code) }}</td>
<td>
<td data-value="{{ __('shop::app.customer.account.order.view.product-name') }}">{{ $item->name }}</td>
<td data-value="{{ __('shop::app.customer.account.order.view.price') }}">{{ core()->formatPrice($item->price, $order->order_currency_code) }}</td>
<td data-value="{{ __('shop::app.customer.account.order.view.item-status') }}">
<span class="qty-row">
{{ __('shop::app.customer.account.order.view.item-ordered', ['qty_ordered' => $item->qty_ordered]) }}
</span>
@ -87,10 +87,10 @@
{{ $item->qty_canceled ? __('shop::app.customer.account.order.view.item-canceled', ['qty_canceled' => $item->qty_canceled]) : '' }}
</span>
</td>
<td>{{ core()->formatPrice($item->total, $order->order_currency_code) }}</td>
<td>{{ number_format($item->tax_percent, 2) }}%</td>
<td>{{ core()->formatPrice($item->tax_amount, $order->order_currency_code) }}</td>
<td>{{ core()->formatPrice($item->total + $item->tax_amount, $order->order_currency_code) }}</td>
<td data-value="{{ __('shop::app.customer.account.order.view.subtotal') }}">{{ core()->formatPrice($item->total, $order->order_currency_code) }}</td>
<td data-value="{{ __('shop::app.customer.account.order.view.tax-percent') }}">{{ number_format($item->tax_percent, 2) }}%</td>
<td data-value="{{ __('shop::app.customer.account.order.view.tax-amount') }}">{{ core()->formatPrice($item->tax_amount, $order->order_currency_code) }}</td>
<td data-value="{{ __('shop::app.customer.account.order.view.grand-total') }}">{{ core()->formatPrice($item->total + $item->tax_amount, $order->order_currency_code) }}</td>
</tr>
@endforeach
</tbody>
@ -98,89 +98,6 @@
</table>
</div>
@foreach ($order->items as $item)
<table class="responsive-table">
<tbody>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.SKU') }}
</td>
<td>
{{ $item->type == 'configurable' ? $item->child->sku : $item->sku }}
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.product-name') }}
</td>
<td>{{ $item->name }}</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.price') }}
</td>
<td>
{{ core()->formatPrice($item->price, $order->order_currency_code) }}
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.item-status') }}
</td>
<td>
<span class="qty-row">
{{ __('shop::app.customer.account.order.view.item-ordered', ['qty_ordered' => $item->qty_ordered]) }}
</span>
<span class="qty-row">
{{ $item->qty_invoiced ? __('shop::app.customer.account.order.view.item-invoice', ['qty_invoiced' => $item->qty_invoiced]) : '' }}
</span>
<span class="qty-row">
{{ $item->qty_shipped ? __('shop::app.customer.account.order.view.item-shipped', ['qty_shipped' => $item->qty_shipped]) : '' }}
</span>
<span class="qty-row">
{{ $item->qty_canceled ? __('shop::app.customer.account.order.view.item-canceled', ['qty_canceled' => $item->qty_canceled]) : '' }}
</span>
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.subtotal') }}
</td>
<td>
{{ core()->formatPrice($item->total, $order->order_currency_code) }}
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.tax-percent') }}
</td>
<td>
{{ number_format($item->tax_percent, 2) }}%
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.tax-amount') }}
</td>
<td>
{{ core()->formatPrice($item->tax_amount, $order->order_currency_code) }}
</td>
</tr>
<tr>
<td>
{{ __('shop::app.customer.account.order.view.grand-total') }}
</td>
<td>
{{ core()->formatPrice($item->total + $item->tax_amount, $order->order_currency_code) }}
</td>
</tr>
</tbody>
</table>
@endforeach
<div class="totals">
<table class="sale-summary">
<tbody>

View File

@ -13,7 +13,7 @@
<script type="text/x-template" id="product-options-template">
<div class="attributes">
<input type="hidden" name="selected_configurable_option" :value="selectedProductId">
<input type="hidden" id="selected_configurable_option" name="selected_configurable_option" :value="selectedProductId">
<div v-for='(attribute, index) in childAttributes' class="attribute control-group" :class="[errors.has('super_attribute[' + attribute.id + ']') ? 'has-error' : '']">
<label class="required">@{{ attribute.label }}</label>
@ -101,25 +101,6 @@
this.selectedProductId = attribute.options[attribute.selectedIndex].allowedProducts[0];
}
//wishlist anchor href changer with options
// @auth('customer')
// var wishlistLink = $('#wishlist-changer').attr('data-href');
// if (this.selectedProductId != '') {
// var splitted = wishlistLink.split("/");
// var lastItem = splitted.pop();
// lastItem = this.selectedProductId;
// var joined = splitted.join('/');
// var newWishlistUrl = joined + '/' + lastItem;
// $('#wishlist-changer').attr('data-href', newWishlistUrl);
// }
// @endauth
//buy now anchor href changer with options
var buyNowLink = $('.btn.buynow').attr('data-href');
@ -156,7 +137,6 @@
selectedIndex = index;
}
})
return selectedIndex;
},
@ -266,10 +246,14 @@
priceLabelElement.style.display = 'none';
priceElement.innerHTML = this.config.variant_prices[this.simpleProduct].final_price.formated_price;
eventBus.$emit('configurable-variant-selected-event', this.simpleProduct)
} else {
priceLabelElement.style.display = 'inline-block';
priceElement.innerHTML = this.config.regular_price.formated_price;
eventBus.$emit('configurable-variant-selected-event', 0)
}
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922",
"/css/ui.css": "/css/ui.css?id=1edd188de8c037f174a0"
"/js/ui.js": "/js/ui.js?id=711bb1082d5b116e929f",
"/css/ui.css": "/css/ui.css?id=384d20a09ced97996829"
}

View File

@ -13,6 +13,9 @@ use Illuminate\Http\Request;
abstract class DataGrid
{
protected $index = null;
protected $sortOrder = 'asc';
protected $enableFilterMap = false;
protected $filterMap = [];
protected $columns = [];
protected $completeColumnDetails = [];
protected $queryBuilder = [];
@ -23,7 +26,50 @@ abstract class DataGrid
protected $parse;
protected $enableMassAction = false;
protected $enableAction = false;
protected $paginate = false;
protected $itemsPerPage = 10;
protected $operators = [
'eq' => "=",
'lt' => "<",
'gt' => ">",
'lte' => "<=",
'gte' => ">=",
'neqs' => "<>",
'neqn' => "!=",
'eqo' => "<=>",
'like' => "like",
'blike' => "like binary",
'nlike' => "not like",
'ilike' => "ilike",
'and' => "&",
'bor' => "|",
'regex' => "regexp",
'notregex' => "not regexp"
];
protected $bindings = [
0 => "select",
1 => "from",
2 => "join",
3 => "where",
4 => "having",
5 => "order",
6 => "union"
];
protected $selectcomponents = [
0 => "aggregate",
1 => "columns",
2 => "from",
3 => "joins",
4 => "wheres",
5 => "groups",
6 => "havings",
7 => "orders",
8 => "limit",
9 => "offset",
10 => "lock"
];
abstract public function prepareQueryBuilder();
abstract public function addColumns();
@ -46,6 +92,17 @@ abstract class DataGrid
return $parsedUrl;
}
/**
* Add the index as alias of the column and use the column to make things happen
*
* @return void
*/
public function addFilter($alias, $column) {
$this->filterMap[$alias] = $column;
$this->enableFilterMap = true;
}
public function addColumn($column)
{
array_push($this->columns, $column);
@ -84,20 +141,20 @@ abstract class DataGrid
if (count($parsedUrl)) {
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $parsedUrl);
if (config('datagrid.paginate')) {
if ($this->paginate) {
if ($this->itemsPerPage > 0)
return $filteredOrSortedCollection->paginate($this->itemsPerPage)->appends(request()->except('page'));
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
} else {
return $filteredOrSortedCollection->get();
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->get();
}
}
if (config('datagrid.paginate')) {
if ($this->paginate) {
if ($this->itemsPerPage > 0) {
$this->collection = $this->queryBuilder->paginate($this->itemsPerPage)->appends(request()->except('page'));
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
}
} else {
$this->collection = $this->queryBuilder->get();
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->get();
}
return $this->collection;
@ -110,8 +167,8 @@ abstract class DataGrid
*/
public function findColumnType($columnAlias)
{
foreach ($this->completeColumnDetails as $column) {
if ($column['index'] == $columnAlias) {
foreach($this->completeColumnDetails as $column) {
if($column['index'] == $columnAlias) {
return [$column['type'], $column['index']];
}
}
@ -132,7 +189,7 @@ abstract class DataGrid
$columnName = $this->findColumnType(array_keys($info)[0]);
return $collection->orderBy(
$collection->orderBy(
$columnName[1],
array_values($info)[0]
);
@ -144,41 +201,79 @@ abstract class DataGrid
}
if ($count_keys == 1) {
return $collection->where(function() use($collection, $info) {
$collection->where(function($collection) use($info) {
foreach ($this->completeColumnDetails as $column) {
if ($column['searchable'] == true)
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
if ($column['searchable'] == true) {
if($this->enableFilterMap && isset($this->filterMap[$column['index']])) {
$collection->orWhere($this->filterMap[$column['index']], 'like', '%'.$info['all'].'%');
} else {
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
}
}
}
});
}
} else {
if (array_keys($info)[0] == "like" || array_keys($info)[0] == "nlike") {
foreach ($info as $condition => $filter_value) {
return $collection->where(
$columnName,
config("datagrid.operators.{$condition}"),
'%'.$filter_value.'%'
);
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
$collection->where(
$this->filterMap[$columnName],
$this->operators[$condition],
'%'.$filter_value.'%'
);
} else {
$collection->where(
$columnName,
$this->operators[$condition],
'%'.$filter_value.'%'
);
}
}
} else {
foreach ($info as $condition => $filter_value) {
if ($columnType == 'datetime') {
return $collection->whereDate(
$columnName,
config("datagrid.operators.{$condition}"),
$filter_value
);
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
$collection->whereDate(
$this->filterMap[$columnName],
$this->operators[$condition],
$filter_value
);
} else {
$collection->whereDate(
$columnName,
$this->operators[$condition],
$filter_value
);
}
} else {
return $collection->where(
$columnName,
config("datagrid.operators.{$condition}"),
$filter_value
);
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
$collection->where(
$this->filterMap[$columnName],
$this->operators[$condition],
$filter_value
);
} else {
$collection->where(
$columnName,
$this->operators[$condition],
$filter_value
);
}
}
}
}
}
}
return $collection;
}
public function prepareMassActions() {
}
public function prepareActions() {
}
public function render()
@ -191,6 +286,6 @@ abstract class DataGrid
$this->prepareQueryBuilder();
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, 'norecords' => trans('ui::app.datagrid.no-records')]);
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, 'norecords' => trans('ui::app.datagrid.no-records')]);
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace Webkul\Ui\DataGrid\Facades;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Facade;
class ProductGrid extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'productgrid';
}
}

View File

@ -1,108 +0,0 @@
<?php
namespace Webkul\Ui\DataGrid\Helpers;
/**
* AbstractFillable
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
abstract class AbstractFillable
{
const NO_RESULT = null;
protected $fillable = [];
abstract protected function setFillable();
public function __construct($args)
{
$error = false;
$this->setFillable();
foreach ($args as $key => $value) {
$this->{$key} = $value;
// switch($value) {
// case (in_array(gettype($value), ["array", "object", "function"])):
// $error = $this->fieldValidate(
// $key,
// $value,
// [$this->fillable[$key]['allowed']]
// );
// break;
// default:
// $error = $this->fieldValidate(
// $key,
// $value
// );
// }
// if ($error) throw new \Exception($error);
}
// foreach ($this->fillable as $fill) {
// if (isset($args[$fill])) {
// $this->{$fill} = [$args[$fill]];
// }
// }
}
private function fieldValidate($key, $value, $allowed = ['string', 'integer', 'float', "boolean"], $merge = false)
{
$error = false;
if ( in_array($key, $this->fillable) ||
array_filter(
array_keys($this->fillable) , function($value) {
return gettype($value) === "string";
}
)
) {
if (in_array(gettype($value), $allowed)) {
// if ($merge) {
// if (! $this->{$key}) $this->{$key} = [];
// $this->{$key}[] = $value;
// } else
// $this->{$key} = $value;
} else {
dump(gettype($value));
dump($value);
$error = 'Allowed params are not valid as per allowed condition! Key - ' . $key;
}
} else {
dump(in_array($key, $this->fillable));
dump($value);
$error = 'Not Allowed field! Key - ' . $key;
}
return $error ?: false;
}
public function __set($key, $value)
{
$error = false;
switch('$value') { //no need to match this
case (in_array(gettype($value), ["array", "object", "function"])):
$error = $this->fieldValidate(
$key,
$value,
[$this->fillable[$key]['allowed']]
);
break;
default:
$error = $this->fieldValidate(
$key,
$value
);
break;
}
if ($error) throw new \Exception($error);
$this->{$key} = $value;
}
public function __get($key) {
if (in_array($key, $this->fillable)) {
return property_exists($this, $key) ? $this->{$key} : false;
} else
return self::NO_RESULT;
}
}

View File

@ -1,169 +0,0 @@
<?php
namespace Webkul\Ui\DataGrid\Helpers;
use Illuminate\Http\Request;
/**
* Column controller
*
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
* &
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
*
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class Column extends AbstractFillable
{
const SORT = 'sort';
const ORDER_DESC = 'DESC';
const ORDER_ASC = 'ASC';
private $request = null;
private $readableName = false;
private $aliasing = false;
private $value = false;
private $sortHtml = '<a href="%s">%s</a>';
/**
* Without Array it will treat it like string
*
* [
* 'name',
* 'Name',
* true,
* filter => [
* 'function' => 'where', // andwhere
* 'condition' => ['u.user_id', '=', '1'] // multiarray
* ],
* attributes => [
* 'class' => 'class-a, class-b',
* 'data-attr' => 'whatever you want',
* 'onlclick' => "window.alert('alert from datagrid column')"
* ],
* wrapper => function($value) {
* return '<a href="'.$value.'">Nikhil</a>';
* },
* ]
*/
protected function setFillable()
{
$this->fillable = [
'name',
'type',
'label',
'sortable',
'searchable',
'filterable',
'massoperations' => [
'allowed' => 'array'
],
'actions' => [
'allowed' => 'array'
],
'filter' => [
'allowed' => 'array',
],
'attributes' => [
'allowed' => 'array',
'validation' => 'FUTURE'
],
'wrapper' => [
// 'allowed' => 'function'
'allowed' => 'object'
],
'callback' => [
'allowed' => 'function'
]
];
}
public function __construct($args, $request = null)
{
parent::__construct($args);
$this->request = $request ?: Request::capture();
}
public function correctFilterSorting()
{
$return = $this->name;
$as = explode('as', $this->name);
if (count($as) > 1) {
$return = trim(current($as));
}
return $return;
}
public function correctDotOnly()
{
$col_name = explode('.', $this->name);
if (isset($col_name)) {
$col_name = trim($col_name[1]);
return $col_name;
}
}
public function correct($tillDot = true)
{
$as = explode('as', $this->name);
if (count($as) > 1) {
return trim(end($as));
}
if (! $tillDot) {
return $this->name;
}
$dot = explode('.', $this->name);
if ($dot) {
return trim(end($dot));
}
}
private function wrap($obj)
{
if ($this->wrapper && is_callable($this->wrapper)) {
$this->value = call_user_func($this->wrapper, $this->value, $obj);
}
}
private function sortingUrl()
{
$query = ['sort' => $this->correct(false)];
if (($sort = $this->request->offsetGet('sort')) && $sort == $this->correct(false)) {
if (! $order = $this->request->offsetGet('order')) {
$query['order'] = self::ORDER_DESC;
} else {
$query['order'] = ($order == self::ORDER_DESC ? self::ORDER_ASC : self::ORDER_DESC);
}
} else {
$query['order'] = self::ORDER_DESC;
}
return '?'.http_build_query(array_merge($this->request->query->all(), $query));
}
/**
* need to process css check on properties like label shouln't include <script>alert('Kaboom!')</script>
*/
public function sorting()
{
return $this->label;
if ($this->sortable) {
return vsprintf($this->sortHtml, [$this->sortingUrl(), $this->label]);
} else {
return $this->label;
}
}
public function render($obj)
{
if (property_exists($obj, ($this->aliasing = $this->alias))) {
$this->value = $obj->{$this->aliasing};
$this->wrap($obj);
}
return $this->value;
}
}

View File

@ -1,36 +0,0 @@
<?php
namespace Webkul\Ui\DataGrid\Helpers;
/**
* Css
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class Css extends AbstractFillable
{
const NO_RESULT = 'no-class';
protected $datagrid = 'datagrid';
protected $table = 'table';
protected $thead = 'thead';
protected $thead_td = 'thead_td';
protected $tbody = 'tbody';
protected $tbody_td = 'tbody_td';
public function __construct($args) {
parent::__construct($args);
}
protected function setFillable() {
$this->fillable = [
'datagrid',
'table',
'thead',
'thead_td',
'tbody',
'tbody_td',
];
}
}

View File

@ -1,36 +0,0 @@
<?php
namespace Webkul\Ui\DataGrid\Helpers;
use Illuminate\Http\Request;
/**
* MassAction
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class MassAction
{
public function validateSchemaMassAction($attributes)
{
$operations_validated = false;
$columns_validated = true;
foreach ($attributes['operations'] as $operation) {
if (array_key_exists('route', $operation) && array_key_exists('method', $operation) && array_key_exists('label', $operation) && array_key_exists('columns', $operation)) {
$operations_validated = true;
}
if ($operations_validated) {
foreach ($operation['columns'] as $column) {
if (array_key_exists('name', $operation) && array_key_exists('label', $operation) && array_key_exists('type', $operation)) {
$columns_validated = true;
}
}
}
}
if ($columns_validated && $operations_validated) {
return true;
} else {
throw new \Exception('Schema is invalid for mass actions');
}
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace Webkul\Ui\DataGrid\Helpers;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
/**
* DataGrid controller
*
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
* &
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
*
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class Pagination extends Paginator
{
const LIMIT = 10;
const OFFSET = 0;
const VIEW = '';
public function __construct(
int $limit = null,
int $offset = null,
int $view = null
) {
$this->limit = $limit ?: self::LIMIT;
$this->offset = $offset ?: self::OFFSET;
$this->view = $view ?: self::VIEW;
parent::__construct([
], 20);
}
}

View File

@ -17,7 +17,7 @@
data () {
return {
datepicker: null
datepicker: null
}
},

View File

@ -276,6 +276,13 @@ h2 {
&.empty {
text-align: center;
}
tr {
td {
// border: 1px solid red;
}
}
}
tbody tr:last-child td {
@ -294,6 +301,32 @@ h2 {
}
}
@media only screen and (max-width: 770px) {
.table {
table thead {
display: none;
}
table tbody {
tr td:before {
content: attr(data-value);
font-size: 15px;
font-weight: 600;
margin-right: 20px;
}
td {
border-bottom: none;
display: block;
}
tr {
border: 1px solid #C7C7C7;
}
}
}
}
.dropdown-btn {
min-width: 150px;
text-align: left;

View File

@ -21,17 +21,25 @@
@if (isset($column['wrapper']))
@if (isset($column['closure']) && $column['closure'] == true)
<td>{!! $column['wrapper']($record->{$columnIndex}) !!}</td>
<td>{!! $column['wrapper']($record) !!}</td>
@else
<td>{{ $column['wrapper']($record->{$columnIndex}) }}</td>
<td>{{ $column['wrapper']($record) }}</td>
@endif
@else
<td>{{ $record->{$columnIndex} }}</td>
@if($column['type'] == 'price')
@if(isset($column['currencyCode']))
<td>{{ core()->formatPrice($record->{$columnIndex}, $column['currencyCode']) }}</td>
@else
<td>{{ core()->formatBasePrice($record->{$columnIndex}) }}</td>
@endif
@else
<td>{{ $record->{$columnIndex} }}</td>
@endif
@endif
@endforeach
@if ($enableActions)
<td style="width: 50px;">
<td>
<div class="actions">
@foreach ($actions as $action)
<a href="{{ route($action['route'], $record->{$index}) }}">
@ -45,7 +53,7 @@
@endforeach
@else
<tr>
<td colspan="10" style="text-align: center;">{{$norecords}}</td>
<td colspan="10" style="text-align: center;">{{ $norecords }}</td>
</tr>
@endif
</tbody>

View File

@ -1,14 +0,0 @@
<thead>
<tr>
<th class="grid_head" id="mastercheckbox" style="width: 50px;">
<span class="checkbox">
<input type="checkbox" id="mastercheckbox">
<label class="checkbox-view" for="checkbox"></label>
</span>
</th>
@foreach ($columns as $key => $column)
<th class="grid_head" data-column-alias="{{ $column['alias'] }}" data-column-name="{{ $column['column'] }}" data-column-sortable="{{ $column['sortable'] }}" data-column-type="{{ $column['type'] }}" style="width: {{ $column['width'] }}" v-on:click="sortCollection({{ $column['alias'] }})">{{ $column['label'] }}</th>
@endforeach
</tr>
</thead>

View File

@ -1,15 +1,15 @@
<div class="table">
<testgrid-filters></testgrid-filters>
<datagrid-filters></datagrid-filters>
@if (config('datagrid.paginate'))
@if (isset($results['paginated']) && $results['paginated'])
@include('ui::datagrid.pagination', ['results' => $results['records']])
@endif
@push('scripts')
<script type="text/x-template" id="testgrid-filters">
<script type="text/x-template" id="datagrid-filters">
{{-- start filter here --}}
<div class="grid-container">
<div class="filter-row-one" id="testgrid-filters">
<div class="filter-row-one" id="datagrid-filters">
<div class="search-filter">
<input type="search" id="search-field" class="control" placeholder="Search Here..." v-model="searchValue" />
@ -34,7 +34,7 @@
<div class="control-group">
<select class="filter-column-select control" v-model="filterColumn" v-on:click="getColumnOrAlias(filterColumn)">
<option selected disabled>Select Column</option>
@foreach ($results['columns'] as $column)
@foreach($results['columns'] as $column)
<option value="{{ $column['index'] }}">
{{ $column['label'] }}
</option>
@ -134,8 +134,9 @@
</div>
</div>
</div>
<div class="filter-row-two">
<span class="filter-tag" v-if="filters.length > 0" v-for="filter in filters" style="text-transform: uppercase;">
<span class="filter-tag" v-if="filters.length > 0" v-for="filter in filters" style="text-transform: capitalize;">
<span v-if="filter.column == 'sort'">@{{ filter.label }}</span>
<span v-else-if="filter.column == 'search'">Search</span>
<span v-else>@{{ filter.label }}</span>
@ -147,11 +148,11 @@
</span>
</div>
<table>
<table class="table">
<thead v-if="massActionsToggle">
@if (isset($results['massactions']))
<tr class="mass-action" style="height: 63px;" v-if="massActionsToggle">
<th colspan="10" style="width: 100%;">
<tr class="mass-action" v-if="massActionsToggle" style="height: 65px;">
<th colspan="100%">
<div class="mass-action-wrapper" style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;">
<span class="massaction-remove" v-on:click="removeMassActions" style="margin-right: 10px;">
@ -164,13 +165,13 @@
<input type="hidden" id="indexes" name="indexes" v-model="dataIds">
<div class="control-group">
<select class="control" v-model="massActionType" @change="changeMassActionTarget" name="massaction-type">
<select class="control" v-model="massActionType" @change="changeMassActionTarget" name="massaction-type" required>
<option v-for="(massAction, index) in massActions" :key="index" :value="massAction.type">@{{ massAction.label }}</option>
</select>
</div>
<div class="control-group" style="margin-left: 10px;" v-if="massActionType == 'update'">
<select class="control" v-model="massActionUpdateValue" name="update-options">
<select class="control" v-model="massActionUpdateValue" name="update-options" required>
<option v-for="(massActionValue, id) in massActionValues" :value="massActionValue">@{{ id }}</option>
</select>
</div>
@ -184,7 +185,7 @@
</thead>
<thead v-if="massActionsToggle == false">
<tr>
<tr style="height: 65px;">
@if (count($results['records']) && $results['enableMassActions'])
<th class="grid_head" id="mastercheckbox" style="width: 50px;">
<span class="checkbox">
@ -195,8 +196,16 @@
</th>
@endif
@foreach ($results['columns'] as $key => $column)
<th class="grid_head" style="width: {{ $column['width'] }}" v-on:click="sortCollection('{{ $column['index'] }}')">
@foreach($results['columns'] as $key => $column)
<th class="grid_head"
@if(isset($column['width']))
style="width: {{ $column['width'] }}"
@endif
@if(isset($column['sortable']) && $column['sortable'])
v-on:click="sortCollection('{{ $column['index'] }}')"
@endif
>
{{ $column['label'] }}
</th>
@endforeach
@ -215,8 +224,8 @@
</script>
<script>
Vue.component('testgrid-filters', {
template: '#testgrid-filters',
Vue.component('datagrid-filters', {
template: '#datagrid-filters',
data: () => ({
gridCurrentData: @json($results['records']),
@ -297,6 +306,13 @@
this.datetimeConditionSelect = false;
this.stringConditionSelect = false;
this.nullify();
} else if (this.type == 'price') {
this.numberConditionSelect = true;
this.booleanConditionSelect = false;
this.datetimeConditionSelect = false;
this.stringConditionSelect = false;
this.nullify();
}
}
@ -314,7 +330,7 @@
label = '';
for(colIndex in this.columns) {
if (this.columns[colIndex].index == this.columnOrAlias) {
if(this.columns[colIndex].index == this.columnOrAlias) {
label = this.columns[colIndex].label;
}
}
@ -327,6 +343,8 @@
this.formURL(this.columnOrAlias, this.booleanCondition, this.booleanValue, label);
} else if (this.type == 'datetime') {
this.formURL(this.columnOrAlias, this.datetimeCondition, this.datetimeValue, label);
} else if (this.type == 'price') {
this.formURL(this.columnOrAlias, this.numberCondition, this.numberValue, label);
}
},
@ -334,7 +352,8 @@
label = '';
for(colIndex in this.columns) {
if (this.columns[colIndex].index == this.columnOrAlias) {
if(this.columns[colIndex].index == alias) {
matched = 0;
label = this.columns[colIndex].label;
}
}
@ -343,13 +362,7 @@
},
searchCollection(searchValue) {
label = '';
for(colIndex in this.columns) {
if (this.columns[colIndex].index == this.columnOrAlias) {
label = this.columns[colIndex].label;
}
}
label = 'Search';
this.formURL("search", 'all', searchValue, label);
},
@ -435,6 +448,12 @@
filterRepeated = 1;
return false;
} else if(this.filters[j].cond == condition && this.filters[j].val != response) {
filterRepeated = 1;
this.filters[j].val = response;
this.makeURL();
}
}
}
@ -600,11 +619,13 @@
obj.cond = cond;
obj.val = val;
if (col == "sort") {
if(col == "sort") {
// console.log('sort', obj.cond);
label = '';
for(colIndex in this.columns) {
if (this.columns[colIndex].index == obj.cond) {
if(this.columns[colIndex].index == obj.cond) {
obj.label = this.columns[colIndex].label;
}
}
@ -614,7 +635,7 @@
obj.label = '';
for(colIndex in this.columns) {
if (this.columns[colIndex].index == obj.column) {
if(this.columns[colIndex].index == obj.column) {
obj.label = this.columns[colIndex].label;
}
}
@ -641,7 +662,10 @@
select() {
this.allSelected = false;
this.massActionsToggle = true;
if(this.dataIds.length == 0)
this.massActionsToggle = false;
else
this.massActionsToggle = true;
},
//triggered when master checkbox is clicked
@ -675,8 +699,6 @@
}
}
}
// console.log(this.dataIds);
},
removeMassActions() {

View File

@ -83,7 +83,7 @@ class RoleController extends Controller
Event::fire('user.role.create.after', $role);
session()->flash('success', 'Role created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Role']));
return redirect()->route($this->_config['redirect']);
}
@ -121,7 +121,7 @@ class RoleController extends Controller
Event::fire('user.role.update.after', $role);
session()->flash('success', 'Role updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Role']));
return redirect()->route($this->_config['redirect']);
}
@ -143,7 +143,7 @@ class RoleController extends Controller
Event::fire('user.role.delete.after', $id);
session()->flash('success', 'Role source deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Role']));
}
return redirect()->back();

View File

@ -98,7 +98,7 @@ class UserController extends Controller
Event::fire('user.admin.delete.after', $admin);
session()->flash('success', 'User created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'User']));
return redirect()->route($this->_config['redirect']);
}
@ -146,7 +146,7 @@ class UserController extends Controller
Event::fire('user.admin.update.after', $admin);
session()->flash('success', 'User updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'User']));
return redirect()->route($this->_config['redirect']);
}
@ -172,7 +172,7 @@ class UserController extends Controller
Event::fire('user.admin.delete.after', $id);
session()->flash('success', 'Admin source deleted successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Admin source']));
}
return redirect()->back();

View File

@ -2,7 +2,7 @@
$install = require __DIR__.'/installer/install.php';
if (!is_null($install)) {
if (0 && !is_null($install)) {
header("Location: $install");

Some files were not shown because too many files have changed in this diff Show More