Merge pull request #15 from bagisto/master

base sync with master
This commit is contained in:
Prashant Singh 2019-02-26 12:04:46 +05:30 committed by GitHub
commit b22f316f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
293 changed files with 3625 additions and 1161 deletions

View File

@ -1,25 +0,0 @@
<?php
return [
[
'key' => 'inventories',
'name' => 'Inventories',
'view' => 'admin::catalog.products.accordians.inventories',
'sort' => 1
], [
'key' => 'images',
'name' => 'Images',
'view' => 'admin::catalog.products.accordians.images',
'sort' => 2
], [
'key' => 'categories',
'name' => 'Categories',
'view' => 'admin::catalog.products.accordians.categories',
'sort' => 3
], [
'key' => 'variations',
'name' => 'Variations',
'view' => 'admin::catalog.products.accordians.variations',
'sort' => 4
]
];

View File

@ -0,0 +1,33 @@
<?php
return [
[
'key' => 'catalog',
'name' => 'Catalog',
'sort' => 1
], [
'key' => 'catalog.products',
'name' => 'Products',
'sort' => 1,
], [
'key' => 'catalog.products.review',
'name' => 'Review',
'sort' => 1,
'fields' => [
[
'name' => 'guest_review',
'title' => 'Allow Guest Review',
'type' => 'select',
'options' => [
[
'title' => 'Yes',
'value' => true
], [
'title' => 'No',
'value' => false
]
],
]
]
],
];

View File

@ -72,14 +72,6 @@ class CategoryDataGrid extends DataGrid
}
]);
$this->addColumn([
'index' => 'locale',
'label' => trans('admin::app.datagrid.locale'),
'type' => 'boolean',
'sortable' => true,
'searchable' => true,
]);
$this->addColumn([
'index' => 'count',
'label' => trans('admin::app.datagrid.no-of-products'),

View File

@ -34,6 +34,7 @@ class OrderDataGrid extends DataGrid
$this->addFilter('billed_to', DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name)'));
$this->addFilter('shipped_to', DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name)'));
$this->addFilter('id', 'orders.id');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -19,23 +19,23 @@ class OrderShipmentsDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('shipments as ship')
$queryBuilder = DB::table('shipments')
->leftJoin('order_address as order_address_shipping', function($leftJoin) {
$leftJoin->on('order_address_shipping.order_id', '=', 'ship.order_address_id')
$leftJoin->on('order_address_shipping.order_id', '=', 'shipments.order_id')
->where('order_address_shipping.address_type', 'shipping');
})
->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')
->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id')
->select('ship.id as shipment_id', 'ship.order_id as shipment_order_id', 'ship.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as orderdate', 'ship.created_at as shipment_created_at')
->leftJoin('orders as ors', 'shipments.order_id', '=', 'ors.id')
->leftJoin('inventory_sources as is', 'shipments.inventory_source_id', '=', 'is.id')
->select('shipments.id as shipment_id', 'shipments.order_id as shipment_order_id', 'shipments.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as orderdate', 'shipments.created_at as shipment_created_at')
->addSelect(DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to'));
$this->addFilter('shipment_id', 'ship.id');
$this->addFilter('shipment_order_id', 'ship.order_id');
$this->addFilter('shipment_total_qty', 'ship.total_qty');
$this->addFilter('shipment_id', 'shipments.id');
$this->addFilter('shipment_order_id', 'shipments.order_id');
$this->addFilter('shipment_total_qty', 'shipments.total_qty');
$this->addFilter('inventory_source_name', 'is.name');
$this->addFilter('orderdate', 'ors.created_at');
$this->addFilter('shipment_created_at', 'ship.created_at');
$this->addFilter('shipped_to', DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name)'));
$this->addFilter('shipment_created_at', 'shipments.created_at');
$this->addFilter('shipped_to', DDB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to'));
$this->setQueryBuilder($queryBuilder);
}

View File

@ -84,5 +84,11 @@ class UserDataGrid extends DataGrid
'route' => 'admin.users.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.users.delete',
'icon' => 'icon trash-icon'
]);
}
}

View File

