export changes

This commit is contained in:
rahul shukla 2019-01-16 16:43:36 +05:30
commit 8c32a21521
244 changed files with 2582 additions and 11913 deletions

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at support@bagisto.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@ -63,7 +63,7 @@ Bagisto is using power of both of these frameworks and making best out of it out
**Run this Command** to download the project on to your local machine or server:
>> Note: If you have downloaded zip file then ignore this.
> Note: If you have downloaded zip file then ignore this.
~~~
composer create-project bagisto/bagisto
@ -89,11 +89,12 @@ default.
**Run these Commands Below**
>> Run this command below, if installing from the zip else skip:
> Run this command, in case installing from the zip else skip this command (no need to run this command if you are creating project through composer):
~~~
composer install
~~~
> Continue run these command below:
~~~
php artisan migrate
~~~
@ -115,6 +116,14 @@ composer dump-autoload
> That's it, now just execute the project on your specified domain entry point pointing to public folder inside installation directory.
> **Note: you can fetch your admin panel by follow below url:**
~~~
http(s)://example.com/admin/login
~~~
~~~
email:admin@example.com
password:admin123
~~~
### 5. License
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).

View File

@ -5,7 +5,7 @@ return [
/**
* Default Select Value
*/
'select' => 'id',
'default_index' => 'id',
/**
* Default OrderBy
@ -13,8 +13,9 @@ return [
* * Accepted Values = Array
*/
'order' => [
'column' => 'id',
'direction' => 'desc'
'default' => 'descending',
'descending' => 'desc',
'ascending' => 'asc'
],
/**
@ -29,7 +30,7 @@ return [
*
* Accepted Value = integer
*/
// 'pagination' => 10,
'paginate' => false,
'operators' => [
'eq' => "=",
@ -84,6 +85,6 @@ return [
7 => "orders",
8 => "limit",
9 => "offset",
10 => "lock",
10 => "lock"
]
];

View File

@ -28,7 +28,7 @@ class AddressController extends Controller
$this->customerAddress = $customerAddress;
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$this->customer = auth()->guard('customer')->user();
} else {
$this->customer['message'] = 'unauthorized';
@ -46,7 +46,7 @@ class AddressController extends Controller
* @return response JSON
*/
public function get() {
if($this->customer == false) {
if ($this->customer == false) {
return response()->json($this->customer, 401);
} else {
$addresses = $this->customer->addresses;
@ -56,7 +56,7 @@ class AddressController extends Controller
}
public function getDefault() {
if($this->customer == false) {
if ($this->customer == false) {
return response()->json($this->customer, 401);
} else {
$defaultAddress = $this->customer->default_address;
@ -89,13 +89,13 @@ class AddressController extends Controller
$cust_id['customer_id'] = $this->customer->id;
$data = array_merge($cust_id, $data);
if($this->customer->addresses->count() == 0) {
if ($this->customer->addresses->count() == 0) {
$data['default_address'] = 1;
}
$result = $this->customerAddress->create($data);
if($result) {
if ($result) {
return response()->json(true, 200);
} else {
return response()->json(false, 200);
@ -111,11 +111,11 @@ class AddressController extends Controller
public function makeDefault($id) {
$defaultAddress = $this->customer->default_address;
if($defaultAddress != null && $defaultAddress->count() > 0) {
if ($defaultAddress != null && $defaultAddress->count() > 0) {
$defaultAddress->update(['default_address' => 0]);
}
if($this->customerAddress->find($id)->default_address == 1) {
if ($this->customerAddress->find($id)->default_address == 1) {
return response()->json(false, 200);
}

View File

@ -26,8 +26,8 @@ class AuthController extends Controller
public function create() {
$data = request()->except('_token');
if(!auth()->guard('customer')->check()) {
if(!auth()->guard('customer')->attempt($data)) {
if (! auth()->guard('customer')->check()) {
if (! auth()->guard('customer')->attempt($data)) {
return response()->json(['message' => 'unauthenticated', 'details' => 'invalid creds'], 401);
} else {
return response()->json(['message' => 'authenticated', 'user' => auth()->guard('customer')->user()], 200);

View File

@ -23,7 +23,7 @@ class CustomerController extends Controller
public function __construct()
{
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$this->customer = auth()->guard('customer')->user();
} else {
$this->customer['message'] = 'unauthorized';
@ -63,10 +63,10 @@ class CustomerController extends Controller
$data = collect(request()->all())->toArray();
if($data['oldpassword'] == null) {
if ($data['oldpassword'] == null) {
$data = collect(request()->input())->except([ 'oldpassword', 'password', 'password_confirmation'])->toArray();
} else {
if(Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
if (Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
$data = collect(request()->input())->toArray();
$data['password'] = bcrypt($data['password']);
@ -77,7 +77,7 @@ class CustomerController extends Controller
$result = $this->customer->update($data);
if($result) {
if ($result) {
return response()->json(true, 200);
} else {
return response()->json(false, 200);
@ -92,7 +92,7 @@ class CustomerController extends Controller
public function getAllCart() {
$carts = $this->customer->carts;
if($cart->count() > 0) {
if ($cart->count() > 0) {
return response()->json(['message' => 'successful','items' => $cart], 200);
} else {
return response()->json(['message' => 'empty', 'items' => null], 200);
@ -102,11 +102,11 @@ class CustomerController extends Controller
public function getActiveCart() {
$cart = Cart::getCart();
if($cart == null) {
if ($cart == null) {
return response()->json(['message' => 'empty', 'items' => 'null']);
}
if($cart->count() > 0 ) {
if ($cart->count() > 0 ) {
return response()->json(['message' => 'success', 'items' => $cart]);
} else {
return response()->json(['message' => 'empty', 'items' => 'null']);

View File

@ -24,7 +24,7 @@ class WishlistController extends Controller
public function __construct(Product $product, Wishlist $wishlist)
{
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$this->product = $product;
$this->wishlist = $wishlist;
$this->customer = auth()->guard('customer')->user();
@ -43,7 +43,7 @@ class WishlistController extends Controller
{
$wishlist = $this->customer->wishlist_items;
if($wishlist->count() > 0) {
if ($wishlist->count() > 0) {
return response()->json($wishlist, 200);
} else {
return response()->json(['message' => 'Wishlist Empty', 'Items' => null], 200);
@ -67,14 +67,14 @@ class WishlistController extends Controller
];
//accidental case if some one adds id of the product in the anchor tag amd gives id of a variant.
if($product->parent_id != null) {
if ($product->parent_id != null) {
$data['product_id'] = $productId = $product->parent_id;
}
$checked = $this->wishlist->findWhere(['channel_id' => core()->getCurrentChannel()->id, 'product_id' => $productId, 'customer_id' => auth()->guard('customer')->user()->id]);
if($checked->isEmpty()) {
if($wishlistItem = $this->wishlist->create($data)) {
if ($checked->isEmpty()) {
if ($wishlistItem = $this->wishlist->create($data)) {
return response()->json(['message' => 'Successfully Added Item To Wishlist', 'items' => $wishlistItem], 200);
} else {
return response()->json(['message' => 'Error! Cannot Add Item To Wishlist', 'items' => null], 401);
@ -93,7 +93,7 @@ class WishlistController extends Controller
{
$result = $this->wishlist->deleteWhere(['customer_id' => auth()->guard('customer')->user()->id, 'channel_id' => core()->getCurrentChannel()->id, 'id' => $itemId]);
if($result) {
if ($result) {
return response()->json(['message' => 'Item Successfully Removed From Wishlist', 'status' => $result]);
} else {
return response()->json(['message' => 'Error! While Removing Item From Wishlist', 'status' => $result]);

View File

@ -89,7 +89,7 @@ class ReviewController extends Controller
$result = $this->productReview->create($data);
if($result) {
if ($result) {
return response()->json(['message' => 'success', 'status' => $result]);
} else {
return response()->json(['message' => 'failed', 'status' => $result]);

View File

@ -39,7 +39,7 @@ class CartController extends Controller
public function get() {
$cart = Cart::getCart();
if($cart == null || $cart == 'null') {
if ($cart == null || $cart == 'null') {
return response()->json(['message' => 'empty', 'items' => null]);
}
@ -54,7 +54,7 @@ class CartController extends Controller
public function add($id) {
$result = Cart::add($id, request()->all());
if($result) {
if ($result) {
Cart::collectTotals();
return response()->json(['message' => 'successful', 'items' => Cart::getCart()->items]);
@ -84,7 +84,7 @@ class CartController extends Controller
public function onePage() {
$cart = Cart::getCart();
if($cart == null || $cart == 'null') {
if ($cart == null || $cart == 'null') {
return response()->json(['message' => 'empty', 'items' => null]);
}
@ -102,13 +102,13 @@ class CartController extends Controller
public function updateOnePage() {
$request = request()->except('_token');
foreach($request['qty'] as $id => $quantity) {
if($quantity <= 0) {
foreach ($request['qty'] as $id => $quantity) {
if ($quantity <= 0) {
return response()->json(['message' => 'Illegal Quantity', 'status' => 'error']);
}
}
foreach($request['qty'] as $key => $value) {
foreach ($request['qty'] as $key => $value) {
$item = $this->cartItem->findOneByField('id', $key);
$data['quantity'] = $value;

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",
"/css/admin.css": "/css/admin.css?id=d40a640933cbcc121f1d"
"/css/admin.css": "/css/admin.css?id=3e790c2215bf5c60ac21"
}

View File

@ -3,147 +3,142 @@
return [
[
'key' => 'dashboard',
'name' => 'Dashboard',
'name' => 'admin::app.acl.dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1
], [
'key' => 'sales',
'name' => 'Sales',
'name' => 'admin::app.acl.sales',
'route' => 'admin.sales.orders.index',
'sort' => 2
], [
'key' => 'sales.orders',
'name' => 'Orders',
'name' => 'admin::app.acl.orders',
'route' => 'admin.sales.orders.index',
'sort' => 1
], [
'key' => 'sales.invoices',
'name' => 'Invoices',
'name' => 'admin::app.acl.invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 2
], [
'key' => 'sales.shipments',
'name' => 'Shipments',
'name' => 'admin::app.acl.shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 3
], [
'key' => 'catalog',
'name' => 'Catalog',
'name' => 'admin::app.acl.catalog',
'route' => 'admin.catalog.index',
'sort' => 3
], [
'key' => 'catalog.products',
'name' => 'Products',
'name' => 'admin::app.acl.products',
'route' => 'admin.catalog.products.index',
'sort' => 1
], [
'key' => 'catalog.categories',
'name' => 'Categories',
'name' => 'admin::app.acl.categories',
'route' => 'admin.catalog.categories.index',
'sort' => 2
], [
'key' => 'catalog.attributes',
'name' => 'Attributes',
'name' => 'admin::app.acl.attributes',
'route' => 'admin.catalog.attributes.index',
'sort' => 3
], [
'key' => 'catalog.families',
'name' => 'Families',
'name' => 'admin::app.acl.attribute-families',
'route' => 'admin.catalog.families.index',
'sort' => 4
], [
'key' => 'customers',
'name' => 'Customers',
'name' => 'admin::app.acl.customers',
'route' => 'admin.customers.index',
'sort' => 4
], [
'key' => 'customers.customers',
'name' => 'Customers',
'name' => 'admin::app.acl.customers',
'route' => 'admin.customers.index',
'sort' => 1
], [
'key' => 'customers.groups',
'name' => 'Groups',
'name' => 'admin::app.acl.groups',
'route' => 'admin.groups.index',
'sort' => 2
], [
'key' => 'customers.reviews',
'name' => 'Reviews',
'name' => 'admin::app.acl.reviews',
'route' => 'admin.customers.reviews.index',
'sort' => 3
], [
'key' => 'configuration',
'name' => 'Configure',
'name' => 'admin::app.acl.configure',
'route' => 'admin.account.edit',
'sort' => 1
], [
'key' => 'configuration',
'name' => 'Configure',
'route' => 'admin.account.edit',
'sort' => 1
'sort' => 5
], [
'key' => 'settings',
'name' => 'Settings',
'name' => 'admin::app.acl.settings',
'route' => 'admin.users.index',
'sort' => 6
], [
'key' => 'settings.locales',
'name' => 'Locales',
'name' => 'admin::app.acl.locales',
'route' => 'admin.locales.index',
'sort' => 1
], [
'key' => 'settings.currencies',
'name' => 'Currencies',
'name' => 'admin::app.acl.currencies',
'route' => 'admin.currencies.index',
'sort' => 2
], [
'key' => 'settings.exchange_rates',
'name' => 'Exchange Rates',
'name' => 'admin::app.acl.exchange-rates',
'route' => 'admin.exchange_rates.index',
'sort' => 3
], [
'key' => 'settings.inventory_sources',
'name' => 'Inventory Sources',
'name' => 'admin::app.acl.inventory-sources',
'route' => 'admin.inventory_sources.index',
'sort' => 4
], [
'key' => 'settings.channels',
'name' => 'Channels',
'name' => 'admin::app.acl.channels',
'route' => 'admin.channels.index',
'sort' => 5
], [
'key' => 'settings.users',
'name' => 'Users',
'name' => 'admin::app.acl.users',
'route' => 'admin.users.index',
'sort' => 6
], [
'key' => 'settings.users.users',
'name' => 'Users',
'name' => 'admin::app.acl.users',
'route' => 'admin.users.index',
'sort' => 1
], [
'key' => 'settings.users.roles',
'name' => 'Roles',
'name' => 'admin::app.acl.roles',
'route' => 'admin.roles.index',
'sort' => 1
], [
'key' => 'settings.sliders',
'name' => 'Sliders',
'name' => 'admin::app.acl.sliders',
'route' => 'admin.sliders.index',
'sort' => 7
], [
'key' => 'settings.taxes',
'name' => 'Taxes',
'name' => 'admin::app.acl.taxes',
'route' => 'admin.tax-categories.index',
'sort' => 8
], [
'key' => 'settings.taxes.tax-categories',
'name' => 'Tax Categories',
'name' => 'admin::app.acl.tax-categories',
'route' => 'admin.tax-categories.index',
'sort' => 1
], [
'key' => 'settings.taxes.tax-rates',
'name' => 'Tax Rates',
'name' => 'admin::app.acl.tax-rates',
'route' => 'admin.tax-rates.index',
'sort' => 2
]

View File

@ -3,176 +3,176 @@
return [
[
'key' => 'dashboard',
'name' => 'Dashboard',
'name' => 'admin::app.layouts.dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1,
'icon-class' => 'dashboard-icon',
], [
'key' => 'sales',
'name' => 'Sales',
'name' => 'admin::app.layouts.sales',
'route' => 'admin.sales.orders.index',
'sort' => 2,
'icon-class' => 'sales-icon',
], [
'key' => 'sales.orders',
'name' => 'Orders',
'name' => 'admin::app.layouts.orders',
'route' => 'admin.sales.orders.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'sales.shipments',
'name' => 'Shipments',
'name' => 'admin::app.layouts.shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'sales.invoices',
'name' => 'Invoices',
'name' => 'admin::app.layouts.invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 3,
'icon-class' => '',
],
[
'key' => 'catalog',
'name' => 'Catalog',
'name' => 'admin::app.layouts.catalog',
'route' => 'admin.catalog.products.index',
'sort' => 3,
'icon-class' => 'catalog-icon',
], [
'key' => 'catalog.products',
'name' => 'Products',
'name' => 'admin::app.layouts.products',
'route' => 'admin.catalog.products.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'catalog.categories',
'name' => 'Categories',
'name' => 'admin::app.layouts.categories',
'route' => 'admin.catalog.categories.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'catalog.attributes',
'name' => 'Attributes',
'name' => 'admin::app.layouts.attributes',
'route' => 'admin.catalog.attributes.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'catalog.families',
'name' => 'Families',
'name' => 'admin::app.layouts.attribute-families',
'route' => 'admin.catalog.families.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'customers',
'name' => 'Customers',
'name' => 'admin::app.layouts.customers',
'route' => 'admin.customer.index',
'sort' => 4,
'icon-class' => 'customer-icon',
], [
'key' => 'customers.customers',
'name' => 'Customers',
'name' => 'admin::app.layouts.customers',
'route' => 'admin.customer.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'customers.groups',
'name' => 'Groups',
'name' => 'admin::app.layouts.groups',
'route' => 'admin.groups.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'customers.reviews',
'name' => 'Reviews',
'name' => 'admin::app.layouts.reviews',
'route' => 'admin.customer.review.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'customers.subscribers',
'name' => 'Newsletter Subscription',
'name' => 'admin::app.layouts.newsletter-subscriptions',
'route' => 'admin.customers.subscribers.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'configuration',
'name' => 'Configure',
'name' => 'admin::app.layouts.configure',
'route' => 'admin.configuration.index',
'sort' => 5,
'icon-class' => 'configuration-icon',
], [
'key' => 'settings',
'name' => 'Settings',
'name' => 'admin::app.layouts.settings',
'route' => 'admin.locales.index',
'sort' => 6,
'icon-class' => 'settings-icon',
], [
'key' => 'settings.locales',
'name' => 'Locales',
'name' => 'admin::app.layouts.locales',
'route' => 'admin.locales.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.currencies',
'name' => 'Currencies',
'name' => 'admin::app.layouts.currencies',
'route' => 'admin.currencies.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'settings.exchange_rates',
'name' => 'Exchange Rates',
'name' => 'admin::app.layouts.exchange-rates',
'route' => 'admin.exchange_rates.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'settings.inventory_sources',
'name' => 'Inventory Sources',
'name' => 'admin::app.layouts.inventory-sources',
'route' => 'admin.inventory_sources.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'settings.channels',
'name' => 'Channels',
'name' => 'admin::app.layouts.channels',
'route' => 'admin.channels.index',
'sort' => 5,
'icon-class' => '',
], [
'key' => 'settings.users',
'name' => 'Users',
'name' => 'admin::app.layouts.users',
'route' => 'admin.users.index',
'sort' => 6,
'icon-class' => '',
], [
'key' => 'settings.users.users',
'name' => 'Users',
'name' => 'admin::app.layouts.users',
'route' => 'admin.users.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.users.roles',
'name' => 'Roles',
'name' => 'admin::app.layouts.roles',
'route' => 'admin.roles.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'settings.sliders',
'name' => 'Sliders',
'name' => 'admin::app.layouts.sliders',
'route' => 'admin.sliders.index',
'sort' => 7,
'icon-class' => '',
], [
'key' => 'settings.taxes',
'name' => 'Taxes',
'name' => 'admin::app.layouts.taxes',
'route' => 'admin.tax-categories.index',
'sort' => 8,
'icon-class' => '',
], [
'key' => 'settings.taxes.tax-categories',
'name' => 'Tax Categories',
'name' => 'admin::app.layouts.tax-categories',
'route' => 'admin.tax-categories.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.taxes.tax-rates',
'name' => 'Tax Rates',
'name' => 'admin::app.layouts.tax-rates',
'route' => 'admin.tax-rates.index',
'sort' => 2,
'icon-class' => '',

View File

@ -2,18 +2,21 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* AttributeDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class AttributeDataGrid extends AbsGrid
class AttributeDataGrid extends DataGrid
{
public $allColumns = [];
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()
{
@ -22,16 +25,11 @@ class AttributeDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'attributeId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +38,7 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'attributeCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +47,7 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'admin_name',
'alias' => 'attributeAdminName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.admin-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,8 +56,7 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'type',
'alias' => 'attributeType',
'label' => 'Type',
'label' => trans('admin::app.datagrid.type'),
'type' => 'string',
'sortable' => true,
'searchable' => true,
@ -70,14 +65,13 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'is_required',
'alias' => 'attributeRequired',
'label' => 'Required',
'label' => trans('admin::app.datagrid.required'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'True';
else
return 'False';
@ -86,14 +80,13 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'is_unique',
'alias' => 'attributeIsUnique',
'label' => 'Unique',
'label' => trans('admin::app.datagrid.unique'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'True';
else
return 'False';
@ -102,14 +95,13 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'value_per_locale',
'alias' => 'attributeValuePerLocale',
'label' => 'Locale Based',
'label' => trans('admin::app.datagrid.per-locale'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'True';
else
return 'False';
@ -118,14 +110,13 @@ class AttributeDataGrid extends AbsGrid
$this->addColumn([
'index' => 'value_per_channel',
'alias' => 'attributeValuePerChannel',
'label' => 'Channel Based',
'label' => trans('admin::app.datagrid.per-channel'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'True';
else
return 'False';
@ -133,7 +124,8 @@ class AttributeDataGrid extends AbsGrid
]);
}
public function prepareActions() {
public function prepareActions()
{
$this->addAction([
'type' => 'Edit',
'route' => 'admin.catalog.attributes.edit',
@ -147,10 +139,12 @@ class AttributeDataGrid extends AbsGrid
]);
}
public function prepareMassActions() {
public function prepareMassActions()
{
$this->addMassAction([
'type' => 'delete',
'action' => route('admin.catalog.attributes.massdelete'),
'label' => 'Delete',
'method' => 'DELETE'
]);
}

View File

@ -2,18 +2,20 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* AttributeFamilyDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class AttributeFamilyDataGrid extends AbsGrid
class AttributeFamilyDataGrid extends DataGrid
{
public $allColumns = [];
protected $itemsPerPage = 5;
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -22,16 +24,11 @@ class AttributeFamilyDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'attributeFamilyId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +37,7 @@ class AttributeFamilyDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'attributeFamilyCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +46,7 @@ class AttributeFamilyDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'attributeFamilyName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* CategoryDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CategoryDataGrid extends AbsGrid
class CategoryDataGrid extends DataGrid
{
public $allColumns = [];
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', 'ct.name', 'cat.position', 'cat.status', 'ct.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 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');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'cat.id',
'alias' => 'catId',
'label' => 'ID',
'index' => 'category_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,9 +34,8 @@ class CategoryDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'ct.name',
'alias' => 'catName',
'label' => 'Name',
'index' => 'category_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -49,9 +43,8 @@ class CategoryDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'cat.position',
'alias' => 'catPosition',
'label' => 'Position',
'index' => 'category_position',
'label' => trans('admin::app.datagrid.position'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -59,15 +52,14 @@ class CategoryDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'cat.status',
'alias' => 'catStatus',
'label' => 'Status',
'index' => 'category_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'sortable' => true,
'searchable' => true,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'Active';
else
return 'Inactive';
@ -75,9 +67,8 @@ class CategoryDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'ct.locale',
'alias' => 'catLocale',
'label' => 'Locale',
'index' => 'category_locale',
'label' => trans('admin::app.datagrid.locale'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Channel Data Grid class
* ChannelDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ChannelDataGrid extends AbsGrid
class ChannelDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class ChannelDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'channelId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class ChannelDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'channelCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class ChannelDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'channelName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,8 +53,7 @@ class ChannelDataGrid extends AbsGrid
$this->addColumn([
'index' => 'hostname',
'alias' => 'channelHostname',
'label' => 'Hostname',
'label' => trans('admin::app.datagrid.hostname'),
'type' => 'string',
'sortable' => true,
'searchable' => true,

View File

@ -1,113 +0,0 @@
<?php
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use DB;
/**
* Product Data Grid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CountryDataGrid extends AbsGrid
{
public $allColumns = [];
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('countries')->select('id')->addSelect($this->columns);
$this->setQueryBuilder($queryBuilder);
}
public function addColumns()
{
$this->addColumn([
'column' => 'id',
'alias' => 'countryId',
'label' => 'ID',
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'column' => 'code',
'alias' => 'countryCode',
'label' => 'Code',
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'column' => 'name',
'alias' => 'countryName',
'label' => 'Name',
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'column' => 'status',
'alias' => 'countryStatus',
'label' => 'Status',
'type' => 'number',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
}
public function prepareActions() {
$this->prepareAction([
'type' => 'Edit',
'route' => 'admin.catalog.products.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->prepareAction([
'type' => 'Delete',
'route' => 'admin.catalog.products.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'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,
// ]
// ]);
}
public function render()
{
$this->addColumns();
$this->prepareActions();
$this->prepareMassActions();
$this->prepareQueryBuilder();
return view('ui::testgrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->allColumns, 'actions' => $this->actions, 'massactions' => $this->massActions]);
}
}

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* CurrencyDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CurrencyDataGrid extends AbsGrid
class CurrencyDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class CurrencyDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'currencyId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class CurrencyDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'currencyName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class CurrencyDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'currencyCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,36 +2,33 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* CustomerDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerDataGrid extends AbsGrid
class CustomerDataGrid extends DataGrid
{
public $allColumns = [];
protected $itemsPerPage = 5;
protected $index = 'customer_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('customers as cus')->addSelect('cus.id', 'cus.first_name', 'cus.email', 'cg.name')->leftJoin('customer_groups as cg', 'cus.customer_group_id', '=', 'cg.id');
$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');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'cus.id',
'alias' => 'customerId',
'label' => 'ID',
'index' => 'customer_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,10 +36,8 @@ class CustomerDataGrid extends AbsGrid
]);
$this->addColumn([
// 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)',
'index' => 'cus.first_name',
'alias' => 'customerFullName',
'label' => 'Name',
'index' => 'customer_full_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,9 +45,8 @@ class CustomerDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'cus.email',
'alias' => 'customerEmail',
'label' => 'Email',
'index' => 'customer_email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,9 +54,8 @@ class CustomerDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'cg.name',
'alias' => 'customerGroupName',
'label' => 'Group',
'index' => 'customer_group_name',
'label' => trans('admin::app.datagrid.group'),
'type' => 'string',
'searchable' => false,
'sortable' => true,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* CustomerDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerGroupDataGrid extends AbsGrid
class CustomerGroupDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -22,15 +22,10 @@ class CustomerGroupDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'groupId',
'label' => 'ID',
'type' => 'number',
'searchable' => false,
@ -39,9 +34,7 @@ class CustomerGroupDataGrid extends AbsGrid
]);
$this->addColumn([
// 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)',
'index' => 'name',
'alias' => 'groupName',
'label' => 'Name',
'type' => 'string',
'searchable' => true,

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* CustomerReviewDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerReviewDataGrid extends AbsGrid
class CustomerReviewDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'product_review_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('product_reviews as pr')->addSelect('pr.id', 'pr.title', 'pr.comment', 'pg.name', 'pr.status')->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id');
$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');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'pr.id',
'alias' => 'reviewId',
'label' => 'ID',
'index' => 'product_review_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,9 +34,8 @@ class CustomerReviewDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'pr.title',
'alias' => 'reviewTitle',
'label' => 'Title',
'index' => 'product_review_title',
'label' => trans('admin::app.datagrid.title'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -49,9 +43,8 @@ class CustomerReviewDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'pr.comment',
'alias' => 'reviewComment',
'label' => 'Comment',
'index' => 'product_review_comment',
'label' => trans('admin::app.datagrid.comment'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -59,9 +52,8 @@ class CustomerReviewDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'pg.name',
'alias' => 'productName',
'label' => 'Product',
'index' => 'product_review_name',
'label' => trans('admin::app.datagrid.product-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -69,18 +61,17 @@ class CustomerReviewDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'pr.status',
'alias' => 'reviewStatus',
'label' => 'Status',
'index' => 'product_review_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'closure' => true,
'wrapper' => function ($value) {
if($value == 'approved')
if ($value == 'approved')
return '<span class="badge badge-md badge-success">Approved</span>';
else if($value == "pending")
else if ($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
},
]);
@ -103,17 +94,19 @@ class CustomerReviewDataGrid extends AbsGrid
public function prepareMassActions() {
$this->addMassAction([
'type' => 'delete',
'action' => route('admin.catalog.products.massdelete'),
'label' => 'Delete',
'action' => route('admin.customer.review.massdelete'),
'method' => 'DELETE'
]);
$this->addMassAction([
'type' => 'update',
'action' => route('admin.catalog.products.massupdate'),
'label' => 'Update Status',
'action' => route('admin.customer.review.massupdate'),
'method' => 'PUT',
'options' => [
0 => true,
1 => false,
'Disapprove' => 0,
'Approve' => 1
]
]);
}

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* ExchangeRateDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ExchangeRatesDataGrid extends AbsGrid
class ExchangeRatesDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'currency_exch_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id', 'curr.name', 'cer.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 as currency_exch_name', 'cer.rate as currency_exch_rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'cer.id',
'alias' => 'exchId',
'label' => 'ID',
'index' => 'currency_exch_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,9 +34,8 @@ class ExchangeRatesDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'curr.name',
'alias' => 'exchName',
'label' => 'Currency Name',
'index' => 'currency_exch_name',
'label' => trans('admin::app.datagrid.currency-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -49,9 +43,8 @@ class ExchangeRatesDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'cer.rate',
'alias' => 'exchRate',
'label' => 'Exchange Rate',
'index' => 'currency_exch_rate',
'label' => trans('admin::app.datagrid.exch-rate'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* InventorySourcesDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class InventorySourcesDataGrid extends AbsGrid
class InventorySourcesDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class InventorySourcesDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'invId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class InventorySourcesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'invCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class InventorySourcesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'invName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,8 +53,7 @@ class InventorySourcesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'priority',
'alias' => 'invPriority',
'label' => 'Priority',
'label' => trans('admin::app.datagrid.priority'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -70,14 +62,13 @@ class InventorySourcesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'status',
'alias' => 'invStatus',
'label' => 'Status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'Active';
else
return 'Inactive';

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* LocalesDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class LocalesDataGrid extends AbsGrid
class LocalesDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class LocalesDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'localeId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class LocalesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'localeCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class LocalesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'localeName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* NewsLetterDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class NewsLetterDataGrid extends AbsGrid
class NewsLetterDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class NewsLetterDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'subsId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,14 +35,13 @@ class NewsLetterDataGrid extends AbsGrid
$this->addColumn([
'index' => 'is_subscribed',
'alias' => 'subsCode',
'label' => 'Subscribed',
'label' => trans('admin::app.datagrid.subscribed'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
'wrapper' => function($value) {
if ($value == 1)
return 'True';
else
return 'False';
@ -56,8 +50,7 @@ class NewsLetterDataGrid extends AbsGrid
$this->addColumn([
'index' => 'email',
'alias' => 'subsEmail',
'label' => 'Email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* OrderDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderDataGrid extends AbsGrid
class OrderDataGrid extends DataGrid
{
public $allColumns = [];
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 fullname'));
$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'));
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'orderId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class OrderDataGrid extends AbsGrid
$this->addColumn([
'index' => 'base_grand_total',
'alias' => 'baseGrandTotal',
'label' => 'Base Total',
'label' => trans('admin::app.datagrid.base-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -53,8 +47,7 @@ class OrderDataGrid extends AbsGrid
$this->addColumn([
'index' => 'grand_total',
'alias' => 'grandTotal',
'label' => 'Grand Total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -66,8 +59,7 @@ class OrderDataGrid extends AbsGrid
$this->addColumn([
'index' => 'created_at',
'alias' => 'orderDate',
'label' => 'Order Date',
'label' => trans('admin::app.datagrid.order-date'),
'type' => 'string',
'sortable' => true,
'searchable' => true,
@ -76,8 +68,7 @@ class OrderDataGrid extends AbsGrid
$this->addColumn([
'index' => 'channel_name',
'alias' => 'channelName',
'label' => 'Channel Name',
'label' => trans('admin::app.datagrid.channel-name'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
@ -86,35 +77,33 @@ class OrderDataGrid extends AbsGrid
$this->addColumn([
'index' => 'status',
'alias' => 'status',
'label' => 'Status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'closure' => true,
'wrapper' => function ($value) {
if($value == 'processing')
if ($value == 'processing')
return '<span class="badge badge-md badge-success">Processing</span>';
else if($value == 'completed')
else if ($value == 'completed')
return '<span class="badge badge-md badge-success">Completed</span>';
else if($value == "canceled")
else if ($value == "canceled")
return '<span class="badge badge-md badge-danger">Canceled</span>';
else if($value == "closed")
else if ($value == "closed")
return '<span class="badge badge-md badge-info">Closed</span>';
else if($value == "pending")
else if ($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
else if($value == "pending_payment")
else if ($value == "pending_payment")
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
else if($value == "fraud")
else if ($value == "fraud")
return '<span class="badge badge-md badge-danger">Fraud</span>';
}
]);
$this->addColumn([
'index' => 'fullname',
'alias' => 'fullName',
'label' => 'Billed To',
'index' => 'full_name',
'label' => trans('admin::app.datagrid.billed-to'),
'type' => 'string',
'searchable' => false,
'sortable' => true,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* OrderInvoicesDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderInvoicesDataGrid extends AbsGrid
class OrderInvoicesDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class OrderInvoicesDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'invid',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class OrderInvoicesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'order_id',
'alias' => 'orderId',
'label' => 'Order ID',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -50,8 +44,7 @@ class OrderInvoicesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'grand_total',
'alias' => 'invgrandtotal',
'label' => 'Grand Total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,8 +53,7 @@ class OrderInvoicesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'created_at',
'alias' => 'invcreatedat',
'label' => 'Invoice Date',
'label' => trans('admin::app.datagrid.invoice-date'),
'type' => 'datetime',
'searchable' => true,
'sortable' => true,

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* OrderShipmentsDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderShipmentsDataGrid extends AbsGrid
class OrderShipmentsDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'shipment_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('shipments as ship')->select('ship.id', 'ship.order_id', 'ship.total_qty', 'is.name', 'ors.created_at as orderdate', 'ship.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')->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');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'ship.id',
'alias' => 'shipId',
'label' => 'ID',
'index' => 'shipment_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,9 +34,8 @@ class OrderShipmentsDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'ship.order_id',
'alias' => 'orderId',
'label' => 'Order ID',
'index' => 'shipment_order_id',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -49,9 +43,8 @@ class OrderShipmentsDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'ship.total_qty',
'alias' => 'shipTotalQty',
'label' => 'Total Qty',
'index' => 'shipment_total_qty',
'label' => trans('admin::app.datagrid.total-qty'),
'type' => 'number',
'searchable' => true,
'sortable' => true,
@ -59,9 +52,8 @@ class OrderShipmentsDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'is.name',
'alias' => 'shipInventoryName',
'label' => 'Inventory Source',
'index' => 'inventory_source_name',
'label' => trans('admin::app.datagrid.inventory-source'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -70,8 +62,7 @@ class OrderShipmentsDataGrid extends AbsGrid
$this->addColumn([
'index' => 'orderdate',
'alias' => 'shipOrderDate',
'label' => 'Order Date',
'label' => trans('admin::app.datagrid.order-date'),
'type' => 'datetime',
'sortable' => true,
'searchable' => true,
@ -79,9 +70,8 @@ class OrderShipmentsDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'ship.created_at',
'alias' => 'shipDate',
'label' => 'Shipment Date',
'index' => 'shipment_created_at',
'label' => trans('admin::app.datagrid.shipment-date'),
'type' => 'datetime',
'sortable' => true,
'searchable' => false,
@ -90,8 +80,7 @@ class OrderShipmentsDataGrid extends AbsGrid
$this->addColumn([
'index' => 'custname',
'alias' => 'shipTO',
'label' => 'Shipping To',
'label' => trans('admin::app.datagrid.shipment-to'),
'type' => 'string',
'sortable' => true,
'searchable' => false,

299
packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php Executable file → Normal file
View File

@ -2,208 +2,133 @@
namespace Webkul\Admin\DataGrids;
use Illuminate\View\View;
use Webkul\Ui\DataGrid\Facades\DataGrid;
use Webkul\Channel\Repositories\ChannelRepository;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product DataGrid
* ProductDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ProductDataGrid
class ProductDataGrid extends DataGrid
{
protected $index = 'product_id';
/**
* The Data Grid implementation for Products
*/
public function createProductDataGrid()
public function prepareQueryBuilder()
{
return DataGrid::make([
'name' => 'Products',
'table' => 'products_grid as prods',
'select' => 'prods.product_id',
'perpage' => 10,
'aliased' => false, //use this with false as default and true in case of joins
$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');
'massoperations' => [
0 => [
'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance
'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE'
],
$this->setQueryBuilder($queryBuilder);
}
1 => [
'type' => 'update', //all lower case will be shifted in the configuration file for better control and increased fault tolerance
'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT',
'options' => [
0 => 'In Active',
1 => 'Active',
]
]
],
'actions' => [
[
'type' => 'Edit',
'route' => 'admin.catalog.products.edit',
// 'confirm_text' => trans('ui::app.datagrid.massaction.edit', ['resource' => 'product']),
'icon' => 'icon pencil-lg-icon'
], [
'type' => 'Delete',
'route' => 'admin.catalog.products.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon'
]
],
'join' => [
],
//use aliasing on secodary columns if join is performed
'columns' => [
//name, alias, type, label, sortable
[
'name' => 'prods.product_id',
'alias' => 'id',
'type' => 'string',
'label' => 'ID',
'sortable' => true,
], [
'name' => 'prods.sku',
'alias' => 'productSku',
'type' => 'string',
'label' => 'SKU',
'sortable' => true,
], [
'name' => 'prods.name',
'alias' => 'ProductName',
'type' => 'string',
'label' => 'Name',
'sortable' => true,
], [
'name' => 'prods.type',
'alias' => 'ProductType',
'type' => 'string',
'label' => 'Type',
'sortable' => true,
], [
'name' => 'prods.status',
'alias' => 'ProductStatus',
'type' => 'boolean',
'label' => 'Status',
'sortable' => true,
'wrapper' => function ($value) {
if($value == 1)
return 'Active';
else
return 'Inactive';
},
], [
'name' => 'prods.price',
'alias' => 'ProductPrice',
'type' => 'string',
'label' => 'Price',
'sortable' => true,
'wrapper' => function ($value) {
return core()->formatBasePrice($value);
},
], [
'name' => 'prods.attribute_family_name',
'alias' => 'productattributefamilyname',
'type' => 'string',
'label' => 'Attribute Family',
'sortable' => true,
], [
'name' => 'prods.quantity',
'alias' => 'ProductQuantity',
'type' => 'string',
'label' => 'Product Quantity',
'sortable' => true,
]
],
'filterable' => [
//column, alias, type, and label
[
'column' => 'prods.product_id',
'alias' => 'productID',
'type' => 'number',
'label' => 'ID',
], [
'column' => 'prods.sku',
'alias' => 'productSku',
'type' => 'string',
'label' => 'SKU',
], [
'column' => 'prods.name',
'alias' => 'ProductName',
'type' => 'string',
'label' => 'Product Name',
], [
'column' => 'prods.type',
'alias' => 'ProductType',
'type' => 'string',
'label' => 'Product Type',
], [
'column' => 'prods.status',
'alias' => 'ProductStatus',
'type' => 'boolean',
'label' => 'Status'
]
],
//don't use aliasing in case of searchables
'searchable' => [
//column, type and label
[
'column' => 'prods.product_id',
'type' => 'number',
'label' => 'ID',
], [
'column' => 'prods.sku',
'type' => 'string',
'label' => 'SKU',
], [
'column' => 'prods.name',
'type' => 'string',
'label' => 'Product Name',
], [
'column' => 'prods.type',
'type' => 'string',
'label' => 'Product Type',
]
],
//list of viable operators that will be used
'operators' => [
'eq' => "=",
'lt' => "<",
'gt' => ">",
'lte' => "<=",
'gte' => ">=",
'neqs' => "<>",
'neqn' => "!=",
'like' => "like",
'nlike' => "not like",
],
// 'css' => []
public function addColumns()
{
$this->addColumn([
'index' => 'product_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'product_sku',
'label' => trans('admin::app.datagrid.sku'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'product_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'product_type',
'label' => trans('admin::app.datagrid.type'),
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'product_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value == 1)
return 'Active';
else
return 'Inactive';
}
]);
$this->addColumn([
'index' => 'product_price',
'label' => trans('admin::app.datagrid.price'),
'type' => 'number',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
return core()->formatBasePrice($value);
}
]);
$this->addColumn([
'index' => 'product_quantity',
'label' => trans('admin::app.datagrid.qty'),
'type' => 'number',
'sortable' => true,
'searchable' => false,
'width' => '100px'
]);
}
public function render()
{
return $this->createProductDataGrid()->render();
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.catalog.products.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.catalog.products.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon'
]);
}
public function export()
{
$paginate = false;
return $this->createProductDataGrid()->render($paginate);
}
public function prepareMassActions() {
$this->addMassAction([
'type' => 'delete',
'label' => 'Delete',
'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE'
]);
$this->addMassAction([
'type' => 'update',
'label' => 'Update Status',
'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT',
'options' => [
'Active' => 1,
'Inactive' => 0
]
]);
}
}

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* RolesDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class RolesDataGrid extends AbsGrid
class RolesDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class RolesDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'roleId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class RolesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'roleName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class RolesDataGrid extends AbsGrid
$this->addColumn([
'index' => 'permission_type',
'alias' => 'roleType',
'label' => 'Permission Type',
'label' => trans('admin::app.datagrid.permission-type'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* SliderDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class SliderDataGrid extends AbsGrid
class SliderDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'slider_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
$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');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'sl.id',
'alias' => 'sliderId',
'label' => 'ID',
'index' => 'slider_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,9 +34,8 @@ class SliderDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'sl.title',
'alias' => 'sliderTitle',
'label' => 'Tile',
'index' => 'slider_title',
'label' => trans('admin::app.datagrid.title'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -49,9 +43,8 @@ class SliderDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'ch.name',
'alias' => 'channelName',
'label' => 'Channel Name',
'index' => 'channel_name',
'label' => trans('admin::app.datagrid.channel-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Tax Category Grid class
* TaxCategoryDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxCategoryDataGrid extends AbsGrid
class TaxCategoryDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class TaxCategoryDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'taxCatId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class TaxCategoryDataGrid extends AbsGrid
$this->addColumn([
'index' => 'name',
'alias' => 'taxCatName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class TaxCategoryDataGrid extends AbsGrid
$this->addColumn([
'index' => 'code',
'alias' => 'taxCatCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -2,18 +2,18 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Tax Rate Grid class
* TaxRateDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxRateDataGrid extends AbsGrid
class TaxRateDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -22,16 +22,11 @@ class TaxRateDataGrid extends AbsGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'taxRateId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -40,8 +35,7 @@ class TaxRateDataGrid extends AbsGrid
$this->addColumn([
'index' => 'identifier',
'alias' => 'taxRateName',
'label' => 'Identifier',
'label' => trans('admin::app.datagrid.identifier'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -50,8 +44,7 @@ class TaxRateDataGrid extends AbsGrid
$this->addColumn([
'index' => 'state',
'alias' => 'taxRateState',
'label' => 'State',
'label' => trans('admin::app.datagrid.state'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,8 +53,7 @@ class TaxRateDataGrid extends AbsGrid
$this->addColumn([
'index' => 'country',
'alias' => 'taxRateCountry',
'label' => 'Country',
'label' => trans('admin::app.datagrid.country'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -70,8 +62,7 @@ class TaxRateDataGrid extends AbsGrid
$this->addColumn([
'index' => 'tax_rate',
'alias' => 'taxRate',
'label' => 'Rate',
'label' => trans('admin::app.datagrid.tax-rate'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -1,147 +0,0 @@
<?php
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use DB;
/**
* Product Data Grid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TestDataGrid extends AbsGrid
{
public $allColumns = [];
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('products_grid')->addSelect('products_grid.product_id', 'products_grid.sku', 'products_grid.name', 'products.type', 'products_grid.status', 'products_grid.price', 'products_grid.quantity')->leftJoin('products', 'products_grid.product_id', '=', 'products.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'product_id'; //the column that needs to be treated as index column
}
// public function setGridName() {
// $this->gridName = 'products_grid'; // should be the table name for getting proper index
// }
public function addColumns()
{
$this->addColumn([
'index' => 'products_grid.product_id',
'alias' => 'productid',
'label' => 'ID',
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
'index' => 'products_grid.sku',
'alias' => 'productsku',
'label' => 'SKU',
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'products_grid.name',
'alias' => 'productname',
'label' => 'Name',
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'products.type',
'alias' => 'producttype',
'label' => 'Type',
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
$this->addColumn([
'index' => 'products_grid.status',
'alias' => 'productstatus',
'label' => 'Status',
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1)
return 'Active';
else
return 'Inactive';
}
]);
$this->addColumn([
'index' => 'products_grid.price',
'alias' => 'productprice',
'label' => 'Price',
'type' => 'number',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
return core()->formatBasePrice($value);
}
]);
$this->addColumn([
'index' => 'products_grid.quantity',
'alias' => 'productqty',
'label' => 'Quantity',
'type' => 'number',
'sortable' => true,
'searchable' => false,
'width' => '100px'
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.catalog.products.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.catalog.products.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon'
]);
}
public function prepareMassActions() {
$this->addMassAction([
'type' => 'delete',
'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE'
]);
$this->addMassAction([
'type' => 'update',
'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT',
'options' => [
0 => true,
1 => false,
]
]);
}
}

View File

@ -2,36 +2,31 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\AbsGrid;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* UserDataGrid Class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class UserDataGrid extends AbsGrid
class UserDataGrid extends DataGrid
{
public $allColumns = [];
protected $index = 'user_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('admins as u')->addSelect('u.id', 'u.name', 'u.status', 'u.email', 'ro.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 as user_status', 'u.email as user_email', 'ro.name as role_name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'u.id',
'alias' => 'adminId',
'label' => 'ID',
'index' => 'user_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -39,9 +34,8 @@ class UserDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'u.name',
'alias' => 'adminName',
'label' => 'Name',
'index' => 'user_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -49,15 +43,14 @@ class UserDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'u.status',
'alias' => 'adminStatus',
'label' => 'Status',
'index' => 'user_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1) {
if ($value == 1) {
return 'Active';
} else {
return 'Inactive';
@ -66,9 +59,8 @@ class UserDataGrid extends AbsGrid
]);
$this->addColumn([
'index' => 'u.email',
'alias' => 'adminEmail',
'label' => 'Email',
'index' => 'user_email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -35,7 +35,7 @@ class Handler extends ExceptionHandler
}
// else if ($exception instanceof ErrorException) {
// if(strpos($_SERVER['REQUEST_URI'], 'admin') !== false){
// if (strpos($_SERVER['REQUEST_URI'], 'admin') !== false) {
// return response()->view('admin::errors.500', [], 500);
// }else {
// return response()->view('shop::errors.500', [], 500);

View File

@ -42,9 +42,11 @@ class DataGridExport implements FromView, ShouldAutoSize
{
$pagination = false;
return view('admin::export.export', [
'results' => $this->gridData->render($pagination)->results,
'columns' => $this->gridData->render($pagination)->columns,
]);
dd($this->gridData);
// return view('admin::export.export', [
// 'results' => $this->gridData->render($pagination)->results,
// 'columns' => $this->gridData->render($pagination)->columns,
// ]);
}
}

View File

@ -65,7 +65,7 @@ class ConfigurationController extends Controller
{
$tree = Tree::create();
foreach(config('core') as $item) {
foreach (config('core') as $item) {
$tree->add($item);
}
@ -83,7 +83,7 @@ class ConfigurationController extends Controller
{
$slugs = $this->getDefaultConfigSlugs();
if(count($slugs)) {
if (count($slugs)) {
return redirect()->route('admin.configuration.index', $slugs);
}
@ -99,7 +99,7 @@ class ConfigurationController extends Controller
{
$slugs = [];
if(!request()->route('slug')) {
if (! request()->route('slug')) {
$firstItem = current($this->configTree->items);
$secondItem = current($firstItem['children']);
@ -110,7 +110,7 @@ class ConfigurationController extends Controller
'slug2' => end($temp)
];
} else {
if(!request()->route('slug2')) {
if (! request()->route('slug2')) {
$secondItem = current($this->configTree->items[request()->route('slug')]['children']);
$temp = explode('.', $secondItem['key']);

View File

@ -103,7 +103,6 @@ class CustomerController extends Controller
'first_name' => 'string|required',
'last_name' => 'string|required',
'gender' => 'required',
'phone' => 'nullable|numeric|unique:customers,phone',
'email' => 'required|unique:customers,email',
'date_of_birth' => 'date|before:today'
]);
@ -112,7 +111,9 @@ class CustomerController extends Controller
$password = bcrypt(rand(100000,10000000));
$data['password']=$password;
$data['password'] = $password;
$data['is_verified'] = 1;
$this->customer->create($data);

View File

@ -129,7 +129,7 @@ class CustomerGroupController extends Controller
{
$group = $this->customerGroup->findOneByField('id', $id);
if($group->is_user_defined == 0) {
if ($group->is_user_defined == 0) {
session()->flash('warning', trans('admin::app.customers.customers.group-default'));
} else {
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer Group']));

View File

@ -114,7 +114,7 @@ class DashboardController extends Controller
public function getPercentageChange($previous, $current)
{
if(!$previous)
if (! $previous)
return $current ? 100 : 0;
return ($current - $previous) / $previous * 100;
@ -291,7 +291,7 @@ class DashboardController extends Controller
? Carbon::createFromTimeString(request()->get('end') . " 23:59:59")
: Carbon::now();
if($this->endDate > Carbon::now())
if ($this->endDate > Carbon::now())
$this->endDate = Carbon::now();
$this->lastStartDate = clone $this->startDate;

View File

@ -32,7 +32,11 @@ class ExportController extends Controller
*/
public function export()
{
$results = unserialize(request()->all()['gridData']);
$results = request()->all()['gridData'];
$data = json_decode($results, true);
$results = (object) $data;
$file_name = class_basename($results);

View File

@ -91,7 +91,7 @@ class InvoiceController extends Controller
{
$order = $this->order->find($orderId);
if(!$order->canInvoice()) {
if (! $order->canInvoice()) {
session()->flash('error', 'Order invoice creation is not allowed.');
return redirect()->back();
@ -105,13 +105,13 @@ class InvoiceController extends Controller
$haveProductToInvoice = false;
foreach ($data['invoice']['items'] as $itemId => $qty) {
if($qty) {
if ($qty) {
$haveProductToInvoice = true;
break;
}
}
if(!$haveProductToInvoice) {
if (! $haveProductToInvoice) {
session()->flash('error', 'Invoice can not be created without products.');
return redirect()->back();

View File

@ -78,7 +78,7 @@ class OrderController extends Controller
{
$result = $this->order->cancel($id);
if($result) {
if ($result) {
session()->flash('success', trans('Order canceled successfully.'));
} else {
session()->flash('error', trans('Order can not be canceled.'));

View File

@ -91,7 +91,7 @@ class ShipmentController extends Controller
{
$order = $this->order->find($orderId);
if(!$order->channel || !$order->canShip()) {
if (! $order->channel || !$order->canShip()) {
session()->flash('error', 'Shipment can not be created for this order.');
return redirect()->back();
@ -111,7 +111,7 @@ class ShipmentController extends Controller
{
$order = $this->order->find($orderId);
if(!$order->canShip()) {
if (! $order->canShip()) {
session()->flash('error', 'Order shipment creation is not allowed.');
return redirect()->back();
@ -126,7 +126,7 @@ class ShipmentController extends Controller
$data = request()->all();
if(!$this->isInventoryValidate($data)) {
if (! $this->isInventoryValidate($data)) {
session()->flash('error', 'Requested quantity is invalid or not available.');
return redirect()->back();
@ -159,6 +159,7 @@ class ShipmentController extends Controller
$inventory = $product->inventories()
->where('inventory_source_id', $data['shipment']['source'])
->where('vendor_id', 0)
->first();
if ($orderItem->qty_to_ship < $qty || $inventory->qty < $qty) {

View File

@ -47,7 +47,7 @@ class Product {
public function afterProductCreated($product) {
$result = $this->productCreated($product);
if($result) {
if ($result) {
return true;
} else {
return false;
@ -76,13 +76,13 @@ class Product {
$found = $this->productGrid->findOneByField('product_id', $product->id);
//extra measure to stop duplicate entries
if($found == null) {
if ($found == null) {
$this->productGrid->create($gridObject);
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$variants = $product->variants()->get();
foreach($variants as $variant) {
foreach ($variants as $variant) {
$variantObj = [
'product_id' => $variant->id,
'sku' => $variant->sku,
@ -130,7 +130,7 @@ class Product {
public function productUpdated($product) {
$productGridObject = $this->productGrid->findOneByField('product_id', $product->id);
if(!$productGridObject) {
if (! $productGridObject) {
return false;
}
@ -143,13 +143,13 @@ class Product {
'status' => $product->status,
];
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$gridObject['quantity'] = 0;
$gridObject['price'] = 0;
} else {
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($product->inventories()->get() as $inventory_source) {
foreach ($product->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
@ -162,7 +162,7 @@ class Product {
if ($product->type == 'configurable') {
$variants = $product->variants()->get();
foreach($variants as $variant) {
foreach ($variants as $variant) {
$variantObj = [
'product_id' => $variant->id,
'sku' => $variant->sku,
@ -176,7 +176,7 @@ class Product {
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($variant->inventories()->get() as $inventory_source) {
foreach ($variant->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
@ -186,7 +186,7 @@ class Product {
$productGridVariant = $this->productGrid->findOneByField('product_id', $variant->id);
if(isset($productGridVariant)) {
if (isset($productGridVariant)) {
$this->productGrid->update($variantObj, $productGridVariant->id);
} else {
$variantObj = [
@ -202,7 +202,7 @@ class Product {
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($variant->inventories()->get() as $inventory_source) {
foreach ($variant->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
@ -224,7 +224,7 @@ class Product {
public function sync() {
$gridObject = [];
foreach($this->product->all() as $product) {
foreach ($this->product->all() as $product) {
$gridObject = [
'product_id' => $product->id,
'sku' => $product->sku,
@ -235,12 +235,12 @@ class Product {
'status' => $product->status
];
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$gridObject['quantity'] = 0;
} else {
$qty = 0;
foreach($product->toArray()['inventories'] as $inventorySource) {
foreach ($product->toArray()['inventories'] as $inventorySource) {
$qty = $qty + $inventorySource['qty'];
}
@ -251,7 +251,7 @@ class Product {
$oldGridObject = $this->productGrid->findOneByField('product_id', $product->id);
if($oldGridObject) {
if ($oldGridObject) {
$oldGridObject->update($gridObject);
} else {
$this->productGrid->create($gridObject);

View File

@ -65,7 +65,7 @@ class AdminServiceProvider extends ServiceProvider
view()->composer(['admin::catalog.products.create', 'admin::catalog.products.edit'], function ($view) {
$accordian = Tree::create();
foreach(config('product_form_accordians') as $item) {
foreach (config('product_form_accordians') as $item) {
$accordian->add($item);
}
@ -77,7 +77,7 @@ class AdminServiceProvider extends ServiceProvider
view()->composer(['admin::layouts.nav-left', 'admin::layouts.nav-aside', 'admin::layouts.tabs'], function ($view) {
$tree = Tree::create();
foreach(config('menu.admin') as $item) {
foreach (config('menu.admin') as $item) {
if (bouncer()->hasPermission($item['key'])) {
$tree->add($item, 'menu');
}
@ -114,12 +114,12 @@ class AdminServiceProvider extends ServiceProvider
{
static $tree;
if($tree)
if ($tree)
return $tree;
$tree = Tree::create();
foreach(config('acl') as $item) {
foreach (config('acl') as $item) {
$tree->add($item, 'acl');
}

View File

@ -8,6 +8,70 @@ return [
'true' => 'True',
'false' => 'False'
],
'layouts' => [
'my-account' => 'My Account',
'logout' => 'Logout',
'visit-shop' => 'Visit Shop',
'dashboard' => 'Dashboard',
'sales' => 'Sales',
'orders' => 'Orders',
'shipments' => 'Shipments',
'invoices' => 'Invoices',
'catalog' => 'Catalog',
'products' => 'Products',
'categories' => 'Categories',
'attributes' => 'Attributes',
'attribute-families' => 'Attribute Families',
'customers' => 'Customers',
'groups' => 'Groups',
'reviews' => 'Reviews',
'newsletter-subscriptions' => 'Newsletter Subscriptions',
'configure' => 'Configure',
'settings' => 'Settings',
'locales' => 'Locales',
'currencies' => 'Currencies',
'exchange-rates' => 'Exchange Rates',
'inventory-sources' => 'Inventory Sources',
'channels' => 'Channels',
'users' => 'Users',
'roles' => 'Roles',
'sliders' => 'Sliders',
'taxes' => 'Taxes',
'tax-categories' => 'Tax Categories',
'tax-rates' => 'Tax Rates'
],
'acl' => [
'dashboard' => 'Dashboard',
'sales' => 'Sales',
'orders' => 'Orders',
'shipments' => 'Shipments',
'invoices' => 'Invoices',
'catalog' => 'Catalog',
'products' => 'Products',
'categories' => 'Categories',
'attributes' => 'Attributes',
'attribute-families' => 'Attribute Families',
'customers' => 'Customers',
'groups' => 'Groups',
'reviews' => 'Reviews',
'newsletter-subscriptions' => 'Newsletter Subscriptions',
'configure' => 'Configure',
'settings' => 'Settings',
'locales' => 'Locales',
'currencies' => 'Currencies',
'exchange-rates' => 'Exchange Rates',
'inventory-sources' => 'Inventory Sources',
'channels' => 'Channels',
'users' => 'Users',
'roles' => 'Roles',
'sliders' => 'Sliders',
'taxes' => 'Taxes',
'tax-categories' => 'Tax Categories',
'tax-rates' => 'Tax Rates'
],
'dashboard' => [
'title' => 'Dashboard',
'from' => 'From',
@ -35,8 +99,51 @@ return [
'method-error' => 'Error! Wrong method detected, please check mass action configuration',
'delete-success' => 'Selected index of :resource were successfully deleted',
'partial-action' => 'Some actions were not performed due restricted system constraints on :resource',
'update-success' => 'Selected index of :resource were successfully updated'
]
'update-success' => 'Selected index of :resource were successfully updated',
],
'id' => 'ID',
'status' => 'Status',
'code' => 'Code',
'admin-name' => 'Name',
'name' => 'Name',
'fullname' => 'Full Name',
'type' => 'Type',
'required' => 'Required',
'unique' => 'Unique',
'per-locale' => 'Locale Based',
'per-channel' => 'Channel Based',
'position' => 'Position',
'locale' => 'Locale',
'hostname' => 'Hostname',
'email' => 'Email',
'group' => 'Group',
'title' => 'Title',
'comment' => 'Comment',
'product-name' => 'Product',
'currency-name' => 'Currency Name',
'exch-rate' => 'Exchange Rate',
'priority' => 'Priority',
'subscribed' => 'Subscribed',
'base-total' => 'Base Total',
'grand-total' => 'Grand Total',
'order-date' => 'Order Date',
'channel-name' => 'Channel Name',
'billed-to' => 'Billed To',
'order-id' => 'Order Id',
'invoice-date' => 'Invoice Date',
'total-qty' => 'Total Qty',
'inventory-source' => 'Inventory Source',
'shipment-date' => 'Shipment Date',
'shipment-to' => 'Shipping To',
'sku' => 'SKU',
'price' => 'Price',
'qty' => 'Quantity',
'permission-type' => 'Permission Type',
'identifier' => 'Identifier',
'state' => 'State',
'country' => 'Country',
'tax-rate' => 'Rate'
],
'account' => [

View File

@ -57,7 +57,7 @@
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
</div>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<div class="control-group">
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
@ -173,7 +173,7 @@
<tr>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
@ -194,7 +194,7 @@
</div>
</td>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<td>
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as="&quot;{{ $locale->name . ' (' . $locale->code . ')' }}&quot;"/>
@ -227,7 +227,7 @@
<script>
$(document).ready(function () {
$('#type').on('change', function (e) {
if(['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
@ -248,7 +248,7 @@
var rowCount = this.optionRowCount++;
var row = {'id': 'option_' + rowCount};
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
@endforeach

View File

@ -77,7 +77,7 @@
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
</div>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<div class="control-group">
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
@ -229,7 +229,7 @@
<tr>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
@ -250,7 +250,7 @@
</div>
</td>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<td>
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as="&quot;{{ $locale->name . ' (' . $locale->code . ')' }}&quot;"/>
@ -283,7 +283,7 @@
<script>
$(document).ready(function () {
$('#type').on('change', function (e) {
if(['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
@ -295,11 +295,11 @@
template: '#options-template',
created () {
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
this.optionRowCount++;
var row = {'id': '{{ $option->id }}', 'admin_name': '{{ $option->admin_name }}', 'sort_order': '{{ $option->sort_order }}'};
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] }}";
@endforeach
@ -317,7 +317,7 @@
var rowCount = this.optionRowCount++;
var row = {'id': 'option_' + rowCount};
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
@endforeach

View File

@ -75,7 +75,7 @@
</div>
</accordian>
@if($categories->count())
@if ($categories->count())
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">

View File

@ -16,7 +16,7 @@
<div class="control-group">
<select class="control" id="locale-switcher" onChange="window.location.href = this.value">
@foreach(core()->getAllLocales() as $localeModel)
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ route('admin.catalog.categories.update', $category->id) . '?locale=' . $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}
@ -89,7 +89,7 @@
</div>
</accordian>
@if($categories->count())
@if ($categories->count())
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">

View File

@ -202,7 +202,7 @@
return this_this.group.groupName.trim() === (group.name ? group.name.trim() : group.groupName.trim())
})
if(filteredGroups.length) {
if (filteredGroups.length) {
const field = this.$validator.fields.find({ name: 'groupName', scope: 'add-group-form' });
if (field) {
@ -248,7 +248,7 @@
group.custom_attributes.forEach(function(attribute) {
var attribute = this.custom_attributes.filter(attributeTemp => attributeTemp.id == attribute.id)
if(attribute.length) {
if (attribute.length) {
let index = this.custom_attributes.indexOf(attribute[0])
this.custom_attributes.splice(index, 1)
@ -323,7 +323,7 @@
$(e.target).prev().find('li input').each(function() {
var attributeId = $(this).val();
if($(this).is(':checked')) {
if ($(this).is(':checked')) {
attributeIds.push(attributeId);
$(this).prop('checked', false);

View File

@ -200,7 +200,7 @@
return this_this.group.groupName.trim() === (group.name ? group.name.trim() : group.groupName.trim())
})
if(filteredGroups.length) {
if (filteredGroups.length) {
const field = this.$validator.fields.find({ name: 'groupName', scope: 'add-group-form' });
if (field) {
@ -246,7 +246,7 @@
group.custom_attributes.forEach(function(attribute) {
var attribute = this.custom_attributes.filter(attributeTemp => attributeTemp.id == attribute.id)
if(attribute.length) {
if (attribute.length) {
let index = this.custom_attributes.indexOf(attribute[0])
this.custom_attributes.splice(index, 1)
@ -306,7 +306,7 @@
computed: {
groupInputName () {
if(this.group.id)
if (this.group.id)
return "attribute_groups[" + this.group.id + "]";
return "attribute_groups[group_" + this.index + "]";
@ -324,7 +324,7 @@
$(e.target).prev().find('li input').each(function() {
var attributeId = $(this).val();
if($(this).is(':checked')) {
if ($(this).is(':checked')) {
attributeIds.push(attributeId);
$(this).prop('checked', false);

View File

@ -1,4 +1,4 @@
@if($categories->count())
@if ($categories->count())
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<div slot="body">

View File

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

View File

@ -205,7 +205,7 @@
var matchCount = 0;
for (var key in this_this.variant) {
if(variant[key] == this_this.variant[key]) {
if (variant[key] == this_this.variant[key]) {
matchCount++;
}
}
@ -213,7 +213,7 @@
return matchCount == this_this.super_attributes.length;
})
if(filteredVariants.length) {
if (filteredVariants.length) {
this.$parent.closeModal();
window.flashMessages = [{'type': 'alert-error', 'message': "{{ __('admin::app.catalog.products.variant-already-exist-message') }}" }];
@ -297,7 +297,7 @@
computed: {
variantInputName () {
if(this.variant.id)
if (this.variant.id)
return "variants[" + this.variant.id + "]";
return "variants[variant_" + this.index + "]";
@ -314,7 +314,7 @@
this.superAttributes.forEach(function(attribute) {
attribute.options.forEach(function(option) {
if(optionId == option.id) {
if (optionId == option.id) {
optionName = option.admin_name;
}
});
@ -325,10 +325,10 @@
sourceInventoryQty (inventorySourceId) {
var inventories = this.variant.inventories.filter(function(inventory) {
return inventorySourceId === inventory.inventory_source_id;
return inventorySourceId === inventory.inventory_source_id && !inventory.vendor_id;
})
if(inventories.length)
if (inventories.length)
return inventories[0]['qty'];
return 0;

View File

@ -51,7 +51,7 @@
<option value="configurable" {{ $familyId ? 'selected' : '' }}>{{ __('admin::app.catalog.products.configurable') }}</option>
</select>
@if($familyId)
@if ($familyId)
<input type="hidden" name="type" value="configurable"/>
@endif
<span class="control-error" v-if="errors.has('type')">@{{ errors.first('type') }}</span>
@ -61,12 +61,12 @@
<label for="attribute_family_id" class="required">{{ __('admin::app.catalog.products.familiy') }}</label>
<select class="control" v-validate="'required'" id="attribute_family_id" name="attribute_family_id" {{ $familyId ? 'disabled' : '' }} data-vv-as="&quot;{{ __('admin::app.catalog.products.familiy') }}&quot;">
<option value=""></option>
@foreach($families as $family)
@foreach ($families as $family)
<option value="{{ $family->id }}" {{ ($familyId == $family->id || old('attribute_family_id') == $family->id) ? 'selected' : '' }}>{{ $family->name }}</option>
@endforeach
</select>
@if($familyId)
@if ($familyId)
<input type="hidden" name="attribute_family_id" value="{{ $familyId }}"/>
@endif
<span class="control-error" v-if="errors.has('attribute_family_id')">@{{ errors.first('attribute_family_id') }}</span>
@ -81,7 +81,7 @@
</div>
</accordian>
@if($familyId)
@if ($familyId)
<accordian :title="'{{ __('admin::app.catalog.products.configurable-attributes') }}'" :active="true">
<div slot="body">
@ -96,13 +96,13 @@
</thead>
<tbody>
@foreach($configurableFamily->configurable_attributes as $attribute)
@foreach ($configurableFamily->configurable_attributes as $attribute)
<tr>
<td>
{{ $attribute->admin_name }}
</td>
<td>
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
<span class="label">
<input type="hidden" name="super_attributes[{{$attribute->code}}][]" value="{{ $option->id }}"/>
{{ $option->admin_name }}

View File

@ -18,7 +18,7 @@
<div class="control-group">
<select class="control" id="channel-switcher" name="channel">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
{{ $channelModel->name }}
@ -30,7 +30,7 @@
<div class="control-group">
<select class="control" id="locale-switcher" name="locale">
@foreach(core()->getAllLocales() as $localeModel)
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}
@ -54,19 +54,19 @@
<input name="_method" type="hidden" value="PUT">
@foreach ($product->attribute_family->attribute_groups as $attributeGroup)
@if(count($attributeGroup->custom_attributes))
@if (count($attributeGroup->custom_attributes))
<accordian :title="'{{ __($attributeGroup->name) }}'" :active="true">
<div slot="body">
@foreach($attributeGroup->custom_attributes as $attribute)
@foreach ($attributeGroup->custom_attributes as $attribute)
@if(!$product->super_attributes->contains($attribute))
@if (! $product->super_attributes->contains($attribute))
<?php
$validations = [];
$disabled = false;
if($product->type == 'configurable' && in_array($attribute->code, ['price', 'cost', 'special_price', 'special_price_from', 'special_price_to', 'width', 'height', 'depth', 'weight'])) {
if(!$attribute->is_required)
if ($product->type == 'configurable' && in_array($attribute->code, ['price', 'cost', 'special_price', 'special_price_from', 'special_price_to', 'width', 'height', 'depth', 'weight'])) {
if (! $attribute->is_required)
continue;
$disabled = true;
@ -85,7 +85,7 @@
$validations = implode('|', array_filter($validations));
?>
@if(view()->exists($typeView = 'admin::catalog.products.field-types.' . $attribute->type))
@if (view()->exists($typeView = 'admin::catalog.products.field-types.' . $attribute->type))
<div class="control-group {{ $attribute->type }}" :class="[errors.has('{{ $attribute->code }}') ? 'has-error' : '']">
<label for="{{ $attribute->code }}" {{ $attribute->is_required ? 'class=required' : '' }}>
@ -97,16 +97,16 @@
<?php
$channel_locale = [];
if($attribute->value_per_channel) {
if ($attribute->value_per_channel) {
array_push($channel_locale, $channel);
}
if($attribute->value_per_locale) {
if ($attribute->value_per_locale) {
array_push($channel_locale, $locale);
}
?>
@if(count($channel_locale))
@if (count($channel_locale))
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
@endif
</label>

View File

@ -1,6 +1,6 @@
<select v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;" multiple {{ $disabled ? 'disabled' : '' }}>
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
<option value="{{ $option->id }}" {{ in_array($option->id, explode(',', $attribute[$attribute->code])) ? 'selected' : ''}}>
{{ $option->admin_name }}
</option>

View File

@ -2,9 +2,9 @@
<?php $selectedOption = old($attribute->code) ?: $product[$attribute->code] ?>
@if($attribute->code != 'tax_category_id')
@if ($attribute->code != 'tax_category_id')
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
<option value="{{ $option->id }}" {{ $option->id == $selectedOption ? 'selected' : ''}}>
{{ $option->admin_name }}
</option>
@ -14,7 +14,7 @@
<option value=""></option>
@foreach(app('Webkul\Tax\Repositories\TaxCategoryRepository')->all() as $taxCategory)
@foreach (app('Webkul\Tax\Repositories\TaxCategoryRepository')->all() as $taxCategory)
<option value="{{ $taxCategory->id }}" {{ $taxCategory->id == $selectedOption ? 'selected' : ''}}>
{{ $taxCategory->name }}
</option>

View File

@ -22,7 +22,7 @@
{{-- @inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
{!! $product->render() !!} --}}
@inject('products', 'Webkul\Admin\DataGrids\TestDataGrid')
@inject('products', 'Webkul\Admin\DataGrids\ProductDataGrid')
{!! $products->render() !!}
</div>
</div>

View File

@ -25,12 +25,12 @@
$channel_locale = [];
if(isset($field['channel_based']) && $field['channel_based'])
if (isset($field['channel_based']) && $field['channel_based'])
{
array_push($channel_locale, $channel);
}
if(isset($field['locale_based']) && $field['locale_based']) {
if (isset($field['locale_based']) && $field['locale_based']) {
array_push($channel_locale, $locale);
}
?>
@ -41,7 +41,7 @@
{{ $field['title'] }}
@if(count($channel_locale))
@if (count($channel_locale))
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
@endif
@ -60,15 +60,15 @@
<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;" >
@if (isset($field['repository']))
@foreach($value as $option)
@foreach ($value as $option)
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
{{ $option['name'] }}
</option>
@endforeach
@else
@foreach($field['options'] as $option)
@foreach ($field['options'] as $option)
<?php
if($option['value'] == false) {
if ($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
@ -89,10 +89,10 @@
<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)
@foreach ($field['options'] as $option)
<?php
if($option['value'] == false) {
if ($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
@ -223,7 +223,7 @@
this.country = country;
})
if(this.countryStates[this.country] && this.countryStates[this.country].length)
if (this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;

View File

@ -20,7 +20,7 @@
<div class="control-group">
<select class="control" id="channel-switcher" name="channel">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
{{ $channelModel->name }}
@ -32,7 +32,7 @@
<div class="control-group">
<select class="control" id="locale-switcher" name="locale">
@foreach(core()->getAllLocales() as $localeModel)
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}

View File

@ -65,7 +65,7 @@
methods: {
haveStates() {
if(this.countryStates[this.country] && this.countryStates[this.country].length)
if (this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;

View File

@ -75,14 +75,14 @@
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
@if(!is_null($customer->customer_group_id))
@if (! is_null($customer->customer_group_id))
<?php $selectedCustomerOption = $customer->customerGroup->id ?>
@else
<?php $selectedCustomerOption = '' ?>
@endif
<select class="control" name="customer_group_id">
@foreach($customerGroup as $group)
@foreach ($customerGroup as $group)
<option value="{{ $group->id }}" {{ $selectedCustomerOption == $group->id ? 'selected' : '' }}>
{{ $group->name}}
</option>
@ -93,14 +93,14 @@
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel" >{{ __('admin::app.customers.customers.channel_name') }}</label>
@if(!is_null($customer->channel_id))
@if (! is_null($customer->channel_id))
<?php $selectedChannelOption = $customer->channel_id ?>
@else
<?php $selectedChannelOption = $customer->channel_id ?>
@endif
<select class="control" name="channel_id" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customers.customers.channel_name') }}&quot;">
@foreach($channelName as $channel)
@foreach ($channelName as $channel)
<option value="{{ $channel->id }}" {{ $selectedChannelOption == $channel->id ? 'selected' : '' }}>
{{ $channel->name}}
</option>

View File

@ -32,8 +32,8 @@
<label for="title">{{ __('admin::app.customers.subscribers.is_subscribed') }}</label>
<select class="control" name="is_subscribed" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.customers.subscribers.is_subscribed') }}&quot;">
<option value="1" @if($subscriber->is_subscribed == 1) selected @endif>{{ __('admin::app.common.true') }}</option>
<option value="0" @if($subscriber->is_subscribed == 0) selected @endif>{{ __('admin::app.common.false') }}</option>
<option value="1" @if ($subscriber->is_subscribed == 1) selected @endif>{{ __('admin::app.common.true') }}</option>
<option value="0" @if ($subscriber->is_subscribed == 0) selected @endif>{{ __('admin::app.common.false') }}</option>
</select>
<span class="control-error" v-if="errors.has('is_subscribed')">@{{ errors.first('is_subscribed') }}</span>

View File

@ -176,7 +176,7 @@
</ul>
@if (!count($statistics['top_selling_categories']))
@if (! count($statistics['top_selling_categories']))
<div class="no-result-found">
@ -231,7 +231,7 @@
</ul>
@if (!count($statistics['top_selling_products']))
@if (! count($statistics['top_selling_products']))
<div class="no-result-found">
@ -289,7 +289,7 @@
</ul>
@if (!count($statistics['customer_with_most_sales']))
@if (! count($statistics['customer_with_most_sales']))
<div class="no-result-found">
@ -339,7 +339,7 @@
</ul>
@if (!count($statistics['stock_threshold']))
@if (! count($statistics['stock_threshold']))
<div class="no-result-found">

View File

@ -94,11 +94,11 @@
<script type="text/javascript">
window.flashMessages = [];
@if($success = session('success'))
@if ($success = session('success'))
window.flashMessages = [{'type': 'alert-success', 'message': "{{ $success }}" }];
@elseif($warning = session('warning'))
@elseif ($warning = session('warning'))
window.flashMessages = [{'type': 'alert-warning', 'message': "{{ $warning }}" }];
@elseif($error = session('error'))
@elseif ($error = session('error'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }];
@endif

View File

@ -15,39 +15,57 @@
@yield('css')
{!! view_render_event('bagisto.admin.layout.head') !!}
</head>
<body style="scroll-behavior: smooth;">
{!! view_render_event('bagisto.admin.layout.body.before') !!}
<div id="app">
<flash-wrapper ref='flashes'></flash-wrapper>
{!! view_render_event('bagisto.admin.layout.nav-top.before') !!}
@include ('admin::layouts.nav-top')
{!! view_render_event('bagisto.admin.layout.nav-top.after') !!}
{!! view_render_event('bagisto.admin.layout.nav-left.before') !!}
@include ('admin::layouts.nav-left')
{!! view_render_event('bagisto.admin.layout.nav-left.after') !!}
<div class="content-container">
{!! view_render_event('bagisto.admin.layout.content.before') !!}
@yield('content-wrapper')
{!! view_render_event('bagisto.admin.layout.content.after') !!}
</div>
</div>
<script type="text/javascript">
window.flashMessages = [];
@if($success = session('success'))
@if ($success = session('success'))
window.flashMessages = [{'type': 'alert-success', 'message': "{{ $success }}" }];
@elseif($warning = session('warning'))
@elseif ($warning = session('warning'))
window.flashMessages = [{'type': 'alert-warning', 'message': "{{ $warning }}" }];
@elseif($error = session('error'))
@elseif ($error = session('error'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }];
@elseif($info = session('info'))
@elseif ($info = session('info'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $info }}" }];
@endif
window.serverErrors = [];
@if(isset($errors))
@if (isset($errors))
@if (count($errors))
window.serverErrors = @json($errors->getMessages());
@endif
@ -59,6 +77,8 @@
@stack('scripts')
{!! view_render_event('bagisto.admin.layout.body.after') !!}
<div class="modal-overlay"></div>
</body>
</html>

View File

@ -3,10 +3,10 @@
@if (request()->route()->getName() != 'admin.configuration.index')
<?php $keys = explode('.', $menu->currentKey); ?>
@foreach(array_get($menu->items, current($keys) . '.children') as $item)
@foreach (array_get($menu->items, current($keys) . '.children') as $item)
<li class="{{ $menu->getActive($item) }}">
<a href="{{ $item['url'] }}">
{{ $item['name'] }}
{{ trans($item['name']) }}
@if ($menu->getActive($item))
<i class="angle-right-icon"></i>
@ -15,10 +15,10 @@
</li>
@endforeach
@else
@foreach($config->items as $key => $item)
@foreach ($config->items as $key => $item)
<li class="{{ $item['key'] == request()->route('slug') ? 'active' : '' }}">
<a href="{{ route('admin.configuration.index', $item['key']) }}">
{{ isset($item['name']) ? $item['name'] : '' }}
{{ isset($item['name']) ? trans($item['name']) : '' }}
@if ($item['key'] == request()->route('slug'))
<i class="angle-right-icon"></i>

View File

@ -1,11 +1,11 @@
<div class="navbar-left">
<ul class="menubar">
@foreach($menu->items as $menuItem)
@foreach ($menu->items as $menuItem)
<li class="menu-item {{ $menu->getActive($menuItem) }}">
<a href="{{ count($menuItem['children']) ? current($menuItem['children'])['url'] : $menuItem['url'] }}">
<span class="icon {{ $menuItem['icon-class'] }}">
</span>
{{ $menuItem['name'] }}
{{ trans($menuItem['name']) }}
</a>
</li>
@endforeach

View File

@ -31,13 +31,13 @@
<label>Account</label>
<ul>
<li>
<a href="{{ route('shop.home.index') }}" target="_blank">Visit Shop</a>
<a href="{{ route('shop.home.index') }}" target="_blank">{{ trans('admin::app.layouts.visit-shop') }}</a>
</li>
<li>
<a href="{{ route('admin.account.edit') }}">My Account</a>
<a href="{{ route('admin.account.edit') }}">{{ trans('admin::app.layouts.my-account') }}</a>
</li>
<li>
<a href="{{ route('admin.session.destroy') }}">Logout</a>
<a href="{{ route('admin.session.destroy') }}">{{ trans('admin::app.layouts.logout') }}</a>
</li>
</ul>
</div>

View File

@ -8,11 +8,11 @@
<ul>
@foreach(array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children') as $item)
@foreach (array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children') as $item)
<li class="{{ $menu->getActive($item) }}">
<a href="{{ $item['url'] }}">
{{ $item['name'] }}
{{ trans($item['name']) }}
</a>
</li>
@ -32,7 +32,7 @@
<li class="{{ $key == request()->route('slug2') ? 'active' : '' }}">
<a href="{{ route('admin.configuration.index', (request()->route('slug') . '/' . $key)) }}">
{{ $item['name'] }}
{{ trans($item['name']) }}
</a>
</li>

View File

@ -121,7 +121,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>

View File

@ -121,7 +121,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>

View File

@ -15,19 +15,19 @@
</div>
<div class="page-action">
@if($order->canCancel())
@if ($order->canCancel())
<a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'">
{{ __('admin::app.sales.orders.cancel-btn-title') }}
</a>
@endif
@if($order->canInvoice())
@if ($order->canInvoice())
<a href="{{ route('admin.sales.invoices.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.invoice-btn-title') }}
</a>
@endif
@if($order->canShip())
@if ($order->canShip())
<a href="{{ route('admin.sales.shipments.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.shipment-btn-title') }}
</a>
@ -108,7 +108,7 @@
</span>
</div>
@if(!is_null($order->customer))
@if (! is_null($order->customer))
<div class="row">
<span class="title">
{{ __('admin::app.customers.customers.customer_group') }}
@ -140,7 +140,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
@ -359,7 +359,7 @@
</tr>
@endforeach
@if (!$order->invoices->count())
@if (! $order->invoices->count())
<tr>
<td class="empty" colspan="7">{{ __('admin::app.common.no-result-found') }}</td>
<tr>
@ -403,7 +403,7 @@
</tr>
@endforeach
@if (!$order->shipments->count())
@if (! $order->shipments->count())
<tr>
<td class="empty" colspan="7">{{ __('admin::app.common.no-result-found') }}</td>
<tr>

View File

@ -121,7 +121,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
@ -299,13 +299,26 @@
<td>
<?php
if($item->type == 'configurable') {
if ($item->type == 'configurable') {
$sourceQty = $item->child->product->inventory_source_qty($inventorySource);
} else {
$sourceQty = $item->product->inventory_source_qty($inventorySource);
}
?>
<?php
$sourceQty = 0;
$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;
}
}
?>
{{ $sourceQty }}
</td>

View File

@ -117,7 +117,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>

View File

@ -47,7 +47,7 @@
<div class="control-group" :class="[errors.has('inventory_sources[]') ? 'has-error' : '']">
<label for="inventory_sources" class="required">{{ __('admin::app.settings.channels.inventory_sources') }}</label>
<select v-validate="'required'" class="control" id="inventory_sources" name="inventory_sources[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.inventory_sources') }}&quot;" multiple>
@foreach(app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
@foreach (app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
<option value="{{ $inventorySource->id }}" {{ old('inventory_sources') && in_array($inventorySource->id, old('inventory_sources')) ? 'selected' : '' }}>
{{ $inventorySource->name }}
</option>
@ -59,7 +59,7 @@
<div class="control-group" :class="[errors.has('root_category_id') ? 'has-error' : '']">
<label for="root_category_id" class="required">{{ __('admin::app.settings.channels.root-category') }}</label>
<select v-validate="'required'" class="control" id="root_category_id" name="root_category_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.root-category') }}&quot;">
@foreach(app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
@foreach (app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
<option value="{{ $category->id }}" {{ old('root_category_id') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@ -82,7 +82,7 @@
<div class="control-group" :class="[errors.has('locales[]') ? 'has-error' : '']">
<label for="locales" class="required">{{ __('admin::app.settings.channels.locales') }}</label>
<select v-validate="'required'" class="control" id="locales" name="locales[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.locales') }}&quot;" multiple>
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ old('locales') && in_array($locale->id, old('locales')) ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -94,7 +94,7 @@
<div class="control-group" :class="[errors.has('default_locale_id') ? 'has-error' : '']">
<label for="default_locale_id" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<select v-validate="'required'" class="control" id="default_locale_id" name="default_locale_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.default-locale') }}&quot;">
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ old('default_locale_id') == $locale->id ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -106,7 +106,7 @@
<div class="control-group" :class="[errors.has('currencies[]') ? 'has-error' : '']">
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.currencies') }}&quot;" multiple>
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ old('currencies') && in_array($currency->id, old('currencies')) ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -118,7 +118,7 @@
<div class="control-group" :class="[errors.has('base_currency_id') ? 'has-error' : '']">
<label for="base_currbase_currency_idency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<select v-validate="'required'" class="control" id="base_currency_id" name="base_currency_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.base-currency') }}&quot;">
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ old('base_currency_id') == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -135,7 +135,7 @@
<div class="control-group">
<label for="theme">{{ __('admin::app.settings.channels.theme') }}</label>
<select class="control" id="theme" name="theme">
@foreach(themes()->all() as $theme)
@foreach (themes()->all() as $theme)
<option value="{{ $theme->code }}" {{ old('theme') == $theme->code ? 'selected' : '' }}>
{{ $theme->name }}
</option>

View File

@ -50,7 +50,7 @@
<label for="inventory_sources" class="required">{{ __('admin::app.settings.channels.inventory_sources') }}</label>
<?php $selectedOptionIds = old('inventory_sources') ?: $channel->inventory_sources->pluck('id')->toArray() ?>
<select v-validate="'required'" class="control" id="inventory_sources" name="inventory_sources[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.inventory_sources') }}&quot;" multiple>
@foreach(app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
@foreach (app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
<option value="{{ $inventorySource->id }}" {{ in_array($inventorySource->id, $selectedOptionIds) ? 'selected' : '' }}>
{{ $inventorySource->name }}
</option>
@ -63,7 +63,7 @@
<label for="root_category_id" class="required">{{ __('admin::app.settings.channels.root-category') }}</label>
<?php $selectedOption = old('root_category_id') ?: $channel->root_category_id ?>
<select v-validate="'required'" class="control" id="root_category_id" name="root_category_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.root-category') }}&quot;">
@foreach(app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
@foreach (app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
<option value="{{ $category->id }}" {{ $selectedOption == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@ -87,7 +87,7 @@
<label for="locales" class="required">{{ __('admin::app.settings.channels.locales') }}</label>
<?php $selectedOptionIds = old('locales') ?: $channel->locales->pluck('id')->toArray() ?>
<select v-validate="'required'" class="control" id="locales" name="locales[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.locales') }}&quot;" multiple>
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ in_array($locale->id, $selectedOptionIds) ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -100,7 +100,7 @@
<label for="default_locale_id" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<?php $selectedOption = old('default_locale_id') ?: $channel->default_locale_id ?>
<select v-validate="'required'" class="control" id="default_locale_id" name="default_locale_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.default-locale') }}&quot;">
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ $selectedOption == $locale->id ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -113,7 +113,7 @@
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
<?php $selectedOptionIds = old('currencies') ?: $channel->currencies->pluck('id')->toArray() ?>
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.currencies') }}&quot;" multiple>
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ in_array($currency->id, $selectedOptionIds) ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -126,7 +126,7 @@
<label for="base_currency_id" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<?php $selectedOption = old('base_currency_id') ?: $channel->base_currency_id ?>
<select v-validate="'required'" class="control" id="base_currency_id" name="base_currency_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.base-currency') }}&quot;">
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ $selectedOption == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -146,7 +146,7 @@
<?php $selectedOption = old('theme') ?: $channel->theme ?>
<select class="control" id="theme" name="theme">
@foreach(themes()->all() as $theme)
@foreach (themes()->all() as $theme)
<option value="{{ $theme->code }}" {{ $selectedOption == $theme->code ? 'selected' : '' }}>
{{ $theme->name }}
</option>

View File

@ -49,8 +49,8 @@
<td>
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
<select v-validate="'required'" class="control" name="target_currency" data-vv-as="&quot;{{ __('admin::app.settings.exchange_rates.target_currency') }}&quot;">
@foreach($currencies as $currency)
@if(is_null($currency->CurrencyExchangeRate))
@foreach ($currencies as $currency)
@if (is_null($currency->CurrencyExchangeRate))
<option value="{{ $currency->id }}">{{ $currency->name }}</option>
@endif
@endforeach

View File

@ -50,7 +50,7 @@
<td>
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
<select v-validate="'required'" class="control" name="target_currency" data-vv-as="&quot;{{ __('admin::app.settings.exchange_rates.target_currency') }}&quot;">
@foreach($currencies as $currency)
@foreach ($currencies as $currency)
<option value="{{ $currency->id }}" {{ $exchangeRate->target_currency == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>

View File

@ -32,8 +32,8 @@
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
<select class="control" id="channel_id" name="channel_id" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.channels') }}&quot;">
@foreach($channels as $channel)
<option value="{{ $channel->id }}" @if($channel->id == old('channel_id')) selected @endif>
@foreach ($channels as $channel)
<option value="{{ $channel->id }}" @if ($channel->id == old('channel_id')) selected @endif>
{{ __($channel->name) }}
</option>
@endforeach

View File

@ -34,8 +34,8 @@
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
<select class="control" id="channel_id" name="channel_id" data-vv-as="&quot;{{ __('admin::app.settings.sliders.channels') }}&quot;" value="" v-validate="'required'">
@foreach($channels as $channel)
<option value="{{ $channel->id }}" @if($channel->id == $slider->channel_id) selected @endif>
@foreach ($channels as $channel)
<option value="{{ $channel->id }}" @if ($channel->id == $slider->channel_id) selected @endif>
{{ __($channel->name) }}
</option>
@endforeach

View File

@ -26,7 +26,7 @@
<label for="channel" class="required">{{ __('admin::app.configuration.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->id }}">
{{ $channelModel->name }}
@ -66,7 +66,7 @@
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>
<select multiple="multiple" v-validate="'required'" class="control" id="taxrates" name="taxrates[]" data-vv-as="&quot;{{ __('admin::app.configuration.tax-categories.select-taxrates') }}&quot;" value="{{ old('taxrates') }}">
@foreach($taxRates as $taxRate)
@foreach ($taxRates as $taxRate)
<option value="{{ $taxRate['id'] }}">{{ $taxRate['identifier'] }}</option>
@endforeach
</select>

View File

@ -27,9 +27,9 @@
<label for="channel" class="required">{{ __('admin::app.settings.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option @if($taxCategory->channel_id == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
<option @if ($taxCategory->channel_id == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
{{ $channelModel->name }}
</option>
@ -57,7 +57,7 @@
@inject('taxRates', 'Webkul\Tax\Repositories\TaxRateRepository')
<select multiple="multiple" class="control" id="taxrates" name="taxrates[]" data-vv-as="&quot;{{ __('admin::app.settings.tax-categories.select-taxrates') }}&quot;" v-validate="'required'">
@foreach($taxRates->all() as $taxRate)
@foreach ($taxRates->all() as $taxRate)
<option value="{{ $taxRate->id }}" {{ is_numeric($taxCategory->tax_rates->pluck('id')->search($taxRate->id)) ? 'selected' : '' }}>{{ $taxRate->identifier }}</option>
@endforeach
</select>

View File

@ -64,7 +64,7 @@
<script>
$(document).ready(function () {
$('#permission_type').on('change', function(e) {
if($(e.target).val() == 'custom') {
if ($(e.target).val() == 'custom') {
$('.tree-container').removeClass('hide')
} else {
$('.tree-container').addClass('hide')

View File

@ -66,7 +66,7 @@
<script>
$(document).ready(function () {
$('#permission_type').on('change', function(e) {
if($(e.target).val() == 'custom') {
if ($(e.target).val() == 'custom') {
$('.tree-wrapper').removeClass('hide')
} else {
$('.tree-wrapper').addClass('hide')

View File

@ -60,7 +60,7 @@
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
<label for="role" class="required">{{ __('admin::app.users.users.role') }}</label>
<select v-validate="'required'" class="control" name="role_id" data-vv-as="&quot;{{ __('admin::app.users.users.role') }}&quot;">
@foreach($roles as $role)
@foreach ($roles as $role)
<option value="{{ $role->id }}">{{ $role->name }}</option>
@endforeach
</select>

View File

@ -61,7 +61,7 @@
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
<label for="role" class="required">{{ __('admin::app.users.users.role') }}</label>
<select v-validate="'required'" class="control" name="role_id" data-vv-as="&quot;{{ __('admin::app.users.users.role') }}&quot;">
@foreach($roles as $role)
@foreach ($roles as $role)
<option value="{{ $role->id }}" {{ $user->role_id == $role->id ? 'selected' : '' }}>{{ $role->name }}</option>
@endforeach
</select>
@ -72,7 +72,7 @@
<label for="status">{{ __('admin::app.users.users.status') }}</label>
<span class="checkbox">
<input type="checkbox" id="status" name="status"
{{-- @if($user->status == 0)
{{-- @if ($user->status == 0)
value="false"
@else
value="true"

View File

@ -1,8 +1,8 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/vendor/webkul/admin/assets";
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/vendor/webkul/admin/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();

View File

@ -158,7 +158,7 @@ class AttributeController extends Controller
$attribute = $this->attribute->findOrFail($value);
try {
if (!$attribute->is_user_defined) {
if (! $attribute->is_user_defined) {
continue;
} else {
$this->attribute->delete($value);
@ -170,7 +170,7 @@ class AttributeController extends Controller
}
}
if (!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'attributes']));

View File

@ -168,7 +168,7 @@ class AttributeFamilyController extends Controller
}
}
if (!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', ('admin::app.datagrid.mass-ops.delete-success'));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Attribute Family']));

View File

@ -74,7 +74,7 @@ class AttributeFamilyRepository extends Repository
$attributeGroup = $family->attribute_groups()->create($group);
foreach ($custom_attributes as $key => $attribute) {
if(isset($attribute['id'])) {
if (isset($attribute['id'])) {
$attributeModel = $this->attribute->find($attribute['id']);
} else {
$attributeModel = $this->attribute->findOneByField('code', $attribute['code']);
@ -84,7 +84,7 @@ class AttributeFamilyRepository extends Repository
}
}
Event::fire('catalog.attribute_family.create.after', $attributeFamily);
Event::fire('catalog.attribute_family.create.after', $family);
return $family;
}
@ -105,19 +105,19 @@ class AttributeFamilyRepository extends Repository
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
if(isset($data['attribute_groups'])) {
if (isset($data['attribute_groups'])) {
foreach ($data['attribute_groups'] as $attributeGroupId => $attributeGroupInputs) {
if (str_contains($attributeGroupId, 'group_')) {
$attributeGroup = $family->attribute_groups()->create($attributeGroupInputs);
if(isset($attributeGroupInputs['custom_attributes'])) {
if (isset($attributeGroupInputs['custom_attributes'])) {
foreach ($attributeGroupInputs['custom_attributes'] as $key => $attribute) {
$attributeModel = $this->attribute->find($attribute['id']);
$attributeGroup->custom_attributes()->save($attributeModel, ['position' => $key + 1]);
}
}
} else {
if(is_numeric($index = $previousAttributeGroupIds->search($attributeGroupId))) {
if (is_numeric($index = $previousAttributeGroupIds->search($attributeGroupId))) {
$previousAttributeGroupIds->forget($index);
}
@ -126,9 +126,9 @@ class AttributeFamilyRepository extends Repository
$attributeIds = $attributeGroup->custom_attributes()->get()->pluck('id');
if(isset($attributeGroupInputs['custom_attributes'])) {
if (isset($attributeGroupInputs['custom_attributes'])) {
foreach ($attributeGroupInputs['custom_attributes'] as $key => $attribute) {
if(is_numeric($index = $attributeIds->search($attribute['id']))) {
if (is_numeric($index = $attributeIds->search($attribute['id']))) {
$attributeIds->forget($index);
} else {
$attributeModel = $this->attribute->find($attribute['id']);
@ -137,7 +137,7 @@ class AttributeFamilyRepository extends Repository
}
}
if($attributeIds->count()) {
if ($attributeIds->count()) {
$attributeGroup->custom_attributes()->detach($attributeIds);
}
}

View File

@ -59,7 +59,7 @@ class AttributeRepository extends Repository
unset($data['options']);
$attribute = $this->model->create($data);
if(in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
foreach ($options as $option) {
$attribute->options()->create($option);
}
@ -88,13 +88,13 @@ class AttributeRepository extends Repository
$previousOptionIds = $attribute->options()->pluck('id');
if(in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
if(isset($data['options'])) {
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
if (isset($data['options'])) {
foreach ($data['options'] as $optionId => $optionInputs) {
if (str_contains($optionId, 'option_')) {
$attribute->options()->create($optionInputs);
} else {
if(is_numeric($index = $previousOptionIds->search($optionId))) {
if (is_numeric($index = $previousOptionIds->search($optionId))) {
$previousOptionIds->forget($index);
}
@ -132,11 +132,11 @@ class AttributeRepository extends Repository
*/
public function validateUserInput($data)
{
if($data['is_configurable']) {
if ($data['is_configurable']) {
$data['value_per_channel'] = $data['value_per_locale'] = 0;
}
if(!in_array($data['type'], ['select', 'multiselect', 'price'])) {
if (! in_array($data['type'], ['select', 'multiselect', 'price'])) {
$data['is_filterable'] = 0;
}
@ -158,7 +158,7 @@ class AttributeRepository extends Repository
{
$attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable'];
if(!is_array($codes) && !$codes)
if (! is_array($codes) && !$codes)
return $this->findWhereIn('code', [
'name',
'description',
@ -171,7 +171,7 @@ class AttributeRepository extends Repository
'status'
], $attributeColumns);
if(in_array('*', $codes))
if (in_array('*', $codes))
return $this->all($attributeColumns);
return $this->findWhereIn('code', $codes, $attributeColumns);

View File

@ -111,7 +111,7 @@ class CategoryController extends Controller
$this->validate(request(), [
$locale . '.slug' => ['required', new \Webkul\Core\Contracts\Validations\Slug, function ($attribute, $value, $fail) use ($id) {
if (!$this->category->isSlugUnique($id, $value)) {
if (! $this->category->isSlugUnique($id, $value)) {
$fail('The :attribute has already been taken.');
}
}],
@ -153,10 +153,10 @@ class CategoryController extends Controller
public function massDestroy() {
$suppressFlash = false;
if(request()->isMethod('delete')) {
if (request()->isMethod('delete')) {
$indexes = explode(',', request()->input('indexes'));
foreach($indexes as $key => $value) {
foreach ($indexes as $key => $value) {
try {
Event::fire('catalog.category.delete.before', $value);
@ -170,7 +170,7 @@ class CategoryController extends Controller
}
}
if(!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success'));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Attribute Family']));

View File

@ -137,7 +137,7 @@ class Cart {
];
//Authentication details
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$cartData['customer_id'] = auth()->guard('customer')->user()->id;
$cartData['is_guest'] = 0;
$cartData['customer_first_name'] = auth()->guard('customer')->user()->first_name;
@ -151,8 +151,8 @@ class Cart {
$this->putCart($result);
if($result) {
if($item = $this->createItem($id, $data))
if ($result) {
if ($item = $this->createItem($id, $data))
return $item;
else
return false;
@ -172,10 +172,10 @@ class Cart {
public function add($id, $data) {
$cart = $this->getCart();
if($cart != null) {
if ($cart != null) {
$ifExists = $this->checkIfItemExists($id, $data);
if($ifExists) {
if ($ifExists) {
$item = $this->cartItem->findOneByField('id', $ifExists);
$data['quantity'] = $data['quantity'] + $item->quantity;
@ -199,14 +199,14 @@ class Cart {
public function checkIfItemExists($id, $data) {
$items = $this->getCart()->items;
foreach($items as $item) {
if($id == $item->product_id) {
foreach ($items as $item) {
if ($id == $item->product_id) {
$product = $this->product->findOnebyField('id', $id);
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$variant = $this->product->findOneByField('id', $data['selected_configurable_option']);
if($item->child->product_id == $data['selected_configurable_option']) {
if ($item->child->product_id == $data['selected_configurable_option']) {
return $item->id;
}
} else {
@ -228,8 +228,8 @@ class Cart {
$product = $parentProduct = $configurable = false;
$product = $this->product->findOneByField('id', $id);
if($product->type == 'configurable') {
if(!isset($data['selected_configurable_option'])) {
if ($product->type == 'configurable') {
if (! isset($data['selected_configurable_option'])) {
return false;
}
@ -237,7 +237,7 @@ class Cart {
$canAdd = $parentProduct->haveSufficientQuantity($data['quantity']);
if(!$canAdd) {
if (! $canAdd) {
session()->flash('warning', 'insuff qty');
return false;
@ -247,7 +247,7 @@ class Cart {
} else {
$canAdd = $product->haveSufficientQuantity($data['quantity']);
if(!$canAdd) {
if (! $canAdd) {
session()->flash('warning', 'insuff qty');
return false;
@ -255,12 +255,12 @@ class Cart {
}
//Check if the product's information is proper or not
if(!isset($data['product']) || !isset($data['quantity'])) {
if (! isset($data['product']) || !isset($data['quantity'])) {
session()->flash('error', trans('shop::app.checkout.cart.integrity.missing_fields'));
return false;
} else {
if($product->type == 'configurable' && !isset($data['super_attribute'])) {
if ($product->type == 'configurable' && !isset($data['super_attribute'])) {
session()->flash('error', trans('shop::app.checkout.cart.integrity.missing_options'));
return false;
@ -290,7 +290,7 @@ class Cart {
'additional' => $data,
];
if($configurable) {
if ($configurable) {
$attributeDetails = $this->getProductAttributeOptionDetails($parentProduct);
unset($attributeDetails['html']);
@ -330,10 +330,10 @@ class Cart {
$additional = $item->additional;
}
if($item->type == 'configurable') {
if ($item->type == 'configurable') {
$product = $this->product->findOneByField('id', $item->child->product_id);
if(!$product->haveSufficientQuantity($data['quantity'])) {
if (! $product->haveSufficientQuantity($data['quantity'])) {
session()->flash('warning', trans('shop::app.checkout.cart.quantity.inventory_warning'));
return false;
@ -346,7 +346,7 @@ class Cart {
} else {
$product = $this->product->findOneByField('id', $item->product_id);
if(!$product->haveSufficientQuantity($data['quantity'])) {
if (! $product->haveSufficientQuantity($data['quantity'])) {
session()->flash('warning', trans('shop::app.checkout.cart.quantity.inventory_warning'));
return false;
@ -366,7 +366,7 @@ class Cart {
$this->collectTotals();
if($result) {
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.quantity.success'));
return $item;
@ -384,15 +384,15 @@ class Cart {
*/
public function removeItem($itemId)
{
if($cart = $this->getCart()) {
if ($cart = $this->getCart()) {
$this->cartItem->delete($itemId);
//delete the cart instance if no items are there
if($cart->items()->get()->count() == 0) {
if ($cart->items()->get()->count() == 0) {
$this->cart->delete($cart->id);
// $this->deActivateCart();
if(session()->has('cart')) {
if (session()->has('cart')) {
session()->forget('cart');
}
}
@ -412,10 +412,10 @@ class Cart {
*/
public function mergeCart()
{
if(session()->has('cart')) {
if (session()->has('cart')) {
$cart = $this->cart->findWhere(['customer_id' => auth()->guard('customer')->user()->id, 'is_active' => 1]);
if($cart->count()) {
if ($cart->count()) {
$cart = $cart->first();
} else {
$cart = false;
@ -424,7 +424,7 @@ class Cart {
$guestCart = session()->get('cart');
//when the logged in customer is not having any of the cart instance previously and are active.
if(!$cart) {
if (! $cart) {
$guestCart->update([
'customer_id' => auth()->guard('customer')->user()->id,
'is_guest' => 0,
@ -444,17 +444,17 @@ class Cart {
$guestCartItems = $this->cart->findOneByField('id', $guestCartId)->items;
foreach($guestCartItems as $key => $guestCartItem) {
foreach($cartItems as $cartItem) {
foreach ($guestCartItems as $key => $guestCartItem) {
foreach ($cartItems as $cartItem) {
if($guestCartItem->type == "simple") {
if($cartItem->product_id == $guestCartItem->product_id) {
if ($guestCartItem->type == "simple") {
if ($cartItem->product_id == $guestCartItem->product_id) {
$prevQty = $cartItem->quantity;
$newQty = $guestCartItem->quantity;
$product = $this->product->findOneByField('id', $cartItem->product_id);
if(!$product->haveSufficientQuantity($prevQty + $newQty)) {
if (! $product->haveSufficientQuantity($prevQty + $newQty)) {
$this->cartItem->delete($guestCartItem->id);
continue;
}
@ -466,18 +466,18 @@ class Cart {
$guestCartItems->forget($key);
$this->cartItem->delete($guestCartItem->id);
}
} else if($guestCartItem->type == "configurable" && $cartItem->type == "configurable") {
} else if ($guestCartItem->type == "configurable" && $cartItem->type == "configurable") {
$guestCartItemChild = $guestCartItem->child;
$cartItemChild = $cartItem->child;
if($guestCartItemChild->product_id == $cartItemChild->product_id) {
if ($guestCartItemChild->product_id == $cartItemChild->product_id) {
$prevQty = $guestCartItem->quantity;
$newQty = $cartItem->quantity;
$product = $this->product->findOneByField('id', $cartItem->child->product_id);
if(!$product->haveSufficientQuantity($prevQty + $newQty)) {
if (! $product->haveSufficientQuantity($prevQty + $newQty)) {
$this->cartItem->delete($guestCartItem->id);
continue;
}
@ -495,9 +495,9 @@ class Cart {
}
//now handle the products that are not removed from the list of items in the guest cart.
foreach($guestCartItems as $guestCartItem) {
foreach ($guestCartItems as $guestCartItem) {
if($guestCartItem->type == "configurable") {
if ($guestCartItem->type == "configurable") {
$guestCartItem->update(['cart_id' => $cart->id]);
$guestCartItem->child->update(['cart_id' => $cart->id]);
@ -527,7 +527,7 @@ class Cart {
*/
public function putCart($cart)
{
if(!auth()->guard('customer')->check()) {
if (! auth()->guard('customer')->check()) {
session()->put('cart', $cart);
}
}
@ -551,8 +551,8 @@ class Cart {
$cart = $this->cart->find(session()->get('cart')->id);
}
// if($cart != null) {
// if($cart->items->count() == 0) {
// if ($cart != null) {
// if ($cart->items->count() == 0) {
// $this->cart->delete($cart->id);
// return false;
@ -594,7 +594,7 @@ class Cart {
$labels = [];
$attribute = $product->parent->super_attributes;
foreach($product->parent->super_attributes as $attribute) {
foreach ($product->parent->super_attributes as $attribute) {
$option = $attribute->options()->where('id', $product->{$attribute->code})->first();
$data['attributes'][$attribute->code] = [
@ -618,24 +618,24 @@ class Cart {
*/
public function saveCustomerAddress($data)
{
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
$billingAddress = $data['billing'];
$shippingAddress = $data['shipping'];
$billingAddress['cart_id'] = $shippingAddress['cart_id'] = $cart->id;
if($billingAddressModel = $cart->billing_address) {
if ($billingAddressModel = $cart->billing_address) {
$this->cartAddress->update($billingAddress, $billingAddressModel->id);
if($shippingAddressModel = $cart->shipping_address) {
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
if ($shippingAddressModel = $cart->shipping_address) {
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->update($billingAddress, $shippingAddressModel->id);
} else {
$this->cartAddress->update($shippingAddress, $shippingAddressModel->id);
}
} else {
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->create(array_merge($billingAddress, ['address_type' => 'shipping']));
} else {
$this->cartAddress->create(array_merge($shippingAddress, ['address_type' => 'shipping']));
@ -644,14 +644,14 @@ class Cart {
} else {
$this->cartAddress->create(array_merge($billingAddress, ['address_type' => 'billing']));
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->create(array_merge($billingAddress, ['address_type' => 'shipping']));
} else {
$this->cartAddress->create(array_merge($shippingAddress, ['address_type' => 'shipping']));
}
}
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$cart->customer_email = auth()->guard('customer')->user()->email;
$cart->customer_first_name = auth()->guard('customer')->user()->first_name;
$cart->customer_last_name = auth()->guard('customer')->user()->last_name;
@ -674,14 +674,14 @@ class Cart {
*/
public function saveShippingMethod($shippingMethodCode)
{
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
$cart->shipping_method = $shippingMethodCode;
$cart->save();
// foreach($cart->shipping_rates as $rate) {
// if($rate->method != $shippingMethodCode) {
// foreach ($cart->shipping_rates as $rate) {
// if ($rate->method != $shippingMethodCode) {
// $rate->delete();
// }
// }
@ -697,10 +697,10 @@ class Cart {
*/
public function savePaymentMethod($payment)
{
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
if($cartPayment = $cart->payment)
if ($cartPayment = $cart->payment)
$cartPayment->delete();
$cartPayment = new CartPayment;
@ -721,11 +721,11 @@ class Cart {
{
$validated = $this->validateItems();
if(!$validated) {
if (! $validated) {
return false;
}
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
$this->calculateItemsTax();
@ -745,13 +745,13 @@ class Cart {
$cart->base_tax_total = (float) $cart->base_tax_total + $item->base_tax_amount;
}
if($shipping = $cart->selected_shipping_rate) {
if ($shipping = $cart->selected_shipping_rate) {
$cart->grand_total = (float) $cart->grand_total + $shipping->price;
$cart->base_grand_total = (float) $cart->base_grand_total + $shipping->base_price;
}
$quantities = 0;
foreach($cart->items as $item) {
foreach ($cart->items as $item) {
$quantities = $quantities + $item->quantity;
}
@ -772,27 +772,27 @@ class Cart {
{
$cart = $this->getCart();
if(!$cart) {
if (! $cart) {
return false;
}
//rare case of accident-->used when there are no items.
if(count($cart->items) == 0) {
if (count($cart->items) == 0) {
$this->cart->delete($cart->id);
return false;
} else {
$items = $cart->items;
foreach($items as $item) {
if($item->product->type == 'configurable') {
if($item->product->sku != $item->sku) {
foreach ($items as $item) {
if ($item->product->type == 'configurable') {
if ($item->product->sku != $item->sku) {
$item->update(['sku' => $item->product->sku]);
} else if($item->product->name != $item->name) {
} else if ($item->product->name != $item->name) {
$item->update(['name' => $item->product->name]);
} else if($item->child->product->price != $item->price) {
} else if ($item->child->product->price != $item->price) {
$price = (float) $item->custom_price ? $item->custom_price : $item->child->product->price;
$item->update([
@ -803,14 +803,14 @@ class Cart {
]);
}
} else if($item->product->type == 'simple') {
if($item->product->sku != $item->sku) {
} else if ($item->product->type == 'simple') {
if ($item->product->sku != $item->sku) {
$item->update(['sku' => $item->product->sku]);
} else if($item->product->name != $item->name) {
} else if ($item->product->name != $item->name) {
$item->update(['name' => $item->product->name]);
} else if($item->product->price != $item->price) {
} else if ($item->product->price != $item->price) {
$price = (float) $item->custom_price ? $item->custom_price : $item->product->price;
$item->update([
@ -835,13 +835,13 @@ class Cart {
{
$cart = $this->getCart();
if(!$shippingAddress = $cart->shipping_address)
if (! $shippingAddress = $cart->shipping_address)
return;
foreach ($cart->items()->get() as $item) {
$taxCategory = $this->taxCategory->find($item->product->tax_category_id);
if(!$taxCategory)
if (! $taxCategory)
continue;
$taxRates = $taxCategory->tax_rates()->where([
@ -849,20 +849,20 @@ class Cart {
'country' => $shippingAddress->country,
])->orderBy('tax_rate', 'desc')->get();
foreach($taxRates as $rate) {
foreach ($taxRates as $rate) {
$haveTaxRate = false;
if(!$rate->is_zip) {
if($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) {
if (! $rate->is_zip) {
if ($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) {
$haveTaxRate = true;
}
} else {
if($shippingAddress->postcode >= $rate->zip_from && $shippingAddress->postcode <= $rate->zip_to) {
if ($shippingAddress->postcode >= $rate->zip_from && $shippingAddress->postcode <= $rate->zip_to) {
$haveTaxRate = true;
}
}
if($haveTaxRate) {
if ($haveTaxRate) {
$item->tax_percent = $rate->tax_rate;
$item->tax_amount = ($item->total * $rate->tax_rate) / 100;
$item->base_tax_amount = ($item->base_total * $rate->tax_rate) / 100;
@ -881,10 +881,10 @@ class Cart {
*/
public function hasError()
{
if(!$this->getCart())
if (! $this->getCart())
return true;
if(!$this->isItemsHaveSufficientQuantity())
if (! $this->isItemsHaveSufficientQuantity())
return true;
return false;
@ -898,7 +898,7 @@ class Cart {
public function isItemsHaveSufficientQuantity()
{
foreach ($this->getCart()->items as $item) {
if(!$this->isItemHaveQuantity($item))
if (! $this->isItemHaveQuantity($item))
return false;
}
@ -914,7 +914,7 @@ class Cart {
{
$product = $item->type == 'configurable' ? $item->child->product : $item->product;
if(!$product->haveSufficientQuantity($item->quantity))
if (! $product->haveSufficientQuantity($item->quantity))
return false;
return true;
@ -927,10 +927,10 @@ class Cart {
*/
public function deActivateCart()
{
if($cart = $this->getCart()) {
if ($cart = $this->getCart()) {
$this->cart->update(['is_active' => false], $cart->id);
if(session()->has('cart')) {
if (session()->has('cart')) {
session()->forget('cart');
}
}
@ -980,7 +980,7 @@ class Cart {
'channel' => core()->getCurrentChannel(),
];
foreach($data['items'] as $item) {
foreach ($data['items'] as $item) {
$finalData['items'][] = $this->prepareDataForOrderItem($item);
}
@ -1012,7 +1012,7 @@ class Cart {
'additional' => $data['additional'],
];
if(isset($data['child']) && $data['child']) {
if (isset($data['child']) && $data['child']) {
$finalData['child'] = $this->prepareDataForOrderItem($data['child']);
}
@ -1027,18 +1027,18 @@ class Cart {
public function moveToCart($wishlistItem) {
$product = $wishlistItem->product;
if($product->type == 'simple') {
if ($product->type == 'simple') {
$data['quantity'] = 1;
$data['product'] = $wishlistItem->product->id;
$result = $this->add($product->id, $data);
if($result) {
if ($result) {
return 1;
} else {
return 0;
}
} else if($product->type == 'configurable' && $product->parent_id == null) {
} else if ($product->type == 'configurable' && $product->parent_id == null) {
return -1;
}
}
@ -1057,9 +1057,9 @@ class Cart {
'customer_id' => auth()->guard('customer')->user()->id,
];
foreach($items as $item) {
if($item->id == $itemId) {
if(is_null($item['parent_id']) && $item['type'] == 'simple') {
foreach ($items as $item) {
if ($item->id == $itemId) {
if (is_null($item['parent_id']) && $item['type'] == 'simple') {
$wishlist['product_id'] = $item->product_id;
} else {
$wishlist['product_id'] = $item->child->product_id;
@ -1068,14 +1068,14 @@ class Cart {
$shouldBe = $this->wishlist->findWhere(['customer_id' => auth()->guard('customer')->user()->id, 'product_id' => $wishlist['product_id']]);
if($shouldBe->isEmpty()) {
if ($shouldBe->isEmpty()) {
$wishlist = $this->wishlist->create($wishlist);
}
$result = $this->cartItem->delete($itemId);
if($result) {
if($cart->items()->count() == 0)
if ($result) {
if ($cart->items()->count() == 0)
$this->cart->delete($cart->id);
session()->flash('success', trans('shop::app.checkout.cart.move-to-wishlist-success'));
@ -1098,14 +1098,14 @@ class Cart {
public function proceedToBuyNow($id) {
$product = $this->product->findOneByField('id', $id);
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
session()->flash('warning', trans('shop::app.buynow.no-options'));
return false;
} else {
$simpleOrVariant = $this->product->find($id);
if($simpleOrVariant->parent_id != null) {
if ($simpleOrVariant->parent_id != null) {
$parent = $simpleOrVariant->parent;
$data['product'] = $parent->id;

View File

@ -38,7 +38,7 @@ class CustomerAddressForm extends FormRequest
'billing.country' => ['required']
];
if(isset($this->get('billing')['use_for_shipping']) && !$this->get('billing')['use_for_shipping']) {
if (isset($this->get('billing')['use_for_shipping']) && !$this->get('billing')['use_for_shipping']) {
$this->rules = array_merge($this->rules, [
'shipping.first_name' => ['required'],
'shipping.last_name' => ['required'],

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