Merge branch 'master' into new-label-on-product

This commit is contained in:
Akhtar Khan 2020-08-03 11:39:52 +05:30 committed by GitHub
commit 342b8e5ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
138 changed files with 1134 additions and 712 deletions

View File

@ -4,6 +4,7 @@ APP_VERSION=1.1.2
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_ADMIN_URL=admin
APP_TIMEZONE=Asia/Kolkata
APP_LOCALE=en
LOG_CHANNEL=stack

View File

@ -4,6 +4,7 @@ APP_VERSION=1.1.2
APP_KEY=base64:G4KY3tUsTaY9ONo1n/QyJvVLQZdJDgbIkSJswFK01HE=
APP_DEBUG=true
APP_URL=http://localhost
APP_ADMIN_URL=admin
LOG_CHANNEL=stack

View File

@ -54,6 +54,18 @@ return [
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Admin URL
|--------------------------------------------------------------------------
|
| This URL suffix is used to define the admin url for example
| admin/ or backend/
|
*/
'admin_url' => env('APP_ADMIN_URL', 'admin'),
/*
|--------------------------------------------------------------------------
| Application Timezone

View File

@ -16,7 +16,7 @@
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.4",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"resolve-url-loader": "^3.1.0",
"sass": "^1.24.5",

View File

@ -15,6 +15,12 @@ class CartRuleDataGrid extends DataGrid
protected $channel = 'all';
/** @var string[] contains the keys for which extra filters to show */
protected $extraFilters = [
'channels',
'customer_groups',
];
public function __construct()
{
parent::__construct();

View File

@ -17,6 +17,12 @@ class ProductDataGrid extends DataGrid
protected $channel = 'all';
/** @var string[] contains the keys for which extra filters to render */
protected $extraFilters = [
'channels',
'locales',
];
public function __construct()
{
parent::__construct();
@ -44,15 +50,11 @@ class ProductDataGrid extends DataGrid
);
if ($this->locale !== 'all') {
$queryBuilder->where('locale', $this->locale);
$queryBuilder->where('product_flat.locale', $this->locale);
}
if ($this->channel !== 'all') {
$queryBuilder->where('channel', $this->channel);
}
if ($currentLocale = app()->getLocale()) {
$queryBuilder->where('product_flat.locale', $currentLocale);
$queryBuilder->where('product_flat.channel', $this->channel);
}
$queryBuilder->groupBy('product_flat.product_id');

View File

@ -15,6 +15,12 @@ class SliderDataGrid extends DataGrid
protected $channel = 'all';
/** @var string[] contains the keys for which extra filters to render */
protected $extraFilters = [
'channels',
'locales',
];
public function __construct()
{
parent::__construct();

View File

@ -241,6 +241,8 @@ class DashboardController extends Controller
->addSelect('id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name')
->where('orders.created_at', '>=', $this->startDate)
->where('orders.created_at', '<=', $this->endDate)
->where('orders.status', '<>', 'closed')
->where('orders.status', '<>', 'canceled')
->groupBy('customer_email')
->orderBy('total_base_grand_total', 'DESC')
->limit(5)

View File

@ -108,8 +108,6 @@ class ShipmentController extends Controller
}
$this->validate(request(), [
'shipment.carrier_title' => 'required',
'shipment.track_number' => 'required',
'shipment.source' => 'required',
'shipment.items.*.*' => 'required|numeric|min:0',
]);

View File

@ -1,7 +1,7 @@
<?php
Route::group(['middleware' => ['web']], function () {
Route::prefix('admin')->group(function () {
Route::prefix(config('app.admin_url'))->group(function () {
Route::get('/', 'Webkul\Admin\Http\Controllers\Controller@redirectToLogin');
@ -673,7 +673,7 @@ Route::group(['middleware' => ['web']], function () {
//tax rate ends
//DataGrid Export
Route::post('admin/export', 'Webkul\Admin\Http\Controllers\ExportController@export')->name('admin.datagrid.export');
Route::post(config('app.admin_url') . '/export', 'Webkul\Admin\Http\Controllers\ExportController@export')->name('admin.datagrid.export');
Route::prefix('promotions')->group(function () {
Route::get('cart-rules', 'Webkul\CartRule\Http\Controllers\CartRuleController@index')->defaults('_config', [

View File

@ -16,22 +16,22 @@ class Order
{
/**
* Send new order Mail to the customer and admin
*
*
* @param \Webkul\Sales\Contracts\Order $order
* @return void
*/
public function sendNewOrderMail($order)
{
try {
/* email to customer */
$configKey = 'emails.general.notifications.emails.general.notifications.new-order';
if (core()->getConfigData($configKey)) {
if (core()->getConfigData($configKey))
Mail::queue(new NewOrderNotification($order));
}
/* email to admin */
$configKey = 'emails.general.notifications.emails.general.notifications.new-admin';
if (core()->getConfigData($configKey)) {
app()->setLocale(env('APP_LOCALE'));
Mail::queue(new NewAdminNotification($order));
}
} catch (\Exception $e) {
@ -41,7 +41,7 @@ class Order
/**
* Send new invoice mail to the customer
*
*
* @param \Webkul\Sales\Contracts\Invoice $invoice
* @return void
*/
@ -64,7 +64,7 @@ class Order
/**
* Send new refund mail to the customer
*
*
* @param \Webkul\Sales\Contracts\Refund $refund
* @return void
*/
@ -83,7 +83,7 @@ class Order
/**
* Send new shipment mail to the customer
*
*
* @param \Webkul\Sales\Contracts\Shipment $shipment
* @return void
*/

View File

@ -38,7 +38,7 @@ class OrderCommentNotification extends Mailable
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to($this->comment->order->customer_email, $this->comment->order->customer_full_name)
->subject(trans('shop::app.mail.order.comment.subject'))
->subject(trans('shop::app.mail.order.comment.subject', ['order_id' => $this->comment->order->increment_id]))
->view('shop::emails.sales.new-order-comment');
}
}

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.attributes.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.attributes.edit-title') }}
</h1>
@ -418,7 +418,7 @@
optionRowCount: 0,
optionRows: [],
show_swatch: "{{ $attribute->type == 'select' ? true : false }}",
swatch_type: "{{ $attribute->swatch_type }}",
swatch_type: "{{ $attribute->swatch_type == '' ? 'dropdown' : $attribute->swatch_type }}",
isNullOptionChecked: false,
idNullOption: null
}

View File

@ -12,7 +12,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.categories.add-title') }}
</h1>

View File

@ -13,7 +13,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.categories.edit-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.families.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.families.edit-title') }}
</h1>

View File

@ -26,7 +26,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.products.add-title') }}
</h1>

View File

@ -18,7 +18,7 @@
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link"
onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.catalog.products.edit-title') }}
</h1>

View File

@ -11,39 +11,6 @@
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.catalog.products.title') }}</h1>
<div class="control-group">
<select class="control" id="channel-switcher" name="channel" onchange="reloadPage('channel', this.value)" >
<option value="all" {{ ! isset($channel) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-channels') }}
</option>
@foreach (core()->getAllChannels() as $channelModel)
<option
value="{{ $channelModel->code }}" {{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
{{ $channelModel->name }}
</option>
@endforeach
</select>
</div>
<div class="control-group">
<select class="control" id="locale-switcher" name="locale" onchange="reloadPage('locale', this.value)" >
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-locales') }}
</option>
@foreach (core()->getAllLocales() as $localeModel)
<option
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}>
{{ $localeModel->name }}
</option>
@endforeach
</select>
</div>
</div>
<div class="page-action">

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.cms.pages.add-title') }}
</h1>

View File

@ -13,7 +13,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.cms.pages.edit-title') }}
</h1>

View File

@ -5,16 +5,16 @@
@stop
@section('content-wrapper')
@section('content')
<div class="content full-page">
<div class="content">
{!! view_render_event('admin.customer.addresses.create.before') !!}
<form method="POST" action="{{ route('admin.customer.addresses.store', ['id' => $customer->id]) }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.addresses.create-title') }}
</h1>

View File

@ -5,9 +5,9 @@
@stop
@section('content-wrapper')
@section('content')
<div class="content full-page">
<div class="content">
{!! view_render_event('admin.customer.addresses.edit.before', ['address' => $address]) !!}
<form method="post" action="{{ route('admin.customer.addresses.update', $address->id) }}" @submit.prevent="onSubmit">

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('address::app.admin.addresses.title-orders', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
</h1>

View File

@ -9,7 +9,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.users.users.confirm-delete-title') }}
</h1>
</div>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.customers.title') }}

View File

@ -9,7 +9,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ $customer->first_name . " " . $customer->last_name }}
</h1>
</div>
@ -25,11 +25,11 @@
<tab name="{{ __('admin::app.customers.customers.addresses') }}" :selected="false">
<div class="style:overflow: auto;">&nbsp;</div>
{!! view_render_event('bagisto.admin.customer.addresses.list.before') !!}
{!! view_render_event('bagisto.admin.customer.addresses.list.before') !!}
{!! app('Webkul\Admin\DataGrids\AddressDataGrid')->render() !!}
{!! view_render_event('bagisto.admin.customer.addresses.list.after') !!}
</div>
</tab>
</tab>
{!! view_render_event('bagisto.admin.customer.edit.after', ['customer' => $customer]) !!}
</tabs>
</div>

View File

@ -11,8 +11,8 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.groups.add-title') }}
</h1>
</div>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.groups.edit-title') }}
</h1>

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.note.title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.reviews.edit-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.customers.subscribers.title-edit') }}
</h1>

View File

@ -21,7 +21,8 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" @click="redirectBack('{{ url('/admin/dashboard') }}')"></i>
<i class="icon angle-left-icon back-link"
onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.promotions.cart-rules.add-title') }}
</h1>

View File

@ -26,7 +26,8 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" @click="redirectBack('{{ url('/admin/dashboard') }}')"></i>
<i class="icon angle-left-icon back-link"
onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.promotions.cart-rules.edit-title') }}
</h1>

View File

@ -14,38 +14,6 @@
</div>
<div class="page-action">
<div class="control-group">
<select class="control" id="channel-switcher" name="channel" onchange="reloadPage('channel', this.value)" >
<option value="all" {{ ! isset($channel) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-channels') }}
</option>
@foreach (core()->getAllChannels() as $channelModel)
<option
value="{{ $channelModel->id }}" {{ (isset($channel) && ($channelModel->id) == $channel) ? 'selected' : '' }}>
{{ $channelModel->name }}
</option>
@endforeach
</select>
</div>
<div class="control-group">
<select class="control" id="customer-group-switcher" name="customer_group" onchange="reloadPage('customer_group', this.value)" >
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-customer-groups') }}
</option>
@foreach (core()->getAllCustomerGroups() as $customerGroupModel)
<option
value="{{ $customerGroupModel->id }}" {{ (isset($customerGroupModel) && ($customerGroupModel->id) == $customer_group) ? 'selected' : '' }}>
{{ $customerGroupModel->name }}
</option>
@endforeach
</select>
</div>
<a href="{{ route('admin.cart-rules.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.promotions.cart-rules.add-title') }}
</a>

View File

@ -21,7 +21,8 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" @click="redirectBack('{{ url('/admin/dashboard') }}')"></i>
<i class="icon angle-left-icon back-link"
onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.promotions.catalog-rules.add-title') }}
</h1>
@ -56,7 +57,7 @@
<div class="control-group">
<label for="status">{{ __('admin::app.promotions.catalog-rules.status') }}</label>
<label class="switch">
<input type="checkbox" id="status" name="status" value="1" {{ old('status') ? 'checked' : '' }}>
<span class="slider round"></span>
@ -345,7 +346,7 @@
attribute_type_indexes: {
'product': 0
},
},
condition_operators: {
'price': [{

View File

@ -21,7 +21,8 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" @click="redirectBack('{{ url('/admin/dashboard') }}')"></i>
<i class="icon angle-left-icon back-link"
onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.promotions.catalog-rules.edit-title') }}
</h1>
@ -56,7 +57,7 @@
<div class="control-group">
<label for="status">{{ __('admin::app.promotions.catalog-rules.status') }}</label>
<label class="switch">
<input type="checkbox" id="status" name="status" value="{{ $catalogRule->status }}" {{ $catalogRule->status ? 'checked' : '' }}>
<span class="slider round"></span>

View File

@ -12,7 +12,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.invoices.add-title') }}
</h1>
@ -181,21 +181,21 @@
<div class="section-content">
<div class="row">
<span class="title">
<span class="title">
{{ __('admin::app.sales.orders.shipping-method') }}
</span>
<span class="value">
<span class="value">
{{ $order->shipping_title }}
</span>
</div>
<div class="row">
<span class="title">
<span class="title">
{{ __('admin::app.sales.orders.shipping-price') }}
</span>
<span class="value">
<span class="value">
{{ core()->formatBasePrice($order->base_shipping_amount) }}
</span>
</div>
@ -230,7 +230,7 @@
@if (isset($item->additional['attributes']))
<div class="item-options">
@foreach ($item->additional['attributes'] as $attribute)
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
@endforeach

View File

@ -14,7 +14,7 @@
<h1>
{!! view_render_event('sales.invoice.title.before', ['order' => $order]) !!}
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.invoices.view-title', ['invoice_id' => $invoice->id]) }}

View File

@ -14,7 +14,7 @@
<h1>
{!! view_render_event('sales.order.title.before', ['order' => $order]) !!}
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.orders.view-title', ['order_id' => $order->increment_id]) }}

View File

@ -12,7 +12,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.refunds.add-title') }}
</h1>

View File

@ -12,7 +12,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.refunds.view-title', ['refund_id' => $refund->id]) }}
</h1>
@ -229,7 +229,7 @@
@if (isset($item->additional['attributes']))
<div class="item-options">
@foreach ($item->additional['attributes'] as $attribute)
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
@endforeach

View File

@ -12,7 +12,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.shipments.add-title') }}
</h1>
@ -199,20 +199,14 @@
</span>
</div>
<div class="control-group" :class="[errors.has('shipment[carrier_title]') ? 'has-error' : '']" style="margin-top: 40px">
<label for="shipment[carrier_title]" class="required">{{ __('admin::app.sales.shipments.carrier-title') }}</label>
<input type="text" v-validate="'required'" class="control" id="shipment[carrier_title]" name="shipment[carrier_title]" data-vv-as="&quot;{{ __('admin::app.sales.shipments.carrier-title') }}&quot;"/>
<span class="control-error" v-if="errors.has('shipment[carrier_title]')">
@{{ errors.first('shipment[carrier_title]') }}
</span>
<div class="control-group" style="margin-top: 40px">
<label for="shipment[carrier_title]">{{ __('admin::app.sales.shipments.carrier-title') }}</label>
<input type="text" class="control" id="shipment[carrier_title]" name="shipment[carrier_title]"/>
</div>
<div class="control-group" :class="[errors.has('shipment[track_number]') ? 'has-error' : '']">
<label for="shipment[track_number]" class="required">{{ __('admin::app.sales.shipments.tracking-number') }}</label>
<input type="text" v-validate="'required'" class="control" id="shipment[track_number]" name="shipment[track_number]" data-vv-as="&quot;{{ __('admin::app.sales.shipments.tracking-number') }}&quot;"/>
<span class="control-error" v-if="errors.has('shipment[track_number]')">
@{{ errors.first('shipment[track_number]') }}
</span>
<div class="control-group">
<label for="shipment[track_number]">{{ __('admin::app.sales.shipments.tracking-number') }}</label>
<input type="text" class="control" id="shipment[track_number]" name="shipment[track_number]"/>
</div>
</div>
</div>
@ -280,7 +274,7 @@
@if (isset($item->additional['attributes']))
<div class="item-options">
@foreach ($item->additional['attributes'] as $attribute)
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
@endforeach
@ -327,7 +321,7 @@
<div class="control-group" :class="[errors.has('{{ $inputName }}') ? 'has-error' : '']">
<input type="text" v-validate="'required|numeric|min_value:0|max_value:{{$sourceQty}}'" class="control" id="{{ $inputName }}" name="{{ $inputName }}" value="{{ $item->qty_invoiced }}" data-vv-as="&quot;{{ __('admin::app.sales.shipments.qty-to-ship') }}&quot;" :disabled="source != '{{ $inventorySource->id }}'"/>
<span class="control-error" v-if="errors.has('{{ $inputName }}')">
@verbatim
{{ errors.first('<?php echo $inputName; ?>') }}

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.sales.shipments.view-title', ['shipment_id' => $shipment->id]) }}
</h1>
@ -254,7 +254,7 @@
@if (isset($item->additional['attributes']))
<div class="item-options">
@foreach ($item->additional['attributes'] as $attribute)
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
@endforeach

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.channels.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.channels.edit-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.currencies.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.currencies.edit-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.exchange_rates.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.exchange_rates.edit-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.inventory_sources.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.inventory_sources.edit-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.locales.add-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.locales.edit-title') }}
</h1>

View File

@ -15,7 +15,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.sliders.add-title') }}
</h1>

View File

@ -12,7 +12,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.sliders.edit-title') }}

View File

@ -14,41 +14,6 @@
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.settings.sliders.title') }}</h1>
<div class="control-group">
<select class="control" id="channel-switcher" name="channel" onchange="reloadPage('channel', this.value)" >
<option value="all" {{ ! isset($channel) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-channels') }}
</option>
@foreach (core()->getAllChannels() as $channelModel)
<option
value="{{ $channelModel->code }}" {{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
{{ $channelModel->name }}
</option>
@endforeach
</select>
</div>
<div class="control-group">
<select class="control" id="locale-switcher" name="locale" onchange="reloadPage('locale', this.value)" >
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-locales') }}
</option>
@foreach (core()->getAllLocales() as $localeModel)
<option
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}>
{{ $localeModel->name }}
</option>
@endforeach
</select>
</div>
</div>
<div class="page-action">

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.tax-categories.add-title') }}
</h1>

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.tax-categories.edit.title') }}
</h1>

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.tax-rates.add-title') }}
</h1>

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.settings.tax-rates.edit.title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.users.roles.add-role-title') }}
</h1>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.users.roles.edit-role-title') }}
</h1>

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.users.users.add-user-title') }}
</h1>
@ -73,7 +73,7 @@
<div class="control-group">
<label for="status">{{ __('admin::app.users.users.status') }}</label>
<label class="switch">
<input type="checkbox" id="status" name="status" value="1" {{ old('status') ? 'checked' : '' }}>
<span class="slider round"></span>

View File

@ -10,7 +10,7 @@
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ route('admin.dashboard.index') }}';"></i>
{{ __('admin::app.users.users.edit-user-title') }}
</h1>
@ -74,7 +74,7 @@
<div class="control-group">
<label for="status">{{ __('admin::app.users.users.status') }}</label>
<label class="switch">
<input type="checkbox" id="status" name="status" value="{{ $user->status }}" {{ $user->status ? 'checked' : '' }}>
<span class="slider round"></span>

View File

@ -33,7 +33,7 @@ class AttributeOption extends TranslatableModel implements AttributeOptionContra
public function swatch_value_url()
{
if ($this->swatch_value && $this->attribute->swatch_type == 'image') {
return Storage::url($this->swatch_value);
return url('cache/small/'.$this->swatch_value);
}
return;

View File

@ -2,16 +2,14 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Carbon\Carbon;
use Faker\Generator as Faker;
use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Product\Models\Product;
$factory->define(BookingProductEventTicket::class, function (Faker $faker, array $attributes) {
$factory->define(BookingProductEventTicket::class, static function (Faker $faker, array $attributes) {
return [
'price' => $faker->randomFloat(4, 3, 900),
'qty' => $faker->numberBetween(1, 99),
'qty' => $faker->numberBetween(100, 1000),
'booking_product_id' => static function () {
return factory(BookingProduct::class)->create(['type' => 'event'])->id;
}

View File

@ -177,10 +177,9 @@ class CartRule
if ($rule->coupon_type) {
if (strlen($cart->coupon_code)) {
/** @var \Webkul\CartRule\Models\CartRule $rule */
// Laravel relation is used instead of repository for performance
// reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery())
$coupon = $rule->cart_rule_coupon;
$coupon = $rule->cart_rule_coupon->where('code', $cart->coupon_code)->first();
if ($coupon && $coupon->code === $cart->coupon_code) {
if ($coupon->usage_limit && $coupon->times_used >= $coupon->usage_limit) {
@ -444,29 +443,34 @@ class CartRule
$cart = Cart::getCart();
foreach ($this->getCartRules() as $rule) {
if (! $this->canProcessRule($cart, $rule)) {
continue;
}
foreach ($cart->items->all() as $item) {
if (! $this->validator->validate($rule, $cart)) {
continue;
}
foreach ($this->getCartRules() as $rule) {
if (! $rule || ! $rule->free_shipping) {
continue;
}
if (! $this->canProcessRule($cart, $rule)) {
continue;
}
$selectedShipping->price = 0;
/* given CartItem instance to the validator */
if (! $this->validator->validate($rule, $item)) {
continue;
}
$selectedShipping->base_price = 0;
if (! $rule || ! $rule->free_shipping) {
continue;
}
$selectedShipping->save();
$selectedShipping->price = 0;
$appliedRuleIds[$rule->id] = $rule->id;
$selectedShipping->base_price = 0;
if ($rule->end_other_rules) {
break;
$selectedShipping->save();
$appliedRuleIds[$rule->id] = $rule->id;
if ($rule->end_other_rules) {
break;
}
}
}

View File

@ -3,22 +3,20 @@
namespace Webkul\Checkout;
use Exception;
use Illuminate\Support\Facades\Log;
use Webkul\Checkout\Models\Cart as CartModel;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Repositories\CartRepository;
use Webkul\Checkout\Repositories\CartItemRepository;
use Webkul\Checkout\Repositories\CartAddressRepository;
use Webkul\Customer\Models\CustomerAddress;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\Tax\Helpers\Tax;
use Webkul\Tax\Repositories\TaxCategoryRepository;
use Webkul\Checkout\Models\CartItem;
use Webkul\Checkout\Models\CartPayment;
use Webkul\Customer\Repositories\WishlistRepository;
use Webkul\Customer\Repositories\CustomerAddressRepository;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Arr;
use Webkul\Tax\Helpers\Tax;
use Illuminate\Support\Facades\Event;
use Webkul\Shipping\Facades\Shipping;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Models\CartPayment;
use Webkul\Checkout\Models\Cart as CartModel;
use Webkul\Checkout\Repositories\CartRepository;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\Tax\Repositories\TaxCategoryRepository;
use Webkul\Checkout\Repositories\CartItemRepository;
use Webkul\Customer\Repositories\WishlistRepository;
use Webkul\Checkout\Repositories\CartAddressRepository;
use Webkul\Customer\Repositories\CustomerAddressRepository;
class Cart
{
@ -325,6 +323,8 @@ class Cart
}
}
Shipping::collectRates();
Event::dispatch('checkout.cart.delete.after', $itemId);
$this->collectTotals();

View File

@ -58,7 +58,7 @@ class CoreServiceProvider extends ServiceProvider
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'core');
Event::listen('bagisto.shop.layout.head', static function(ViewRenderEventManager $viewRenderEventManager) {
Event::listen('bagisto.shop.layout.body.after', static function(ViewRenderEventManager $viewRenderEventManager) {
$viewRenderEventManager->addTemplate('core::blade.tracer.style');
});

View File

@ -54,7 +54,7 @@
}
$(this).remove();
})
});
$('.path-hint').on('mouseover', function(e) {
e.stopPropagation();

View File

@ -95,7 +95,7 @@ class Toolbar extends AbstractProduct
$sortBy = core()->getConfigData('catalog.products.storefront.sort_by')
? core()->getConfigData('catalog.products.storefront.sort_by')
: 'created_at-asc';
if ($key == $sortBy) {
return true;
}
@ -155,4 +155,27 @@ class Toolbar extends AbstractProduct
? core()->getConfigData('catalog.products.storefront.mode')
: 'grid';
}
/**
* Returns the view option if mode is set by param then it will overwrite default one and return new mode
*
* @return string
*/
public function getViewOption()
{
/* checking default option first */
$viewOption = core()->getConfigData('catalog.products.storefront.mode');
/* checking mode param if exist then overwrite the default option */
if ($this->isModeActive('grid')) {
$viewOption = 'grid';
}
/* checking mode param if exist then overwrite the default option */
if ($this->isModeActive('list')) {
$viewOption = 'list';
}
return $viewOption;
}
}

View File

@ -189,7 +189,33 @@ class ProductController extends Controller
*/
public function update(ProductForm $request, $id)
{
$product = $this->productRepository->update(request()->all(), $id);
$data = request()->all();
$multiselectAttributeCodes = array();
$productAttributes = $this->productRepository->findOrFail($id);
foreach ($productAttributes->attribute_family->attribute_groups as $attributeGroup) {
$customAttributes = $productAttributes->getEditableAttributes($attributeGroup);
if (count($customAttributes)) {
foreach ($customAttributes as $attribute) {
if ($attribute->type == 'multiselect') {
array_push($multiselectAttributeCodes,$attribute->code);
}
}
}
}
if (count($multiselectAttributeCodes)) {
foreach ($multiselectAttributeCodes as $multiselectAttributeCode) {
if(! isset($data[$multiselectAttributeCode])){
$data[$multiselectAttributeCode] = array();
}
}
}
$product = $this->productRepository->update($data, $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Product']));

View File

@ -136,6 +136,9 @@ class ProductFlat
$table->dropColumn($attribute->code . '_label');
}
});
$this->productFlatRepository->updateAttributeColumn( $attribute , $this );
}
}
@ -313,4 +316,4 @@ class ProductFlat
}
}
}
}
}

View File

@ -86,4 +86,22 @@ class ProductFlatRepository extends Repository
return $filterAttributes;
}
/**
* update product_flat custom column
*
* @param \Webkul\Attribute\Models\Attribute $attribute
* @param \Webkul\Product\Listeners\ProductFlat $listener
*/
public function updateAttributeColumn(
\Webkul\Attribute\Models\Attribute $attribute ,
\Webkul\Product\Listeners\ProductFlat $listener ) {
return $this->model
->leftJoin('product_attribute_values as v', function($join) use ($attribute) {
$join->on('product_flat.id', '=', 'v.product_id')
->on('v.attribute_id', '=', \DB::raw($attribute->id));
})->update(['product_flat.'.$attribute->code => \DB::raw($listener->attributeTypeFields[$attribute->type] .'_value')]);
}
}

View File

@ -111,9 +111,9 @@ class ProductRepository extends Repository
if (core()->getConfigData('catalog.products.storefront.products_per_page')) {
$pages = explode(',', core()->getConfigData('catalog.products.storefront.products_per_page'));
$perPage = isset($params['limit']) ? $params['limit'] : current($pages);
$perPage = isset($params['limit']) ? (!empty($params['limit']) ? $params['limit'] : 9) : current($pages);
} else {
$perPage = isset($params['limit']) ? $params['limit'] : 9;
$perPage = isset($params['limit']) && !empty($params['limit']) ? $params['limit'] : 9;
}
$page = Paginator::resolveCurrentPage('page');
@ -125,7 +125,7 @@ class ProductRepository extends Repository
$qb = $query->distinct()
->select('product_flat.*')
->join('product_flat as variants', 'product_flat.id', '=', DB::raw('COALESCE(variants.parent_id, variants.id)'))
->join('product_flat as variants', 'product_flat.id', '=', DB::raw('COALESCE('.DB::getTablePrefix().'variants.parent_id, '.DB::getTablePrefix().'variants.id)'))
->leftJoin('product_categories', 'product_categories.product_id', '=', 'product_flat.product_id')
->leftJoin('product_attribute_values', 'product_attribute_values.product_id', '=', 'variants.product_id')
->where('product_flat.channel', $channel)
@ -151,17 +151,17 @@ class ProductRepository extends Repository
$orderDirection = 'asc';
if( isset($params['order']) && in_array($params['order'], ['desc', 'asc']) ){
$orderDirection = $params['order'];
} else {
$sortOptions = $this->getDefaultSortByOption();
$orderDirection = !empty($sortOptions) ? $sortOptions[1] : 'asc';
}
if (isset($params['sort'])) {
$attribute = $this->attributeRepository->findOneByField('code', $params['sort']);
if ($attribute) {
if ($attribute->code == 'price') {
$qb->orderBy('min_price', $orderDirection);
} else {
$qb->orderBy($params['sort'] == 'created_at' ? 'product_flat.created_at' : $attribute->code, $orderDirection);
}
$this->checkSortAttributeAndGenerateQuery($qb, $params['sort'], $orderDirection);
} else {
$sortOptions = $this->getDefaultSortByOption();
if (!empty($sortOptions)) {
$this->checkSortAttributeAndGenerateQuery($qb, $sortOptions[0], $orderDirection);
}
}
@ -184,7 +184,7 @@ class ProductRepository extends Repository
foreach ($attributeFilters as $attribute) {
$filterQuery->orWhere(function ($attributeQuery) use ($attribute) {
$column = 'product_attribute_values.' . ProductAttributeValueProxy::modelClass()::$attributeTypeFields[$attribute->type];
$column = DB::getTablePrefix() . 'product_attribute_values.' . ProductAttributeValueProxy::modelClass()::$attributeTypeFields[$attribute->type];
$filterInputValues = explode(',', request()->get($attribute->code));
@ -388,7 +388,7 @@ class ProductRepository extends Repository
->where('product_flat.channel', $channel)
->where('product_flat.locale', $locale)
->whereNotNull('product_flat.url_key')
->where(function($subQuery) use ($term) {
->where(function($subQuery) use ($term) {
$queries = explode('_', $term);
foreach (array_map('trim', $queries) as $value) {
@ -399,7 +399,7 @@ class ProductRepository extends Repository
->orderBy('product_id', 'desc');
})->paginate(16);
}
return $results;
}
@ -453,4 +453,41 @@ class ProductRepository extends Repository
->orderBy('product_id', 'desc');
})->get();
}
/**
* Get default sort by option
*
* @return array
*/
private function getDefaultSortByOption()
{
$value = core()->getConfigData('catalog.products.storefront.sort_by');
$config = $value ? $value : 'name-desc';
return explode('-', $config);
}
/**
* Check sort attribute and generate query
*
* @param object $query
* @param string $sort
* @param string $direction
* @return object
*/
private function checkSortAttributeAndGenerateQuery($query, $sort, $direction)
{
$attribute = $this->attributeRepository->findOneByField('code', $sort);
if ($attribute) {
if ($attribute->code == 'price') {
$query->orderBy('min_price', $direction);
} else {
$query->orderBy($sort == 'created_at' ? 'product_flat.created_at' : $attribute->code, $direction);
}
}
return $query;
}
}

View File

@ -278,7 +278,7 @@ class Bundle extends AbstractType
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
continue;
}
if (in_array($option->type, ['multiselect', 'checkbox'])) {
if (! isset($optionPrices[$option->id][0])) {
$optionPrices[$option->id][0] = 0;
@ -315,7 +315,7 @@ class Bundle extends AbstractType
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
continue;
}
if (in_array($option->type, ['multiselect', 'checkbox'])) {
if (! isset($optionPrices[$option->id][0])) {
$optionPrices[$option->id][0] = 0;
@ -381,6 +381,25 @@ class Bundle extends AbstractType
];
}
/**
* Get bundle product special price
*
* @return boolean
*/
private function checkBundleProductHaveSpecialPrice()
{
$haveSpecialPrice = false;
foreach ($this->product->bundle_options as $option) {
foreach ($option->bundle_option_products as $index => $bundleOptionProduct) {
if ($bundleOptionProduct->product->getTypeInstance()->haveSpecialPrice()) {
$haveSpecialPrice = true;
break;
}
}
}
return $haveSpecialPrice;
}
/**
* Get product minimal price
*
@ -390,7 +409,12 @@ class Bundle extends AbstractType
{
$prices = $this->getProductPrices();
$priceHtml = '<div class="price-from">';
$priceHtml = '';
if ($this->checkBundleProductHaveSpecialPrice())
$priceHtml .= '<div class="sticker sale">' . trans('shop::app.products.sale') . '</div>';
$priceHtml .= '<div class="price-from">';
if ($prices['from']['regular_price']['price'] != $prices['from']['final_price']['price']) {
$priceHtml .= '<span class="regular-price">' . $prices['from']['regular_price']['formated_price'] . '</span>'
@ -426,6 +450,8 @@ class Bundle extends AbstractType
*/
public function prepareForCart($data)
{
$bundleQuantity = $data['quantity'];
if (isset($data['bundle_options'])) {
$data['bundle_options'] = array_filter($this->validateBundleOptionForCart($data['bundle_options']));
}
@ -434,11 +460,21 @@ class Bundle extends AbstractType
return trans('shop::app.checkout.cart.integrity.missing_options');
}
if (! $this->haveSufficientQuantity($data['quantity'])) {
return trans('shop::app.checkout.cart.quantity.inventory_warning');
}
$products = parent::prepareForCart($data);
foreach ($this->getCartChildProducts($data) as $productId => $data) {
$product = $this->productRepository->find($productId);
/* need to check each individual quantity as well if don't have then show error */
if (! $product->getTypeInstance()->haveSufficientQuantity($data['quantity'] * $bundleQuantity)) {
return trans('shop::app.checkout.cart.quantity.inventory_warning');
}
if (! $product->getTypeInstance()->isSaleable()) {
continue;
}
@ -693,7 +729,7 @@ class Bundle extends AbstractType
if ($option->is_required) {
foreach ($option->bundle_option_products as $bundleOptionProduct) {
# as long as at least one product in the required group is available we can continue checking other groups
if($bundleOptionProduct->product->haveSufficientQuantity($bundleOptionProduct->qty * $qty)) {
if ($bundleOptionProduct->product->haveSufficientQuantity($bundleOptionProduct->qty * $qty)) {
continue 2;
}
}

View File

@ -139,6 +139,23 @@ class Grouped extends AbstractType
return min($minPrices);
}
/**
* Get group product special price
*
* @return boolean
*/
private function checkGroupProductHaveSpecialPrice()
{
$haveSpecialPrice = false;
foreach ($this->product->grouped_products as $groupOptionProduct) {
if ($groupOptionProduct->associated_product->getTypeInstance()->haveSpecialPrice()) {
$haveSpecialPrice = true;
break;
}
}
return $haveSpecialPrice;
}
/**
* Get product minimal price
*
@ -146,9 +163,16 @@ class Grouped extends AbstractType
*/
public function getPriceHtml()
{
return '<span class="price-label">' . trans('shop::app.products.starting-at') . '</span>'
. ' '
. '<span class="final-price">' . core()->currency($this->getMinimalPrice()) . '</span>';
$html = '';
if ($this->checkGroupProductHaveSpecialPrice())
$html .= '<div class="sticker sale">' . trans('shop::app.products.sale') . '</div>';
$html .= '<span class="price-label">' . trans('shop::app.products.starting-at') . '</span>'
. ' '
. '<span class="final-price">' . core()->currency($this->getMinimalPrice()) . '</span>';
return $html;
}
/**

View File

@ -81,10 +81,13 @@ class Shipping
$shippingAddress = $cart->shipping_address;
foreach ($this->rates as $rate) {
$rate->cart_address_id = $shippingAddress->id;
if ($shippingAddress) {
$rate->save();
foreach ($this->rates as $rate) {
$rate->cart_address_id = $shippingAddress->id;
$rate->save();
}
}
}

View File

@ -3308,6 +3308,10 @@ section.review {
margin-top: 5.5%;
margin-bottom: 5.5%;
a.btn.btn-lg.btn-primary {
float: right;
}
.sidebar {
display: flex;
flex-direction: column;
@ -3564,6 +3568,7 @@ section.review {
}
}
.account-items-list , .edit-form {
margin-top: 20px;
@ -4333,6 +4338,10 @@ section.review {
float: left;
}
a.btn.btn-lg.btn-primary {
float: left;
}
.account-item-card {
.media-info .info {
margin-right: 20px;
@ -4616,4 +4625,4 @@ td {
}
.add-to-wishlist {
margin-left: 15px;
}
}

View File

@ -579,6 +579,15 @@ return [
'final-summary' => 'شكرا لإظهارك إهتمامك بمتجرنا سنرسل لك رقم التتبع بمجرد شحنه',
'help' => ': support_email إذا كنت بحاجة إلى أي نوع من المساعدة يرجى الاتصال بنا على',
'thanks' => 'شكرا!',
'comment' => [
'subject' => '#:order_id تمت إضافة تعليق جديد إلى طلبك',
'dear' => ':customer_name العزيز',
'final-summary' => 'شكرا لإظهار اهتمامك بمتجرنا',
'help' => ':support_email إذا كنت بحاجة إلى أي نوع من المساعدة يرجى الاتصال بنا على',
'thanks' => 'شكر!',
],
'cancel' => [
'subject' => 'تأكيد إلغاء الأمر',
'heading' => 'تم الغاء الأمر او الطلب',

View File

@ -573,6 +573,15 @@ return [
'final-summary' => 'Vielen Dank für Ihr Interesse an unserem Shop. Nach dem Versand senden wir Ihnen die Sendungsverfolgungsnummer',
'help' => 'Wenn Sie Hilfe benötigen, kontaktieren Sie uns bitte unter :support_email',
'thanks' => 'Vielen Dank!',
'comment' => [
'subject' => 'Neuer Kommentar zu Ihrer Bestellung hinzugefügt #:order_id',
'dear' => 'sehr geehrter :customer_name',
'final-summary' => 'Vielen Dank für Ihr Interesse an unserem Shop',
'help' => 'Wenn Sie Hilfe benötigen, kontaktieren Sie uns bitte unter :support_email',
'thanks' => 'Vielen Dank!',
],
'cancel' => [
'subject' => 'Bestätigung der Bestellungsstornierung',
'heading' => 'Bestellung storniert',

View File

@ -579,9 +579,9 @@ return [
'final-summary' => 'Thanks for showing your interest in our store we will send you tracking number once it shipped',
'help' => 'If you need any kind of help please contact us at :support_email',
'thanks' => 'Thanks!',
'comment' => [
'subject' => 'New comment added to your order',
'subject' => 'New comment added to your order #:order_id',
'dear' => 'Dear :customer_name',
'final-summary' => 'Thanks for showing your interest in our store',
'help' => 'If you need any kind of help please contact us at :support_email',
@ -618,9 +618,9 @@ return [
'shipment' => [
'heading' => 'Shipment #:shipment_id has been generated for Order #:order_id',
'inventory-heading' => 'New shipment #:shipment_id had been generated for Order #:order_id',
'inventory-heading' => 'New shipment #:shipment_id has been generated for Order #:order_id',
'subject' => 'Shipment for your order #:order_id',
'inventory-subject' => 'New shipment had been generated for Order #:order_id',
'inventory-subject' => 'New shipment has been generated for Order #:order_id',
'summary' => 'Summary of Shipment',
'carrier' => 'Carrier',
'tracking-number' => 'Tracking Number',

View File

@ -538,6 +538,15 @@ return [
'final-summary' => 'Gracias por tu pedido, te enviaremos el número de seguimiento una vez enviado',
'help' => 'Si necesitas ayuda contacta con nosotros a través de :support_email',
'thanks' => '¡Gracias!',
'comment' => [
'subject' => 'Nuevo comentario agregado a su pedido #:order_id',
'dear' => 'Querida :customer_name',
'final-summary' => 'Gracias por mostrar su interés en nuestra tienda.',
'help' => 'Si necesita algún tipo de ayuda, contáctenos en :support_email',
'thanks' => '¡Gracias!',
],
'cancel' => [
'subject' => 'Confirmación de pedido cancelado',
'heading' => 'Pedido cancelado',

View File

@ -578,6 +578,15 @@ return [
'final-summary' => 'با تشکر از علاقه شما به فروشگاه ما ، شماره حمل و نقل را برای شما ارسال می کنیم',
'help' => 'در صورت نیاز به هر نوع کمک ، لطفا با ما تماس بگیرید :support_email',
'thanks' => 'با تشکر!',
'comment' => [
'subject' => '#:order_id نظر جدیدی به سفارش شما اضافه شد',
'dear' => ':customer_name عزیز',
'final-summary' => 'با تشکر از علاقه شما به فروشگاه ما',
'help' => ':support_email در صورت نیاز به هر نوع کمک ، لطفا با ما تماس بگیرید',
'thanks' => 'با تشکر!',
],
'cancel' => [
'subject' => 'تأیید سفارش را لغو کنید',
'heading' => 'سفارش لغو شد',

View File

@ -580,7 +580,7 @@ return [
'thanks' => 'Grazie!',
'comment' => [
'subject' => 'Nuovo commento aggiunto al tuo ordine',
'subject' => 'Nuovo commento aggiunto al tuo ordine #:order_id',
'dear' => ':customer_name',
'final-summary' => 'Grazie per aver mostrato interesse per il nostro store',
'help' => 'Se hai bisogno di aiuto contattaci all\'indirizzo :support_email',
@ -675,7 +675,7 @@ return [
'subject' => 'Email Iscrizione',
'greeting' => ' Benvenuto ' . config('app.name') . ' - Email Iscrizione',
'unsubscribe' => 'Cancellati',
'summary' => 'Grazie per avere scelto di ricevere le nostre email. È passato un po\' di tempo da quando hai letto le email di ' . config('app.name') . '. Non è un nostro desidero inondare la tua casella email con le nostre comunicazioni. Se desideri comunque
'summary' => 'Grazie per avere scelto di ricevere le nostre email. È passato un po\' di tempo da quando hai letto le email di ' . config('app.name') . '. Non è un nostro desidero inondare la tua casella email con le nostre comunicazioni. Se desideri comunque
non ricevere più le nostre news clicca il bottone qui sotto.'
]
]

View File

@ -529,7 +529,16 @@ return [
'grand-total' => '合計',
'final-summary' => '発送手続き完了後、お知らせメールを配信いたしますので、今しばらくお待ちください。',
'help' => 'お問合せなどは下記メールアドレスへご連絡ください。:support_email',
'thanks' => 'Gracias!',
'thanks' => 'ありがとう!',
'comment' => [
'subject' => '注文に新しいコメントが追加されました #:order_id',
'dear' => '親愛な :customer_name',
'final-summary' => '当店へのご関心をお寄せいただきありがとうございます',
'help' => '何か助けが必要な場合は、私たちに連絡してください :support_email',
'thanks' => 'ありがとう!',
],
'cancel' => [
'subject' => '注文がキャンセルされました',
'heading' => '注文がキャンセルされました',
@ -548,7 +557,7 @@ return [
'grand-total' => '合計',
'final-summary' => '私たちのお店にお越しいただき、ありがとうございます。',
'help' => 'お問合せなどは下記メールアドレスへご連絡ください。 :support_email',
'thanks' => 'Gracias!',
'thanks' => 'ありがとう!',
]
],
'invoice' => [

View File

@ -582,7 +582,16 @@ return [
'grand-total' => 'Eindtotaal',
'final-summary' => 'Bedankt voor het tonen van uw interesse in onze winkel.We sturen u een trackingnummer zodra het is verzonden',
'help' => 'Als u hulp nodig heeft, neem dan contact met ons op via :support_email',
'thanks' => 'Thanks!',
'thanks' => 'Bedankt!',
'comment' => [
'subject' => 'Nieuwe opmerking toegevoegd aan uw bestelling #:order_id',
'dear' => 'Lieve :customer_name',
'final-summary' => 'Bedankt voor het tonen van uw interesse in onze winkel',
'help' => 'Als u hulp nodig heeft, neem dan contact met ons op via :support_email',
'thanks' => 'Bedankt!',
],
'cancel' => [
'subject' => 'Order Annuleren Bevestiging',
'heading' => 'Bestelling geannuleerd',

View File

@ -577,6 +577,15 @@ return [
'final-summary' => 'TDziękujemy za zainteresowanie naszym sklepem, a po podsumowaniu wyślemy ci numer śledzenia',
'help' => 'Jeśli potrzebujesz jakiejkolwiek pomocy, skontaktuj się z nami pod adresem :support_email',
'thanks' => 'Dzięki!',
'comment' => [
'subject' => 'Dodano nowy komentarz do Twojego zamówienia #:order_id',
'dear' => 'Drogi :customer_name',
'final-summary' => 'Dziękujemy za zainteresowanie naszym sklepem',
'help' => 'Jeśli potrzebujesz pomocy, skontaktuj się z nami pod adresem :support_email',
'thanks' => 'Dzięki!',
],
'cancel' => [
'subject' => 'Potwierdź anulowanie zamówienia',
'heading' => 'Zamówienie anulowane',

View File

@ -554,6 +554,15 @@ return [
'final-summary' => 'Obrigado por mostrar o seu interesse em nossa loja nós lhe enviaremos o número de rastreamento assim que for despachado',
'help' => 'Se você precisar de algum tipo de ajuda, por favor entre em contato conosco :support_email',
'thanks' => 'Muito Obrigado!',
'comment' => [
'subject' => 'Novo comentário adicionado ao seu pedido #: order_id',
'dear' => 'Prezado :customer_name',
'final-summary' => 'Obrigado por mostrar seu interesse em nossa loja',
'help' => 'Se você precisar de algum tipo de ajuda, entre em contato conosco :support_email',
'thanks' => 'Obrigada!',
],
'cancel' => [
'subject' => 'Confirmação de Cancelamento de Pedido',
'heading' => 'Pedido Cancelado',

View File

@ -574,9 +574,9 @@ return [
'final-summary' => 'Bizi tercih ettiğiniz için teşekkür ederiz. Ürün kargoya teslim edildikten sonra takip numarası iletilecektir.',
'help' => 'Soru ve görüşleriniz için lütfen bizimle iletişime geçiniz: :support_email',
'thanks' => 'Teşekkürler!',
'comment' => [
'subject' => 'Siparişinize yeni yorum yapıldı.',
'subject' => 'Siparişinize #:order_id yeni yorum yapıldı.',
'dear' => 'Sayın :customer_name',
'final-summary' => 'Bizi tercih ettiğiniz için teşekkür ederiz.',
'help' => 'Soru ve görüşleriniz için lütfen bizimle iletişime geçiniz: :support_email',

View File

@ -21,7 +21,7 @@
@if ($order->canCancel())
<a href="{{ route('customer.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('shop::app.customer.account.order.view.cancel-confirm-msg') }}'" style="float: right">
<a href="{{ route('customer.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('shop::app.customer.account.order.view.cancel-confirm-msg') }}'">
{{ __('shop::app.customer.account.order.view.cancel-btn-title') }}
</a>
@endif
@ -544,4 +544,4 @@
</div>
@endsection
@endsection

View File

@ -180,6 +180,10 @@
} else {
this.$set(this, 'products', this.products.filter(product => product.id != productId));
}
window.flashMessages = [{'type': 'alert-success', 'message': response.data.message }];
this.$root.addFlashMessages();
})
.catch(error => {
console.log("{{ __('velocity::app.error.something_went_wrong') }}");
@ -196,6 +200,10 @@
}
this.setStorageValue('compared_product', updatedItems);
window.flashMessages = [{'type': 'alert-success', 'message': response.data.message }];
this.$root.addFlashMessages();
}
},

View File

@ -46,9 +46,9 @@
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
<?php $products = $productRepository->getAll($category->id); ?>
@if ($products->count())
@include ('shop::products.list.toolbar')
@include ('shop::products.list.toolbar')
@if ($products->count())
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')

File diff suppressed because one or more lines are too long

View File

@ -1,24 +0,0 @@
/**
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/
/* flatpickr v4.6.3, @license MIT */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=3ccd955983e91b6ccc96",
"/js/ui.js": "/js/ui.js?id=9f7467acd7ea119b7d87",
"/css/ui.css": "/css/ui.css?id=b5bedc0ff04a145ca18a"
}

View File

@ -8,14 +8,14 @@ abstract class DataGrid
{
/**
* set index columns, ex: id.
*
*
* @var int
*/
protected $index = null;
protected $index;
/**
* Default sort order of datagrid
*
*
* @var string
*/
protected $sortOrder = 'asc';
@ -23,21 +23,21 @@ abstract class DataGrid
/**
* Situation handling property when working with custom columns in datagrid, helps abstaining
* aliases on custom column.
*
*
* @var bool
*/
protected $enableFilterMap = false;
/**
* This is array where aliases and custom column's name are passed
*
*
* @var array
*/
protected $filterMap = [];
/**
* array to hold all the columns which will be displayed on frontend.
*
*
* @var array
*/
protected $columns = [];
@ -51,14 +51,14 @@ abstract class DataGrid
/**
* Hold query builder instance of the query prepared by executing datagrid
* class method setQueryBuilder
*
*
* @var array
*/
protected $queryBuilder = [];
/**
* Final result of the datagrid program that is collection object.
*
*
* @var array
*/
protected $collection = [];
@ -66,7 +66,7 @@ abstract class DataGrid
/**
* Set of handly click tools which you could be using for various operations.
* ex: dyanmic and static redirects, deleting, etc.
*
*
* @var array
*/
protected $actions = [];
@ -74,21 +74,21 @@ abstract class DataGrid
/**
* Works on selection of values index column as comma separated list as response
* to your endpoint set as route.
*
*
* @var array
*/
protected $massActions = [];
/**
* Parsed value of the url parameters
*
*
* @var array
*/
protected $parse;
/**
* To show mass action or not.
*
*
* @var bool
*/
protected $enableMassAction = false;
@ -100,14 +100,14 @@ abstract class DataGrid
/**
* paginate the collection or not
*
*
* @var bool
*/
protected $paginate = true;
/**
* If paginated then value of pagination.
*
*
* @var int
*/
protected $itemsPerPage = 10;
@ -164,8 +164,11 @@ abstract class DataGrid
10 => "lock",
];
/** @var string[] contains the keys for which extra filters to show */
protected $extraFilters = [];
abstract public function prepareQueryBuilder();
abstract public function addColumns();
/**
@ -178,7 +181,7 @@ abstract class DataGrid
/**
* Parse the URL and get it ready to be used.
*
*
* @return void
*/
private function parseUrl()
@ -199,6 +202,12 @@ abstract class DataGrid
unset($parsedUrl['page']);
}
if (isset($parsedUrl['grand_total'])) {
foreach ($parsedUrl['grand_total'] as $key => $value) {
$parsedUrl['grand_total'][$key] = str_replace(',', '.', $parsedUrl['grand_total'][$key]);
}
}
$this->itemsPerPage = isset($parsedUrl['perPage']) ? $parsedUrl['perPage']['eq'] : $this->itemsPerPage;
unset($parsedUrl['perPage']);
@ -209,42 +218,47 @@ abstract class DataGrid
/**
* Add the index as alias of the column and use the column to make things happen
*
* @param string $alias
* @param string $column
* @param string $alias
* @param string $column
*
* @return void
*/
public function addFilter($alias, $column) {
public function addFilter($alias, $column)
{
$this->filterMap[$alias] = $column;
$this->enableFilterMap = true;
}
/**
* @param string $column
* @param string $column
*
* @return void
*/
public function addColumn($column)
{
$this->fireEvent('add.column.before.'.$column['index']);
$this->fireEvent('add.column.before.' . $column['index']);
array_push($this->columns, $column);
$this->columns[] = $column;
$this->setCompleteColumnDetails($column);
$this->fireEvent('add.column.after.'.$column['index']);
$this->fireEvent('add.column.after.' . $column['index']);
}
/**
* @param string $column
* @param string $column
*
* @return void
*/
public function setCompleteColumnDetails($column)
{
array_push($this->completeColumnDetails, $column);
$this->completeColumnDetails[] = $column;
}
/**
* @param \Illuminate\Database\Query\Builder $queryBuilder
* @param \Illuminate\Database\Query\Builder $queryBuilder
*
* @return void
*/
public function setQueryBuilder($queryBuilder)
@ -253,7 +267,8 @@ abstract class DataGrid
}
/**
* @param array $action
* @param array $action
*
* @return void
*/
public function addAction($action)
@ -266,7 +281,7 @@ abstract class DataGrid
$eventName = null;
}
$this->fireEvent('action.before.'.$eventName);
$this->fireEvent('action.before.' . $eventName);
array_push($this->actions, $action);
@ -276,7 +291,8 @@ abstract class DataGrid
}
/**
* @param array $massAction
* @param array $massAction
*
* @return void
*/
public function addMassAction($massAction)
@ -291,7 +307,7 @@ abstract class DataGrid
$this->fireEvent('mass.action.before.' . $eventName);
array_push($this->massActions, $massAction);
$this->massActions[] = $massAction;
$this->enableMassAction = true;
@ -306,21 +322,24 @@ abstract class DataGrid
$parsedUrl = $this->parseUrl();
foreach ($parsedUrl as $key => $value) {
if ( $key == 'locale') {
if ( ! is_array($value)) {
if ($key === 'locale') {
if (! is_array($value)) {
unset($parsedUrl[$key]);
}
} elseif ( ! is_array($value)) {
} elseif (! is_array($value)) {
unset($parsedUrl[$key]);
}
}
if (count($parsedUrl)) {
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $parsedUrl);
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder,
$parsedUrl);
if ($this->paginate) {
if ($this->itemsPerPage > 0)
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
if ($this->itemsPerPage > 0) {
return $filteredOrSortedCollection->orderBy($this->index,
$this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
}
} else {
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->get();
}
@ -328,7 +347,8 @@ abstract class DataGrid
if ($this->paginate) {
if ($this->itemsPerPage > 0) {
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
$this->collection = $this->queryBuilder->orderBy($this->index,
$this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
}
} else {
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->get();
@ -340,30 +360,32 @@ abstract class DataGrid
/**
* To find the alias of the column and by taking the column name.
*
* @param array $columnAlias
* @param array $columnAlias
*
* @return array
*/
public function findColumnType($columnAlias)
{
foreach($this->completeColumnDetails as $column) {
if($column['index'] == $columnAlias) {
foreach ($this->completeColumnDetails as $column) {
if ($column['index'] == $columnAlias) {
return [$column['type'], $column['index']];
}
}
}
/**
* @param \Illuminate\Support\Collection $collection
* @param array $parseInfo
* @param \Illuminate\Support\Collection $collection
* @param array $parseInfo
*
* @return \Illuminate\Support\Collection
*/
public function sortOrFilterCollection($collection, $parseInfo)
{
foreach ($parseInfo as $key => $info) {
foreach ($parseInfo as $key => $info) {
$columnType = $this->findColumnType($key)[0] ?? null;
$columnName = $this->findColumnType($key)[1] ?? null;
if ($key == "sort") {
if ($key === "sort") {
$count_keys = count(array_keys($info));
if ($count_keys > 1) {
@ -376,7 +398,7 @@ abstract class DataGrid
$columnName[1],
array_values($info)[0]
);
} elseif ($key == "search") {
} elseif ($key === "search") {
$count_keys = count(array_keys($info));
if ($count_keys > 1) {
@ -384,15 +406,16 @@ abstract class DataGrid
}
if ($count_keys == 1) {
$collection->where(function($collection) use($info) {
$collection->where(function ($collection) use ($info) {
foreach ($this->completeColumnDetails as $column) {
if ($column['searchable'] == true) {
if($this->enableFilterMap && isset($this->filterMap[$column['index']])) {
$collection->orWhere($this->filterMap[$column['index']], 'like', '%'.$info['all'].'%');
} elseif($this->enableFilterMap && !isset($this->filterMap[$column['index']])) {
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
}else {
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
if ($this->enableFilterMap && isset($this->filterMap[$column['index']])) {
$collection->orWhere($this->filterMap[$column['index']], 'like',
'%' . $info['all'] . '%');
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$column['index']])) {
$collection->orWhere($column['index'], 'like', '%' . $info['all'] . '%');
} else {
$collection->orWhere($column['index'], 'like', '%' . $info['all'] . '%');
}
}
}
@ -400,36 +423,41 @@ abstract class DataGrid
}
} else {
foreach ($this->completeColumnDetails as $column) {
if($column['index'] == $columnName && !$column['filterable']) {
if ($column['index'] === $columnName && ! $column['filterable']) {
return $collection;
}
}
if (array_keys($info)[0] == "like" || array_keys($info)[0] == "nlike") {
if (array_keys($info)[0] === "like" || array_keys($info)[0] === "nlike") {
foreach ($info as $condition => $filter_value) {
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
$collection->where(
$this->filterMap[$columnName],
$this->operators[$condition],
'%'.$filter_value.'%'
'%' . $filter_value . '%'
);
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
$collection->where(
$columnName,
$this->operators[$condition],
'%'.$filter_value.'%'
'%' . $filter_value . '%'
);
} else {
$collection->where(
$columnName,
$this->operators[$condition],
'%'.$filter_value.'%'
'%' . $filter_value . '%'
);
}
}
} else {
foreach ($info as $condition => $filter_value) {
if ($columnType == 'datetime') {
if ($condition === 'undefined') {
$condition = '=';
}
if ($columnType === 'datetime') {
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
$collection->whereDate(
$this->filterMap[$columnName],
@ -456,7 +484,7 @@ abstract class DataGrid
$this->operators[$condition],
$filter_value
);
} elseif($this->enableFilterMap && !isset($this->filterMap[$columnName])) {
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
$collection->where(
$columnName,
$this->operators[$condition],
@ -479,7 +507,8 @@ abstract class DataGrid
}
/**
* @param string $name
* @param string $name
*
* @return void
*/
protected function fireEvent($name)
@ -524,6 +553,17 @@ abstract class DataGrid
$this->prepareQueryBuilder();
$necessaryExtraFilters = [];
if (in_array('channels', $this->extraFilters)) {
$necessaryExtraFilters['channels'] = core()->getAllChannels();
}
if (in_array('locales', $this->extraFilters)) {
$necessaryExtraFilters['locales'] = core()->getAllLocales();
}
if (in_array('customer_groups', $this->extraFilters)) {
$necessaryExtraFilters['customer_groups'] = core()->getAllCustomerGroups();
}
return view('ui::datagrid.table')->with('results', [
'records' => $this->getCollection(),
'columns' => $this->completeColumnDetails,
@ -533,7 +573,8 @@ abstract class DataGrid
'enableMassActions' => $this->enableMassAction,
'enableActions' => $this->enableAction,
'paginated' => $this->paginate,
'norecords' => trans('ui::app.datagrid.no-records'),
'norecords' => __('ui::app.datagrid.no-records'),
'extraFilters' => $necessaryExtraFilters
]);
}

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