Merge branch 'master' of https://github.com/bagisto/bagisto into elektronika

 Conflicts:
	packages/Webkul/Shop/src/Http/Controllers/CartController.php
This commit is contained in:
merdan 2022-08-25 14:06:45 +05:00
commit bcc9debe99
367 changed files with 2555 additions and 2518 deletions

View File

@ -16,9 +16,7 @@ jobs:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: bagisto_testing
MYSQL_USER: bagisto
MYSQL_PASSWORD: secret
MYSQL_DATABASE: bagisto
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
@ -42,11 +40,12 @@ jobs:
run: |
cp .env.example .env.testing
set -e
sed -i "s|^\(APP_ENV=\s*\).*$|\1testing|" .env.testing
sed -i "s|^\(DB_HOST=\s*\).*$|\1127.0.0.1|" .env.testing
sed -i "s|^\(DB_PORT=\s*\).*$|\1${{ job.services.mysql.ports['3306'] }}|" .env.testing
sed -i "s|^\(DB_DATABASE=\s*\).*$|\1bagisto_testing|" .env.testing
sed -i "s|^\(DB_USERNAME=\s*\).*$|\1bagisto|" .env.testing
sed -i "s|^\(DB_PASSWORD=\s*\).*$|\1secret|" .env.testing
sed -i "s|^\(DB_DATABASE=\s*\).*$|\1bagisto|" .env.testing
sed -i "s|^\(DB_USERNAME=\s*\).*$|\1root|" .env.testing
sed -i "s|^\(DB_PASSWORD=\s*\).*$|\1root|" .env.testing
- name: Key Generate
run: set -e && php artisan key:generate --env=testing

View File

@ -14,11 +14,11 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\Webkul\Core\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Webkul\Core\Http\Middleware\SecureHeaders::class,
];
@ -29,7 +29,9 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\Illuminate\Session\Middleware\AuthenticateSession::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
@ -52,6 +54,7 @@ class Kernel extends HttpKernel
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,

View File

@ -144,14 +144,16 @@
"@php artisan migrate:fresh --env=testing",
"vendor/bin/codecept run unit",
"vendor/bin/codecept run functional",
"vendor/bin/codecept run trigger"
"vendor/bin/codecept run trigger",
"vendor/bin/codecept run api"
],
"test-win": [
"@set -e",
"@php artisan migrate:fresh --env=testing",
"vendor\\bin\\codecept.bat run unit",
"vendor\\bin\\codecept.bat run functional",
"vendor\\bin\\codecept.bat run trigger"
"vendor\\bin\\codecept.bat run trigger",
"vendor\\bin\\codecept.bat run api"
]
},
"config": {

13
config/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
db-blade-compiler.php
debugbar.php
dompdf.php
excel.php
flare.php
ignition.php
image.php
imagecache.php
jwt.php
repository.php
scout.php
tinker.php
translatable.php

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#9497B8" stroke-width="2"/>
<path d="M9 9L15 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15 9L9 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 471 B

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v7.0.6
* Pusher JavaScript Library v7.2.0
* https://pusher.com/
*
* Copyright 2020, Pusher
@ -18,8 +18,8 @@
*/
/*!
* Vue.js v2.6.14
* (c) 2014-2021 Evan You
* Vue.js v2.7.7
* (c) 2014-2022 Evan You
* Released under the MIT License.
*/
@ -37,6 +37,8 @@
* Date: 2021-03-02T17:08Z
*/
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license
* Lodash <https://lodash.com/>

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js?id=fecd2e4463e43c5595a5",
"/css/admin.css": "/css/admin.css?id=e4ebf1879c19e72942f5"
"/js/admin.js": "/js/admin.js?id=342ead48e2eb8d7dc7a3",
"/css/admin.css": "/css/admin.css?id=bd6f253e4db4d12d1a57"
}

View File

