Merge branch 'master' of https://github.com/bagisto/bagisto into sarga-v1

 Conflicts:
	composer.json
	composer.lock
	packages/Webkul/Product/src/Listeners/ProductFlat.php
	packages/Webkul/Velocity/src/Http/Controllers/Shop/ShopController.php
This commit is contained in:
merdan 2022-07-25 16:09:17 +05:00
commit ae72375120
264 changed files with 2745 additions and 1356 deletions

View File

@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1']
php-versions: ['8.1']
name: PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-system }}
services:

View File

@ -14,6 +14,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\Illuminate\Http\Middleware\HandleCors::class,
\Webkul\Core\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,

View File

@ -8,15 +8,14 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.0.2",
"php": "^8.1",
"astrotomic/laravel-translatable": "^11.0.0",
"babenkoivan/elastic-scout-driver": "^2.0",
"bagisto/legacy-api": "^1.0",
"bagisto/rest-api": "dev-master",
"bagistobrasil/bagisto-product-social-share": "^0.1.2",
"barryvdh/laravel-debugbar": "^3.1",
"barryvdh/laravel-dompdf": "^1.0.0",
"beyondcode/laravel-websockets": "^1.13",
"barryvdh/laravel-dompdf": "^2.0.0",
"diglactic/laravel-breadcrumbs": "^7.0",
"doctrine/dbal": "^2.9",
"enshrined/svg-sanitize": "^0.15.0",
@ -112,8 +111,7 @@
"Sarga\\API\\": "packages/Sarga/API",
"Sarga\\Admin\\": "packages/Sarga/Admin/src",
"Sarga\\Brand\\": "packages/Sarga/Brand/src",
"Sarga\\Payment\\": "packages/Sarga/Payment",
"Webkul\\suggestion\\": "packages/Webkul/suggestion/src"
"Sarga\\Payment\\": "packages/Sarga/Payment"
}
},
"autoload-dev": {

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Facade;
return [
/*
@ -304,64 +306,20 @@ return [
|
*/
'aliases' => [
/**
* Laravel
*
* Place your aliases in alphabetical order.
*/
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
/**
* Bagisto
*
* Place your aliases in alphabetical order.
*/
'aliases' => Facade::defaultAliases()->merge([
'Captcha' => Webkul\Customer\Facades\Captcha::class,
'Cart' => Webkul\Checkout\Facades\Cart::class,
'Concord' => Konekt\Concord\Facades\Concord::class,
'Core' => Webkul\Core\Facades\Core::class,
'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class,
'DbView' => Flynsarmy\DbBladeCompiler\Facades\DbView::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Helper' => Konekt\Concord\Facades\Helper::class,
'Image' => Intervention\Image\Facades\Image::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
'ProductImage' => Webkul\Product\Facades\ProductImage::class,
'ProductVideo' => Webkul\Product\Facades\ProductVideo::class,
],
'Redis' => Illuminate\Support\Facades\Redis::class,
])->toArray(),
];

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

@ -173,7 +173,7 @@ class CartRuleDataGrid extends DataGrid
'closure' => function ($value) {
if ($value->status == 1) {
return trans('admin::app.datagrid.active');
} else if ($value->status == 0) {
} elseif ($value->status == 0) {
return trans('admin::app.datagrid.inactive');
} else {
return trans('admin::app.datagrid.draft');

View File

@ -70,9 +70,9 @@ class EmailTemplateDataGrid extends DataGrid
'closure' => function ($value) {
if ($value->status == 'active') {
return trans('admin::app.datagrid.active');
} else if ($value->status == 'inactive') {
} elseif ($value->status == 'inactive') {
return trans('admin::app.datagrid.inactive');
} else if ($value->status == 'draft') {
} elseif ($value->status == 'draft') {
return trans('admin::app.datagrid.draft');
}
},

View File

@ -97,10 +97,29 @@ class ConfigurationController extends Controller
* Store a newly created resource in storage.
*
* @param \Webkul\Admin\Http\Requests\ConfigurationForm $request
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\RedirectResponse
*/
public function store(ConfigurationForm $request)
{
$data = $request->request->all();
if (isset($data['sales']['carriers'])) {
$atLeastOneCarrierEnabled = false;
foreach ($data['sales']['carriers'] as $carrier) {
if ($carrier['active']) {
$atLeastOneCarrierEnabled = true;
break;
}
}
if (! $atLeastOneCarrierEnabled) {
session()->flash('error', trans('admin::app.configuration.enable-atleast-one-shipping'));
return redirect()->back();
}
}
$this->coreConfigRepository->create($request->except(['_token', 'admin_locale']));
session()->flash('success', trans('admin::app.configuration.save-message'));

View File

@ -115,7 +115,7 @@ class RefundController extends Controller
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Refund']));
return redirect()->route($this->_config['redirect'], $orderId);
return redirect()->route($this->_config['redirect']);
}
/**

View File

@ -26,7 +26,8 @@ class ConfigurationForm extends FormRequest
{
$this->rules = [];
if (request()->has('catalog.products.storefront.products_per_page')
if (
request()->has('catalog.products.storefront.products_per_page')
&& ! empty(request()->input('catalog.products.storefront.products_per_page'))
) {
$this->rules = [
@ -34,7 +35,8 @@ class ConfigurationForm extends FormRequest
];
}
if (request()->has('general.design.admin_logo.logo_image')
if (
request()->has('general.design.admin_logo.logo_image')
&& ! request()->input('general.design.admin_logo.logo_image.delete')
) {
$this->rules = array_merge($this->rules, [
@ -42,7 +44,8 @@ class ConfigurationForm extends FormRequest
]);
}
if (request()->has('general.design.admin_logo.favicon')
if (
request()->has('general.design.admin_logo.favicon')
&& ! request()->input('general.design.admin_logo.favicon.delete')
) {
$this->rules = array_merge($this->rules, [
@ -50,7 +53,8 @@ class ConfigurationForm extends FormRequest
]);
}
if (request()->has('sales.invoice_setttings.invoice_slip_design.logo')
if (
request()->has('sales.invoice_setttings.invoice_slip_design.logo')
&& ! request()->input('sales.invoice_setttings.invoice_slip_design.logo.delete')
) {
$this->rules = array_merge($this->rules, [

View File

@ -94,10 +94,16 @@ class AdminServiceProvider extends ServiceProvider
continue;
}
if ($index + 1 < count(config('menu.admin')) && $permissionType != 'all') {
if (
$index + 1 < count(config('menu.admin'))
&& $permissionType != 'all'
) {
$permission = config('menu.admin')[$index + 1];
if (substr_count($permission['key'], '.') == 2 && substr_count($item['key'], '.') == 1) {
if (
substr_count($permission['key'], '.') == 2
&& substr_count($item['key'], '.') == 1
) {
foreach ($allowedPermissions as $key => $value) {
if ($item['key'] == $value) {
$neededItem = $allowedPermissions[$key + 1];

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

@ -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

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

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes',
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -732,6 +732,7 @@ return [
'yes' => 'Ja',
'no' => 'Nein',
'delete' => 'Löschen',
'enable-atleast-one-shipping' => 'Aktivieren Sie mindestens eine Versandart.',
'tax-categories' =>
[
'title' => 'Steuerkategorien',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes',
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

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

View File

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

View File

@ -7,7 +7,7 @@ return [
'create' => 'Créer',
'update' => 'Mettre à jour',
'delete' => 'Effacer',
'failed' => 'Manqué',
'failed' => 'Erreur',
'store' => 'Magasin',
'image' => 'Image',
'no result' => 'Pas de résultat',
@ -35,7 +35,7 @@ return [
'category' => 'Catégorie',
'common' => [
'no-result-found' => 'Nous n\'avons pu trouver aucun enregistrement.',
'no-result-found' => 'Nous n\'avons pu trouver aucun résultat',
'country' => 'Pays',
'state' => 'État',
'true' => 'Vrai',
@ -49,16 +49,16 @@ return [
'visit-shop' => 'Visiter la boutique',
'dashboard' => 'Tableau de bord',
'sales' => 'Ventes',
'orders' => 'Ordres',
'orders' => 'Commandes',
'shipments' => 'Expéditions',
'invoices' => 'Factures',
'refunds' => 'Remboursements',
'catalog' => 'Catalogue',
'products' => 'Des produits',
'products' => 'Produits',
'categories' => 'Catégories',
'attributes' => 'Les attributs',
'attributes' => 'Ättributs',
'attribute-families' => 'Familles d\'attributs',
'customers' => 'Les clients',
'customers' => 'Clients',
'groups' => 'Groupes',
'reviews' => 'Commentaires',
'configure' => 'Configurer',
@ -69,11 +69,11 @@ return [
'inventory-sources' => 'Sources d\'inventaire',
'channels' => 'Canaux',
'users' => 'Utilisateurs',
'roles' => 'Les rôles',
'sliders' => 'Curseurs',
'roles' => 'Rôles',
'sliders' => 'Panneaux défilants',
'taxes' => 'Impôts',
'tax-categories' => 'Catégories de taxes',
'tax-rates' => 'Les taux d\'imposition',
'tax-rates' => 'Taux d\'imposition',
'marketing' => 'Commercialisation',
'promotions' => 'Promotions',
'email-marketing' => 'Publicité par e-mail',
@ -93,19 +93,19 @@ return [
'dashboard' => 'Tableau de bord',
'sales' => 'Ventes',
'cancel' => 'Annuler',
'orders' => 'Ordres',
'orders' => 'Commandes',
'shipments' => 'Expéditions',
'invoices' => 'Factures',
'refunds' => 'Remboursements',
'catalog' => 'Catalogue',
'products' => 'Des produits',
'products' => 'Produits',
'copy' => 'Copie',
'categories' => 'Catégories',
'attributes' => 'Les attributs',
'attributes' => 'Attributs',
'attribute-families' => 'Familles d\'attributs',
'customers' => 'Les clients',
'customers' => 'Clients',
'addresses' => 'Adresses',
'note' => 'Noter',
'note' => 'Notes',
'groups' => 'Groupes',
'reviews' => 'Commentaires',
'configure' => 'Configurer',
@ -116,8 +116,8 @@ return [
'inventory-sources' => 'Sources d\'inventaire',
'channels' => 'Canaux',
'users' => 'Utilisateurs',
'roles' => 'Les rôles',
'sliders' => 'Curseurs',
'roles' => 'Rôles',
'sliders' => 'Panneaux défilants',
'taxes' => 'Impôts',
'tax-categories' => 'Catégories de taxes',
'tax-rates' => 'Les taux d\'imposition',
@ -125,12 +125,12 @@ return [
'edit' => 'Éditer',
'create' => 'Ajouter',
'delete' => 'Effacer',
'mass-delete' => 'Suppression en masse',
'mass-update' => 'Mise à jour de masse',
'mass-delete' => 'Suppression multiple',
'mass-update' => 'Mise à jour multiple',
'marketing' => 'Commercialisation',
'promotions' => 'Promotions',
'cart-rules' => 'Règles du panier',
'catalog-rules' => 'Règles du catalogue',
'cart-rules' => 'Paramètres du panier',
'catalog-rules' => 'Paramètres du catalogue',
'email-marketing' => 'Publicité par e-mail',
'email-templates' => 'Modèles d\'e-mails',
'campaigns' => 'Campagnes',
@ -146,8 +146,8 @@ return [
'to' => 'À',
'total-customers' => 'Clients totaux',
'total-orders' => 'Total des commandes',
'total-sale' => 'Vente totale',
'average-sale' => 'Vente de commande moyenne',
'total-sale' => 'Ventes totales',
'average-sale' => 'Prix moyen d\'une commande',
'total-unpaid-invoices' => 'Total des factures impayées',
'increased' => ':progress%',
'decreased' => ':progress%',
@ -165,7 +165,7 @@ return [
'datagrid' => [
'mass-ops' => [
'method-error' => 'Erreur! Mauvaise méthode détectée, veuillez vérifier la configuration de l\'action de masse',
'method-error' => 'Une erreur est survenue. Mauvaise configuration détectée, veuillez vérifier la configuration de l\'action multiple',
'delete-success' => 'Sélectionné :resource a été supprimée avec succès',
'partial-action' => 'Certaines actions n\'ont pas été effectuées en raison de contraintes système restreintes sur :resource',
'update-success' => 'Sélectionné :resource a été mise à jour avec succès',
@ -186,17 +186,17 @@ return [
'per-locale' => 'Basé sur les paramètres régionaux',
'per-channel' => 'Basé sur le canal',
'position' => 'Positionner',
'locale' => 'Lieu',
'locale' => 'Langue',
'hostname' => 'Nom d\'hôte',
'email' => 'E-mail',
'group' => 'Grouper',
'phone' => 'Téléphoner',
'group' => 'Groupe',
'phone' => 'Téléphone',
'gender' => 'Genre',
'title' => 'Titre',
'layout' => 'Mise en page',
'url-key' => 'Clé URL',
'comment' => 'Commenter',
'product-name' => 'Produit',
'product-name' => 'Nom du produit',
'currency-name' => 'Nom de la devise',
'exch-rate' => 'Taux de change',
'priority' => 'Priorité',
@ -206,8 +206,8 @@ return [
'order-date' => 'Date de commande',
'channel-name' => 'Nom du canal',
'billed-to' => 'Facturé à',
'shipped-to' => 'Expédiés à',
'order-id' => 'numéro de commande',
'shipped-to' => 'Expédié à',
'order-id' => 'Numéro de commande',
'invoice-id' => 'Numéro de facture',
'invoice-date' => 'Date de la facture',
'total-qty' => 'Quantité totale',
@ -222,13 +222,13 @@ return [
'identifier' => 'Identifiant',
'state' => 'État',
'country' => 'Pays',
'tax-rate' => 'Taux',
'tax-rate' => 'Taxes',
'role' => 'Rôle',
'sub-total' => 'Sous-total',
'no-of-products' => 'Nombre de produits',
'attribute-family' => 'Famille d\'attributs',
'starts-from' => 'Commence à partir de',
'ends-till' => 'Se termine jusqu\'à',
'ends-till' => 'Se termine à',
'per-cust' => 'Par client',
'usage-throttle' => 'Temps d\'utilisation',
'for-guest' => 'Pour les invités',
@ -236,7 +236,7 @@ return [
'refund-date' => 'date de remboursement',
'refunded' => 'Remboursé',
'start' => 'Démarrer',
'end' => 'Finir',
'end' => 'Terminer',
'active' => 'actif',
'inactive' => 'Inactif',
'draft' => 'Brouillon',
@ -246,7 +246,7 @@ return [
'pending' => 'En attente',
'disapproved' => 'Refusé',
'coupon-code' => 'Code de réduction',
'times-used' => 'Temps utilisés',
'times-used' => 'Utilisé',
'created-date' => 'Date de création',
'expiration-date' => 'Date d\'expiration',
'edit' => 'Éditer',
@ -254,10 +254,10 @@ return [
'view' => 'Vue',
'rtl' => 'RTL',
'ltr' => 'LTR',
'update-status' => 'État de mise à jour',
'subject' => 'Matière',
'update-status' => 'Statut de mise à jour',
'subject' => 'Sujet',
'date' => 'Date',
'transaction-id' => 'identifiant de transaction',
'transaction-id' => 'Identifiant de transaction',
'transaction-date' => 'Date de la transaction',
'file-name' => 'File Name',
'path' => 'Path',
@ -268,9 +268,9 @@ return [
'title' => 'Mon compte',
'save-btn-title' => 'Sauvegarder',
'general' => 'Général',
'upload-image-info' => 'Upload a Profile Image (100px x 100px) in PNG or JPG Format',
'remove-image' => 'Remove Image',
'image-upload-message' => 'Only images (.jpeg, .jpg, .png, ..) are allowed.',
'upload-image-info' => 'Uploadez une image de profil (100px x 100px) en PNG ou JPG.',
'remove-image' => 'Supprimer l\'image',
'image-upload-message' => 'Seulement les images (.jpeg, .jpg, .png, ..) sont autorisées.',
'name' => 'Nom',
'email' => 'E-mail',
'password' => 'Mot de passe',
@ -286,7 +286,7 @@ return [
'email' => 'Email enregistré',
'password' => 'Mot de passe',
'confirm-password' => 'Confirmez le mot de passe',
'back-link-title' => 'Retour à la connexion',
'back-link-title' => 'Retour à l\'écran de connexion',
'submit-btn-title' => 'Envoyer un e-mail de réinitialisation du mot de passe',
'passwords' => [
'throttled' => 'Avertissement : Vous avez récemment demandé la réinitialisation de votre mot de passe, veuillez vérifier votre messagerie.',
@ -294,16 +294,16 @@ return [
],
'reset-password' => [
'title' => 'réinitialiser le mot de passe',
'title' => 'Réinitialiser le mot de passe',
'email' => 'Email enregistré',
'password' => 'Mot de passe',
'confirm-password' => 'Confirmez le mot de passe',
'back-link-title' => 'Retour à la connexion',
'submit-btn-title' => 'réinitialiser le mot de passe',
'submit-btn-title' => 'Réinitialiser le mot de passe',
],
'roles' => [
'title' => 'Les rôles',
'title' => 'Rôles',
'add-role-title' => 'Ajouter un rôle',
'edit-role-title' => 'Modifier le rôle',
'save-btn-title' => 'Enregistrer le rôle',
@ -326,20 +326,20 @@ return [
'name' => 'Nom',
'password' => 'Mot de passe',
'confirm-password' => 'Confirmez le mot de passe',
'status-and-role' => 'Statut et rôle',
'status-and-role' => 'Statut et autorisations',
'role' => 'Rôle',
'status' => 'Statut',
'status' => 'Statut d\'activation',
'account-is-active' => 'Le compte est actif',
'current-password' => 'Saisissez le mot de passe actuel',
'confirm-delete' => 'Confirmer la suppression de ce compte',
'confirm-delete-title' => 'Confirmer le mot de passe avant de supprimer',
'delete-last' => 'Au moins un administrateur est requis.',
'delete-success' => 'Succès! Utilisateur supprimé',
'delete-success' => 'Utilisateur supprimé avec succès',
'incorrect-password' => 'Le mot de passe que vous avez entré est incorrect',
'password-match' => 'Le mot de passe actuel ne correspond pas.',
'account-save' => 'Les modifications du compte ont été enregistrées avec succès.',
'login-error' => 'Veuillez vérifier vos informations d\'identification et réessayer.',
'activate-warning' => 'Votre compte n\'est pas encore activé, veuillez contacter l\'administrateur.',
'activate-warning' => 'Votre compte n\'est pas encore activé, veuillez contacter un administrateur.',
],
'sessions' => [
@ -347,14 +347,14 @@ return [
'email' => 'E-mail',
'password' => 'Mot de passe',
'forget-password-link-title' => 'Mot de passe oublié ?',
'remember-me' => 'Souviens-toi de moi',
'remember-me' => 'Se souvenir de moi',
'submit-btn-title' => 'S\'identifier',
],
],
'sales' => [
'orders' => [
'title' => 'Ordres',
'title' => 'Commandes',
'view-title' => 'N° de commande :order_id',
'cancel-btn-title' => 'Annuler',
'shipment-btn-title' => 'Bateau',
@ -399,12 +399,12 @@ return [
'item-canceled' => 'Annulé (:qty_cancelled]',
'item-refunded' => 'Remboursé (:qty_refunded]',
'price' => 'Prix',
'total' => 'Le total',
'total' => 'Total',
'subtotal' => 'Total',
'shipping-handling' => 'Expédition et manutention',
'discount' => 'Rabais',
'tax' => 'Impôt',
'tax-percent' => 'Pourcentage d\'impôt',
'tax' => 'Imposition',
'tax-percent' => 'Pourcentage d\'imposition',
'tax-amount' => 'Montant de la taxe',
'discount-amount' => 'Montant de la remise',
'grand-total' => 'Total',
@ -436,9 +436,9 @@ return [
'action' => 'action',
'add-title' => 'Créer une facture',
'save-btn-title' => 'Enregistrer la facture',
'send-duplicate-invoice' => 'Send Duplicate Invoice',
'send' => 'Send',
'invoice-sent' => 'Invoice sent successfully!',
'send-duplicate-invoice' => 'Envoyez un duplicata',
'send' => 'Envoyer',
'invoice-sent' => 'Facture envoyée avec succès!',
'qty' => 'Qté',
'qty-ordered' => 'Qté commandée',
'qty-to-invoice' => 'Quantité à facturer',
@ -516,22 +516,22 @@ return [
'view-title' => 'N° de transaction :transaction_id',
'transaction-data' => 'Données de transaction',
'order-id' => 'numéro de commande',
'invoice-id' => 'Identifiant de la facture',
'invoice-id' => 'Numéro de facture',
'status' => 'Statut',
'created-at' => 'Créé à',
'transaction-details' => 'détails de la transaction',
'response' => [
'invoice-missing' => 'Cet identifiant de facture n\'existe pas',
'invoice-missing' => 'Ce numéro de facture n\'existe pas',
'transaction-saved' => 'La transaction a été enregistrée',
'already-paid' => 'Cette facture a déjà été payée',
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
'transaction-amount-exceeds' => 'Le montant de cette transaction dépasse le montant total de la facture.',
],
],
],
'catalog' => [
'products' => [
'title' => 'Des produits',
'title' => 'Produits',
'add-product-btn-title' => 'Ajouter un produit',
'add-title' => 'Ajouter un produit',
'edit-title' => 'Modifier le produit',
@ -539,12 +539,12 @@ return [
'general' => 'Général',
'product-type' => 'type de produit',
'type' => [
'simple' => 'Facile',
'booking' => 'réservation',
'bundle' => 'empaqueter',
'simple' => 'Simple',
'booking' => 'Réservation',
'bundle' => 'Bundle',
'downloadable' => 'téléchargeable',
'grouped' => 'groupé',
'virtual' => 'virtuelle',
'virtual' => 'Produit virtuel',
'configurable' => 'configurable',
],
@ -745,6 +745,7 @@ return [
'yes' => 'Oui',
'no' => 'Non',
'delete' => 'Effacer',
'enable-atleast-one-shipping' => 'Activez au moins une méthode d\'expédition.',
'tax-categories' => [
'title' => 'Catégories de taxes',
@ -1105,7 +1106,7 @@ return [
'orders' => [
'list' => 'liste des commandes de :customer_name',
'title' => 'Ordres',
'title' => 'Commandes',
],
],

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes',
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -742,6 +742,7 @@ return [
'yes' => 'हां',
'no' => 'नहीं',
'delete' => 'हटाएं',
'enable-atleast-one-shipping' => 'कम से कम एक शिपिंग विधि सक्षम करें।',
'tax-categories' => [
'title' => 'कर श्रेणियाँ',

View File

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

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes',
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

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

View File

@ -725,6 +725,7 @@ return [
'yes' => 'Tak',
'no' => 'Nie',
'delete' => 'Usuń',
'enable-atleast-one-shipping' => 'Włącz co najmniej jedną metodę wysyłki.',
'tax-categories' => [
'title' => 'Kategorie podatkowe',

View File

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

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes',
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Включите хотя бы один способ доставки.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes',
'no' => 'No',
'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [
'title' => 'Tax Categories',

View File

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

View File

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

View File

@ -215,21 +215,21 @@
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.controls.after', ['category' => $category]) !!}
</div>
</accordian>
<accordian title="{{ __('admin::app.catalog.categories.products') }}" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
<datagrid-plus src="{{ route('admin.catalog.categories.products', $category->id) }}"></datagrid-plus>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.after', ['category' => $category]) !!}
</div>
</div>
</form>
<div class="page-content">
<accordian title="{{ __('admin::app.catalog.categories.products') }}" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
<datagrid-plus src="{{ route('admin.catalog.categories.products', $category->id) }}"></datagrid-plus>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
</div>
</accordian>
</div>
</div>
@stop

View File

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

View File

@ -101,7 +101,10 @@
@foreach ($customAttributes as $attribute)
<?php
if ($attribute->code == 'guest_checkout' && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) {
if (
$attribute->code == 'guest_checkout'
&& ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')
) {
continue;
}
if($attribute->code=='brand'){
@ -119,12 +122,14 @@
}
if ($attribute->type == 'file') {
$retVal = (core()->getConfigData('catalog.products.attribute.file_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.file_attribute_upload_size') : '2048' ;
$retVal = (core()->getConfigData('catalog.products.attribute.file_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.file_attribute_upload_size') : '2048';
array_push($validations, 'size:' . $retVal);
}
if ($attribute->type == 'image') {
$retVal = (core()->getConfigData('catalog.products.attribute.image_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.image_attribute_upload_size') : '2048' ;
$retVal = (core()->getConfigData('catalog.products.attribute.image_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.image_attribute_upload_size') : '2048';
array_push($validations, 'size:' . $retVal . '|mimes:bmp,jpeg,jpg,png,webp');
}
@ -167,8 +172,8 @@
@include ($typeView)
<span class="control-error"
@if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')"
@else v-if="errors.has('{{ $attribute->code }}')" @endif>
@if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')"
@else v-if="errors.has('{{ $attribute->code }}')" @endif>
@if ($attribute->type == 'multiselect')
@{{ errors.first('{!! $attribute->code !!}[]') }}
@else

View File

@ -5,13 +5,14 @@
class="control"
id="{{ $attribute->code }}"
{{-- To Do (@devansh-webkul): Need to handle from the backend. --}}
@if ($attribute->code === 'sku')
v-validate="{ required: true, regex: /^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/ }"
@else
v-validate="'{{ $validations }}'"
@endif
data-vv-as="&quot;{{ $attribute->admin_name }}&quot;"
{{ in_array($attribute->code, ['url_key']) ? 'v-slugify' : '' }}
{{ $attribute->code == 'name' && ! $product[$attribute->code] ? 'v-slugify-target=\'url_key\'' : '' }}>
{{ $attribute->code == 'name' && ! $product->url_key ? 'v-slugify-target=\'url_key\'' : '' }}
>

View File

@ -66,7 +66,10 @@
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
@if (
core()->getConfigData('customer.settings.address.street_lines')
&& core()->getConfigData('customer.settings.address.street_lines') > 1
)
<div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}">

View File

@ -69,7 +69,10 @@
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
@if (
core()->getConfigData('customer.settings.address.street_lines')
&& core()->getConfigData('customer.settings.address.street_lines') > 1
)
<div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}" value="{{ isset($addresses[$i]) ? $addresses[$i] : '' }}">

View File

@ -67,8 +67,9 @@
methods: {
haveStates: function () {
if (this.countryStates[this.country] && this.countryStates[this.country].length)
if (this.countryStates[this.country] && this.countryStates[this.country].length) {
return true;
}
return false;
},

View File

@ -134,12 +134,11 @@
if (toggle) {
toggle.addEventListener("click", () => {
if (nav.classList.contains("is-active")) {
nav.classList.remove("is-active");
}
else {
nav.classList.add("is-active");
}
if (nav.classList.contains("is-active")) {
nav.classList.remove("is-active");
} else {
nav.classList.add("is-active");
}
});
nav.addEventListener("blur", () => {

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">

View File

@ -218,8 +218,9 @@
</div>
<div v-else>
<div class="control-group" v-if="matchedAttribute.type == 'text' || matchedAttribute.type == 'price' || matchedAttribute.type == 'decimal' || matchedAttribute.type == 'integer'">
<input class="control" :name="['conditions[' + index + '][value]']" v-model="condition.value"/>
<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"/>
<span class="control-error" v-if="errors.has('value')" v-text="errors.first('value')"></span>
</div>
<div class="control-group date" v-if="matchedAttribute.type == 'date'">

View File

@ -111,7 +111,10 @@
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">

View File

@ -139,7 +139,10 @@
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">

View File

@ -25,13 +25,19 @@
<div class="page-action">
{!! view_render_event('sales.order.page_action.before', ['order' => $order]) !!}
@if ($order->canCancel() && bouncer()->hasPermission('sales.orders.cancel'))
@if (
$order->canCancel()
&& bouncer()->hasPermission('sales.orders.cancel')
)
<a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'">
{{ __('admin::app.sales.orders.cancel-btn-title') }}
</a>
@endif
@if ($order->canInvoice() && $order->payment->method !== 'paypal_standard')
@if (
$order->canInvoice()
&& $order->payment->method !== 'paypal_standard'
)
<a href="{{ route('admin.sales.invoices.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.invoice-btn-title') }}
</a>
@ -139,7 +145,10 @@
{!! view_render_event('sales.order.customer_email.after', ['order' => $order]) !!}
@if (! is_null($order->customer) && ! is_null($order->customer->group))
@if (
! is_null($order->customer)
&& ! is_null($order->customer->group)
)
<div class="row">
<span class="title">
{{ __('admin::app.customers.customers.customer_group') }}
@ -159,7 +168,10 @@
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">

View File

@ -110,7 +110,10 @@
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">

View File

@ -107,7 +107,10 @@
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">

View File

@ -1,241 +1,244 @@
@extends('admin::layouts.master')
@section('page_title')
{{ __('admin::app.sales.shipments.add-title') }}
{{ __('admin::app.sales.shipments.add-title') }}
@stop
@section('content-wrapper')
<div class="content full-page">
<form method="POST" action="{{ route('admin.sales.shipments.store', $order->id) }}" @submit.prevent="onSubmit">
@csrf()
<div class="content full-page">
<form method="POST" action="{{ route('admin.sales.shipments.store', $order->id) }}" @submit.prevent="onSubmit">
@csrf()
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.shipments.index') }}'"></i>
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.shipments.index') }}'"></i>
{{ __('admin::app.sales.shipments.add-title') }}
</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.shipments.save-btn-title') }}
</button>
</div>
{{ __('admin::app.sales.shipments.add-title') }}
</h1>
</div>
<div class="page-content">
<div class="sale-container">
<accordian title="{{ __('admin::app.sales.orders.order-and-account') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.order-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.shipments.order-id') }}
</span>
<span class="value">
<a href="{{ route('admin.sales.orders.view', $order->id) }}">#{{ $order->increment_id }}</a>
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-date') }}
</span>
<span class="value">
{{ $order->created_at }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-status') }}
</span>
<span class="value">
{{ $order->status_label }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.channel') }}
</span>
<span class="value">
{{ $order->channel_name }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.account-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.customer-name') }}
</span>
<span class="value">
{{ $order->customer_full_name }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.email') }}
</span>
<span class="value">
{{ $order->customer_email }}
</span>
</div>
</div>
</div>
</div>
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">
@if ($order->billing_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.billing-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->billing_address])
</div>
</div>
@endif
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->shipping_address])
</div>
</div>
@endif
</div>
</div>
</accordian>
@endif
<accordian title="{{ __('admin::app.sales.orders.payment-and-shipping') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.payment-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.payment-method') }}
</span>
<span class="value">
{{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.currency') }}
</span>
<span class="value">
{{ $order->order_currency_code }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-method') }}
</span>
<span class="value">
{{ $order->shipping_title }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-price') }}
</span>
<span class="value">
{{ core()->formatBasePrice($order->base_shipping_amount) }}
</span>
</div>
<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">
<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>
</div>
</div>
</accordian>
<accordian title="{{ __('admin::app.sales.orders.products-ordered') }}" :active="true">
<div slot="body">
<order-item-list></order-item-list>
</div>
</accordian>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.shipments.save-btn-title') }}
</button>
</div>
</form>
</div>
</div>
<div class="page-content">
<div class="sale-container">
<accordian title="{{ __('admin::app.sales.orders.order-and-account') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.order-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.shipments.order-id') }}
</span>
<span class="value">
<a href="{{ route('admin.sales.orders.view', $order->id) }}">#{{ $order->increment_id }}</a>
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-date') }}
</span>
<span class="value">
{{ $order->created_at }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-status') }}
</span>
<span class="value">
{{ $order->status_label }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.channel') }}
</span>
<span class="value">
{{ $order->channel_name }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.account-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.customer-name') }}
</span>
<span class="value">
{{ $order->customer_full_name }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.email') }}
</span>
<span class="value">
{{ $order->customer_email }}
</span>
</div>
</div>
</div>
</div>
</div>
</accordian>
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">
@if ($order->billing_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.billing-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->billing_address])
</div>
</div>
@endif
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->shipping_address])
</div>
</div>
@endif
</div>
</div>
</accordian>
@endif
<accordian title="{{ __('admin::app.sales.orders.payment-and-shipping') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.payment-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.payment-method') }}
</span>
<span class="value">
{{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.currency') }}
</span>
<span class="value">
{{ $order->order_currency_code }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-method') }}
</span>
<span class="value">
{{ $order->shipping_title }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-price') }}
</span>
<span class="value">
{{ core()->formatBasePrice($order->base_shipping_amount) }}
</span>
</div>
<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">
<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>
</div>
</div>
</accordian>
<accordian title="{{ __('admin::app.sales.orders.products-ordered') }}" :active="true">
<div slot="body">
<order-item-list></order-item-list>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop
@push('scripts')
<script type="text/x-template" id="order-item-list-template">
<div>
<script type="text/x-template" id="order-item-list-template">
<div>
<div class="control-group" :class="[errors.has('shipment[source]') ? 'has-error' : '']">
<label for="shipment[source]" class="required">{{ __('admin::app.sales.shipments.source') }}</label>
@ -270,7 +273,10 @@
<tbody>
@foreach ($order->items as $item)
@if ($item->qty_to_ship > 0 && $item->product)
@if (
$item->qty_to_ship > 0
&& $item->product
)
<tr>
<td>{{ $item->getTypeInstance()->getOrderedItem($item)->sku }}</td>
<td>
@ -324,7 +330,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_to_ship }}" data-vv-as="&quot;{{ __('admin::app.sales.shipments.qty-to-ship') }}&quot;" :disabled="source != '{{ $inventorySource->id }}'"/>
<input type="text" v-validate="'required|numeric|min_value:0|max_value:{{$item->qty_ordered}}'" class="control" id="{{ $inputName }}" name="{{ $inputName }}" value="{{ $item->qty_to_ship }}" 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
@ -349,19 +355,19 @@
</div>
</script>
<script>
Vue.component('order-item-list', {
<script>
Vue.component('order-item-list', {
template: '#order-item-list-template',
template: '#order-item-list-template',
inject: ['$validator'],
inject: ['$validator'],
data: function() {
return {
source: ""
}
data: function() {
return {
source: ""
}
});
</script>
}
});
</script>
@endpush

View File

@ -106,7 +106,10 @@
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">
@ -199,7 +202,10 @@
</span>
</div>
@if ($shipment->inventory_source || $shipment->inventory_source_name)
@if (
$shipment->inventory_source
|| $shipment->inventory_source_name
)
<div class="row">
<span class="title">
{{ __('admin::app.sales.shipments.inventory-source') }}

View File

@ -66,7 +66,10 @@
<div class="control-group">
<label>{{ __('velocity::app.admin.general.locale_logo') }}</label>
@if (isset($locale) && $locale->locale_image)
@if (
isset($locale)
&& $locale->locale_image
)
<image-wrapper
input-name="locale_image"
:multiple="false"

View File

@ -89,7 +89,7 @@ Route::group(['middleware' => ['web', 'admin'], 'prefix' => config('app.admin_ur
])->name('admin.sales.refunds.create');
Route::post('/refunds/create/{order_id}', [RefundController::class, 'store'])->defaults('_config', [
'redirect' => 'admin.sales.orders.view',
'redirect' => 'admin.sales.refunds.index',
])->name('admin.sales.refunds.store');
Route::post('/refunds/update-qty/{order_id}', [RefundController::class, 'updateQty'])->defaults('_config', [

View File

@ -87,7 +87,11 @@ class ProductCategoryUniqueSlug implements Rule
*/
protected function isSlugExistsInCategories($slug)
{
if ($this->tableName && $this->id && $this->tableName === 'category_translations') {
if (
$this->tableName
&& $this->id
&& $this->tableName === 'category_translations'
) {
return CategoryTranslationProxy::modelClass()::where('category_id', '<>', $this->id)
->where('slug', $slug)
->limit(1)
@ -109,7 +113,11 @@ class ProductCategoryUniqueSlug implements Rule
*/
protected function isSlugExistsInProducts($slug)
{
if ($this->tableName && $this->id && $this->tableName === 'product_flat') {
if (
$this->tableName
&& $this->id
&& $this->tableName === 'product_flat'
) {
return ProductFlatProxy::modelClass()::where('product_id', '<>', $this->id)
->where('url_key', $slug)
->limit(1)

View File

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

View File

@ -152,7 +152,10 @@ class AttributeFamilyRepository extends Repository
$trimmed = [];
foreach ($attributeFamilies as $key => $attributeFamily) {
if ($attributeFamily->name != null || $attributeFamily->name != "") {
if (
$attributeFamily->name != null
|| $attributeFamily->name != ""
) {
$trimmed[$key] = [
'id' => $attributeFamily->id,
'code' => $attributeFamily->code,

View File

@ -52,7 +52,10 @@ class AttributeOptionRepository extends Repository
*/
public function uploadSwatchImage($data, $optionId)
{
if (! isset($data['swatch_value']) || ! $data['swatch_value']) {
if (
! isset($data['swatch_value'])
|| ! $data['swatch_value']
) {
return;
}

View File

@ -51,7 +51,10 @@ class AttributeRepository extends Repository
$attribute = $this->model->create($data);
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
if (
in_array($attribute->type, ['select', 'multiselect', 'checkbox'])
&& count($options)
) {
foreach ($options as $optionInputs) {
$this->attributeOptionRepository->create(array_merge([
'attribute_id' => $attribute->id,
@ -169,7 +172,10 @@ class AttributeRepository extends Repository
{
$attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable'];
if (! is_array($codes) && ! $codes)
if (
! is_array($codes)
&& ! $codes
)
return $this->findWhereIn('code', [
'name',
'description',
@ -206,6 +212,23 @@ class AttributeRepository extends Repository
return $attributes[$code] = $this->findOneByField('code', $code);
}
/**
* Get attribute by id.
*
* @param integer $id
* @return \Webkul\Attribute\Contracts\Attribute
*/
public function getAttributeById($id)
{
static $attributes = [];
if (array_key_exists($id, $attributes)) {
return $attributes[$id];
}
return $attributes[$id] = $this->find($id);
}
/**
* Get family attributes.
*

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,10 @@ class Booking
$date = clone $currentTime;
$date->addDays($i);
if ($date >= $availableFrom && $date <= $availableTo) {
if (
$date >= $availableFrom
&& $date <= $availableTo
) {
$days[$i] = $date->format('l');
}
}
@ -235,7 +238,10 @@ class Booking
{
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) {
if (
! is_array($bookingProductSlot->slots)
|| ! count($bookingProductSlot->slots)
) {
return [];
}
@ -255,7 +261,8 @@ class Booking
? $bookingProductSlot->slots
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
if ($requestedDate < $availableFrom
if (
$requestedDate < $availableFrom
|| $requestedDate > $availableTo
) {
return [];
@ -289,17 +296,32 @@ class Booking
$to = clone $tempStartDayTime;
if (($startDayTime <= $from && $from <= $availableTo)
&& ($availableTo >= $to && $to >= $startDayTime)
&& ($startDayTime <= $from && $from <= $endDayTime)
&& ($endDayTime >= $to && $to >= $startDayTime)
if (
($startDayTime <= $from
&& $from <= $availableTo
)
&& (
$availableTo >= $to
&& $to >= $startDayTime
)
&& (
$startDayTime <= $from
&& $from <= $endDayTime
)
&& (
$endDayTime >= $to
&& $to >= $startDayTime
)
) {
// Get already ordered qty for this slot
$orderedQty = 0;
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
if ($qty && $currentTime <= $from) {
if (
$qty
&& $currentTime <= $from
) {
$slots[] = [
'from' => $from->format('h:i A'),
'to' => $to->format('h:i A'),
@ -324,7 +346,10 @@ class Booking
{
$bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']);
if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity'] || $this->isSlotExpired($cartItem)) {
if (
$bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity']
|| $this->isSlotExpired($cartItem)
) {
return false;
}

View File

@ -22,7 +22,10 @@ class DefaultSlot extends Booking
{
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) {
if (
! is_array($bookingProductSlot->slots)
|| ! count($bookingProductSlot->slots)
) {
return [];
}
@ -38,7 +41,8 @@ class DefaultSlot extends Booking
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
if ($requestedDate < $availableFrom
if (
$requestedDate < $availableFrom
|| $requestedDate > $availableTo
) {
return [];
@ -110,7 +114,10 @@ class DefaultSlot extends Booking
$timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
if (! count($timeDuration) || ! $timeDuration['status']) {
if (
! count($timeDuration)
|| ! $timeDuration['status']
) {
return [];
}
@ -141,17 +148,33 @@ class DefaultSlot extends Booking
$to = clone $tempStartDayTime;
if (($startDayTime <= $from && $from <= $availableTo)
&& ($availableTo >= $to && $to >= $startDayTime)
&& ($startDayTime <= $from && $from <= $endDayTime)
&& ($endDayTime >= $to && $to >= $startDayTime)
if (
(
$startDayTime <= $from
&& $from <= $availableTo
)
&& (
$availableTo >= $to
&& $to >= $startDayTime
)
&& (
$startDayTime <= $from
&& $from <= $endDayTime
)
&& (
$endDayTime >= $to
&& $to >= $startDayTime
)
) {
// Get already ordered qty for this slot
$orderedQty = 0;
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
if ($qty && $currentTime <= $from) {
if (
$qty
&& $currentTime <= $from
) {
$slots[] = [
'from' => $from->format('h:i A'),
'to' => $to->format('h:i A'),

View File

@ -21,7 +21,10 @@ class RentalSlot extends Booking
{
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) {
if (
! is_array($bookingProductSlot->slots)
|| ! count($bookingProductSlot->slots)
) {
return [];
}
@ -41,7 +44,8 @@ class RentalSlot extends Booking
? $bookingProductSlot->slots
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
if ($requestedDate < $availableFrom
if (
$requestedDate < $availableFrom
|| $requestedDate > $availableTo
) {
return [];
@ -66,17 +70,33 @@ class RentalSlot extends Booking
$to = clone $tempStartDayTime;
if (($startDayTime <= $from && $from <= $availableTo)
&& ($availableTo >= $to && $to >= $startDayTime)
&& ($startDayTime <= $from && $from <= $endDayTime)
&& ($endDayTime >= $to && $to >= $startDayTime)
if (
(
$startDayTime <= $from
&& $from <= $availableTo
)
&& (
$availableTo >= $to
&& $to >= $startDayTime
)
&& (
$startDayTime <= $from
&& $from <= $endDayTime
)
&& (
$endDayTime >= $to
&& $to >= $startDayTime
)
) {
// Get already ordered qty for this slot
$orderedQty = 0;
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
if ($qty && $currentTime <= $from) {
if (
$qty
&& $currentTime <= $from
) {
if (! isset($slots[$index])) {
$slots[$index]['time'] = $startDayTime->format('h:i A') . ' - ' . $endDayTime->format('h:i A');
}
@ -174,7 +194,8 @@ class RentalSlot extends Booking
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
: Carbon::createFromTimeString('2080-01-01 00:00:00');
if ($requestedFromDate < $availableFrom
if (
$requestedFromDate < $availableFrom
|| $requestedFromDate > $availableTo
|| $requestedToDate < $availableFrom
|| $requestedToDate > $availableTo
@ -242,7 +263,8 @@ class RentalSlot extends Booking
$rentingType = $item->additional['booking']['renting_type'] ?? $bookingProduct->rental_slot->renting_type;
if ($rentingType == 'daily') {
if (! isset($item->additional['booking']['date_from'])
if (
! isset($item->additional['booking']['date_from'])
|| ! isset($item->additional['booking']['date_to'])
) {
$result->itemIsInactive();
@ -255,7 +277,8 @@ class RentalSlot extends Booking
$price += $bookingProduct->rental_slot->daily_price * $to->diffInDays($from);
} else {
if (! isset($item->additional['booking']['slot']['from'])
if (
! isset($item->additional['booking']['slot']['from'])
|| ! isset($item->additional['booking']['slot']['to'])
) {
$result->itemIsInactive();

View File

@ -22,7 +22,10 @@ class TableSlot extends Booking
$bookedQty *= $bookingProduct->table_slot->guest_limit;
}
if ($bookingProduct->qty - $bookedQty < $requestedQty || $this->isSlotExpired($cartItem)) {
if (
$bookingProduct->qty - $bookedQty < $requestedQty
|| $this->isSlotExpired($cartItem)
) {
return false;
}

View File

@ -115,7 +115,10 @@ class BookingProductRepository extends Repository
*/
public function formatSlots($data)
{
if (isset($data['same_slot_all_days']) && ! $data['same_slot_all_days']) {
if (
isset($data['same_slot_all_days'])
&& ! $data['same_slot_all_days']
) {
for ($i = 0; $i < 7; $i++) {
if (! isset($data['slots'][$i])) {
$data['slots'][$i] = [];
@ -183,8 +186,15 @@ class BookingProductRepository extends Repository
$isOverLapping = false;
foreach ($tempSlots as $slot) {
if (($slot['from'] <= $from && $slot['to'] >= $from)
|| ($slot['from'] <= $to && $slot['to'] >= $to)
if (
(
$slot['from'] <= $from
&& $slot['to'] >= $from
)
|| (
$slot['from'] <= $to
&& $slot['to'] >= $to
)
) {
$isOverLapping = true;

View File

@ -37,7 +37,10 @@ class BookingRepository extends Repository
$from = $to = null;
if (isset($item->additional['booking']['slot'])) {
if (isset($item->additional['booking']['slot']['from']) && isset($item->additional['booking']['slot']['to'])) {
if (
isset($item->additional['booking']['slot']['from'])
&& isset($item->additional['booking']['slot']['to'])
) {
$from = $item->additional['booking']['slot']['from'];
$to = $item->additional['booking']['slot']['to'];
@ -48,7 +51,10 @@ class BookingRepository extends Repository
$to = end($timestamps);
}
} elseif (isset($item->additional['booking']['date_from']) && isset($item->additional['booking']['date_to'])) {
} elseif (
isset($item->additional['booking']['date_from'])
&& isset($item->additional['booking']['date_to'])
) {
$from = Carbon::createFromTimeString($item->additional['booking']['date_from'] . ' 00:00:00')->getTimestamp();
$to = Carbon::createFromTimeString($item->additional['booking']['date_to'] . ' 23:59:59')->getTimestamp();

View File

@ -118,6 +118,17 @@
width: 100%;
float: left;
span {
position: relative;
.icon {
position: absolute;
right: 30px;
top: 10px !important;
}
}
.control-group:not(.quantity), .form-group:not(.quantity) {
width: 50%;
float: left;
@ -258,4 +269,15 @@
pointer-events: none;
}
}
}
}
body {
&.rtl {
.booking-information {
.cross-icon {
left: 80px !important;
right: inherit !important;
}
}
}
}

View File

@ -241,8 +241,9 @@
if (this.default_booking.booking_type == 'one') {
this.slots['one'] = this.default_booking.slots ? this.default_booking.slots : [];
} else {
if (this.default_booking.slots)
if (this.default_booking.slots) {
this.slots['many'] = this.default_booking.slots;
}
}
},

View File

@ -170,8 +170,9 @@
computed: {
controlName: function () {
if (this.ticketItem.id)
if (this.ticketItem.id) {
return 'booking[tickets][' + this.ticketItem.id + ']';
}
return 'booking[tickets][ticket_' + this.index + ']';
}

View File

@ -136,8 +136,9 @@
},
created: function() {
if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots)
if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots) {
return;
}
if (bookingProduct[this.bookingType].same_slot_all_days) {
this.slots['same_for_week'] = bookingProduct[this.bookingType].slots;
@ -149,8 +150,9 @@
methods: {
addSlot: function (dayIndex = null) {
if (dayIndex !== null) {
if (this.slots['different_for_week'][dayIndex] == undefined)
if (this.slots['different_for_week'][dayIndex] == undefined) {
this.slots['different_for_week'][dayIndex] = [];
}
var slot = {
'from': '',

View File

@ -36,7 +36,10 @@
<td>{{ $day['name'] }}</td>
<td>
@if ($day['slots'] && count($day['slots']))
@if (
$day['slots']
&& count($day['slots'])
)
@foreach ($day['slots'] as $slot)
{{ $slot['from'] . ' - ' . $slot['to'] }}</br>
@endforeach

View File

@ -36,7 +36,10 @@
<td>{{ $day['name'] }}</td>
<td>
@if ($day['slots'] && count($day['slots']))
@if (
$day['slots']
&& count($day['slots'])
)
@foreach ($day['slots'] as $slot)
{{ $slot['from'] . ' - ' . $slot['to'] }}</br>
@endforeach

View File

@ -36,7 +36,10 @@
<td>{{ $day['name'] }}</td>
<td>
@if ($day['slots'] && count($day['slots']))
@if (
$day['slots']
&& count($day['slots'])
)
@foreach ($day['slots'] as $slot)
{{ $slot['from'] . ' - ' . $slot['to'] }}</br>
@endforeach

View File

@ -161,7 +161,10 @@ class Booking extends Virtual
*/
public function prepareForCart($data)
{
if (! isset($data['booking']) || ! count($data['booking'])) {
if (
! isset($data['booking'])
|| ! count($data['booking'])
) {
return trans('shop::app.checkout.cart.integrity.missing_options');
}
@ -170,7 +173,10 @@ class Booking extends Virtual
$bookingProduct = $this->getBookingProduct($data['product_id']);
if ($bookingProduct->type == 'event') {
if (Carbon::now() > $bookingProduct->available_from && Carbon::now() > $bookingProduct->available_to) {
if (
Carbon::now() > $bookingProduct->available_from
&& Carbon::now() > $bookingProduct->available_to
) {
return trans('shop::app.checkout.cart.event.expired');
}
@ -225,10 +231,12 @@ class Booking extends Virtual
return false;
}
if (isset($options1['booking'], $options2['booking'])
if (
isset($options1['booking'], $options2['booking'])
&& isset($options1['booking']['ticket_id'], $options2['booking']['ticket_id'])
&& $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']) {
return true;
&& $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']
) {
return true;
}
return false;

View File

@ -46,20 +46,24 @@ class CartRule
/**
* Collect discount on cart
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return void
*/
public function collect()
public function collect($cart)
{
$cart = Cart::getCart();
$appliedCartRuleIds = [];
$this->calculateCartItemTotals($cart->items);
$this->calculateCartItemTotals($cart, $cart->items);
foreach ($cart->items as $item) {
$itemCartRuleIds = $this->process($item);
$itemCartRuleIds = $this->process($cart, $item);
$appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds);
if ($item->children()->count() && $item->product->getTypeInstance()->isChildrenCalculated()) {
if (
$item->children()->count()
&& $item->product->getTypeInstance()->isChildrenCalculated()
) {
$this->divideDiscount($item);
}
}
@ -72,7 +76,7 @@ class CartRule
$this->processFreeShippingDiscount($cart);
if (! $this->checkCouponCode()) {
if (! $this->checkCouponCode($cart)) {
cart()->removeCouponCode();
}
}
@ -80,20 +84,24 @@ class CartRule
/**
* Returns cart rules
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return \Illuminate\Support\Collection
*/
public function getCartRules()
public function getCartRules($cart)
{
$staticCartRules = new class() {
public static $cartRules;
public static $cartID;
};
if ($staticCartRules::$cartID === cart()->getCart()->id && $staticCartRules::$cartRules) {
if (
$staticCartRules::$cartID === $cart->id
&& $staticCartRules::$cartRules
) {
return $staticCartRules::$cartRules;
}
$staticCartRules::$cartID = cart()->getCart()->id;
$staticCartRules::$cartID = $cart->id;
$customerGroupId = null;
@ -110,15 +118,15 @@ class CartRule
$cartRules = $this->getCartRuleQuery($customerGroupId, core()->getCurrentChannel()->id);
$staticCartRules::$cartRules = $cartRules;
return $cartRules;
}
/**
* Check if cart rule can be applied
*
* @param $cart
* @param \Webkul\CartRule\Contracts\CartRule $rule
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @param \Webkul\CartRule\Contracts\CartRule $rule
* @return bool
*/
public function canProcessRule($cart, $rule): bool
@ -130,18 +138,30 @@ class CartRule
// reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery())
$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) {
if (
$coupon
&& $coupon->code === $cart->coupon_code
) {
if (
$coupon->usage_limit
&& $coupon->times_used >= $coupon->usage_limit
) {
return false;
}
if ($cart->customer_id && $coupon->usage_per_customer) {
if (
$cart->customer_id
&& $coupon->usage_per_customer
) {
$couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([
'cart_rule_coupon_id' => $coupon->id,
'customer_id' => $cart->customer_id,
]);
if ($couponUsage && $couponUsage->times_used >= $coupon->usage_per_customer) {
if (
$couponUsage
&& $couponUsage->times_used >= $coupon->usage_per_customer
) {
return false;
}
}
@ -159,7 +179,10 @@ class CartRule
'customer_id' => $cart->customer_id,
]);
if ($ruleCustomer && $ruleCustomer->times_used >= $rule->usage_per_customer) {
if (
$ruleCustomer
&& $ruleCustomer->times_used >= $rule->usage_per_customer
) {
return false;
}
}
@ -170,10 +193,11 @@ class CartRule
/**
* Cart item discount calculation process
*
* @param \Webkul\Checkout\Models\CartItem $item
* @param \Webkul\Checkout\Contracts\Cart $cart
* @param \Webkul\Checkout\Models\CartItem $item
* @return array
*/
public function process(CartItem $item): array
public function process($cart, CartItem $item): array
{
$item->discount_percent = 0;
$item->discount_amount = 0;
@ -181,9 +205,7 @@ class CartRule
$appliedRuleIds = [];
$cart = Cart::getCart();
foreach ($rules = $this->getCartRules() as $rule) {
foreach ($rules = $this->getCartRules($cart) as $rule) {
if (! $this->canProcessRule($cart, $rule)) {
continue;
}
@ -208,7 +230,10 @@ class CartRule
$baseDiscountAmount = ($quantity * $item->base_price + $item->base_tax_amount - $item->base_discount_amount) * ($rulePercent / 100);
if (! $rule->discount_quantity || $rule->discount_quantity > $quantity) {
if (
! $rule->discount_quantity
|| $rule->discount_quantity > $quantity
) {
$discountPercent = min(100, $item->discount_percent + $rulePercent);
$item->discount_percent = $discountPercent;
@ -241,7 +266,10 @@ class CartRule
break;
case 'buy_x_get_y':
if (! $rule->discount_step || $rule->discount_amount > $rule->discount_step) {
if (
! $rule->discount_step
|| $rule->discount_amount > $rule->discount_step
) {
break;
}
@ -304,9 +332,7 @@ class CartRule
$appliedRuleIds = [];
$cart = Cart::getCart();
foreach ($this->getCartRules() as $rule) {
foreach ($this->getCartRules($cart) as $rule) {
if (! $this->canProcessRule($cart, $rule)) {
continue;
}
@ -315,7 +341,10 @@ class CartRule
continue;
}
if (! $rule || ! $rule->apply_to_shipping) {
if (
! $rule
|| ! $rule->apply_to_shipping
) {
continue;
}
@ -388,11 +417,9 @@ class CartRule
$appliedRuleIds = [];
$cart = Cart::getCart();
foreach ($cart->items->all() as $item) {
foreach ($this->getCartRules() as $rule) {
foreach ($this->getCartRules($cart) as $rule) {
if (! $this->canProcessRule($cart, $rule)) {
continue;
@ -403,7 +430,10 @@ class CartRule
continue;
}
if (! $rule || ! $rule->free_shipping) {
if (
! $rule
|| ! $rule->free_shipping
) {
continue;
}
@ -435,14 +465,13 @@ class CartRule
/**
* Calculate cart item totals for each rule
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @param \Illuminate\Support\Collecton $items
* @return \Webkul\Rule\Helpers\Validator
*/
public function calculateCartItemTotals($items)
public function calculateCartItemTotals($cart, $items)
{
$cart = Cart::getCart();
foreach ($this->getCartRules() as $rule) {
foreach ($this->getCartRules($cart) as $rule) {
if ($rule->action_type == 'cart_fixed') {
$totalPrice = $totalBasePrice = $validCount = 0;
@ -473,12 +502,11 @@ class CartRule
/**
* Check if coupon code is applied or not
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return bool
*/
public function checkCouponCode(): bool
public function checkCouponCode($cart): bool
{
$cart = cart()->getCart();
if (! $cart->coupon_code) {
return true;
}
@ -550,5 +578,4 @@ class CartRule
->orderBy('sort_order', 'asc');
})->findWhere(['status' => 1]);
}
}

View File

@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
use Webkul\Admin\DataGrids\CartRuleDataGrid;
use Webkul\CartRule\Http\Requests\CartRuleRequest;
use Webkul\CartRule\Repositories\CartRuleRepository;
class CartRuleController extends Controller
@ -91,26 +92,14 @@ class CartRuleController extends Controller
/**
* Store a newly created resource in storage.
*
*
* @param \Webkul\CartRule\Http\Requests\CartRuleRequest $cartRuleRequest
* @return \Illuminate\Http\Response
*/
public function store()
public function store(CartRuleRequest $cartRuleRequest)
{
try {
$this->validate(request(), [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'coupon_type' => 'required',
'use_auto_generation' => 'required_if:coupon_type,==,1',
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
]);
$data = request()->all();
$data = $cartRuleRequest->all();
$this->cartRuleRepository->create($data);
@ -142,25 +131,13 @@ class CartRuleController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Webkul\CartRule\Http\Requests\CartRuleRequest $cartRuleRequest
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(CartRuleRequest $cartRuleRequest, $id)
{
try {
$this->validate(request(), [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'coupon_type' => 'required',
'use_auto_generation' => 'required_if:coupon_type,==,1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
]);
$cartRule = $this->cartRuleRepository->findOrFail($id);
if ($cartRule->coupon_type) {
@ -175,7 +152,7 @@ class CartRuleController extends Controller
}
}
$cartRule = $this->cartRuleRepository->update(request()->all(), $id);
$cartRule = $this->cartRuleRepository->update($cartRuleRequest->all(), $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Cart Rule']));

View File

@ -0,0 +1,52 @@
<?php
namespace Webkul\CartRule\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CartRuleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'coupon_type' => 'required',
'use_auto_generation' => 'required_if:coupon_type,==,1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
];
if (! request('id')) {
$rules = array_merge($rules, [
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code',
]);
}
if (request()->has('action_type') && request()->action_type == 'by_percent') {
$rules = array_merge($rules, [
'discount_amount' => 'required|numeric|min:0|max:100',
]);
}
return $rules;
}
}

View File

@ -24,6 +24,6 @@ class Cart
*/
public function applyCartRules($cart)
{
$this->cartRuleHepler->collect();
$this->cartRuleHepler->collect($cart);
}
}

View File

@ -124,7 +124,7 @@ class CartRule extends Model implements CartRuleContract
$coupon = $this->coupon_code()
->first();
if (!$coupon) {
if (! $coupon) {
return;
}

View File

@ -12,11 +12,12 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
'checkout.order.save.after' => [
'Webkul\CartRule\Listeners\Order@manageCartRule'
],
'checkout.cart.collect.totals.before' => [
'Webkul\CartRule\Listeners\Cart@applyCartRules'
],
'checkout.order.save.after' => [
'Webkul\CartRule\Listeners\Order@manageCartRule'
],
'checkout.cart.collect.totals.before' => [
'Webkul\CartRule\Listeners\Cart@applyCartRules'
],
];
}

View File

@ -71,7 +71,10 @@ class CartRuleRepository extends Repository
$cartRule->customer_groups()->sync($data['customer_groups']);
if ($data['coupon_type'] && ! $data['use_auto_generation']) {
if (
$data['coupon_type']
&& ! $data['use_auto_generation']
) {
$this->cartRuleCouponRepository->create([
'cart_rule_id' => $cartRule->id,
'code' => $data['coupon_code'],

View File

@ -106,7 +106,8 @@ class CatalogRuleProduct
$appliedAttributes = [];
foreach ($rule->conditions as $condition) {
if (! $condition['attribute']
if (
! $condition['attribute']
|| ! isset($condition['value'])
|| is_null($condition['value'])
|| $condition['value'] == ''

View File

@ -48,7 +48,10 @@ class CatalogRuleProductPrice
foreach ($catalogRuleProducts as $row) {
$productKey = $row->product_id . '-' . $row->channel_id . '-' . $row->customer_group_id;
if ($previousKey && $previousKey != $productKey) {
if (
$previousKey
&& $previousKey != $productKey
) {
$endRuleFlags = [];
if (count($prices) > $batchCount) {
@ -59,8 +62,15 @@ class CatalogRuleProductPrice
}
foreach ($dates as $key => $date) {
if ((! $row->starts_from || $date >= $row->starts_from)
&& (! $row->ends_till || $date <= $row->ends_till)
if (
(
! $row->starts_from
|| $date >= $row->starts_from
)
&& (
! $row->ends_till
|| $date <= $row->ends_till
)
) {
$priceKey = $date->getTimestamp() . '-' . $productKey;

View File

@ -5,6 +5,7 @@ namespace Webkul\CatalogRule\Http\Controllers;
use Illuminate\Http\Request;
use Webkul\Admin\DataGrids\CatalogRuleDataGrid;
use Webkul\CatalogRule\Helpers\CatalogRuleIndex;
use Webkul\CatalogRule\Http\Requests\CatalogRuleRequest;
use Webkul\CatalogRule\Repositories\CatalogRuleRepository;
class CatalogRuleController extends Controller
@ -58,21 +59,12 @@ class CatalogRuleController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Webkul\CatalogRule\Http\Requests\CatalogRuleRequest $catalogRuleRequest
* @return \Illuminate\Http\Response
*/
public function store()
public function store(CatalogRuleRequest $catalogRuleRequest)
{
$this->validate(request(), [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
]);
$data = request()->all();
$data = $catalogRuleRequest->all();
$this->catalogRuleRepository->create($data);
@ -99,25 +91,15 @@ class CatalogRuleController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Webkul\CatalogRule\Http\Requests\CatalogRuleRequest $catalogRuleRequest
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(CatalogRuleRequest $catalogRuleRequest, $id)
{
$this->validate(request(), [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
]);
$this->catalogRuleRepository->findOrFail($id);
$this->catalogRuleRepository->update(request()->all(), $id);
$this->catalogRuleRepository->update($catalogRuleRequest->all(), $id);
$this->catalogRuleIndexHelper->reindexComplete();

View File

@ -0,0 +1,44 @@
<?php
namespace Webkul\CatalogRule\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CatalogRuleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
];
if (request()->has('action_type') && request()->action_type == 'by_percent') {
$rules = array_merge($rules, [
'discount_amount' => 'required|numeric|min:0|max:100',
]);
}
return $rules;
}
}

View File

@ -175,7 +175,10 @@ class CategoryController extends Controller
}
}
if (count($categoryIds) != 1 || $suppressFlash == true) {
if (
count($categoryIds) != 1
|| $suppressFlash == true
) {
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'Category']));
}

View File

@ -32,7 +32,10 @@ class CategoryRepository extends Repository
{
Event::dispatch('catalog.category.create.before');
if (isset($data['locale']) && $data['locale'] == 'all') {
if (
isset($data['locale'])
&& $data['locale'] == 'all'
) {
$model = app()->make($this->model());
foreach (core()->getAllLocales() as $locale) {
@ -269,7 +272,10 @@ class CategoryRepository extends Repository
$trimmed = [];
foreach ($categories as $key => $category) {
if ($category->name != null || $category->name != '') {
if (
$category->name != null
|| $category->name != ''
) {
$trimmed[$key] = [
'id' => $category->id,
'name' => $category->name,

View File

@ -25,6 +25,12 @@ class Cart
{
use CartCoupons, CartTools, CartValidators;
/**
* @var \Webkul\Checkout\Contracts\Cart
*/
private $cart;
/**
* Create a new class instance.
*
@ -47,6 +53,21 @@ class Cart
protected CustomerAddressRepository $customerAddressRepository
)
{
$this->initCart();
}
/**
* Returns cart.
*
* @return \Webkul\Checkout\Contracts\Cart|null
*/
public function initCart()
{
$this->getCart();
if ($this->cart) {
$this->removeInactiveItems();
}
}
/**
@ -56,27 +77,48 @@ class Cart
*/
public function getCart(): ?\Webkul\Checkout\Contracts\Cart
{
$cart = null;
if ($this->cart) {
return $this->cart;
}
if (auth()->guard()->check()) {
$cart = $this->cartRepository->findOneWhere([
$this->cart = $this->cartRepository->findOneWhere([
'customer_id' => auth()->guard()->user()->id,
'is_active' => 1,
]);
} else if (session()->has('cart')) {
$cart = $this->cartRepository->find(session()->get('cart')->id);
} elseif (session()->has('cart')) {
$this->cart = $this->cartRepository->find(session()->get('cart')->id);
}
$this->removeInactiveItems($cart);
return $this->cart;
}
return $cart;
/**
* Set cart model to the variable for reuse
*
* @param \Webkul\Checkout\Contracts\Cart
* @return void
*/
public function setCart($cart)
{
$this->cart = $cart;
}
/**
* Reset cart
*
* @return void
*/
public function resetCart()
{
$this->cart = null;
}
/**
* Get cart item by product.
*
* @param array|null $data
* @param array $parentData
* @param array $data
* @param array|null $parentData
* @return \Webkul\Checkout\Contracts\CartItem|void
*/
public function getItemByProduct($data, $parentData = null)
@ -110,23 +152,26 @@ class Cart
$cart = $this->getCart();
if (! $cart && ! $cart = $this->create($data)) {
if (
! $cart
&& ! $cart = $this->create($data)
) {
return ['warning' => __('shop::app.checkout.cart.item.error-add')];
}
$product = $this->productRepository->findOneByField('id', $productId);
$product = $this->productRepository->find($productId);
if ($product->status === 0) {
if (! $product->status) {
return ['info' => __('shop::app.checkout.cart.item.inactive-add')];
}
$cartProducts = $product->getTypeInstance()->prepareForCart($data);
if (is_string($cartProducts)) {
$this->collectTotals();
if (count($cart->all_items) <= 0) {
session()->forget('cart');
if ($cart->all_items->count() <= 0) {
$this->removeCart($cart);
} else {
$this->collectTotals();
}
throw new Exception($cartProducts);
@ -143,7 +188,10 @@ class Cart
if (! $cartItem) {
$cartItem = $this->cartItemRepository->create(array_merge($cartProduct, ['cart_id' => $cart->id]));
} else {
if (isset($cartProduct['parent_id']) && $cartItem->parent_id !== $parentCartItem->id) {
if (
isset($cartProduct['parent_id'])
&& $cartItem->parent_id !== $parentCartItem->id
) {
$cartItem = $this->cartItemRepository->create(array_merge($cartProduct, [
'cart_id' => $cart->id,
]));
@ -175,8 +223,8 @@ class Cart
{
$cartData = [
'channel_id' => core()->getCurrentChannel()->id,
'global_currency_code' => core()->getBaseCurrencyCode(),
'base_currency_code' => core()->getBaseCurrencyCode(),
'global_currency_code' => $baseCurrencyCode = core()->getBaseCurrencyCode(),
'base_currency_code' => $baseCurrencyCode,
'channel_currency_code' => core()->getChannelBaseCurrencyCode(),
'cart_currency_code' => core()->getCurrentCurrencyCode(),
'items_count' => 1,
@ -186,11 +234,15 @@ class Cart
* Fill in the customer data, as far as possible.
*/
if (auth()->guard()->check()) {
$cartData['customer_id'] = auth()->guard()->user()->id;
$cartData['is_guest'] = 0;
$cartData['customer_first_name'] = auth()->guard()->user()->first_name;
$cartData['customer_last_name'] = auth()->guard()->user()->last_name;
$cartData['customer_email'] = auth()->guard()->user()->email;
$customer = auth()->guard()->user();
$cartData = array_merge($cartData, [
'customer_id' => $customer->id,
'is_guest' => 0,
'customer_first_name' => $customer->first_name,
'customer_last_name' => $customer->last_name,
'customer_email' => $customer->email,
]);
} else {
$cartData['is_guest'] = 1;
}
@ -203,6 +255,8 @@ class Cart
return;
}
$this->setCart($cart);
$this->putCart($cart);
return $cart;
@ -217,13 +271,16 @@ class Cart
public function updateItems($data)
{
foreach ($data['qty'] as $itemId => $quantity) {
$item = $this->cartItemRepository->findOneByField('id', $itemId);
$item = $this->cartItemRepository->find($itemId);
if (! $item) {
continue;
}
if ($item->product && $item->product->status === 0) {
if (
$item->product
&& $item->product->status === 0
) {
throw new Exception(__('shop::app.checkout.cart.item.inactive'));
}
@ -275,15 +332,11 @@ class Cart
$cartItem->delete();
if ($cart->items()->get()->count() == 0) {
$this->cartRepository->delete($cart->id);
if (session()->has('cart')) {
session()->forget('cart');
}
$this->removeCart($cart);
} else {
Shipping::collectRates();
}
Shipping::collectRates();
Event::dispatch('checkout.cart.delete.after', $itemId);
$this->collectTotals();
@ -321,35 +374,23 @@ class Cart
/**
* Remove cart items, whose product is inactive.
*
* @param \Webkul\Checkout\Models\Cart|null $cart
* @return \Webkul\Checkout\Models\Cart|null
* @return void
*/
public function removeInactiveItems(CartModel $cart = null): ?CartModel
public function removeInactiveItems()
{
if (! $cart) {
return $cart;
}
$cart = $this->getCart();
foreach ($cart->items as $item) {
if ($this->isCartItemInactive($item)) {
$this->cartItemRepository->delete($item->id);
if ($cart->items->count() == 0) {
$this->cartRepository->delete($cart->id);
if (session()->has('cart')) {
session()->forget('cart');
}
$this->removeCart($cart);
}
session()->flash('info', __('shop::app.checkout.cart.item.inactive'));
}
}
$cart->save();
return $cart;
}
/**
@ -373,7 +414,24 @@ class Cart
$this->linkAddresses($cart, $billingAddressData, $shippingAddressData);
$this->assignCustomerFields($cart);
if (
auth()->guard()->check()
&& ($user = auth()->guard()->user())
&& (
$user->email
&& $user->first_name
&&
$user->last_name
)
) {
$cart->customer_email = $user->email;
$cart->customer_first_name = $user->first_name;
$cart->customer_last_name = $user->last_name;
} else {
$cart->customer_email = $cart->billing_address->email;
$cart->customer_first_name = $cart->billing_address->first_name;
$cart->customer_last_name = $cart->billing_address->last_name;
}
$cart->save();
@ -447,21 +505,30 @@ class Cart
Event::dispatch('checkout.cart.collect.totals.before', $cart);
$this->calculateItemsTax();
$cart->refresh();
$cart->grand_total = $cart->base_grand_total = 0;
$cart->sub_total = $cart->base_sub_total = 0;
$cart->grand_total = $cart->base_grand_total = 0;
$cart->tax_total = $cart->base_tax_total = 0;
$cart->discount_amount = $cart->base_discount_amount = 0;
$quantities = 0;
foreach ($cart->items as $item) {
$cart->discount_amount += $item->discount_amount;
$cart->base_discount_amount += $item->base_discount_amount;
$cart->sub_total = (float) $cart->sub_total + $item->total;
$cart->base_sub_total = (float) $cart->base_sub_total + $item->base_total;
$quantities += $item->quantity;
}
$cart->items_qty = $quantities;
$cart->items_count = $cart->items->count();
$cart->tax_total = Tax::getTaxTotal($cart, false);
$cart->base_tax_total = Tax::getTaxTotal($cart, true);
@ -476,17 +543,14 @@ class Cart
$cart->base_discount_amount += $shipping->base_discount_amount;
}
$cart = $this->finalizeCartTotals($cart);
$cart->discount_amount = round($cart->discount_amount, 2);
$cart->base_discount_amount = round($cart->base_discount_amount, 2);
$quantities = 0;
$cart->sub_total = round($cart->sub_total, 2);
$cart->base_sub_total = round($cart->base_sub_total, 2);
foreach ($cart->items as $item) {
$quantities = $quantities + $item->quantity;
}
$cart->items_count = $cart->items->count();
$cart->items_qty = $quantities;
$cart->grand_total = round($cart->grand_total, 2);
$cart->base_grand_total = round($cart->base_grand_total, 2);
$cart->cart_currency_code = core()->getCurrentCurrencyCode();
@ -530,7 +594,7 @@ class Cart
$address = Tax::getDefaultAddress();
}
$item = $this->setItemTaxToZero($item);
$item->tax_percent = $item->tax_amount = $item->base_tax_amount = 0;
Tax::isTaxApplicableInCurrentAddress($taxCategory, $address, function ($rate) use ($cart, $item) {
$item->tax_percent = $rate->tax_rate;
@ -557,15 +621,17 @@ class Cart
return false;
}
if (count($cart->items) === 0) {
$this->cartRepository->delete($cart->id);
$cartItems = $cart->items()->get();
if (count($cartItems) === 0) {
$this->removeCart($cart);
return false;
}
$isInvalid = false;
foreach ($cart->items as $item) {
foreach ($cartItems as $item) {
$validationResult = $item->product->getTypeInstance()->validateCartItem($item);
if ($validationResult->isItemInactive()) {
@ -574,17 +640,17 @@ class Cart
$isInvalid = true;
session()->flash('info', __('shop::app.checkout.cart.item.inactive'));
} else {
$price = ! is_null($item->custom_price) ? $item->custom_price : $item->base_price;
$this->cartItemRepository->update([
'price' => core()->convertPrice($price),
'base_price' => $price,
'total' => core()->convertPrice($price * $item->quantity),
'base_total' => $price * $item->quantity,
], $item->id);
}
$price = ! is_null($item->custom_price) ? $item->custom_price : $item->base_price;
$this->cartItemRepository->update([
'price' => core()->convertPrice($price),
'base_price' => $price,
'total' => core()->convertPrice($price * $item->quantity),
'base_total' => $price * $item->quantity,
], $item->id);
$isInvalid |= $validationResult->isCartInvalid();
}
@ -683,7 +749,10 @@ class Cart
'additional' => is_array($data['additional']) ? array_merge($data['additional'], $locale) : $locale,
];
if (isset($data['children']) && $data['children']) {
if (
isset($data['children'])
&& $data['children']
) {
foreach ($data['children'] as $child) {
/**
* - For bundle, child quantity will not be zero.
@ -722,71 +791,11 @@ class Cart
$data['payment'] = $cart->payment->toArray();
$data['items'] = $cart->items->toArray();
$data['items'] = $cart->items()->with('children')->get()->toArray();
return $data;
}
/**
* Set Item tax to zero.
*
* @param \Webkul\Checkout\Contracts\CartItem $item
* @return \Webkul\Checkout\Contracts\CartItem
*/
protected function setItemTaxToZero(\Webkul\Checkout\Contracts\CartItem $item): \Webkul\Checkout\Contracts\CartItem
{
$item->tax_percent = 0;
$item->tax_amount = 0;
$item->base_tax_amount = 0;
return $item;
}
/**
* Transfer the user profile information into the cart/into the order.
*
* When logged in as guest or the customer profile is not complete, we use the
* billing address to fill the order customer_ data.
*
* @param \Webkul\Checkout\Contracts\Cart $cart
*/
private function assignCustomerFields(\Webkul\Checkout\Contracts\Cart $cart): void
{
if (
auth()->guard()->check()
&& ($user = auth()->guard()->user())
&& $this->profileIsComplete($user)
) {
$cart->customer_email = $user->email;
$cart->customer_first_name = $user->first_name;
$cart->customer_last_name = $user->last_name;
} else {
$cart->customer_email = $cart->billing_address->email;
$cart->customer_first_name = $cart->billing_address->first_name;
$cart->customer_last_name = $cart->billing_address->last_name;
}
}
/**
* Round cart totals.
*
* @param \Webkul\Checkout\Models\Cart $cart
* @return \Webkul\Checkout\Models\Cart
*/
private function finalizeCartTotals(CartModel $cart): CartModel
{
$cart->discount_amount = round($cart->discount_amount, 2);
$cart->base_discount_amount = round($cart->base_discount_amount, 2);
$cart->sub_total = round($cart->sub_total, 2);
$cart->base_sub_total = round($cart->base_sub_total, 2);
$cart->grand_total = round($cart->grand_total, 2);
$cart->base_grand_total = round($cart->base_grand_total, 2);
return $cart;
}
/**
* Returns true, if cart item is inactive.
*
@ -804,17 +813,6 @@ class Cart
return $loadedCartItem[$item->product_id] = $item->product->getTypeInstance()->isCartItemInactive($item);
}
/**
* Is profile is complete.
*
* @param $user
* @return bool
*/
private function profileIsComplete($user): bool
{
return $user->email && $user->first_name && $user->last_name;
}
/**
* Fill customer attributes.
*
@ -871,11 +869,17 @@ class Cart
): void {
$shippingAddress['cart_id'] = $billingAddress['cart_id'] = null;
if (isset($data['billing']['save_as_address']) && $data['billing']['save_as_address']) {
if (
isset($data['billing']['save_as_address'])
&& $data['billing']['save_as_address']
) {
$this->customerAddressRepository->create($billingAddress);
}
if (isset($data['shipping']['save_as_address']) && $data['shipping']['save_as_address']) {
if (
isset($data['shipping']['save_as_address'])
&& $data['shipping']['save_as_address']
) {
$this->customerAddressRepository->create($shippingAddress);
}
}
@ -891,7 +895,10 @@ class Cart
{
$customerAddress = [];
if (isset($data['billing']['address_id']) && $data['billing']['address_id']) {
if (
isset($data['billing']['address_id'])
&& $data['billing']['address_id']
) {
$customerAddress = $this
->customerAddressRepository
->findOneWhere(['id' => $data['billing']['address_id']])
@ -920,7 +927,10 @@ class Cart
{
$customerAddress = [];
if (isset($data['shipping']['address_id']) && $data['shipping']['address_id']) {
if (
isset($data['shipping']['address_id'])
&& $data['shipping']['address_id']
) {
$customerAddress = $this
->customerAddressRepository
->findOneWhere(['id' => $data['shipping']['address_id']])
@ -952,22 +962,33 @@ class Cart
array $shippingAddressData
): void {
$billingAddressModel = $cart->billing_address;
if ($billingAddressModel) {
$billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_BILLING;
$this->cartAddressRepository->update($billingAddressData, $billingAddressModel->id);
if ($cart->haveStockableItems()) {
$shippingAddressModel = $cart->shipping_address;
if ($shippingAddressModel) {
if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) {
if (
isset($billingAddressData['use_for_shipping'])
&& $billingAddressData['use_for_shipping']
) {
$billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING;
$this->cartAddressRepository->update($billingAddressData, $shippingAddressModel->id);
} else {
$shippingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING;
$this->cartAddressRepository->update($shippingAddressData, $shippingAddressModel->id);
}
} else {
if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) {
if (
isset($billingAddressData['use_for_shipping'])
&& $billingAddressData['use_for_shipping']
) {
$this->cartAddressRepository->create(array_merge(
$billingAddressData,
['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]
@ -984,7 +1005,10 @@ class Cart
$this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_BILLING]));
if ($cart->haveStockableItems()) {
if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) {
if (
isset($billingAddressData['use_for_shipping'])
&& $billingAddressData['use_for_shipping']
) {
$this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]));
} else {
$this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]));

View File

@ -38,7 +38,10 @@ class CustomerAddressForm extends FormRequest
$this->mergeNewAddressRules('billing');
}
if (isset($this->get('billing')['use_for_shipping']) && ! $this->get('billing')['use_for_shipping']) {
if (
isset($this->get('billing')['use_for_shipping'])
&& ! $this->get('billing')['use_for_shipping']
) {
if (isset($this->get('shipping')['address_id'])) {
$this->mergeExistingAddressRules('shipping');
} else {

View File

@ -20,10 +20,10 @@ class Cart extends Model implements CartContract
'updated_at',
];
protected $with = [
'items',
'items.children',
];
// protected $with = [
// 'items',
// 'items.children',
// ];
/**
* To get relevant associated items with the cart instance
@ -162,11 +162,11 @@ class Cart extends Model implements CartContract
public function hasProductsWithQuantityBox(): bool
{
foreach ($this->items as $item) {
if ($item->product->getTypeInstance()
->showQuantityBox() === true) {
if ($item->product->getTypeInstance()->showQuantityBox() === true) {
return true;
}
}
return false;
}

View File

@ -45,10 +45,6 @@ class CheckoutServiceProvider extends ServiceProvider
$loader->alias('cart', Cart::class);
$this->app->singleton('cart', function () {
return new Cart();
});
$this->app->bind('cart', \Webkul\Checkout\Cart::class);
$this->app->singleton('cart', \Webkul\Checkout\Cart::class);
}
}

View File

@ -11,6 +11,23 @@ namespace Webkul\Checkout\Traits;
*/
trait CartTools
{
/**
* Remove cart and destroy the session
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return void
*/
public function removeCart($cart)
{
$this->cartRepository->delete($cart->id);
if (session()->has('cart')) {
session()->forget('cart');
}
$this->resetCart();
}
/**
* Save cart for guest.
*
@ -20,7 +37,10 @@ trait CartTools
public function putCart($cart)
{
if (! auth()->guard()->check()) {
session()->put('cart', $cart);
$cartTemp = new \stdClass();
$cartTemp->id = $cart->id;
session()->put('cart', $cartTemp);
}
}
@ -37,7 +57,9 @@ trait CartTools
'is_active' => 1,
]);
$guestCart = session()->get('cart');
$this->setCart($cart);
$guestCart = $this->cartRepository->find(session()->get('cart')->id);
/**
* When the logged in customer is not having any of the cart instance previously and are active.
@ -58,7 +80,7 @@ trait CartTools
foreach ($guestCart->items as $guestCartItem) {
try {
$this->addProduct($guestCartItem->product_id, $guestCartItem->additional);
$cart = $this->addProduct($guestCartItem->product_id, $guestCartItem->additional);
} catch (\Exception $e) {
//Ignore exception
}
@ -66,9 +88,7 @@ trait CartTools
$this->collectTotals();
$this->cartRepository->delete($guestCart->id);
session()->forget('cart');
$this->removeCart($guestCart);
}
}
@ -140,7 +160,9 @@ trait CartTools
public function deActivateCart(): void
{
if ($cart = $this->getCart()) {
$this->cartRepository->update(['is_active' => false], $cart->id);
$cart = $this->cartRepository->update(['is_active' => false], $cart->id);
$this->resetCart();
if (session()->has('cart')) {
session()->forget('cart');

View File

@ -489,7 +489,10 @@ class Core
{
static $exchangeRate;
if ($exchangeRate || $exchangeRate === '') {
if (
$exchangeRate
|| $exchangeRate === ''
) {
return $exchangeRate;
}
@ -538,7 +541,11 @@ class Core
$exchangeRate = $this->getExchangeRate($targetCurrency->id);
if ('' === $exchangeRate || null === $exchangeRate || ! $exchangeRate->rate) {
if (
'' === $exchangeRate
|| null === $exchangeRate
|| ! $exchangeRate->rate
) {
return $amount;
}
@ -572,7 +579,10 @@ class Core
'target_currency' => $targetCurrency->id,
]);
if (null === $exchangeRate || ! $exchangeRate->rate) {
if (
null === $exchangeRate
|| ! $exchangeRate->rate
) {
return $amount;
}
@ -716,9 +726,15 @@ class Core
$toTimeStamp += 86400;
}
if (! $this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) {
if (
! $this->is_empty_date($dateFrom)
&& $channelTimeStamp < $fromTimeStamp
) {
$result = false;
} elseif (! $this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) {
} elseif (
! $this->is_empty_date($dateTo)
&& $channelTimeStamp > $toTimeStamp
) {
$result = false;
} else {
$result = true;
@ -791,7 +807,10 @@ class Core
{
static $loadedConfigs = [];
if (array_key_exists($field, $loadedConfigs) && ! in_array($field, $this->coreConfigExceptions)) {
if (
array_key_exists($field, $loadedConfigs)
&& ! in_array($field, $this->coreConfigExceptions)
) {
$coreConfigValue = $loadedConfigs[$field];
} else {
if (null === $channel) {
@ -1103,7 +1122,10 @@ class Core
while (count($keys) > 1) {
$key = array_shift($keys);
if (! isset($array[$key]) || ! is_array($array[$key])) {
if (
! isset($array[$key])
|| ! is_array($array[$key])
) {
$array[$key] = [];
}
@ -1212,7 +1234,11 @@ class Core
$merged = $array1;
foreach ($array2 as $key => &$value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
if (
is_array($value)
&& isset($merged[$key])
&& is_array($merged[$key])
) {
$merged[$key] = $this->arrayMerge($merged[$key], $value);
} else {
$merged[$key] = $value;
@ -1234,8 +1260,14 @@ class Core
{
$fields = $this->getConfigField($field);
if (isset($fields['channel_based']) && $fields['channel_based']) {
if (isset($fields['locale_based']) && $fields['locale_based']) {
if (
isset($fields['channel_based'])
&& $fields['channel_based']
) {
if (
isset($fields['locale_based'])
&& $fields['locale_based']
) {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field,
'channel_code' => $channel,
@ -1248,7 +1280,10 @@ class Core
]);
}
} else {
if (isset($fields['locale_based']) && $fields['locale_based']) {
if (
isset($fields['locale_based'])
&& $fields['locale_based']
) {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field,
'locale_code' => $locale,

View File

@ -57,7 +57,10 @@ class ExchangeRates extends ExchangeRate
$result = json_decode($result->getBody()->getContents(), true);
if (isset($result['success']) && ! $result['success']) {
if (
isset($result['success'])
&& ! $result['success']
) {
throw new \Exception(
isset($result['error']['info'])
? $result['error']['info']

View File

@ -57,7 +57,10 @@ class FixerExchange extends ExchangeRate
$result = json_decode($result->getBody()->getContents(), true);
if (isset($result['success']) && ! $result['success']) {
if (
isset($result['success'])
&& ! $result['success']
) {
throw new \Exception(
isset($result['error']['info'])
? $result['error']['info']

View File

@ -33,7 +33,10 @@ class CoreConfigRepository extends Repository
{
Event::dispatch('core.configuration.save.before');
if ($data['locale'] || $data['channel']) {
if (
$data['locale']
|| $data['channel']
) {
$locale = $data['locale'];
$channel = $data['channel'];
@ -51,12 +54,21 @@ class CoreConfigRepository extends Repository
$localeBased = isset($field['locale_based']) && $field['locale_based'] ? true : false;
if (getType($value) == 'array' && ! isset($value['delete'])) {
if (
getType($value) == 'array'
&& ! isset($value['delete'])
) {
$value = implode(',', $value);
}
if (isset($field['channel_based']) && $field['channel_based']) {
if (isset($field['locale_based']) && $field['locale_based']) {
if (
isset($field['channel_based'])
&& $field['channel_based']
) {
if (
isset($field['locale_based'])
&& $field['locale_based']
) {
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('locale_code', $locale)
@ -69,7 +81,10 @@ class CoreConfigRepository extends Repository
->get();
}
} else {
if (isset($field['locale_based']) && $field['locale_based']) {
if (
isset($field['locale_based'])
&& $field['locale_based']
) {
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('locale_code', $locale)

View File

@ -109,11 +109,17 @@ trait CoreConfigField
{
$info = [];
if (isset($field['channel_based']) && $field['channel_based']) {
if (
isset($field['channel_based'])
&& $field['channel_based']
) {
$info[] = $channel;
}
if (isset($field['locale_based']) && $field['locale_based']) {
if (
isset($field['locale_based'])
&& $field['locale_based']
) {
$info[] = $locale;
}

View File

@ -99,7 +99,10 @@ class Tree {
{
$url = trim($item['url'], '/');
if ((strpos($this->current, $url) !== false) || (strpos($this->currentKey, $item['key']) === 0)) {
if (
(strpos($this->current, $url) !== false)
|| (strpos($this->currentKey, $item['key']) === 0)
) {
return 'active';
}
}

View File

@ -16,7 +16,8 @@ class BladeCompiler extends BaseBladeCompiler
{
$tokens = $this->getOpenAndClosingPhpTokens($contents);
if (config('view.tracer')
if (
config('view.tracer')
&& strpos($this->getPath(), 'tracer/style.blade.php') == false
&& strpos($this->getPath(), 'master.blade.php') == false
) {
@ -25,7 +26,10 @@ class BladeCompiler extends BaseBladeCompiler
$contents = '<div class="path-hint" data-toggle="tooltip" data-title="' . $finalPath . '" data-id="' . uniqid() . '"><span class="testing"></span>' . $contents . '</div>';
}
if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) {
if (
$tokens->isNotEmpty()
&& $tokens->last() !== T_CLOSE_TAG
) {
$contents .= ' ?>';
}

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