@ -88,7 +88,7 @@ class CustomerController extends Controller
$channelName = $this->channel->all();
return view($this->_config['view'],compact('customerGroup','channelName'));
return view($this->_config['view'], compact('customerGroup','channelName'));
}
/**
@ -107,7 +107,7 @@ class CustomerController extends Controller
'date_of_birth' => 'date|before:today'
]);
$data=request()->all();
$data = request()->all();
$password = bcrypt(rand(100000,10000000));
@ -136,7 +136,7 @@ class CustomerController extends Controller
$channelName = $this->channel->all();
return view($this->_config['view'],compact('customer', 'customerGroup', 'channelName'));
return view($this->_config['view'], compact('customer', 'customerGroup', 'channelName'));
}
/**
@ -158,7 +158,7 @@ class CustomerController extends Controller
'date_of_birth' => 'date|before:today'
]);
$this->customer->update(request()->all(),$id);
$this->customer->update(request()->all(), $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));

View File

@ -96,7 +96,7 @@ class CustomerGroupController extends Controller
{
$group = $this->customerGroup->findOneWhere(['id'=>$id]);
return view($this->_config['view'],compact('group'));
return view($this->_config['view'], compact('group'));
}
/**
@ -112,7 +112,7 @@ class CustomerGroupController extends Controller
'name' => 'string|required',
]);
$this->customerGroup->update(request()->all(),$id);
$this->customerGroup->update(request()->all(), $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer Group']));

View File

@ -92,7 +92,7 @@ class InvoiceController extends Controller
$order = $this->order->find($orderId);
if (! $order->canInvoice()) {
session()->flash('error', 'Order invoice creation is not allowed.');
session()->flash('error', trans('admin::app.sales.invoices.creation-error'));
return redirect()->back();
}
@ -102,7 +102,7 @@ class InvoiceController extends Controller
]);
$data = request()->all();
$haveProductToInvoice = false;
foreach ($data['invoice']['items'] as $itemId => $qty) {
if ($qty) {
@ -112,14 +112,14 @@ class InvoiceController extends Controller
}
if (! $haveProductToInvoice) {
session()->flash('error', 'Invoice can not be created without products.');
session()->flash('error', trans('admin::app.sales.invoices.product-error'));
return redirect()->back();
}
$this->invoice->create(array_merge($data, ['order_id' => $orderId]));
session()->flash('success', 'Invoice created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Invoice']));
return redirect()->route($this->_config['redirect'], $orderId);
}

View File

@ -77,11 +77,11 @@ class OrderController extends Controller
public function cancel($id)
{
$result = $this->order->cancel($id);
if ($result) {
session()->flash('success', trans('Order canceled successfully.'));
session()->flash('success', trans('admin::app.response.cancel-success', ['name' => 'Order']));
} else {
session()->flash('error', trans('Order can not be canceled.'));
session()->flash('error', trans('admin::app.response.cancel-error', ['name' => 'Order']));
}
return redirect()->back();

View File

@ -92,7 +92,7 @@ class ShipmentController extends Controller
$order = $this->order->find($orderId);
if (! $order->channel || !$order->canShip()) {
session()->flash('error', 'Shipment can not be created for this order.');
session()->flash('error', trans('admin::app.sales.shipments.creation-error'));
return redirect()->back();
}
@ -112,7 +112,7 @@ class ShipmentController extends Controller
$order = $this->order->find($orderId);
if (! $order->canShip()) {
session()->flash('error', 'Order shipment creation is not allowed.');
session()->flash('error', trans('admin::app.sales.shipments.order-error'));
return redirect()->back();
}
@ -127,14 +127,14 @@ class ShipmentController extends Controller
$data = request()->all();
if (! $this->isInventoryValidate($data)) {
session()->flash('error', 'Requested quantity is invalid or not available.');
session()->flash('error', trans('admin::app.sales.shipments.quantity-invalid'));
return redirect()->back();
}
$this->shipment->create(array_merge($data, ['order_id' => $orderId]));
session()->flash('success', 'Shipment created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Shipment']));
return redirect()->route($this->_config['redirect'], $orderId);
}

View File

@ -10,10 +10,6 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::users.sessions.create'
])->name('admin.session.create');
Route::get('/testgrid', 'Webkul\Admin\Http\Controllers\DataGridController@testGrid')->defaults('_config', [
'view' => 'admin::catalog.categories.test'
]);
//login post route to admin auth controller
Route::post('/login', 'Webkul\User\Http\Controllers\SessionController@store')->defaults('_config', [
'redirect' => 'admin.dashboard.index'
@ -38,8 +34,6 @@ Route::group(['middleware' => ['web']], function () {
// Admin Routes
Route::group(['middleware' => ['admin']], function () {
Route::get('testev', 'Webkul\Product\Http\Controllers\ProductController@testProductFlat');
Route::get('/logout', 'Webkul\User\Http\Controllers\SessionController@destroy')->defaults('_config', [
'redirect' => 'admin.session.create'
])->name('admin.session.destroy');

View File

@ -44,7 +44,7 @@ class AdminServiceProvider extends ServiceProvider
Handler::class
);
}
/**
* Register services.
*
@ -62,18 +62,6 @@ class AdminServiceProvider extends ServiceProvider
*/
protected function composeView()
{
view()->composer(['admin::catalog.products.create', 'admin::catalog.products.edit'], function ($view) {
$accordian = Tree::create();
foreach (config('product_form_accordians') as $item) {
$accordian->add($item);
}
$accordian->items = core()->sortItems($accordian->items);
$view->with('form_accordians', $accordian);
});
view()->composer(['admin::layouts.nav-left', 'admin::layouts.nav-aside', 'admin::layouts.tabs'], function ($view) {
$tree = Tree::create();
@ -127,7 +115,7 @@ class AdminServiceProvider extends ServiceProvider
return $tree;
}
/**
* Register package config.
*
@ -144,7 +132,7 @@ class AdminServiceProvider extends ServiceProvider
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/product_form_accordians.php', 'product_form_accordians'
dirname(__DIR__) . '/Config/system.php', 'core'
);
}
}

View File

@ -80,8 +80,8 @@ return [
'total-orders' => 'Total Orders',
'total-sale' => 'Total Sale',
'average-sale' => 'Average Order Sale',
'increased' => ':progress% Increased',
'decreased' => ':progress% Decreased',
'increased' => ':progress%',
'decreased' => ':progress%',
'sales' => 'Sales',
'top-performing-categories' => 'Top Performing Categories',
'product-count' => ':count Products',
@ -217,6 +217,10 @@ return [
'delete-last' => 'At least one admin is required.',
'delete-success' => 'Success! User deleted',
'incorrect-password' => 'The password you entered is incorrect',
'password-match' => 'Current password does not match.',
'account-save' => 'Account changes saved successfully.',
'login-error' => 'Please check your credentials and try again.',
'activate-warning' => 'Your account is yet to be activated, please contact administrator.'
],
'sessions' => [
@ -301,7 +305,9 @@ return [
'bill-to' => 'Bill to',
'ship-to' => 'Ship to',
'print' => 'Print',
'order-date' => 'Order Date'
'order-date' => 'Order Date',
'creation-error' => 'Order invoice creation is not allowed.',
'product-error' => 'Invoice can not be created without products.'
],
'shipments' => [
@ -324,7 +330,10 @@ return [
'inventory-source' => 'Inventory Source',
'carrier-title' => 'Carrier Title',
'tracking-number' => 'Tracking Number',
'view-title' => 'Shipment #:shipment_id'
'view-title' => 'Shipment #:shipment_id',
'creation-error' => 'Shipment can not be created for this order.',
'order-error' => 'Order shipment creation is not allowed.',
'quantity-invalid' => 'Requested quantity is invalid or not available.',
]
],
@ -360,7 +369,12 @@ return [
'variant-already-exist-message' => 'Variant with same attribute options already exists.',
'add-image-btn-title' => 'Add Image',
'mass-delete-success' => 'All the selected index of products have been deleted successfully',
'mass-update-success' => 'All the selected index of products have been updated successfully'
'mass-update-success' => 'All the selected index of products have been updated successfully',
'configurable-error' => 'Please select atleast one configurable attribute.',
'categories' => 'Categories',
'images' => 'Images',
'inventories' => 'Inventories',
'variations' => 'Variations'
],
'attributes' => [
@ -402,7 +416,13 @@ return [
'is_filterable' => 'Use in Layered Navigation',
'is_configurable' => 'Use To Create Configurable Product',
'admin_name' => 'Admin Name',
'is_visible_on_front' => 'Visible on Product View Page on Front-end'
'is_visible_on_front' => 'Visible on Product View Page on Front-end',
'swatch_type' => 'Swatch Type',
'dropdown' => 'Dropdown',
'color-swatch' => 'Color Swatch',
'image-swatch' => 'Image Swatch',
'text-swatch' => 'Text Swatch',
'swatch' => 'Swatch'
],
'families' => [
'title' => 'Families',
@ -757,7 +777,8 @@ return [
'xls' => 'XLS',
'file' => 'File',
'upload-error' => 'The file must be a file of type: xls, xlsx, csv.',
'duplicate-error' => 'Identifier must be unique, duplicate identifier :identifier at row :position.'
'duplicate-error' => 'Identifier must be unique, duplicate identifier :identifier at row :position.',
'enough-row-error' => 'file has not enough rows'
],
'response' => [
@ -772,6 +793,13 @@ return [
'currency-delete-error' => 'This currency is set as channel base currency so it can not be deleted.',
'upload-success' => ':name uploaded successfully.',
'delete-category-root' => 'Cannot delete the root category',
'create-root-failure' => 'Category with name root already exists'
'create-root-failure' => 'Category with name root already exists',
'cancel-success' => ':name canceled successfully.',
'cancel-error' => ':name can not be canceled.',
'already-taken' => 'The :name has already been taken.'
],
'footer' => [
'copy-right' => '© Copyright 2018 Webkul Software, All rights reserved.'
],
];

View File

@ -28,8 +28,13 @@
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.general.before') !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.general.controls.before') !!}
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code">{{ __('admin::app.catalog.attributes.code') }}</label>
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') }}" data-vv-as="&quot;{{ __('admin::app.catalog.attributes.code') }}&quot;" v-code/>
@ -49,12 +54,22 @@
<option value="date">{{ __('admin::app.catalog.attributes.date') }}</option>
</select>
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.general.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.general.after') !!}
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.label.before') !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.label') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.label.controls.before') !!}
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
<input type="text" v-validate="'required'" class="control" id="admin_name" name="admin_name" value="{{ old('admin_name') }}" data-vv-as="&quot;{{ __('admin::app.catalog.attributes.admin') }}&quot;"/>
@ -70,22 +85,41 @@
@endforeach
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.label.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.label.after') !!}
<div class="hide">
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.options.before') !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.options.controls.before') !!}
<option-wrapper></option-wrapper>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.options.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.options.after') !!}
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.validations.before') !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.validations') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.options.controls.before') !!}
<div class="control-group">
<label for="is_required">{{ __('admin::app.catalog.attributes.is_required') }}</label>
<select class="control" id="is_required" name="is_required">
@ -113,12 +147,21 @@
</select>
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.options.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.validations.after') !!}
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.configuration.before') !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.configuration') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.configuration.controls.before') !!}
<div class="control-group">
<label for="value_per_locale">{{ __('admin::app.catalog.attributes.value_per_locale') }}</label>
<select class="control" id="value_per_locale" name="value_per_locale">
@ -159,8 +202,13 @@
</select>
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.configuration.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.configuration.after') !!}
</div>
</div>
@ -171,10 +219,34 @@
@push('scripts')
<script type="text/x-template" id="options-template">
<div>
<div class="control-group">
<label for="swatch_type">{{ __('admin::app.catalog.attributes.swatch_type') }}</label>
<select class="control" id="swatch_type" name="swatch_type" v-model="swatch_type">
<option value="dropdown">
{{ __('admin::app.catalog.attributes.dropdown') }}
</option>
<option value="color">
{{ __('admin::app.catalog.attributes.color-swatch') }}
</option>
<option value="image">
{{ __('admin::app.catalog.attributes.image-swatch') }}
</option>
<option value="text">
{{ __('admin::app.catalog.attributes.text-swatch') }}
</option>
</select>
</div>
<div class="table">
<table>
<thead>
<tr>
<th v-if="swatch_type == 'color' || swatch_type == 'image'">{{ __('admin::app.catalog.attributes.swatch') }}</th>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@foreach (Webkul\Core\Models\Locale::all() as $locale)
@ -191,6 +263,14 @@
<tbody>
<tr v-for="row in optionRows">
<td v-if="swatch_type == 'color'">
<swatch-picker :input-name="'options[' + row.id + '][swatch_value]'" :color="row.swatch_value" colors="text-advanced" show-fallback />
</td>
<td v-if="swatch_type == 'image'">
<input type="file" accept="image/*" :name="'options[' + row.id + '][swatch_value]'"/>
</td>
<td>
<div class="control-group" :class="[errors.has(adminName(row)) ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.attributes.admin_name') }}&quot;"/>
@ -244,7 +324,8 @@
data: () => ({
optionRowCount: 0,
optionRows: []
optionRows: [],
swatch_type: ''
}),
methods: {
@ -253,7 +334,7 @@
var row = {'id': 'option_' + rowCount};
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
row['{{ $locale->code }}'] = '';
@endforeach
this.optionRows.push(row);

View File

@ -6,7 +6,7 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.catalog.attributes.update', $attribute->id) }}" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.catalog.attributes.update', $attribute->id) }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
<div class="page-header">
<div class="page-title">
@ -29,8 +29,13 @@
@csrf()
<input name="_method" type="hidden" value="PUT">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.before', ['attribute' => $attribute]) !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.controls.before', ['attribute' => $attribute]) !!}
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.catalog.attributes.code') }}</label>
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ $attribute->code }}" disabled="disabled" data-vv-as="&quot;{{ __('admin::app.catalog.attributes.code') }}&quot;" v-code/>
@ -69,12 +74,21 @@
</select>
<input type="hidden" name="type" value="{{ $attribute->type }}"/>
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.controls.after', ['attribute' => $attribute]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.after', ['attribute' => $attribute]) !!}
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.before', ['attribute' => $attribute]) !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.label') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.controls.before', ['attribute' => $attribute]) !!}
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
<input type="text" v-validate="'required'" class="control" id="admin_name" name="admin_name" value="{{ old('admin_name') ?: $attribute->admin_name }}" data-vv-as="&quot;{{ __('admin::app.catalog.attributes.admin_name') }}&quot;"/>
@ -90,22 +104,41 @@
@endforeach
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.controls.after', ['attribute' => $attribute]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.after', ['attribute' => $attribute]) !!}
<div class="{{ in_array($attribute->type, ['select', 'multiselect', 'checkbox']) ?: 'hide' }}">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.before', ['attribute' => $attribute]) !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.controls.before', ['attribute' => $attribute]) !!}
<option-wrapper></option-wrapper>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.controls.after', ['attribute' => $attribute]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.after', ['attribute' => $attribute]) !!}
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.before', ['attribute' => $attribute]) !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.validations') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.controls.before', ['attribute' => $attribute]) !!}
<div class="control-group">
<label for="is_required">{{ __('admin::app.catalog.attributes.is_required') }}</label>
<select class="control" id="is_required" name="is_required">
@ -147,12 +180,21 @@
</select>
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.controls.after', ['attribute' => $attribute]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.after', ['attribute' => $attribute]) !!}
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.before', ['attribute' => $attribute]) !!}
<accordian :title="'{{ __('admin::app.catalog.attributes.configuration') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.before', ['attribute' => $attribute]) !!}
<div class="control-group">
<label for="value_per_locale">{{ __('admin::app.catalog.attributes.value_per_locale') }}</label>
<select class="control" id="value_per_locale" name="value_per_locale" disabled>
@ -215,8 +257,12 @@
</select>
</div>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.after', ['attribute' => $attribute]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.after', ['attribute' => $attribute]) !!}
</div>
</div>
@ -227,10 +273,34 @@
@push('scripts')
<script type="text/x-template" id="options-template">
<div>
<div class="control-group">
<label for="swatch_type">{{ __('admin::app.catalog.attributes.swatch_type') }}</label>
<select class="control" id="swatch_type" name="swatch_type" v-model="swatch_type">
<option value="dropdown">
{{ __('admin::app.catalog.attributes.dropdown') }}
</option>
<option value="color">
{{ __('admin::app.catalog.attributes.color-swatch') }}
</option>
<option value="image">
{{ __('admin::app.catalog.attributes.image-swatch') }}
</option>
<option value="text">
{{ __('admin::app.catalog.attributes.text-swatch') }}
</option>
</select>
</div>
<div class="table">
<table>
<thead>
<tr>
<th v-if="swatch_type == 'color' || swatch_type == 'image'">{{ __('admin::app.catalog.attributes.swatch') }}</th>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@foreach (Webkul\Core\Models\Locale::all() as $locale)
@ -246,7 +316,16 @@
</thead>
<tbody>
<tr v-for="row in optionRows">
<tr v-for="(row, index) in optionRows">
<td v-if="swatch_type == 'color'">
<swatch-picker :input-name="'options[' + row.id + '][swatch_value]'" :color="row.swatch_value" colors="text-advanced" show-fallback />
</td>
<td v-if="swatch_type == 'image'">
<img style="width: 36px;height: 36px;vertical-align: middle;background: #F2F2F2;border-radius: 2px;margin-right: 10px;" v-if="row.swatch_value_url" :src="row.swatch_value_url"/>
<input type="file" accept="image/*" :name="'options[' + row.id + '][swatch_value]'"/>
</td>
<td>
<div class="control-group" :class="[errors.has(adminName(row)) ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.attributes.admin_name') }}&quot;"/>
@ -285,75 +364,73 @@
</script>
<script>
$(document).ready(function () {
$('#type').on('change', function (e) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
}
})
$('#type').on('change', function (e) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
}
})
var optionWrapper = Vue.component('option-wrapper', {
Vue.component('option-wrapper', {
template: '#options-template',
template: '#options-template',
created () {
@foreach ($attribute->options as $option)
this.optionRowCount++;
var row = {'id': '{{ $option->id }}', 'admin_name': '{{ $option->admin_name }}', 'sort_order': '{{ $option->sort_order }}'};
data: () => ({
optionRowCount: 0,
optionRows: [],
swatch_type: "{{ $attribute->swatch_type }}"
}),
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] }}";
@endforeach
created () {
@foreach ($attribute->options as $option)
this.optionRowCount++;
var row = {
'id': '{{ $option->id }}',
'admin_name': '{{ $option->admin_name }}',
'sort_order': '{{ $option->sort_order }}',
'sort_order': '{{ $option->sort_order }}',
'swatch_value': '{{ $option->swatch_value }}',
'swatch_value_url': '{{ $option->swatch_value_url }}'
};
this.optionRows.push(row);
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] }}";
@endforeach
this.optionRows.push(row);
@endforeach
},
methods: {
addOptionRow () {
var rowCount = this.optionRowCount++;
var row = {'id': 'option_' + rowCount};
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
@endforeach
this.optionRows.push(row);
},
data: () => ({
optionRowCount: 0,
optionRows: []
}),
removeRow (row) {
var index = this.optionRows.indexOf(row)
Vue.delete(this.optionRows, index);
},
methods: {
addOptionRow () {
var rowCount = this.optionRowCount++;
var row = {'id': 'option_' + rowCount};
adminName (row) {
return 'options[' + row.id + '][admin_name]';
},
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
@endforeach
localeInputName (row, locale) {
return 'options[' + row.id + '][' + locale + '][label]';
},
this.optionRows.push(row);
},
removeRow (row) {
var index = this.optionRows.indexOf(row)
Vue.delete(this.optionRows, index);
},
adminName (row) {
return 'options[' + row.id + '][admin_name]';
},
localeInputName (row, locale) {
return 'options[' + row.id + '][' + locale + '][label]';
},
sortOrderName (row) {
return 'options[' + row.id + '][sort_order]';
}
sortOrderName (row) {
return 'options[' + row.id + '][sort_order]';
}
})
new Vue({
el: '#options',
components: {
optionWrapper: optionWrapper
},
})
}
});
</script>
@endpush

View File

@ -18,9 +18,14 @@
</div>
</div>
{!! view_render_event('bagisto.admin.catalog.attributes.list.before') !!}
<div class="page-content">
@inject('attributes','Webkul\Admin\DataGrids\AttributeDataGrid')
{!! $attributes->render() !!}
{!! app('Webkul\Admin\DataGrids\AttributeDataGrid')->render() !!}
</div>
{!! view_render_event('bagisto.admin.catalog.attributes.list.after') !!}
</div>
@stop

View File

@ -30,9 +30,13 @@
@csrf()
<input type="hidden" name="locale" value="all"/>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.general.before') !!}
<accordian :title="'{{ __('admin::app.catalog.categories.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.general.controls.before') !!}
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') }}" data-vv-as="&quot;{{ __('admin::app.catalog.categories.name') }}&quot;"/>
@ -58,12 +62,21 @@
<span class="control-error" v-if="errors.has('position')">@{{ errors.first('position') }}</span>
</div>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.general.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.general.after') !!}
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.description_images.before') !!}
<accordian :title="'{{ __('admin::app.catalog.categories.description-and-images') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.description_images.controls.before') !!}
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
<textarea v-validate="'required'" class="control" id="description" name="description" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old('description') }}</textarea>
@ -76,22 +89,42 @@
<image-wrapper :button-label="'{{ __('admin::app.catalog.products.add-image-btn-title') }}'" input-name="image" :multiple="false"></image-wrapper>
</div>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.description_images.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.description_images.after') !!}
@if ($categories->count())
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)'></tree-view>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.before') !!}
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.controls.before') !!}
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)'></tree-view>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.after') !!}
</div>
</accordian>
@endif
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.seo.before') !!}
<accordian :title="'{{ __('admin::app.catalog.categories.seo') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.seo.controls.before') !!}
<div class="control-group">
<label for="meta_title">{{ __('admin::app.catalog.categories.meta_title') }}</label>
<input type="text" class="control" id="meta_title" name="meta_title" value="{{ old('meta_title') }}"/>
@ -113,9 +146,13 @@
<textarea class="control" id="meta_keywords" name="meta_keywords">{{ old('meta_keywords') }}</textarea>
</div>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.seo.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.seo.after') !!}
</div>
</div>

View File

@ -43,9 +43,13 @@
@csrf()
<input name="_method" type="hidden" value="PUT">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.general.before', ['category' => $category]) !!}
<accordian :title="'{{ __('admin::app.catalog.categories.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.general.controls.before', ['category' => $category]) !!}
<div class="control-group" :class="[errors.has('{{$locale}}[name]') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
<input type="text" v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" value="{{ old($locale)['name'] ?: $category->translate($locale)['name'] }}" data-vv-as="&quot;{{ __('admin::app.catalog.categories.name') }}&quot;"/>
@ -71,11 +75,20 @@
<span class="control-error" v-if="errors.has('position')">@{{ errors.first('position') }}</span>
</div>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.general.controls.after', ['category' => $category]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.general.after', ['category' => $category]) !!}
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.description_images.before', ['category' => $category]) !!}
<accordian :title="'{{ __('admin::app.catalog.categories.description-and-images') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.description_images.controls.before', ['category' => $category]) !!}
<div class="control-group" :class="[errors.has('{{$locale}}[description]') ? 'has-error' : '']">
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
@ -90,22 +103,41 @@
</div>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.description_images.controls.after', ['category' => $category]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.description_images.after', ['category' => $category]) !!}
@if ($categories->count())
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.before', ['category' => $category]) !!}
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)'></tree-view>
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.controls.before', ['category' => $category]) !!}
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)'></tree-view>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.controls.before', ['category' => $category]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.after', ['category' => $category]) !!}
</div>
</accordian>
@endif
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.before', ['category' => $category]) !!}
<accordian :title="'{{ __('admin::app.catalog.categories.seo') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.controls.before', ['category' => $category]) !!}
<div class="control-group">
<label for="meta_title">{{ __('admin::app.catalog.categories.meta_title') }}</label>
<input type="text" class="control" id="meta_title" name="{{$locale}}[meta_title]" value="{{ old($locale)['meta_title'] ?: $category->translate($locale)['meta_title'] }}"/>
@ -127,9 +159,13 @@
<textarea class="control" id="meta_keywords" name="{{$locale}}[meta_keywords]">{{ old($locale)['meta_keywords'] ?: $category->translate($locale)['meta_keywords'] }}</textarea>
</div>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.controls.after', ['category' => $category]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.after', ['category' => $category]) !!}
</div>
</div>

View File

@ -18,9 +18,15 @@
</div>
</div>
{!! view_render_event('bagisto.admin.catalog.categories.list.before') !!}
<div class="page-content">
@inject('categories','Webkul\Admin\DataGrids\CategoryDataGrid')
{!! $categories->render() !!}
{!! app('Webkul\Admin\DataGrids\CategoryDataGrid')->render() !!}
</div>
{!! view_render_event('bagisto.admin.catalog.categories.list.after') !!}
</div>
@stop

View File

@ -29,9 +29,13 @@
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.general.before') !!}
<accordian :title="'{{ __('admin::app.catalog.families.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.general.controls.before') !!}
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.catalog.families.code') }}</label>
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') }}" data-vv-as="&quot;{{ __('admin::app.catalog.families.code') }}&quot;" v-code/>
@ -44,19 +48,33 @@
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.general.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.general.after') !!}
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.groups.before') !!}
<accordian :title="'{{ __('admin::app.catalog.families.groups') }}'" :active="true">
<div slot="body">
<button type="button" class="btn btn-md btn-primary" @click="showModal('addGroup')">
<button type="button" style="margin-bottom : 20px" class="btn btn-md btn-primary" @click="showModal('addGroup')">
{{ __('admin::app.catalog.families.add-group-title') }}
</button>
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.groups.controls.before') !!}
<group-list></group-list>
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.groups.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.family.create_form_accordian.groups.after') !!}
</div>
</div>

View File

@ -30,9 +30,13 @@
@csrf()
<input name="_method" type="hidden" value="PUT">
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.general.before', ['attributeFamily' => $attributeFamily]) !!}
<accordian :title="'{{ __('admin::app.catalog.families.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.general.controls.before', ['attributeFamily' => $attributeFamily]) !!}
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<input type="text" v-validate="'required'" name="code" class="control" id="code" value="{{ $attributeFamily->code }}" disabled="disabled" data-vv-as="&quot;{{ __('admin::app.catalog.families.code') }}&quot;" v-code/>
<input type="hidden" name="code" value="{{ $attributeFamily->code }}"/>
@ -45,19 +49,33 @@
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.general.controls.after', ['attributeFamily' => $attributeFamily]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.general.after', ['attributeFamily' => $attributeFamily]) !!}
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.groups.before', ['attributeFamily' => $attributeFamily]) !!}
<accordian :title="'{{ __('admin::app.catalog.families.groups') }}'" :active="true">
<div slot="body">
<button type="button" class="btn btn-md btn-primary" @click="showModal('addGroup')">
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.groups.controls.before', ['attributeFamily' => $attributeFamily]) !!}
<button type="button" style="margin-bottom : 20px" class="btn btn-md btn-primary" @click="showModal('addGroup')">
{{ __('admin::app.catalog.families.add-group-title') }}
</button>
<group-list></group-list>
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.groups.controls.before', ['attributeFamily' => $attributeFamily]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.family.edit_form_accordian.groups.after', ['attributeFamily' => $attributeFamily]) !!}
</div>
</div>

View File

@ -18,9 +18,15 @@
</div>
</div>
{!! view_render_event('bagisto.admin.catalog.families.list.before') !!}
<div class="page-content">
@inject('attributefamily','Webkul\Admin\DataGrids\AttributeFamilyDataGrid')
{!! $attributefamily->render() !!}
{!! app('Webkul\Admin\DataGrids\AttributeFamilyDataGrid')->render() !!}
</div>
{!! view_render_event('bagisto.admin.catalog.families.list.after') !!}
</div>
@stop

View File

@ -1,9 +1,13 @@
@if ($categories->count())
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<accordian :title="'{{ __('admin::app.catalog.products.categories') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.before', ['product' => $product]) !!}
<tree-view behavior="normal" value-field="id" name-field="categories" input-type="checkbox" items='@json($categories)' value='@json($product->categories->pluck("id"))'></tree-view>
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.after', ['product' => $product]) !!}
</div>
</accordian>
@endif

View File

@ -1,8 +1,11 @@
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<accordian :title="'{{ __('admin::app.catalog.products.images') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.images.controls.before', ['product' => $product]) !!}
<image-wrapper :button-label="'{{ __('admin::app.catalog.products.add-image-btn-title') }}'" input-name="images" :images='@json($product->images)'></image-wrapper>
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.images.controls.after', ['product' => $product]) !!}
</div>
</accordian>

View File

@ -1,7 +1,9 @@
@if ($product->type != 'configurable')
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<accordian :title="'{{ __('admin::app.catalog.products.inventories') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.inventories.controls.before', ['product' => $product]) !!}
@foreach ($inventorySources as $inventorySource)
<?php
@ -26,6 +28,8 @@
@endforeach
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.inventories.controls.after', ['product' => $product]) !!}
</div>
</accordian>
@endif

View File

@ -1,4 +1,4 @@
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<accordian :title="'{{ __('admin::app.catalog.products.product-link') }}'" :active="true">
<div slot="body">

View File

@ -18,15 +18,19 @@
</style>
@stop
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<accordian :title="'{{ __('admin::app.catalog.products.variations') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.variations.controls.before', ['product' => $product]) !!}
<button type="button" class="btn btn-md btn-primary" @click="showModal('addVariant')">
{{ __('admin::app.catalog.products.add-variant-btn-title') }}
</button>
<variant-list></variant-list>
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.variations.controls.after', ['product' => $product]) !!}
</div>
</accordian>

View File

@ -45,9 +45,13 @@
<?php $familyId = app('request')->input('family') ?>
<?php $sku = app('request')->input('sku') ?>
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.general.before') !!}
<accordian :title="'{{ __('admin::app.catalog.products.general') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.general.controls.before') !!}
<div class="control-group" :class="[errors.has('type') ? 'has-error' : '']">
<label for="type" class="required">{{ __('admin::app.catalog.products.product-type') }}</label>
<select class="control" v-validate="'required'" id="type" name="type" {{ $familyId ? 'disabled' : '' }} data-vv-as="&quot;{{ __('admin::app.catalog.products.product-type') }}&quot;">
@ -82,13 +86,22 @@
<span class="control-error" v-if="errors.has('sku')">@{{ errors.first('sku') }}</span>
</div>
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.general.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.general.after') !!}
@if ($familyId)
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.configurable_attributes.before') !!}
<accordian :title="'{{ __('admin::app.catalog.products.configurable-attributes') }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.configurable_attributes.controls.before') !!}
<div class="table">
<table>
<thead>
@ -125,8 +138,12 @@
</table>
</div>
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.configurable_attributes.controls.after') !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.product.create_form_accordian.configurable_attributes.after') !!}
@endif
</div>

View File

@ -9,6 +9,8 @@
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
<?php $channel = request()->get('channel') ?: core()->getDefaultChannelCode(); ?>
{!! view_render_event('bagisto.admin.catalog.product.edit.before', ['product' => $product]) !!}
<form method="POST" action="" @submit.prevent="onSubmit" enctype="multipart/form-data">
<div class="page-header">
@ -58,9 +60,14 @@
<input name="_method" type="hidden" value="PUT">
@foreach ($product->attribute_family->attribute_groups as $attributeGroup)
@if (count($attributeGroup->custom_attributes))
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.' . $attributeGroup->name . '.before', ['product' => $product]) !!}
<accordian :title="'{{ __($attributeGroup->name) }}'" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.' . $attributeGroup->name . '.controls.before', ['product' => $product]) !!}
@foreach ($attributeGroup->custom_attributes as $attribute)
@ -126,24 +133,50 @@
@endforeach
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.' . $attributeGroup->name . '.controls.after', ['product' => $product]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.' . $attributeGroup->name . '.after', ['product' => $product]) !!}
@endif
@endforeach
@if ($form_accordians)
@foreach ($form_accordians->items as $accordian)
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.inventories.before', ['product' => $product]) !!}
@include ($accordian['view'])
@include ('admin::catalog.products.accordians.inventories')
@endforeach
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.inventories.after', ['product' => $product]) !!}
@endif
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.images.before', ['product' => $product]) !!}
@include ('admin::catalog.products.accordians.images')
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.images.after', ['product' => $product]) !!}
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.before', ['product' => $product]) !!}
@include ('admin::catalog.products.accordians.categories')
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.after', ['product' => $product]) !!}
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.variations.before', ['product' => $product]) !!}
@include ('admin::catalog.products.accordians.variations')
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.variations.after', ['product' => $product]) !!}
</div>
</form>
{!! view_render_event('bagisto.admin.catalog.product.edit.after', ['product' => $product]) !!}
</div>
@stop

View File

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

View File

@ -18,6 +18,8 @@
</div>
</div>
{!! view_render_event('bagisto.admin.catalog.products.list.before') !!}
<div class="page-content">
{{-- @inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
{!! $product->render() !!} --}}
@ -25,5 +27,8 @@
@inject('products', 'Webkul\Admin\DataGrids\ProductDataGrid')
{!! $products->render() !!}
</div>
{!! view_render_event('bagisto.admin.catalog.products.list.after') !!}
</div>
@stop

View File

@ -66,8 +66,8 @@
@if (isset($field['repository']))
@foreach ($value as $key => $option)
<option value="{{ $value[$key] }}" {{ $value[$key] == $selectedOption ? 'selected' : ''}}>
{{ trans($value[$key]) }}
<option value="{{ $key }}" {{ $option == $selectedOption ? 'selected' : ''}}>
{{ trans($option) }}
</option>
@endforeach
@ -212,6 +212,10 @@
@endif
@if (isset($field['info']))
<span class="control-info">{{ trans($field['info']) }}</span>
@endif
<span class="control-error" v-if="errors.has('{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]')">@{{ errors.first('{!! $firstField !!}[{!! $secondField !!}][{!! $thirdField !!}][{!! $field['name'] !!}]') }}</span>
</div>

View File

@ -42,7 +42,7 @@
<div class="control-group">
<label for="name" >{{ __('admin::app.customers.reviews.rating') }}</label>
<div class="stars">
@for($i = 1; $i <= $review->rating; $i++)
@for ($i = 1; $i <= $review->rating; $i++)
<span class="icon star-icon"></span>
@endfor
</div>
@ -67,7 +67,7 @@
<div class="control-group">
<label for="name" >{{ __('admin::app.customers.reviews.comment') }}</label>
<textarea class="control" disabled> {{$review->comment}}</textarea>
<textarea class="control" disabled> {{ $review->comment }}</textarea>
</div>
</div>

View File

@ -71,7 +71,7 @@
<flash-wrapper ref='flashes'></flash-wrapper>
<div class="center-box">
<div class="adjacent-center">
<div class="brand-logo">
@ -82,7 +82,7 @@
<div class="footer">
<p>
© Copyright 2018 Webkul Software, All rights reserved.
{{ trans('admin::app.footer.copy-right') }}
</p>
</div>
@ -112,6 +112,6 @@
<script type="text/javascript" src="{{ asset('vendor/webkul/ui/assets/js/ui.js') }}"></script>
@yield('javascript')
</body>
</html>

View File

@ -19,7 +19,7 @@
</head>
<body style="scroll-behavior: smooth;">
<body @if (app()->getLocale() == 'ar') class="rtl" @endif style="scroll-behavior: smooth;">
{!! view_render_event('bagisto.admin.layout.body.before') !!}
<div id="app">

View File

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

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Attribute\Contracts;
interface Attribute
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Attribute\Contracts;
interface AttributeFamily
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Attribute\Contracts;
interface AttributeGroup
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Attribute\Contracts;
interface AttributeOption
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Attribute\Contracts;
interface AttributeOptionTranslation
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Attribute\Contracts;
interface AttributeTranslation
{
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSwatchTypeColumnInAttributesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('attributes', function (Blueprint $table) {
$table->string('swatch_type')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('attributes', function (Blueprint $table) {
//
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSwatchValueColumnsInAttributeOptionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('attribute_options', function (Blueprint $table) {
$table->string('swatch_value')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('attribute_options', function (Blueprint $table) {
//
});
}
}

View File

@ -81,7 +81,7 @@ class AttributeController extends Controller
$attribute = $this->attribute->create($data);
session()->flash('success', 'Attribute created successfully.');
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
return redirect()->route($this->_config['redirect']);
}
@ -116,7 +116,7 @@ class AttributeController extends Controller
$attribute = $this->attribute->update(request()->all(), $id);
session()->flash('success', 'Attribute updated successfully.');
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
return redirect()->route($this->_config['redirect']);
}
@ -132,12 +132,12 @@ class AttributeController extends Controller
$attribute = $this->attribute->findOrFail($id);
if(!$attribute->is_user_defined) {
session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'attribute']));
session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'Attribute']));
} else {
try {
$this->attribute->delete($id);
session()->flash('success', 'Attribute deleted successfully.');
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Attribute']));
} catch(\Exception $e) {
session()->flash('error', trans('admin::app.response.attribute-error', ['name' => 'Attribute']));

View File

@ -3,14 +3,13 @@
namespace Webkul\Attribute\Models;
use Webkul\Core\Eloquent\TranslatableModel;
use Webkul\Attribute\Models\AttributeOption;
use Webkul\Attribute\Models\AttributeGroup;
use Webkul\Attribute\Contracts\Attribute as AttributeContract;
class Attribute extends TranslatableModel
class Attribute extends TranslatableModel implements AttributeContract
{
public $translatedAttributes = ['name'];
protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'validation', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front', 'is_user_defined'];
protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'validation', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front', 'is_user_defined', 'swatch_type'];
protected $with = ['options'];
@ -19,7 +18,7 @@ class Attribute extends TranslatableModel
*/
public function options()
{
return $this->hasMany(AttributeOption::class);
return $this->hasMany(AttributeOptionProxy::modelClass());
}
/**

View File

@ -3,13 +3,13 @@
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Models\AttributeGroup;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductProxy;
use Webkul\Attribute\Contracts\AttributeFamily as AttributeFamilyContract;
class AttributeFamily extends Model
class AttributeFamily extends Model implements AttributeFamilyContract
{
public $timestamps = false;
protected $fillable = ['code', 'name'];
/**
@ -17,7 +17,7 @@ class AttributeFamily extends Model
*/
public function custom_attributes()
{
return Attribute::join('attribute_group_mappings', 'attributes.id', '=', 'attribute_group_mappings.attribute_id')
return (AttributeProxy::modelClass())::join('attribute_group_mappings', 'attributes.id', '=', 'attribute_group_mappings.attribute_id')
->join('attribute_groups', 'attribute_group_mappings.attribute_group_id', '=', 'attribute_groups.id')
->join('attribute_families', 'attribute_groups.attribute_family_id', '=', 'attribute_families.id')
->where('attribute_families.id', $this->id)
@ -37,7 +37,7 @@ class AttributeFamily extends Model
*/
public function attribute_groups()
{
return $this->hasMany(AttributeGroup::class)->orderBy('position');
return $this->hasMany(AttributeGroupProxy::modelClass())->orderBy('position');
}
/**
@ -53,6 +53,6 @@ class AttributeFamily extends Model
*/
public function products()
{
return $this->hasMany(Product::class);
return $this->hasMany(ProductProxy::modelClass());
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeFamilyProxy extends ModelProxy
{
}

View File

@ -3,12 +3,12 @@
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Models\Attribute;
use Webkul\Attribute\Contracts\AttributeGroup as AttributeGroupContract;
class AttributeGroup extends Model
class AttributeGroup extends Model implements AttributeGroupContract
{
public $timestamps = false;
protected $fillable = ['name', 'position', 'is_user_defined'];
/**
@ -16,7 +16,7 @@ class AttributeGroup extends Model
*/
public function custom_attributes()
{
return $this->belongsToMany(Attribute::class, 'attribute_group_mappings')
return $this->belongsToMany(AttributeProxy::modelClass(), 'attribute_group_mappings')
->withPivot('position')
->orderBy('pivot_position', 'asc');
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeGroupProxy extends ModelProxy
{
}

View File

@ -2,23 +2,42 @@
namespace Webkul\Attribute\Models;
use Illuminate\Support\Facades\Storage;
use Webkul\Core\Eloquent\TranslatableModel;
use Dimsav\Translatable\Translatable;
use Webkul\Attribute\Models\Attribute;
use Webkul\Attribute\Contracts\AttributeOption as AttributeOptionContract;
class AttributeOption extends TranslatableModel
class AttributeOption extends TranslatableModel implements AttributeOptionContract
{
public $timestamps = false;
public $translatedAttributes = ['label'];
protected $fillable = ['admin_name', 'sort_order'];
protected $fillable = ['admin_name', 'swatch_value', 'sort_order', 'attribute_id'];
/**
* Get the attribute that owns the attribute option.
*/
public function attribute()
{
return $this->model()->getCustomAttributesAttribute();
return $this->belongsTo(AttributeProxy::modelClass());
}
/**
* Get image url for the swatch value url.
*/
public function swatch_value_url()
{
if ($this->swatch_value && $this->attribute->swatch_type == 'image')
return Storage::url($this->swatch_value);
return;
}
/**
* Get image url for the product image.
*/
public function getSwatchValueUrlAttribute()
{
return $this->swatch_value_url();
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeOptionProxy extends ModelProxy
{
}

View File

@ -3,8 +3,9 @@
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Contracts\AttributeOptionTranslation as AttributeOptionTranslationContract;
class AttributeOptionTranslation extends Model
class AttributeOptionTranslation extends Model implements AttributeOptionTranslationContract
{
public $timestamps = false;

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeOptionTranslationProxy extends ModelProxy
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeProxy extends ModelProxy
{
}

View File

@ -3,10 +3,11 @@
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Contracts\AttributeTranslation as AttributeTranslationContract;
class AttributeTranslation extends Model
class AttributeTranslation extends Model implements AttributeTranslationContract
{
public $timestamps = false;
protected $fillable = ['name'];
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeTranslationProxy extends ModelProxy
{
}

View File

@ -15,6 +15,8 @@ class AttributeServiceProvider extends ServiceProvider
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app->register(ModuleServiceProvider::class);
}
/**

View File

@ -0,0 +1,17 @@
<?php
namespace Webkul\Attribute\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Attribute\Models\Attribute::class,
\Webkul\Attribute\Models\AttributeFamily::class,
\Webkul\Attribute\Models\AttributeGroup::class,
\Webkul\Attribute\Models\AttributeOption::class,
\Webkul\Attribute\Models\AttributeOptionTranslation::class,
\Webkul\Attribute\Models\AttributeTranslation::class,
];
}

View File

@ -53,7 +53,7 @@ class AttributeFamilyRepository extends Repository
*/
function model()
{
return 'Webkul\Attribute\Models\AttributeFamily';
return 'Webkul\Attribute\Contracts\AttributeFamily';
}
/**
@ -79,7 +79,7 @@ class AttributeFamilyRepository extends Repository
} else {
$attributeModel = $this->attribute->findOneByField('code', $attribute['code']);
}
$attributeGroup->custom_attributes()->save($attributeModel, ['position' => $key + 1]);
}
}

View File

@ -1,7 +1,7 @@
<?php
<?php
namespace Webkul\Attribute\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
@ -12,7 +12,7 @@ use Webkul\Core\Eloquent\Repository;
*/
class AttributeGroupRepository extends Repository
{
/**
* Specify Model class name
*
@ -20,6 +20,6 @@ class AttributeGroupRepository extends Repository
*/
function model()
{
return 'Webkul\Attribute\Models\AttributeGroup';
return 'Webkul\Attribute\Contracts\AttributeGroup';
}
}

View File

@ -1,7 +1,7 @@
<?php
<?php
namespace Webkul\Attribute\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
@ -12,7 +12,7 @@ use Webkul\Core\Eloquent\Repository;
*/
class AttributeOptionRepository extends Repository
{
/**
* Specify Model class name
*
@ -20,6 +20,51 @@ class AttributeOptionRepository extends Repository
*/
function model()
{
return 'Webkul\Attribute\Models\AttributeOption';
return 'Webkul\Attribute\Contracts\AttributeOption';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$option = parent::create($data);
$this->uploadSwatchImage($data, $option->id);
return $option;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$option = parent::update($data, $id);
$this->uploadSwatchImage($data, $id);
return $option;
}
/**
* @param array $data
* @param mixed $optionId
* @return mixed
*/
public function uploadSwatchImage($data, $optionId)
{
if (! isset($data['swatch_value']) || ! $data['swatch_value'])
return;
if ($data['swatch_value'] instanceof \Illuminate\Http\UploadedFile) {
parent::update([
'swatch_value' => $data['swatch_value']->store('attribute_option')
], $optionId);
}
}
}

View File

@ -1,7 +1,7 @@
<?php
<?php
namespace Webkul\Attribute\Repositories;
use Webkul\Core\Eloquent\Repository;
use Illuminate\Support\Facades\Event;
use Webkul\Attribute\Repositories\AttributeOptionRepository;
@ -42,7 +42,7 @@ class AttributeRepository extends Repository
*/
function model()
{
return 'Webkul\Attribute\Models\Attribute';
return 'Webkul\Attribute\Contracts\Attribute';
}
/**
@ -60,8 +60,10 @@ class AttributeRepository extends Repository
$attribute = $this->model->create($data);
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
foreach ($options as $option) {
$attribute->options()->create($option);
foreach ($options as $optionInputs) {
$this->attributeOption->create(array_merge([
'attribute_id' => $attribute->id
], $optionInputs));
}
}
@ -92,7 +94,9 @@ class AttributeRepository extends Repository
if (isset($data['options'])) {
foreach ($data['options'] as $optionId => $optionInputs) {
if (str_contains($optionId, 'option_')) {
$attribute->options()->create($optionInputs);
$this->attributeOption->create(array_merge([
'attribute_id' => $attribute->id,
], $optionInputs));
} else {
if (is_numeric($index = $previousOptionIds->search($optionId))) {
$previousOptionIds->forget($index);
@ -170,7 +174,7 @@ class AttributeRepository extends Repository
'special_price_to',
'status'
], $attributeColumns);
if (in_array('*', $codes))
return $this->all($attributeColumns);

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Category\Contracts;
interface Category
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Category\Contracts;
interface CategoryTranslation
{
}

View File

@ -126,7 +126,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)) {
$fail('The :attribute has already been taken.');
$fail(trans('admin::app.response.already-taken', ['name' => 'Category']));
}
}],
$locale . '.name' => 'required',

View File

@ -5,8 +5,9 @@ namespace Webkul\Category\Models;
use Webkul\Core\Eloquent\TranslatableModel;
use Kalnoy\Nestedset\NodeTrait;
use Illuminate\Support\Facades\Storage;
use Webkul\Category\Contracts\Category as CategoryContract;
class Category extends TranslatableModel
class Category extends TranslatableModel implements CategoryContract
{
use NodeTrait;

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Category\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CategoryProxy extends ModelProxy
{
}

View File

@ -3,10 +3,11 @@
namespace Webkul\Category\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Category\Contracts\CategoryTranslation as CategoryTranslationContract;
class CategoryTranslation extends Model
class CategoryTranslation extends Model implements CategoryTranslationContract
{
public $timestamps = false;
protected $fillable = ['name', 'description', 'slug', 'meta_title', 'meta_description', 'meta_keywords'];
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Category\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CategoryTranslationProxy extends ModelProxy
{
}

View File

@ -16,6 +16,8 @@ class CategoryServiceProvider extends ServiceProvider
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app->register(ModuleServiceProvider::class);
}
/**

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Category\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Category\Models\Category::class,
\Webkul\Category\Models\CategoryTranslation::class,
];
}

View File

@ -35,7 +35,7 @@ class CategoryRepository extends Repository
*/
public function model()
{
return 'Webkul\Category\Models\Category';
return 'Webkul\Category\Contracts\Category';
}
/**
@ -76,7 +76,7 @@ class CategoryRepository extends Repository
public function getCategoryTree($id = null)
{
return $id
? Category::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
? Category::orderBy('position', 'ASC')->descendantsOf($id)->toTree()
: Category::orderBy('position', 'ASC')->get()->toTree();
}
@ -100,7 +100,7 @@ class CategoryRepository extends Repository
public function getVisibleCategoryTree($id = null)
{
return $id
? Category::orderBy('position', 'ASC')->where('id', '!=', $id)->where('status', 1)->get()->toTree()
? Category::orderBy('position', 'ASC')->where('status', 1)->descendantsOf($id)->toTree()
: Category::orderBy('position', 'ASC')->where('status', 1)->get()->toTree();
}

View File

@ -11,6 +11,7 @@ use Webkul\Product\Repositories\ProductRepository;
use Webkul\Tax\Repositories\TaxCategoryRepository;
use Webkul\Checkout\Models\CartPayment;
use Webkul\Customer\Repositories\WishlistRepository;
use Webkul\Customer\Repositories\CustomerAddressRepository;
/**
* Facades handler for all the methods to be implemented in Cart.
@ -70,6 +71,13 @@ class Cart {
*/
protected $wishlist;
/**
* CustomerAddressRepository model
*
* @var mixed
*/
protected $customerAddress;
/**
* Suppress the session flash messages
*/
@ -78,12 +86,13 @@ class Cart {
/**
* Create a new controller instance.
*
* @param Webkul\Checkout\Repositories\CartRepository $cart
* @param Webkul\Checkout\Repositories\CartItemRepository $cartItem
* @param Webkul\Checkout\Repositories\CartAddressRepository $cartAddress
* @param Webkul\Customer\Repositories\CustomerRepository $customer
* @param Webkul\Product\Repositories\ProductRepository $product
* @param Webkul\Product\Repositories\TaxCategoryRepository $taxCategory
* @param Webkul\Checkout\Repositories\CartRepository $cart
* @param Webkul\Checkout\Repositories\CartItemRepository $cartItem
* @param Webkul\Checkout\Repositories\CartAddressRepository $cartAddress
* @param Webkul\Customer\Repositories\CustomerRepository $customer
* @param Webkul\Product\Repositories\ProductRepository $product
* @param Webkul\Product\Repositories\TaxCategoryRepository $taxCategory
* @param Webkul\Product\Repositories\CustomerAddressRepository $customerAddress
* @return void
*/
public function __construct(
@ -93,7 +102,8 @@ class Cart {
CustomerRepository $customer,
ProductRepository $product,
TaxCategoryRepository $taxCategory,
WishlistRepository $wishlist
WishlistRepository $wishlist,
CustomerAddressRepository $customerAddress
)
{
$this->customer = $customer;
@ -110,6 +120,8 @@ class Cart {
$this->wishlist = $wishlist;
$this->customerAddress = $customerAddress;
$this->suppressFlash = false;
}
@ -229,7 +241,7 @@ class Cart {
$product = $this->product->findOneByField('id', $id);
if ($product->type == 'configurable') {
if (! isset($data['selected_configurable_option'])) {
if (! isset($data['selected_configurable_option']) || ! $data['selected_configurable_option']) {
return false;
}
@ -617,6 +629,44 @@ class Cart {
$shippingAddress = $data['shipping'];
$billingAddress['cart_id'] = $shippingAddress['cart_id'] = $cart->id;
if (isset($data['billing']['address_id']) && $data['billing']['address_id']) {
$address = $this->customerAddress->findOneWhere(['id'=> $data['billing']['address_id']])->toArray();
$billingAddress['first_name'] = auth()->guard('customer')->user()->first_name;
$billingAddress['last_name'] = auth()->guard('customer')->user()->last_name;
$billingAddress['email'] = auth()->guard('customer')->user()->email;
$billingAddress['address1'] = $address['address1'];
$billingAddress['address2'] = $address['address2'];
$billingAddress['country'] = $address['country'];
$billingAddress['state'] = $address['state'];
$billingAddress['city'] = $address['city'];
$billingAddress['postcode'] = $address['postcode'];
$billingAddress['phone'] = $address['phone'];
}
if (isset($data['shipping']['address_id']) && $data['shipping']['address_id']) {
$address = $this->customerAddress->findOneWhere(['id'=> $data['shipping']['address_id']])->toArray();
$shippingAddress['first_name'] = auth()->guard('customer')->user()->first_name;
$shippingAddress['last_name'] = auth()->guard('customer')->user()->last_name;
$shippingAddress['email'] = auth()->guard('customer')->user()->email;
$shippingAddress['address1'] = $address['address1'];
$shippingAddress['address2'] = $address['address2'];
$shippingAddress['country'] = $address['country'];
$shippingAddress['state'] = $address['state'];
$shippingAddress['city'] = $address['city'];
$shippingAddress['postcode'] = $address['postcode'];
$shippingAddress['phone'] = $address['phone'];
}
if (isset($data['billing']['save_as_address']) && $data['billing']['save_as_address']) {
$billingAddress['customer_id'] = auth()->guard('customer')->user()->id;
$this->customerAddress->create($billingAddress);
}
if (isset($data['shipping']['save_as_address']) && $data['shipping']['save_as_address']) {
$shippingAddress['customer_id'] = auth()->guard('customer')->user()->id;
$this->customerAddress->create($shippingAddress);
}
if ($billingAddressModel = $cart->billing_address) {
$this->cartAddress->update($billingAddress, $billingAddressModel->id);
@ -672,12 +722,6 @@ class Cart {
$cart->shipping_method = $shippingMethodCode;
$cart->save();
// foreach ($cart->shipping_rates as $rate) {
// if ($rate->method != $shippingMethodCode) {
// $rate->delete();
// }
// }
return true;
}
@ -814,7 +858,7 @@ class Cart {
}
}
}
return true;
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Checkout\Contracts;
interface Cart
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Checkout\Contracts;
interface CartAddress
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Checkout\Contracts;
interface CartItem
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Checkout\Contracts;
interface CartPayment
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Checkout\Contracts;
interface CartShippingRate
{
}

View File

@ -26,30 +26,42 @@ class CustomerAddressForm extends FormRequest
*/
public function rules()
{
$this->rules = [
'billing.first_name' => ['required'],
'billing.last_name' => ['required'],
'billing.email' => ['required'],
'billing.address1' => ['required'],
'billing.city' => ['required'],
'billing.state' => ['required'],
'billing.postcode' => ['required'],
'billing.phone' => ['required'],
'billing.country' => ['required']
];
if (isset($this->get('billing')['address_id'])) {
$this->rules = [
'billing.address_id' => ['required'],
];
} else {
$this->rules = [
'billing.first_name' => ['required'],
'billing.last_name' => ['required'],
'billing.email' => ['required'],
'billing.address1' => ['required'],
'billing.city' => ['required'],
'billing.state' => ['required'],
'billing.postcode' => ['required'],
'billing.phone' => ['required'],
'billing.country' => ['required']
];
}
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'],
'shipping.email' => ['required'],
'shipping.address1' => ['required'],
'shipping.city' => ['required'],
'shipping.state' => ['required'],
'shipping.postcode' => ['required'],
'shipping.phone' => ['required'],
'shipping.country' => ['required']
]);
if (isset($this->get('shipping')['address_id'])) {
$this->rules = array_merge($this->rules, [
'shipping.address_id' => ['required'],
]);
} else {
$this->rules = array_merge($this->rules, [
'shipping.first_name' => ['required'],
'shipping.last_name' => ['required'],
'shipping.email' => ['required'],
'shipping.address1' => ['required'],
'shipping.city' => ['required'],
'shipping.state' => ['required'],
'shipping.postcode' => ['required'],
'shipping.phone' => ['required'],
'shipping.country' => ['required']
]);
}
}
return $this->rules;

View File

@ -3,13 +3,10 @@
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Product\Models\Product;
use Webkul\Checkout\Models\CartItem;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Models\CartPayment;
use Webkul\Checkout\Models\CartShippingRate;
use Webkul\Product\Models\ProductProxy;
use Webkul\Checkout\Contracts\Cart as CartContract;
class Cart extends Model
class Cart extends Model implements CartContract
{
protected $table = 'cart';
@ -23,14 +20,14 @@ class Cart extends Model
* To get relevant associated items with the cart instance
*/
public function items() {
return $this->hasMany(CartItem::class)->whereNull('parent_id');
return $this->hasMany(CartItemProxy::modelClass())->whereNull('parent_id');
}
/**
* To get all the associated items with the cart instance even the parent and child items of configurable products
*/
public function all_items() {
return $this->hasMany(CartItem::class);
return $this->hasMany(CartItemProxy::modelClass());
}
/**
@ -38,7 +35,7 @@ class Cart extends Model
*/
public function addresses()
{
return $this->hasMany(CartAddress::class);
return $this->hasMany(CartAddressProxy::modelClass());
}
/**
@ -78,7 +75,7 @@ class Cart extends Model
*/
public function shipping_rates()
{
return $this->hasManyThrough(CartShippingRate::class, CartAddress::class, 'cart_id', 'cart_address_id');
return $this->hasManyThrough(CartShippingRateProxy::modelClass(), CartAddressProxy::modelClass(), 'cart_id', 'cart_address_id');
}
/**
@ -102,6 +99,6 @@ class Cart extends Model
*/
public function payment()
{
return $this->hasOne(CartPayment::class);
return $this->hasOne(CartPaymentProxy::modelClass());
}
}

View File

@ -3,9 +3,9 @@
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Checkout\Models\CartShippingRate;
use Webkul\Checkout\Contracts\CartAddress as CartAddressContract;
class CartAddress extends Model
class CartAddress extends Model implements CartAddressContract
{
protected $table = 'cart_address';
@ -16,7 +16,7 @@ class CartAddress extends Model
*/
public function shipping_rates()
{
return $this->hasMany(CartShippingRate::class);
return $this->hasMany(CartShippingRateProxy::modelClass());
}
/**

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Checkout\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CartAddressProxy extends ModelProxy
{
}

View File

@ -3,10 +3,11 @@
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductProxy;
use Webkul\Checkout\Contracts\CartItem as CartItemContract;
class CartItem extends Model
class CartItem extends Model implements CartItemContract
{
protected $table = 'cart_items';
@ -18,12 +19,12 @@ class CartItem extends Model
public function product()
{
return $this->hasOne(Product::class, 'id', 'product_id');
return $this->hasOne(ProductProxy::modelClass(), 'id', 'product_id');
}
public function cart()
{
return $this->hasOne(Cart::class, 'id', 'cart_id');
return $this->hasOne(CartProxy::modelClass(), 'id', 'cart_id');
}
/**

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Checkout\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CartItemProxy extends ModelProxy
{
}

View File

@ -3,8 +3,9 @@
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Checkout\Contracts\CartPayment as CartPaymentContract;
class CartPayment extends Model
class CartPayment extends Model implements CartPaymentContract
{
protected $table = 'cart_payment';
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Checkout\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CartPaymentProxy extends ModelProxy
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Checkout\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CartProxy extends ModelProxy
{
}

View File

@ -3,15 +3,15 @@
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Contracts\CartShippingRate as CartShippingRateContract;
class CartShippingRate extends Model
class CartShippingRate extends Model implements CartShippingRateContract
{
/**
* Get the post that owns the comment.
*/
public function shipping_address()
{
return $this->belongsTo(CartAddress::class);
return $this->belongsTo(CartAddressProxy::modelClass());
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Checkout\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CartShippingRateProxy extends ModelProxy
{
}

View File

@ -18,6 +18,8 @@ class CheckoutServiceProvider extends ServiceProvider
include __DIR__ . '/../Http/helpers.php';
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app->register(ModuleServiceProvider::class);
}
/**

View File

@ -0,0 +1,16 @@
<?php
namespace Webkul\Checkout\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Checkout\Models\Cart::class,
\Webkul\Checkout\Models\CartAddress::class,
\Webkul\Checkout\Models\CartItem::class,
\Webkul\Checkout\Models\CartPayment::class,
\Webkul\Checkout\Models\CartShippingRate::class,
];
}

View File

@ -20,6 +20,6 @@ class CartAddressRepository extends Repository
*/
function model()
{
return 'Webkul\Checkout\Models\CartAddress';
return 'Webkul\Checkout\Contracts\CartAddress';
}
}

View File

@ -21,7 +21,7 @@ class CartItemRepository extends Repository
function model()
{
return 'Webkul\Checkout\Models\CartItem';
return 'Webkul\Checkout\Contracts\CartItem';
}
/**

View File

@ -21,7 +21,7 @@ class CartRepository extends Repository
function model()
{
return 'Webkul\Checkout\Models\Cart';
return 'Webkul\Checkout\Contracts\Cart';
}
/**

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Core\Contracts;
interface Channel
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Core\Contracts;
interface CoreConfig
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Core\Contracts;
interface Country
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Core\Contracts;
interface CountryState
{
}

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