@ -146,7 +146,7 @@ class AddressDataGrid extends DataGrid
'sortable' => true,
'searchable' => false,
'closure' => function ($row) {
if ($row->default_address == 1) {
if ($row->default_address) {
return '<span class="badge badge-md badge-success"">' . trans('admin::app.customers.addresses.yes') . '</span>';
} else {
return trans('admin::app.customers.addresses.dash');

View File

@ -89,7 +89,7 @@ class AttributeDataGrid extends DataGrid
'sortable' => true,
'searchable' => false,
'closure' => function ($value) {
if ($value->is_required == 1) {
if ($value->is_required) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');
@ -105,7 +105,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'filterable' => true,
'closure' => function ($value) {
if ($value->is_unique == 1) {
if ($value->is_unique) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');
@ -121,7 +121,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'filterable' => true,
'closure' => function ($value) {
if ($value->value_per_locale == 1) {
if ($value->value_per_locale) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');
@ -137,7 +137,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'filterable' => true,
'closure' => function ($value) {
if ($value->value_per_channel == 1) {
if ($value->value_per_channel) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');

View File

@ -77,7 +77,7 @@ class CampaignDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->status == 1) {
if ($value->status) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');

View File

@ -86,7 +86,7 @@ class CartRuleCouponsDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->end_other_rules == 1) {
if ($value->end_other_rules) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');

View File

@ -88,7 +88,7 @@ class CatalogRuleDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->status == 1) {
if ($value->status) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');

View File

@ -128,7 +128,7 @@ class CategoryDataGrid extends DataGrid
'searchable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->status == 1) {
if ($value->status) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');

View File

@ -161,7 +161,7 @@ class CategoryProductDataGrid extends DataGrid
'searchable' => false,
'filterable' => true,
'closure' => function ($value) {
if ($value->status == 1) {
if ($value->status) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');

View File

@ -145,13 +145,13 @@ class CustomerDataGrid extends DataGrid
'closure' => function ($row) {
$html = '';
if ($row->status == 1) {
if ($row->status) {
$html .= '<span class="badge badge-md badge-success">' . trans('admin::app.customers.customers.active') . '</span>';
} else {
$html .= '<span class="badge badge-md badge-danger">' . trans('admin::app.customers.customers.inactive') . '</span>';
}
if ($row->is_suspended == 1) {
if ($row->is_suspended) {
$html .= '<span class="badge badge-md badge-danger">' . trans('admin::app.customers.customers.suspended') . '</span>';
}

View File

@ -86,7 +86,7 @@ class InventorySourcesDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->status == 1) {
if ($value->status) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');

View File

@ -59,7 +59,7 @@ class NewsLetterDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->status === 1) {
if ($value->status) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');

View File

@ -204,7 +204,7 @@ class ProductDataGrid extends DataGrid
'closure' => function ($value) {
$html = '';
if ($value->status == 1) {
if ($value->status) {
$html .= '<span class="badge badge-md badge-success">' . trans('admin::app.datagrid.active') . '</span>';
} else {
$html .= '<span class="badge badge-md badge-danger">' . trans('admin::app.datagrid.inactive') . '</span>';

View File

@ -81,7 +81,7 @@ class UserDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'closure' => function ($value) {
if ($value->status == 1) {
if ($value->status) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');

View File

@ -79,6 +79,7 @@ class ConfigurationController extends Controller
{
if (! request()->route('slug')) {
$firstItem = current($this->configTree->items);
$secondItem = current($firstItem['children']);
return $this->getSlugs($secondItem);
@ -109,6 +110,7 @@ class ConfigurationController extends Controller
foreach ($data['sales']['carriers'] as $carrier) {
if ($carrier['active']) {
$atLeastOneCarrierEnabled = true;
break;
}
}
@ -116,6 +118,22 @@ class ConfigurationController extends Controller
if (! $atLeastOneCarrierEnabled) {
session()->flash('error', trans('admin::app.configuration.enable-atleast-one-shipping'));
return redirect()->back();
}
} elseif (isset($data['sales']['paymentmethods'])) {
$atLeastOnePaymentMethodEnabled = false;
foreach ($data['sales']['paymentmethods'] as $paymentMethod) {
if ($paymentMethod['active']) {
$atLeastOnePaymentMethodEnabled = true;
break;
}
}
if (! $atLeastOnePaymentMethodEnabled) {
session()->flash('error', trans('admin::app.configuration.enable-atleast-one-payment'));
return redirect()->back();
}
}

View File

@ -2,6 +2,7 @@
namespace Webkul\Admin\Http\Controllers\Customer;
use Illuminate\Support\Facades\Event;
use Webkul\Customer\Rules\VatIdRule;
use Webkul\Admin\DataGrids\AddressDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
@ -73,8 +74,6 @@ class AddressController extends Controller
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
]);
$data = collect(request()->input())->except('_token')->toArray();
$this->validate(request(), [
'company_name' => 'string',
'address1' => 'string|required',
@ -86,15 +85,15 @@ class AddressController extends Controller
'vat_id' => new VatIdRule(),
]);
if ($this->customerAddressRepository->create($data)) {
session()->flash('success', trans('admin::app.customers.addresses.success-create'));
Event::dispatch('customer.addresses.create.before');
return redirect()->route('admin.customer.edit', ['id' => $data['customer_id']]);
} else {
session()->flash('success', trans('admin::app.customers.addresses.error-create'));
$customerAddress = $this->customerAddressRepository->create(request()->all());
return redirect()->back();
}
Event::dispatch('customer.addresses.create.after', $customerAddress);
session()->flash('success', trans('admin::app.customers.addresses.success-create'));
return redirect()->route('admin.customer.edit', ['id' => request('customer_id')]);
}
/**
@ -131,18 +130,15 @@ class AddressController extends Controller
'vat_id' => new VatIdRule(),
]);
$data = collect(request()->input())->except('_token')->toArray();
Event::dispatch('customer.addresses.update.before', $id);
$address = $this->customerAddressRepository->find($id);
$customerAddress = $this->customerAddressRepository->update(request()->all(), $id);
if ($address) {
$this->customerAddressRepository->update($data, $id);
Event::dispatch('customer.addresses.update.after', $customerAddress);
session()->flash('success', trans('admin::app.customers.addresses.success-update'));
session()->flash('success', trans('admin::app.customers.addresses.success-update'));
return redirect()->route('admin.customer.addresses.index', ['id' => $address->customer_id]);
}
return redirect()->route($this->_config['redirect']);
return redirect()->route('admin.customer.addresses.index', ['id' => $customerAddress->customer_id]);
}
/**
@ -153,11 +149,15 @@ class AddressController extends Controller
*/
public function destroy($id)
{
Event::dispatch('customer.addresses.delete.before', $id);
$this->customerAddressRepository->delete($id);
Event::dispatch('customer.addresses.delete.after', $id);
return response()->json([
'redirect' => false,
'message' => trans('admin::app.customers.addresses.success-delete')
'message' => trans('admin::app.customers.addresses.success-delete')
]);
}
@ -172,7 +172,11 @@ class AddressController extends Controller
$addressIds = explode(',', request()->input('indexes'));
foreach ($addressIds as $addressId) {
Event::dispatch('customer.addresses.delete.before', $addressId);
$this->customerAddressRepository->delete($addressId);
Event::dispatch('customer.addresses.delete.after', $addressId);
}
session()->flash('success', trans('admin::app.customers.addresses.success-mass-delete'));

View File

@ -2,14 +2,13 @@
namespace Webkul\Admin\Http\Controllers\Customer;
use Mail;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use Webkul\Admin\DataGrids\CustomerDataGrid;
use Webkul\Admin\DataGrids\CustomerOrderDataGrid;
use Webkul\Admin\DataGrids\CustomersInvoicesDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Mail\NewCustomerNotification;
use Webkul\Core\Repositories\ChannelRepository;
use Webkul\Customer\Repositories\CustomerAddressRepository;
use Webkul\Customer\Repositories\CustomerGroupRepository;
use Webkul\Customer\Repositories\CustomerRepository;
@ -26,15 +25,11 @@ class CustomerController extends Controller
* Create a new controller instance.
*
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
* @param \Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
* @param \Webkul\Core\Repositories\ChannelRepository $channelRepository
*/
public function __construct(
protected CustomerRepository $customerRepository,
protected CustomerAddressRepository $customerAddressRepository,
protected CustomerGroupRepository $customerGroupRepository,
protected ChannelRepository $channelRepository
protected CustomerGroupRepository $customerGroupRepository
)
{
$this->_config = request('_config');
@ -61,11 +56,9 @@ class CustomerController extends Controller
*/
public function create()
{
$customerGroup = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
$groups = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
$channelName = $this->channelRepository->all();
return view($this->_config['view'], compact('customerGroup', 'channelName'));
return view($this->_config['view'], compact('groups'));
}
/**
@ -83,18 +76,20 @@ class CustomerController extends Controller
'date_of_birth' => 'date|before:today',
]);
$data = request()->all();
$password = rand(100000, 10000000);
$data['password'] = bcrypt($password);
Event::dispatch('customer.registration.before');
$data['is_verified'] = 1;
$customer = $this->customerRepository->create(array_merge(request()->all() , [
'password' => bcrypt($password),
'is_verified' => 1,
]));
$customer = $this->customerRepository->create($data);
Event::dispatch('customer.registration.after', $customer);
try {
$configKey = 'emails.general.notifications.emails.general.notifications.customer';
if (core()->getConfigData($configKey)) {
Mail::queue(new NewCustomerNotification($customer, $password));
}
@ -116,11 +111,10 @@ class CustomerController extends Controller
public function edit($id)
{
$customer = $this->customerRepository->findOrFail($id);
$address = $this->customerAddressRepository->find($id);
$customerGroup = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
$channelName = $this->channelRepository->all();
return view($this->_config['view'], compact('customer', 'address', 'customerGroup', 'channelName'));
$groups = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
return view($this->_config['view'], compact('customer', 'groups'));
}
/**
@ -139,13 +133,14 @@ class CustomerController extends Controller
'date_of_birth' => 'date|before:today',
]);
$data = request()->all();
Event::dispatch('customer.update.before', $id);
$customer = $this->customerRepository->update(array_merge(request()->all(), [
'status' => request()->has('status'),
'is_suspended' => request()->has('is_suspended'),
]), $id);
$data['status'] = ! isset($data['status']) ? 0 : 1;
$data['is_suspended'] = ! isset($data['is_suspended']) ? 0 : 1;
$this->customerRepository->update($data, $id);
Event::dispatch('customer.update.after', $customer);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));
@ -199,15 +194,15 @@ class CustomerController extends Controller
'notes' => 'string|nullable',
]);
$customer = $this->customerRepository->find(request()->input('_customer'));
Event::dispatch('customer.update.before', request()->input('_customer'));
$noteTaken = $customer->update(['notes' => request()->input('notes')]);
$customer = $this->customerRepository->update([
'notes' => request()->input('notes'),
], request()->input('_customer'));
if ($noteTaken) {
session()->flash('success', 'Note taken');
} else {
session()->flash('error', 'Note cannot be taken');
}
Event::dispatch('customer.update.after', $customer);
session()->flash('success', 'Note taken');
return redirect()->route($this->_config['redirect']);
}
@ -220,12 +215,17 @@ class CustomerController extends Controller
public function massUpdate()
{
$customerIds = explode(',', request()->input('indexes'));
$updateOption = request()->input('update-options');
foreach ($customerIds as $customerId) {
$customer = $this->customerRepository->find($customerId);
Event::dispatch('customer.update.before', $customerId);
$customer->update(['status' => $updateOption]);
$customer = $this->customerRepository->update([
'status' => $updateOption,
], $customerId);
Event::dispatch('customer.update.after', $customer);
}
session()->flash('success', trans('admin::app.customers.customers.mass-update-success'));
@ -243,9 +243,12 @@ class CustomerController extends Controller
$customerIds = explode(',', request()->input('indexes'));
if (! $this->customerRepository->checkBulkCustomerIfTheyHaveOrderPendingOrProcessing($customerIds)) {
foreach ($customerIds as $customerId) {
$this->customerRepository->deleteWhere(['id' => $customerId]);
Event::dispatch('customer.delete.before', $customerId);
$this->customerRepository->delete($customerId);
Event::dispatch('customer.delete.after', $customerId);
}
session()->flash('success', trans('admin::app.customers.customers.mass-destroy-success'));
@ -254,6 +257,7 @@ class CustomerController extends Controller
}
session()->flash('error', trans('admin::app.response.order-pending', ['name' => 'Customers']));
return redirect()->back();
}

View File

@ -2,6 +2,7 @@
namespace Webkul\Admin\Http\Controllers\Customer;
use Illuminate\Support\Facades\Event;
use Webkul\Admin\DataGrids\CustomerGroupDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Customer\Repositories\CustomerGroupRepository;
@ -62,11 +63,13 @@ class CustomerGroupController extends Controller
'name' => 'required',
]);
$data = request()->all();
Event::dispatch('customer.customer_group.create.before');
$data['is_user_defined'] = 1;
$customerGroup = $this->customerGroupRepository->create(array_merge(request()->all() , [
'is_user_defined' => 1,
]));
$this->customerGroupRepository->create($data);
Event::dispatch('customer.customer_group.create.after', $customerGroup);
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
@ -99,7 +102,11 @@ class CustomerGroupController extends Controller
'name' => 'required',
]);
$this->customerGroupRepository->update(request()->all(), $id);
Event::dispatch('customer.customer_group.update.before', $id);
$customerGroup = $this->customerGroupRepository->update(request()->all(), $id);
Event::dispatch('customer.customer_group.update.after', $customerGroup);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer Group']));
@ -116,21 +123,25 @@ class CustomerGroupController extends Controller
{
$customerGroup = $this->customerGroupRepository->findOrFail($id);
if ($customerGroup->is_user_defined == 0) {
if (! $customerGroup->is_user_defined) {
return response()->json([
'message' => trans('admin::app.customers.customers.group-default'),
], 400);
}
if (count($customerGroup->customers) > 0) {
if ($customerGroup->customers->count()) {
return response()->json([
'message' => trans('admin::app.response.customer-associate', ['name' => 'Customer Group']),
], 400);
}
try {
Event::dispatch('customer.customer_group.delete.before', $id);
$this->customerGroupRepository->delete($id);
Event::dispatch('customer.customer_group.delete.after', $id);
return response()->json(['message' => trans('admin::app.response.delete-success', ['name' => 'Customer Group'])]);
} catch (\Exception $e) {}

View File

@ -20,9 +20,7 @@ class ExportController extends Controller
$gridName = explode('\\', $criteria['gridName']);
$path = '\Webkul\Admin\DataGrids' . '\\' . last($gridName);
$gridInstance = app($path);
$gridInstance = app('\Webkul\Admin\DataGrids' . '\\' . last($gridName));
$records = $gridInstance->export();
@ -34,9 +32,7 @@ class ExportController extends Controller
if ($format == 'csv') {
return Excel::download(new DataGridExport($records), last($gridName) . '.csv');
}
if ($format == 'xls') {
} elseif ($format == 'xls') {
return Excel::download(new DataGridExport($records), last($gridName) . '.xlsx');
}

View File

@ -99,21 +99,21 @@ class InvoiceController extends Controller
'invoice.items.*' => 'required|numeric|min:0',
]);
$data = request()->all();
if (! $this->invoiceRepository->haveProductToInvoice($data)) {
if (! $this->invoiceRepository->haveProductToInvoice(request()->all())) {
session()->flash('error', trans('admin::app.sales.invoices.product-error'));
return redirect()->back();
}
if (! $this->invoiceRepository->isValidQuantity($data)) {
if (! $this->invoiceRepository->isValidQuantity(request()->all())) {
session()->flash('error', trans('admin::app.sales.invoices.invalid-qty'));
return redirect()->back();
}
$this->invoiceRepository->create(array_merge($data, ['order_id' => $orderId]));
$this->invoiceRepository->create(array_merge(request()->all(), [
'order_id' => $orderId,
]));
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Invoice']));
@ -148,15 +148,9 @@ class InvoiceController extends Controller
$invoice = $this->invoiceRepository->findOrFail($id);
if ($invoice) {
$this->sendDuplicateInvoiceMail($invoice, $request->email);
$this->sendDuplicateInvoiceMail($invoice, $request->email);
session()->flash('success', __('admin::app.sales.invoices.invoice-sent'));
return redirect()->back();
}
session()->flash('error', __('admin::app.response.something-went-wrong'));
session()->flash('success', trans('admin::app.sales.invoices.invoice-sent'));
return redirect()->back();
}

View File

@ -86,15 +86,12 @@ class OrderController extends Controller
*/
public function comment($id)
{
$data = array_merge(request()->all(), [
'order_id' => $id,
]);
Event::dispatch('sales.order.comment.create.before');
$data['customer_notified'] = isset($data['customer_notified']) ? 1 : 0;
Event::dispatch('sales.order.comment.create.before', $data);
$comment = $this->orderCommentRepository->create($data);
$comment = $this->orderCommentRepository->create(array_merge(request()->all(), [
'order_id' => $id,
'customer_notified' => request()->has('customer_notified'),
]));
Event::dispatch('sales.order.comment.create.after', $comment);

View File

@ -96,7 +96,9 @@ class ShipmentController extends Controller
return redirect()->back();
}
$this->shipmentRepository->create(array_merge($data, ['order_id' => $orderId]));
$this->shipmentRepository->create(array_merge($data, [
'order_id' => $orderId,
]));
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Shipment']));
@ -141,7 +143,10 @@ class ShipmentController extends Controller
->where('inventory_source_id', $inventorySourceId)
->sum('qty');
if ($child->qty_to_ship < $finalQty || $availableQty < $finalQty) {
if (
$child->qty_to_ship < $finalQty
|| $availableQty < $finalQty
) {
return false;
}
}
@ -150,7 +155,10 @@ class ShipmentController extends Controller
->where('inventory_source_id', $inventorySourceId)
->sum('qty');
if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) {
if (
$orderItem->qty_to_ship < $qty
|| $availableQty < $qty
) {
return false;
}
}

View File

@ -5,6 +5,8 @@ namespace Webkul\Admin\Listeners;
use Illuminate\Support\Facades\Mail;
use Webkul\User\Notifications\AdminUpdatePassword;
use Webkul\Customer\Notifications\CustomerUpdatePassword;
use Webkul\Customer\Models\Customer;
use Webkul\User\Models\Admin;
class PasswordChange
{
@ -17,11 +19,9 @@ class PasswordChange
public function sendUpdatePasswordMail($adminOrCustomer)
{
try {
if ($adminOrCustomer instanceof \Webkul\Customer\Models\Customer) {
if ($adminOrCustomer instanceof Customer) {
Mail::queue(new CustomerUpdatePassword($adminOrCustomer));
}
if ($adminOrCustomer instanceof \Webkul\User\Models\Admin) {
} elseif ($adminOrCustomer instanceof Admin) {
Mail::queue(new AdminUpdatePassword($adminOrCustomer));
}
} catch (\Exception $e) {

View File

@ -21,8 +21,8 @@ class CancelOrderAdminNotification extends Mailable
public function build()
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to(core()->getAdminEmailDetails()['email'])
->subject(trans('shop::app.mail.order.cancel.subject'))
->view('shop::emails.sales.order-cancel-admin');
->to(core()->getAdminEmailDetails()['email'])
->subject(trans('shop::app.mail.order.cancel.subject'))
->view('shop::emails.sales.order-cancel-admin');
}
}

View File

@ -22,8 +22,8 @@ class CancelOrderNotification extends Mailable
public function build()
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to($this->order->customer_email, $this->order->customer_full_name)
->subject(trans('shop::app.mail.order.cancel.subject'))
->view('shop::emails.sales.order-cancel');
->to($this->order->customer_email, $this->order->customer_full_name)
->subject(trans('shop::app.mail.order.cancel.subject'))
->view('shop::emails.sales.order-cancel');
}
}

View File

@ -21,7 +21,8 @@ class DuplicateInvoiceNotification extends Mailable
public $invoice,
public $customerEmail
)
{}
{
}
/**
* Build the message.

View File

@ -16,12 +16,15 @@ class InvoiceOverdueReminder extends Mailable
*
* @param \Webkul\Customer\Contracts\Customer $customer
* @param \Webkul\Sales\Contracts\Invoice $invoice
* @return void
*/
public function __construct(
public $customer,
public $invoice
)
{}
{
}
/**
* Build the message.
@ -31,8 +34,11 @@ class InvoiceOverdueReminder extends Mailable
public function build()
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to($this->customer->email)
->subject(trans('shop::app.mail.invoice.reminder.subject'))
->view('shop::emails.customer.invoice-reminder')->with(['customer' => $this->customer, 'invoice' => $this->invoice]);
->to($this->customer->email)
->subject(trans('shop::app.mail.invoice.reminder.subject'))
->view('shop::emails.customer.invoice-reminder')->with([
'customer' => $this->customer,
'invoice' => $this->invoice,
]);
}
}

View File

@ -29,8 +29,8 @@ class NewAdminNotification extends Mailable
public function build()
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to(core()->getAdminEmailDetails()['email'])
->subject(trans('shop::app.mail.order.subject'))
->view('shop::emails.sales.new-admin-order');
->to(core()->getAdminEmailDetails()['email'])
->subject(trans('shop::app.mail.order.subject'))
->view('shop::emails.sales.new-admin-order');
}
}

View File

@ -33,8 +33,11 @@ class NewCustomerNotification extends Mailable
public function build()
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to($this->customer->email)
->subject(trans('shop::app.mail.customer.new.subject'))
->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]);
->to($this->customer->email)
->subject(trans('shop::app.mail.customer.new.subject'))
->view('shop::emails.customer.new-customer')->with([
'customer' => $this->customer,
'password' => $this->password,
]);
}
}

View File

@ -33,8 +33,8 @@ class NewInventorySourceNotification extends Mailable
$inventory = $this->shipment->inventory_source;
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to($inventory->contact_email, $inventory->name)
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
->view('shop::emails.sales.new-inventorysource-shipment');
->to($inventory->contact_email, $inventory->name)
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
->view('shop::emails.sales.new-inventorysource-shipment');
}
}

View File

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

View File

@ -29,8 +29,8 @@ class NewOrderNotification extends Mailable
public function build()
{
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
->to($this->order->customer_email, $this->order->customer_full_name)
->subject(trans('shop::app.mail.order.subject'))
->view('shop::emails.sales.new-order');
->to($this->order->customer_email, $this->order->customer_full_name)
->subject(trans('shop::app.mail.order.subject'))
->view('shop::emails.sales.new-order');
}
}

View File

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

View File

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

View File

@ -29,8 +29,8 @@ class OrderCommentNotification extends Mailable
public function build()
{
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', ['order_id' => $this->comment->order->increment_id]))
->view('shop::emails.sales.new-order-comment');
->to($this->comment->order->customer_email, $this->comment->order->customer_full_name)
->subject(trans('shop::app.mail.order.comment.subject', ['order_id' => $this->comment->order->increment_id]))
->view('shop::emails.sales.new-order-comment');
}
}

View File

@ -105,13 +105,15 @@ class AdminServiceProvider extends ServiceProvider
&& substr_count($item['key'], '.') == 1
) {
foreach ($allowedPermissions as $key => $value) {
if ($item['key'] == $value) {
$neededItem = $allowedPermissions[$key + 1];
if ($item['key'] != $value) {
continue;
}
foreach (config('menu.admin') as $key1 => $findMatced) {
if ($findMatced['key'] == $neededItem) {
$item['route'] = $findMatced['route'];
}
$neededItem = $allowedPermissions[$key + 1];
foreach (config('menu.admin') as $key1 => $findMatced) {
if ($findMatced['key'] == $neededItem) {
$item['route'] = $findMatced['route'];
}
}
}

View File

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#9497B8" stroke-width="2"/>
<path d="M9 9L15 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15 9L9 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 471 B

View File

@ -5,7 +5,7 @@
<i class="icon notification-icon active" style="margin-left:0px"></i>
</div>
<div class="dropdown-list bottom-right notification">
<div class="dropdown-list bottom-right notification" ref="dropdownList">
<div class="dropdown-container">
<ul class="notif">
<div id="notif-title">{{ title }}</div>
@ -132,34 +132,38 @@ export default {
read: 0
};
let this_this = this;
let self = this;
this.$http.get(this.getNotificationUrl, {
params: params
})
.then(function (response) {
this_this.notifications = response.data.search_results.data;
this_this.totalUnRead = response.data.total_unread;
self.notifications = response.data.search_results.data;
self.totalUnRead = response.data.total_unread;
})
.catch(function (error) {})
},
readAll: function () {
let this_this = this;
let self = this;
let dropdownList = this.$refs.dropdownList;
this.$http.post(this.getReadAllUrl)
.then(function (response) {
this_this.notifications = response.data.search_results.data;
self.notifications = response.data.search_results.data;
this_this.totalUnRead = response.data.total_unread;
self.totalUnRead = response.data.total_unread;
window.flashMessages.push({
'type': 'alert-success',
'message': response.data.success_message
});
this_this.$root.addFlashMessages();
self.$root.addFlashMessages();
})
.catch(function (error) {})
dropdownList.style.display = "none";
}
}
}

View File

@ -452,6 +452,19 @@
.control {
border: 1px solid $dark-mode-switch-border;
}
input[type=date] {
background-position-x: 95%;
background-position-y: center;
background-image: url(../images/Icon-remove.svg);
background-size: 18px 30px;
background-repeat: no-repeat;
&::-webkit-inner-spin-button,
&::-webkit-calendar-picker-indicator {
-webkit-appearance: none;
opacity: 0;
}
}
}
.grid-container {

View File

@ -153,7 +153,7 @@ $toggleColor: #3c41ff;
min-width: 300px;
max-width: 25vw;
width: 100vw;
height: 100%;
height: 90vh;
z-index: 1;
padding-bottom: 10px;
transition: transform 0.3s ease;

View File

@ -741,6 +741,7 @@ return [
'no' => 'لا.',
'delete' => 'احذف',
'enable-atleast-one-shipping' => 'تفعيل طريقة شحن واحدة على الأقل.',
'enable-atleast-one-payment' => 'تفعيل طريقة دفع واحدة على الأقل.',
'tax-categories' => [
'title' => 'فئات الضرائب',

View File

@ -627,6 +627,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -746,6 +747,7 @@ return [
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -733,6 +733,8 @@ return [
'no' => 'Nein',
'delete' => 'Löschen',
'enable-atleast-one-shipping' => 'Aktivieren Sie mindestens eine Versandart.',
'enable-atleast-one-payment' => 'Aktivieren Sie mindestens eine Zahlungsmethode.',
'tax-categories' =>
[
'title' => 'Steuerkategorien',

View File

@ -627,6 +627,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -746,6 +747,7 @@ return [
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -743,6 +743,7 @@ return [
'no' => 'No',
'delete' => 'Borrar',
'enable-atleast-one-shipping' => 'Habilite al menos un método de envío.',
'enable-atleast-one-payment' => 'Habilite al menos un método de pago.',
'tax-categories' => [
'title' => 'Categorías de impuestos',

View File

@ -726,6 +726,7 @@ return [
'no' => 'خیر',
'delete' => 'حذف',
'enable-atleast-one-shipping' => 'حداقل یک روش حمل و نقل را فعال کنید.',
'enable-atleast-one-payment' => 'حداقل یک روش پرداخت را فعال کنید.',
'tax-categories' => [
'title' => 'دسته بندی های مالیات',

View File

@ -746,6 +746,7 @@ return [
'no' => 'Non',
'delete' => 'Effacer',
'enable-atleast-one-shipping' => 'Activez au moins une méthode d\'expédition.',
'enable-atleast-one-payment' => 'Activez au moins un mode de paiement.',
'tax-categories' => [
'title' => 'Catégories de taxes',

View File

@ -627,6 +627,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -746,6 +747,7 @@ return [
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -624,6 +624,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -743,6 +744,7 @@ return [
'no' => 'नहीं',
'delete' => 'हटाएं',
'enable-atleast-one-shipping' => 'कम से कम एक शिपिंग विधि सक्षम करें।',
'enable-atleast-one-payment' => 'कम से कम एक भुगतान विधि सक्षम करें।',
'tax-categories' => [
'title' => 'कर श्रेणियाँ',

View File

@ -731,6 +731,7 @@ return [
'no' => 'No',
'delete' => 'Elimina',
'enable-atleast-one-shipping' => 'Abilita almeno un metodo di spedizione.',
'enable-atleast-one-payment' => 'Abilita almeno un metodo di pagamento.',
'tax-categories' => [
'title' => 'Categorie IVA',

View File

@ -627,6 +627,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -746,6 +747,7 @@ return [
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -725,6 +725,7 @@ return [
'no' => 'Nee',
'delete' => 'Verwijder',
'enable-atleast-one-shipping' => 'Schakel ten minste één verzendmethode in.',
'enable-atleast-one-payment' => 'Schakel ten minste één betaalmethode in.',
'tax-categories' => [
'title' => 'BTW categorieën',

View File

@ -726,6 +726,7 @@ return [
'no' => 'Nie',
'delete' => 'Usuń',
'enable-atleast-one-shipping' => 'Włącz co najmniej jedną metodę wysyłki.',
'enable-atleast-one-payment' => 'Włącz co najmniej jedną formę płatności.',
'tax-categories' => [
'title' => 'Kategorie podatkowe',

View File

@ -724,6 +724,7 @@ return [
'no' => 'Não',
'delete' => 'Deletar',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
'tax-categories' => [
'title' => 'Categorias de Imposto',

View File

@ -627,6 +627,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -746,6 +747,7 @@ return [
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Включите хотя бы один способ доставки.',
'enable-atleast-one-payment' => 'Включите хотя бы один способ оплаты.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -627,6 +627,7 @@ return [
'quantity-integer' => 'Quantity should be integer.',
'quantity-min-zero' => 'Quantity should be greater then zero.',
],
'video-size' => 'Maximum video size should be like :size',
],
'attributes' => [
@ -746,6 +747,7 @@ return [
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -731,6 +731,7 @@ return [
'no' => 'Hayır',
'delete' => 'Sil',
'enable-atleast-one-shipping' => 'En az bir gönderim yöntemini etkinleştirin.',
'enable-atleast-one-payment' => 'En az bir ödeme yöntemini etkinleştirin.',
'tax-categories' => [
'title' => 'Vergi Kategorileri',

View File

@ -726,6 +726,7 @@ return [
'no' => 'No',
'delete' => '删除',
'enable-atleast-one-shipping' => '啟用至少一種運輸方式',
'enable-atleast-one-payment' => '啟用至少一種付款方式。',
'tax-categories' => [
'title' => '税分类',

View File

@ -240,7 +240,7 @@
<script>
var groups = @json($attributeFamily ? $attributeFamily->attribute_groups : []);
var custom_attributes = @json($custom_attributes);
var custom_attributes = @json($customAttributes);
Vue.component('group-list', {

View File

@ -237,7 +237,7 @@
<script>
var groups = @json($attributeFamily->attribute_groups);
var custom_attributes = @json($custom_attributes);
var custom_attributes = @json($customAttributes);
Vue.component('group-list', {

View File

@ -13,6 +13,8 @@
class="control-error"
v-text="'{{ $errors->first('videos.files.*') }}'">
</span>
<span class="control-info mt-10">{{ __('admin::app.catalog.products.video-size', ['size' => core()->getMaxUploadSize()]) }}</span>
</div>
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.videos.controls.after', ['product' => $product]) !!}

View File

@ -37,7 +37,7 @@
@elseif ($field['type'] == 'number')
<input type="number" min="0" v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($nameKey) ?: core()->getConfigData($nameKey, $channel, $locale) }}" data-vv-as="&quot;{{ trans($field['title']) }}&quot;">
<input type="number" min="{{ $field['name'] == 'minimum_order_amount' ? 1 : 0 }}" v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($nameKey) ?: core()->getConfigData($nameKey, $channel, $locale) }}" data-vv-as="&quot;{{ trans($field['title']) }}&quot;">
@elseif ($field['type'] == 'color')

View File

@ -89,7 +89,7 @@
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
<select class="control" id="customerGroup" name="customer_group_id">
@foreach ($customerGroup as $group)
@foreach ($groups as $group)
<option value="{{ $group->id }}"> {{ $group->name}} </>
@endforeach
</select>

View File

@ -168,7 +168,7 @@
@endif
<select class="control" id="customerGroup" name="customer_group_id">
@foreach ($customerGroup as $group)
@foreach ($groups as $group)
<option value="{{ $group->id }}" {{ $selectedCustomerOption == $group->id ? 'selected' : '' }}>
{{ $group->name}}
</option>

View File

@ -123,16 +123,18 @@
</div>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('uses_per_coupon') ? 'has-error' : '']">
<label for="uses_per_coupon">{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}</label>
<input class="control" id="uses_per_coupon" name="uses_per_coupon" value="{{ old('uses_per_coupon') }}"/>
<input v-validate="'numeric'" class="control" id="uses_per_coupon" name="uses_per_coupon" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}&quot;" value="{{ old('uses_per_coupon') }}"/>
<span class="control-error" v-if="errors.has('uses_per_coupon')">@{{ errors.first('uses_per_coupon') }}</span>
</div>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('usage_per_customer') ? 'has-error' : '']">
<label for="usage_per_customer">{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}</label>
<input class="control" id="usage_per_customer" name="usage_per_customer" value="{{ old('usage_per_customer') }}"/>
<input v-validate="'numeric'" class="control" id="usage_per_customer" name="usage_per_customer" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}&quot;" value="{{ old('usage_per_customer') }}"/>
<span class="control-info">{{ __('admin::app.promotions.cart-rules.uses-per-customer-control-info') }}</span>
<span class="control-error" v-if="errors.has('usage_per_customer')">@{{ errors.first('usage_per_customer') }}</span>
</div>
<div class="control-group date">

View File

@ -135,19 +135,22 @@
</div>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('uses_per_coupon') ? 'has-error' : '']">
<label for="uses_per_coupon">{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}</label>
<input class="control" id="uses_per_coupon" name="uses_per_coupon" value="{{ old('uses_per_coupon') ?: $cartRule->uses_per_coupon }}"/>
<input v-validate="'numeric'" class="control" id="uses_per_coupon" name="uses_per_coupon" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}&quot;" value="{{ old('uses_per_coupon') ?: $cartRule->uses_per_coupon }}"/>
<span class="control-error" v-if="errors.has('uses_per_coupon')">@{{ errors.first('uses_per_coupon') }}</span>
</div>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('usage_per_customer') ? 'has-error' : '']">
<label for="usage_per_customer">{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}</label>
<input class="control" id="usage_per_customer" name="usage_per_customer" value="{{ old('usage_per_customer') ?: $cartRule->usage_per_customer }}"/>
<input v-validate="'numeric'" class="control" id="usage_per_customer" name="usage_per_customer" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}&quot;" value="{{ old('usage_per_customer') ?: $cartRule->usage_per_customer }}"/>
<span class="control-info">{{ __('admin::app.promotions.cart-rules.uses-per-customer-control-info') }}</span>
<span class="control-error" v-if="errors.has('usage_per_customer')">@{{ errors.first('usage_per_customer') }}</span>
</div>
<div class="control-group date">
@ -307,7 +310,7 @@
{!! view_render_event('bagisto.admin.promotions.cart-rules.create.after') !!}
<accordian title="{{ __('admin::app.promotions.cart-rules.coupon-codes') }}" :active="false" v-if="coupon_type && use_auto_generation">
<accordian title="{{ __('admin::app.promotions.cart-rules.coupon-codes') }}" :active="false" v-if="parseInt(use_auto_generation) && parseInt(coupon_type)">
<div slot="body">
<create-coupon-form></create-coupon-form>
</div>

View File

@ -219,7 +219,7 @@
<div v-else>
<div class="control-group" :class="[errors.has('value') ? 'has-error' : '']" v-if="matchedAttribute.type == 'text' || matchedAttribute.type == 'price' || matchedAttribute.type == 'decimal' || matchedAttribute.type == 'integer'">
<input v-validate="matchedAttribute.type == 'price' ? 'decimal: 2' : '' || matchedAttribute.type == 'decimal' ? 'decimal: 2' : '' || matchedAttribute.type == 'integer' ? 'decimal: 2' : '' || matchedAttribute.type == 'text' ? 'alpha_num' : ''" class="control" :name="['conditions[' + index + '][value]']" v-model="condition.value" name="value"/>
<input v-validate="matchedAttribute.type == 'price' ? 'decimal:2' : '' || matchedAttribute.type == 'decimal' ? 'decimal:2' : '' || matchedAttribute.type == 'integer' ? 'decimal:2' : '' || matchedAttribute.type == 'text' ? 'alpha_num' : ''" class="control" :name="['conditions[' + index + '][value]']" v-model="condition.value" name="value"/>
<span class="control-error" v-if="errors.has('value')" v-text="errors.first('value')"></span>
</div>

View File

@ -2,6 +2,7 @@
namespace Webkul\Attribute\Http\Controllers;
use Illuminate\Support\Facades\Event;
use Webkul\Admin\DataGrids\AttributeDataGrid;
use Webkul\Attribute\Repositories\AttributeRepository;
@ -62,11 +63,13 @@ class AttributeController extends Controller
'type' => 'required',
]);
$data = request()->all();
Event::dispatch('catalog.attribute.create.before');
$data['is_user_defined'] = 1;
$attribute = $this->attributeRepository->create(array_merge(request()->all(), [
'is_user_defined' => 1,
]));
$this->attributeRepository->create($data);
Event::dispatch('catalog.attribute.create.after', $attribute);
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
@ -113,7 +116,11 @@ class AttributeController extends Controller
'type' => 'required',
]);
$this->attributeRepository->update(request()->all(), $id);
Event::dispatch('catalog.attribute.update.before', $id);
$attribute = $this->attributeRepository->update(request()->all(), $id);
Event::dispatch('catalog.attribute.update.after', $attribute);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
@ -137,8 +144,12 @@ class AttributeController extends Controller
}
try {
Event::dispatch('catalog.attribute.delete.before', $id);
$this->attributeRepository->delete($id);
Event::dispatch('catalog.attribute.delete.after', $id);
return response()->json(['message' => trans('admin::app.response.delete-success', ['name' => 'Attribute'])]);
} catch (\Exception $e) {}
@ -166,16 +177,18 @@ class AttributeController extends Controller
}
foreach ($indexes as $index) {
Event::dispatch('catalog.attribute.delete.before', $index);
$this->attributeRepository->delete($index);
Event::dispatch('catalog.attribute.delete.after', $index);
}
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
return redirect()->back();
} else {
session()->flash('error', trans('admin::app.datagrid.mass-ops.method-error'));
return redirect()->back();
}
return redirect()->back();
}
}

View File

@ -2,6 +2,7 @@
namespace Webkul\Attribute\Http\Controllers;
use Illuminate\Support\Facades\Event;
use Webkul\Admin\DataGrids\AttributeFamilyDataGrid;
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
use Webkul\Attribute\Repositories\AttributeRepository;
@ -53,9 +54,9 @@ class AttributeFamilyController extends Controller
{
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOneByField('code', 'default');
$custom_attributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
$customAttributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
return view($this->_config['view'], compact('custom_attributes', 'attributeFamily'));
return view($this->_config['view'], compact('attributeFamily', 'customAttributes'));
}
/**
@ -70,8 +71,12 @@ class AttributeFamilyController extends Controller
'name' => 'required',
]);
Event::dispatch('catalog.attribute_family.create.before');
$attributeFamily = $this->attributeFamilyRepository->create(request()->all());
Event::dispatch('catalog.attribute_family.create.after', $attributeFamily);
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Family']));
return redirect()->route($this->_config['redirect']);
@ -87,9 +92,9 @@ class AttributeFamilyController extends Controller
{
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOrFail($id, ['*']);
$custom_attributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
$customAttributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
return view($this->_config['view'], compact('attributeFamily', 'custom_attributes'));
return view($this->_config['view'], compact('attributeFamily', 'customAttributes'));
}
/**
@ -105,8 +110,12 @@ class AttributeFamilyController extends Controller
'name' => 'required',
]);
Event::dispatch('catalog.attribute_family.update.before', $id);
$attributeFamily = $this->attributeFamilyRepository->update(request()->all(), $id);
Event::dispatch('catalog.attribute_family.update.after', $attributeFamily);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Family']));
return redirect()->route($this->_config['redirect']);
@ -135,8 +144,12 @@ class AttributeFamilyController extends Controller
}
try {
Event::dispatch('catalog.attribute_family.delete.before', $id);
$this->attributeFamilyRepository->delete($id);
Event::dispatch('catalog.attribute_family.delete.after', $id);
return response()->json([
'message' => trans('admin::app.response.delete-success', ['name' => 'Family']),
]);
@ -161,9 +174,13 @@ class AttributeFamilyController extends Controller
if (request()->isMethod('delete')) {
$indexes = explode(',', request()->input('indexes'));
foreach ($indexes as $key => $value) {
foreach ($indexes as $index) {
try {
$this->attributeFamilyRepository->delete($value);
Event::dispatch('catalog.attribute_family.delete.before', $index);
$this->attributeFamilyRepository->delete($index);
Event::dispatch('catalog.attribute_family.delete.after', $index);
} catch (\Exception $e) {
report($e);
$suppressFlash = true;

View File

@ -56,8 +56,8 @@ class Attribute extends TranslatableModel implements AttributeContract
public function scopeFilterableAttributes(Builder $query): Builder
{
return $query->where('is_filterable', 1)
->where('swatch_type', '<>', 'image')
->orderBy('position');
->where('swatch_type', '<>', 'image')
->orderBy('position');
}
/**

View File

@ -27,10 +27,10 @@ class AttributeFamily extends Model implements AttributeFamilyContract
public function custom_attributes()
{
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)
->select('attributes.*');
->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)
->select('attributes.*');
}

View File

@ -17,7 +17,7 @@ class AttributeGroup extends Model implements AttributeGroupContract
public function custom_attributes()
{
return $this->belongsToMany(AttributeProxy::modelClass(), 'attribute_group_mappings')
->withPivot('position')
->orderBy('pivot_position', 'asc');
->withPivot('position')
->orderBy('pivot_position', 'asc');
}
}

View File

@ -2,37 +2,37 @@
namespace Webkul\Attribute\Repositories;
use Illuminate\Container\Container;
use Illuminate\Support\Str;
use Webkul\Core\Eloquent\Repository;
use Illuminate\Support\Facades\Event;
use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Attribute\Repositories\AttributeGroupRepository;
use Illuminate\Container\Container as App;
use Illuminate\Support\Str;
class AttributeFamilyRepository extends Repository
{
/**
* Create a new controller instance.
* Create a new repository instance.
*
* @param \Webkul\Attribute\Repositories\AttributeRepository $attributeRepository
* @param \Webkul\Attribute\Repositories\AttributeGroupRepository $attributeGroupRepository
* @param \Illuminate\Container\Container $container
* @return void
*/
public function __construct(
protected AttributeRepository $attributeRepository,
protected AttributeGroupRepository $attributeGroupRepository,
App $app
Container $container
)
{
parent::__construct($app);
parent::__construct($container);
}
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\Attribute\Contracts\AttributeFamily';
}
@ -43,8 +43,6 @@ class AttributeFamilyRepository extends Repository
*/
public function create(array $data)
{
Event::dispatch('catalog.attribute_family.create.before');
$attributeGroups = isset($data['attribute_groups']) ? $data['attribute_groups'] : [];
unset($data['attribute_groups']);
@ -69,8 +67,6 @@ class AttributeFamilyRepository extends Repository
}
}
Event::dispatch('catalog.attribute_family.create.after', $family);
return $family;
}
@ -83,9 +79,7 @@ class AttributeFamilyRepository extends Repository
public function update(array $data, $id, $attribute = "id")
{
$family = $this->find($id);
Event::dispatch('catalog.attribute_family.update.before', $id);
$family->update($data);
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
@ -136,8 +130,6 @@ class AttributeFamilyRepository extends Repository
$this->attributeGroupRepository->delete($attributeGroupId);
}
Event::dispatch('catalog.attribute_family.update.after', $family);
return $family;
}
@ -166,17 +158,4 @@ class AttributeFamilyRepository extends Repository
return $trimmed;
}
/**
* @param int $id
* @return void
*/
public function delete($id)
{
Event::dispatch('catalog.attribute_family.delete.before', $id);
parent::delete($id);
Event::dispatch('catalog.attribute_family.delete.after', $id);
}
}

View File

@ -10,9 +10,9 @@ class AttributeGroupRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\Attribute\Contracts\AttributeGroup';
}

View File

@ -10,9 +10,9 @@ class AttributeOptionRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\Attribute\Contracts\AttributeOption';
}

View File

@ -6,13 +6,12 @@ use Webkul\Core\Eloquent\Repository;
class AttributeOptionTranslationRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\Attribute\Contracts\AttributeOptionTranslation';
}

View File

@ -2,8 +2,7 @@
namespace Webkul\Attribute\Repositories;
use Illuminate\Container\Container as App;
use Illuminate\Support\Facades\Event;
use Illuminate\Container\Container;
use Webkul\Attribute\Repositories\AttributeOptionRepository;
use Webkul\Core\Eloquent\Repository;
@ -13,22 +12,23 @@ class AttributeRepository extends Repository
* Create a new repository instance.
*
* @param \Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository
* @param \Illuminate\Container\Container $container
* @return void
*/
public function __construct(
protected AttributeOptionRepository $attributeOptionRepository,
App $app
Container $container
)
{
parent::__construct($app);
parent::__construct($container);
}
/**
* Specify model class name.
*
* @return mixed
* @return string
*/
public function model()
public function model(): string
{
return 'Webkul\Attribute\Contracts\Attribute';
}
@ -41,8 +41,6 @@ class AttributeRepository extends Repository
*/
public function create(array $data)
{
Event::dispatch('catalog.attribute.create.before');
$data = $this->validateUserInput($data);
$options = isset($data['options']) ? $data['options'] : [];
@ -62,8 +60,6 @@ class AttributeRepository extends Repository
}
}
Event::dispatch('catalog.attribute.create.after', $attribute);
return $attribute;
}
@ -81,23 +77,21 @@ class AttributeRepository extends Repository
$attribute = $this->find($id);
Event::dispatch('catalog.attribute.update.before', $id);
$data['enable_wysiwyg'] = ! isset($data['enable_wysiwyg']) ? 0 : 1;
$data['enable_wysiwyg'] = isset($data['enable_wysiwyg']);
$attribute->update($data);
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
if (isset($data['options'])) {
foreach ($data['options'] as $optionId => $optionInputs) {
$isNew = $optionInputs['isNew'] == 'true' ? true : false;
$isNew = $optionInputs['isNew'] == 'true';
if ($isNew) {
$this->attributeOptionRepository->create(array_merge([
'attribute_id' => $attribute->id,
], $optionInputs));
} else {
$isDelete = $optionInputs['isDelete'] == 'true' ? true : false;
$isDelete = $optionInputs['isDelete'] == 'true';
if ($isDelete) {
$this->attributeOptionRepository->delete($optionId);
@ -109,26 +103,9 @@ class AttributeRepository extends Repository
}
}
Event::dispatch('catalog.attribute.update.after', $attribute);
return $attribute;
}
/**
* Delete attribute.
*
* @param int $id
* @return void
*/
public function delete($id)
{
Event::dispatch('catalog.attribute.delete.before', $id);
parent::delete($id);
Event::dispatch('catalog.attribute.delete.after', $id);
}
/**
* Validate user input.
*
@ -260,29 +237,18 @@ class AttributeRepository extends Repository
foreach ($attributes as $key => $attribute) {
if (
$attribute->code != 'tax_category_id'
&& ($attribute->type == 'select'
|| $attribute->type == 'multiselect'
|| $attribute->code == 'sku')
&& (
in_array($attribute->type ,['select', 'multiselect'])
|| $attribute->code == 'sku'
)
) {
if ($attribute->options()->exists()) {
array_push($trimmed, [
'id' => $attribute->id,
'name' => $attribute->admin_name,
'type' => $attribute->type,
'code' => $attribute->code,
'has_options' => true,
'options' => $attribute->options,
]);
} else {
array_push($trimmed, [
'id' => $attribute->id,
'name' => $attribute->admin_name,
'type' => $attribute->type,
'code' => $attribute->code,
'has_options' => false,
'options' => null,
]);
}
array_push($trimmed, [
'id' => $attribute->id,
'name' => $attribute->admin_name,
'type' => $attribute->type,
'code' => $attribute->code,
'options' => $attribute->options,
]);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -37,7 +37,15 @@ class Booking
/**
* @return array
*/
protected $daysOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
protected $daysOfWeek = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
];
/**
* Create a new helper instance.
@ -95,7 +103,7 @@ class Booking
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
$availabileDays = $this->getAvailableWeekDays($bookingProduct);
$availableDays = $this->getAvailableWeekDays($bookingProduct);
foreach ($this->daysOfWeek as $index => $isOpen) {
$slots = [];
@ -106,7 +114,7 @@ class Booking
$slotsByDays[] = [
'name' => trans($this->daysOfWeek[$index]),
'slots' => isset($availabileDays[$index]) ? $this->conver24To12Hours($slots) : [],
'slots' => isset($availableDays[$index]) ? $this->conver24To12Hours($slots) : [],
];
}
@ -128,8 +136,8 @@ class Booking
}
return count($slots)
? implode(' | ', $slots)
: '<span class="text-danger">' . trans('bookingproduct::app.shop.products.closed') . '</span>';
? implode(' | ', $slots)
: '<span class="text-danger">' . trans('bookingproduct::app.shop.products.closed') . '</span>';
}
/**
@ -162,15 +170,16 @@ class Booking
$currentTime = Carbon::now();
$availableFrom = ! $bookingProduct->available_from && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = ! $bookingProduct->available_from && $bookingProduct->available_to
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
for ($i = 0; $i < 7; $i++) {
$date = clone $currentTime;
$date->addDays($i);
if (
@ -221,6 +230,7 @@ class Booking
foreach ($slots as $index => $slot) {
$slots[$index]['from'] = Carbon::createFromTimeString($slot['from'])->format("h:i a");
$slots[$index]['to'] = Carbon::createFromTimeString($slot['to'])->format("h:i a");
}
@ -250,16 +260,16 @@ class Booking
$requestedDate = Carbon::createFromTimeString($date . " 00:00:00");
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
$timeDurations = $bookingProductSlot->same_slot_all_days
? $bookingProductSlot->slots
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
? $bookingProductSlot->slots
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
if (
$requestedDate < $availableFrom
@ -387,7 +397,7 @@ class Booking
return $slot['timestamp'] == $cartItem['additional']['booking']['slot'];
});
return count($filtered) ? false : true;
return ! count($filtered);
}
/**
@ -399,12 +409,12 @@ class Booking
$timestamps = explode('-', $data['additional']['booking']['slot']);
$result = $this->bookingRepository->getModel()
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
->where('bookings.product_id', $data['product_id'])
->where('bookings.from', $timestamps[0])
->where('bookings.to', $timestamps[1])
->first();
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
->where('bookings.product_id', $data['product_id'])
->where('bookings.from', $timestamps[0])
->where('bookings.to', $timestamps[1])
->first();
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
}
@ -576,10 +586,6 @@ class Booking
*/
public function isCartItemInactive(\Webkul\Checkout\Contracts\CartItem $item): bool
{
if ($item->product->status === 0) {
return true;
}
return false;
return ! $item->product->status;
}
}

View File

@ -12,7 +12,7 @@ class DefaultSlot extends Booking
protected $daysOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
/**
* Returns slots for a perticular day
* Returns slots for a particular day
*
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
* @param string $date
@ -34,12 +34,12 @@ class DefaultSlot extends Booking
$currentTime = Carbon::now();
$availableFrom = $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = $bookingProduct->available_to
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
if (
$requestedDate < $availableFrom
@ -51,8 +51,8 @@ class DefaultSlot extends Booking
$slots = [];
return $bookingProductSlot->booking_type == 'one'
? $this->getOneBookingForManyDaysSlots($bookingProductSlot, $requestedDate)
: $this->getManyBookingsforOneDaySlots($bookingProductSlot, $requestedDate);
? $this->getOneBookingForManyDaysSlots($bookingProductSlot, $requestedDate)
: $this->getManyBookingsForOneDaySlots($bookingProductSlot, $requestedDate);
}
/**
@ -98,19 +98,19 @@ class DefaultSlot extends Booking
* @param string $requestedDate
* @return array
*/
public function getManyBookingsforOneDaySlots($bookingProductSlot, $requestedDate)
public function getManyBookingsForOneDaySlots($bookingProductSlot, $requestedDate)
{
$bookingProduct = $bookingProductSlot->booking_product;
$currentTime = Carbon::now();
$availableFrom = $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = $bookingProduct->available_to
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
$timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];

View File

@ -91,11 +91,11 @@ class EventTicket extends Booking
public function getBookedQuantity($data)
{
$result = $this->bookingRepository->getModel()
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
->where('bookings.product_id', $data['product_id'])
->where('bookings.booking_product_event_ticket_id', $data['additional']['booking']['ticket_id'])
->first();
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
->where('bookings.product_id', $data['product_id'])
->where('bookings.booking_product_event_ticket_id', $data['additional']['booking']['ticket_id'])
->first();
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
}
@ -114,6 +114,7 @@ class EventTicket extends Booking
$ticket = $bookingProduct->event_tickets()->find($product['additional']['booking']['ticket_id']);
$price = $ticket->price;
if ($this->isInSale($ticket)) {
$price = $ticket->special_price;
}
@ -186,7 +187,15 @@ class EventTicket extends Booking
{
return $ticket->special_price !== null
&& $ticket->special_price > 0.0
&& ($ticket->special_price_from === null || $ticket->special_price_from === '0000-00-00 00:00:00' || $ticket->special_price_from <= Carbon::now())
&& ($ticket->special_price_to === null || $ticket->special_price_to === '0000-00-00 00:00:00' || $ticket->special_price_to > Carbon::now());
&& (
$ticket->special_price_from === null
|| $ticket->special_price_from === '0000-00-00 00:00:00'
|| $ticket->special_price_from <= Carbon::now()
)
&& (
$ticket->special_price_to === null
|| $ticket->special_price_to === '0000-00-00 00:00:00'
|| $ticket->special_price_to > Carbon::now()
);
}
}

View File

@ -33,16 +33,16 @@ class RentalSlot extends Booking
$currentTime = Carbon::now();
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
$timeDurations = $bookingProductSlot->same_slot_all_days
? $bookingProductSlot->slots
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
? $bookingProductSlot->slots
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
if (
$requestedDate < $availableFrom
@ -139,18 +139,18 @@ class RentalSlot extends Booking
}
$result = $this->bookingRepository->getModel()
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
->where('bookings.product_id', $data['product_id'])
->where(function ($query) use($from, $to) {
$query->where(function ($query) use($from) {
$query->where('bookings.from', '<=', $from)->where('bookings.to', '>=', $from);
})
->orWhere(function($query) use($to) {
$query->where('bookings.from', '<=', $to)->where('bookings.to', '>=', $to);
});
})
->first();
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
->where('bookings.product_id', $data['product_id'])
->where(function ($query) use($from, $to) {
$query->where(function ($query) use($from) {
$query->where('bookings.from', '<=', $from)->where('bookings.to', '>=', $from);
})
->orWhere(function($query) use($to) {
$query->where('bookings.from', '<=', $to)->where('bookings.to', '>=', $to);
});
})
->first();
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
}
@ -187,12 +187,12 @@ class RentalSlot extends Booking
$requestedToDate = Carbon::createFromTimeString($cartItem['additional']['booking']['date_to'] . " 23:59:59");
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from->format('Y-m-d') . ' 00:00:00')
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
? Carbon::createFromTimeString($bookingProduct->available_from->format('Y-m-d') . ' 00:00:00')
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
: Carbon::createFromTimeString('2080-01-01 00:00:00');
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
: Carbon::createFromTimeString('2080-01-01 00:00:00');
if (
$requestedFromDate < $availableFrom

View File

@ -45,12 +45,12 @@ class BookingController extends Controller
{
if (request('view_type')) {
$startDate = request()->get('startDate')
? Carbon::createFromTimeString(request()->get('startDate') . " 00:00:01")
: Carbon::now()->startOfWeek()->format('Y-m-d H:i:s');
? Carbon::createFromTimeString(request()->get('startDate') . " 00:00:01")
: Carbon::now()->startOfWeek()->format('Y-m-d H:i:s');
$endDate = request()->get('endDate')
? Carbon::createFromTimeString(request()->get('endDate') . " 23:59:59")
: Carbon::now()->endOfWeek()->format('Y-m-d H:i:s');
? Carbon::createFromTimeString(request()->get('endDate') . " 23:59:59")
: Carbon::now()->endOfWeek()->format('Y-m-d H:i:s');
$bookings = $this->bookingRepository->getBookings([strtotime($startDate), strtotime($endDate)])
->map(function ($booking) {

View File

@ -21,11 +21,11 @@ class BookingProductController extends Controller
* Create a new controller instance.
*
* @param \Webkul\BookingProduct\Repositories\BookingProductRepository $bookingProductRepository
* @param \Webkul\BookingProduct\Helpers\DefaultSlot $defaultSlotHelper
* @param \Webkul\BookingProduct\Helpers\AppointmentSlot $appointmentSlotHelper
* @param \Webkul\BookingProduct\Helpers\RentalSlot $rentalSlotHelper
* @param \Webkul\BookingProduct\Helpers\EventTicket $EventTicketHelper
* @param \Webkul\BookingProduct\Helpers\TableSlot $tableSlotHelper
* @param \Webkul\BookingProduct\Helpers\DefaultSlot $defaultSlotHelper
* @param \Webkul\BookingProduct\Helpers\AppointmentSlot $appointmentSlotHelper
* @param \Webkul\BookingProduct\Helpers\RentalSlot $rentalSlotHelper
* @param \Webkul\BookingProduct\Helpers\EventTicket $EventTicketHelper
* @param \Webkul\BookingProduct\Helpers\TableSlot $tableSlotHelper
* @return void
*/
public function __construct(

View File

@ -9,9 +9,9 @@ class BookingProductAppointmentSlotRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\BookingProductAppointmentSlot';
}

View File

@ -9,9 +9,9 @@ class BookingProductDefaultSlotRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\BookingProductDefaultSlot';
}

View File

@ -11,17 +11,16 @@ class BookingProductEventTicketRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\BookingProductEventTicket';
}
/**
* @param array $data
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
*
* @param array $data
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
* @return void
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/

View File

@ -9,9 +9,9 @@ class BookingProductRentalSlotRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\BookingProductRentalSlot';
}

View File

@ -2,7 +2,7 @@
namespace Webkul\BookingProduct\Repositories;
use Illuminate\Container\Container as App;
use Illuminate\Container\Container;
use Carbon\Carbon;
use Webkul\Core\Eloquent\Repository;
@ -21,6 +21,7 @@ class BookingProductRepository extends Repository
* @param \Webkul\BookingProduct\Repositories\BookingProductEventTicketRepository $bookingProductEventTicketRepository
* @param \Webkul\BookingProduct\Repositories\BookingProductRentalSlotRepository $bookingProductRentalSlotRepository
* @param \Webkul\BookingProduct\Repositories\BookingProductTableSlotRepository $bookingProductTableSlotRepository
* @param \Illuminate\Container\Container $container
* @return void
*/
public function __construct(
@ -29,10 +30,10 @@ class BookingProductRepository extends Repository
BookingProductEventTicketRepository $bookingProductEventTicketRepository,
BookingProductRentalSlotRepository $bookingProductRentalSlotRepository,
BookingProductTableSlotRepository $bookingProductTableSlotRepository,
App $app
Container $container
)
{
parent::__construct($app);
parent::__construct($container);
$this->typeRepositories['default'] = $bookingProductDefaultSlotRepository;
@ -48,9 +49,9 @@ class BookingProductRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\BookingProduct';
}

View File

@ -9,9 +9,9 @@ class BookingProductTableSlotRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\BookingProductTableSlot';
}

View File

@ -2,7 +2,6 @@
namespace Webkul\BookingProduct\Repositories;
use Illuminate\Container\Container as App;
use Illuminate\Support\Facades\Event;
use Carbon\Carbon;
use Webkul\Core\Eloquent\Repository;
@ -12,9 +11,9 @@ class BookingRepository extends Repository
/**
* Specify Model class name
*
* @return mixed
* @return string
*/
function model()
function model(): string
{
return 'Webkul\BookingProduct\Contracts\Booking';
}

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