Merge branch 'master' of https://github.com/bagisto/bagisto into sarga-v1
Conflicts: packages/Webkul/Category/src/Repositories/CategoryRepository.php packages/Webkul/Product/src/Listeners/ProductFlat.php packages/Webkul/Sales/src/Repositories/InvoiceRepository.php
This commit is contained in:
commit
6d4bee4e14
|
|
@ -1,6 +1,6 @@
|
|||
APP_NAME=Bagisto
|
||||
APP_ENV=local
|
||||
APP_VERSION=1.4.3
|
||||
APP_VERSION=1.4.4
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ name: CI
|
|||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
|
|
@ -16,9 +19,7 @@ jobs:
|
|||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: bagisto_testing
|
||||
MYSQL_USER: bagisto
|
||||
MYSQL_PASSWORD: secret
|
||||
MYSQL_DATABASE: bagisto
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
|
|
@ -42,11 +43,12 @@ jobs:
|
|||
run: |
|
||||
cp .env.example .env.testing
|
||||
set -e
|
||||
sed -i "s|^\(APP_ENV=\s*\).*$|\1testing|" .env.testing
|
||||
sed -i "s|^\(DB_HOST=\s*\).*$|\1127.0.0.1|" .env.testing
|
||||
sed -i "s|^\(DB_PORT=\s*\).*$|\1${{ job.services.mysql.ports['3306'] }}|" .env.testing
|
||||
sed -i "s|^\(DB_DATABASE=\s*\).*$|\1bagisto_testing|" .env.testing
|
||||
sed -i "s|^\(DB_USERNAME=\s*\).*$|\1bagisto|" .env.testing
|
||||
sed -i "s|^\(DB_PASSWORD=\s*\).*$|\1secret|" .env.testing
|
||||
sed -i "s|^\(DB_DATABASE=\s*\).*$|\1bagisto|" .env.testing
|
||||
sed -i "s|^\(DB_USERNAME=\s*\).*$|\1root|" .env.testing
|
||||
sed -i "s|^\(DB_PASSWORD=\s*\).*$|\1root|" .env.testing
|
||||
|
||||
- name: Key Generate
|
||||
run: set -e && php artisan key:generate --env=testing
|
||||
|
|
|
|||
|
|
@ -2,6 +2,209 @@
|
|||
|
||||
This changelog consists of the bug & security fixes and new features being included in the releases listed below.
|
||||
|
||||
## **v1.4.4 (30th of August 2022)** - *Release*
|
||||
|
||||
* #5584 [feature] - there should be an feature so that when we click on mark as read , notification box should close.
|
||||
|
||||
* #5463 [feature] - there should be a button so that we should clear all filters.
|
||||
|
||||
* [enhancement] - Optimized product
|
||||
|
||||
* [enhancement] - Optimized cart
|
||||
|
||||
* [enhancement] - Refactored code
|
||||
|
||||
* #6556 [enhancement] - Cart Rule -. Validation should be applied in Coupon Code uses per customer and used per coupon section.
|
||||
|
||||
* #6555 [enhancement] - Cart Rule - Auto Generate Coupon Code details at bottom must not visible when we switch to Manual Coupon Code.
|
||||
|
||||
* #6501 [enhancement] - Cart item prices rounded with precision of 2 resulting in rounding errors after applying taxes.
|
||||
|
||||
* #6494 [enhancement] - The product's URL_KEY should not be changed if the admin is editing the product's name for another locale.
|
||||
|
||||
* #6464 [enhancement] - UI - In Table Booking Product, Special Request/Notes must be in Bold for Main Cart.
|
||||
|
||||
* #6458 [enhancement] - There should be the validations for the input fields if the admin is trying to create catalog rules.
|
||||
|
||||
* #6452 [enhancement] - The page should be open on the next tab when the admin is trying to view the CMS pages.
|
||||
|
||||
* #6427 [enhancement] - The mouse property should be not-allowed if the cart is empty. in default theme.
|
||||
|
||||
* #6426 [enhancement] - The warning message should be correct if the admin is trying to ship the invalid product quantity.
|
||||
|
||||
* #6417 [enhancement] - There should be a flash message [ Coupan is already applied ] if the user is trying to apply the same coupon multiple times.
|
||||
|
||||
* #6408 [enhancement] - The name of the applied filters should be meaningful if the customer is trying to filter the orders.
|
||||
|
||||
* #6393 [enhancement] - The page should not be refreshed if the customer is trying to apply the same coupon multiple times.
|
||||
|
||||
* #6371 [enhancement] - There should be a flash message for customers when the cart rule is applied on the checkout page.
|
||||
|
||||
* #6358 [enhancement] - Unable to see any notification on Coupon Applied on the Checkout Page.
|
||||
|
||||
* #6355 [enhancement] - There should be a preview option in the CMS pages table.
|
||||
|
||||
* #6327 [enhancement] - Add Missing Language Folder In All Package
|
||||
|
||||
* #6273 [enhancement] - There should be a tooltip message, after copying the wishlist share link
|
||||
|
||||
* #5801 [enhancement] - Maximum video uploading size should be mentioned when we create product.
|
||||
|
||||
* #5464 [enhancement] - there should be an image icon of user profile image.
|
||||
|
||||
* #6545 [fixed] - The admin should be able to create transactions only with the Grand Total amount of the order.
|
||||
|
||||
* #6406 [fixed] - Discount should be shown only for the product for which we created a catalog rule.
|
||||
|
||||
* #6312 [fixed] - The billing address should not be saved multiple times, if the customer is clicking on save address checkbox in multiple times.
|
||||
|
||||
* #6654 [fixed] - The size of the image card should be fixed. on the home page.
|
||||
|
||||
* #6644 [fixed] - Trimming should be added for the search string.
|
||||
|
||||
* #6640 [fixed] - There should not be any alert box if the admin is trying to filter the products.
|
||||
|
||||
* #6635 [fixed] - The page should not be redirected to the wishlist page when the customer removes any product from the wishlist.
|
||||
|
||||
* #6632 [fixed] - There add to cart and the wishlist button are adjusting if the customer is trying to view any product.
|
||||
|
||||
* #6609 [fixed] - The wishlist should not get empty after deleting the all product of the second-page wishlist.
|
||||
|
||||
* #6606 [fixed] - The admin should be able to upload and remove the product's image.
|
||||
|
||||
* #6558 [fixed] - The cross icon should be just before the calendar icon if the customer is trying to select the appointment date for booking the product.
|
||||
|
||||
* #6554 [fixed] - The discount amount cannot be greater than 100 if the action type is the Percentage of the product.
|
||||
|
||||
* #6547 [fixed] - The product video should be played properly if any.
|
||||
|
||||
* #6518 [fixed] - The admin should be able to update the product's status by mass action.
|
||||
|
||||
* #6514 [fixed] - The save as category button should not be clicked automatically if the admin is pressing the enter key for the searching product.
|
||||
|
||||
* #6509 [fixed] - There is an exception if the admin is trying to search products from the category page.
|
||||
|
||||
* #6507 [fixed] - Notification url is broken when admin_url is changed.
|
||||
|
||||
* #6505 [fixed] - The model box should be in the center of the page if the user is clicking on Quick view for any produt.
|
||||
|
||||
* #6492 [fixed] - There is a UI issue if the user is trying to view the compared products in Arabic locale.
|
||||
|
||||
* #6485 [fixed] - The trash icon should be on the right side of the text if the user is trying to view the shopping cart in the Arabic locale.
|
||||
|
||||
* #6484 [fixed] - The admin is not able to logout on the mobile view.
|
||||
|
||||
* #6479 [fixed] - The position of the top bar should be fixed if the customer is trying to view any order in mobile view.
|
||||
|
||||
* #6471 [fixed] - UI Issue - In Customer Profile Edit option, there we can see the Calendar Logo at DOB is inappropriate.
|
||||
|
||||
* #6469 [fixed] - Translation Issue in the Configure Section related to Number.
|
||||
|
||||
* #6463 [fixed] - There should not be an exception if the admin is trying to add a new variant for the configurable product.
|
||||
|
||||
* #6461 [fixed] - There should not be any warning message for the default empty option if the admin is trying to create/edit any attribute.
|
||||
|
||||
* #6459 [fixed] - Only the review should be deleted which the user wants to delete.
|
||||
|
||||
* #6453 [fixed] - The new customer is not able to login properly when the another user is logging out.
|
||||
|
||||
* #6447 [fixed] - There should not be an exception if the customer is trying to add that product to the wishlist which is deleted by the admin.
|
||||
|
||||
* #6444 [fixed] - The page should be redirected to the login page if the guest user is trying to move products from compare to wishlist.
|
||||
|
||||
* #6443 [fixed] - The height of Add to cart button should be a little less on compare page.
|
||||
|
||||
* #6442 [fixed] - The products should be in proper alignment if there are multiple products in the compare list.
|
||||
|
||||
* #6441 [fixed] - The customer should be able to share the wishlist product if the share link is already generated.
|
||||
|
||||
* #6434 [fixed] - There should not be any translation issue in the checkout page, if the customer is trying to place an order.
|
||||
|
||||
* #6430 [fixed] - The admin should not be able to create a transaction for an invoice with the incorrect Transaction amount
|
||||
|
||||
* #6429 [fixed] - The user should not be able to add products into the cart with 0 quantity.
|
||||
|
||||
* #6425 [fixed] - The sidebar submenu dropdown icon should be shown properly if the admin is changing the English from LTR to RTL.
|
||||
|
||||
* #6423 [fixed] - The order status should be shown properly in the admin panel. if the status of the order is payment pending.
|
||||
|
||||
* #6419 [fixed] - There is an exception if the admin is trying to add transactions for any invoice.
|
||||
|
||||
* #6407 [fixed] - The user should not be able to place the order if the user is inactive.
|
||||
|
||||
* #6402 [fixed] - Only the address should be deleted which the user wants to delete.
|
||||
|
||||
* #6401 [fixed] - There is no option to view compare items for guests.
|
||||
|
||||
* #6400 [fixed] - The success message should not be shown multiple times if the user is trying to remove the applied coupon.
|
||||
|
||||
* #6397 [fixed] - The should not be an exception if the guest is trying to log in after deleting all the cart items.
|
||||
|
||||
* #6390 [fixed] - The radio button should be toggle only after clicking on the radio button's in admin panel
|
||||
|
||||
* #6389 [fixed] - The share wishlist and delete button should not overlap the sidebar in mobile view.
|
||||
|
||||
* #6386 [fixed] - The Products Ordered label should be highlighted if there is an error, while the admin is trying to create a ship for the order in dark mode.
|
||||
|
||||
* #6385 [fixed] - There should be a search icon if the customer is trying to search the orders.
|
||||
|
||||
* #6384 [fixed] - The product's image should not be out of the product card if the user is trying to view products in list mode.
|
||||
|
||||
* #6370 [fixed] - At least one shipping and payment method should be available.
|
||||
|
||||
* #6369 [fixed] - The product images are overriding if there are multiple products in the cart.
|
||||
|
||||
* #6368 [fixed] - There should be an option to update the cart if the customer is adding downloadable and simple products into the cart.
|
||||
|
||||
* #6366 [fixed] - The product's image is adjusted when the user is trying to view any variant of the configurable product
|
||||
|
||||
* #6365 [fixed] - The bullet symbol should be visible if the user is trying to change the product's image in a quick view popup box.
|
||||
|
||||
* #6364 [fixed] - The warning message should be correct when the condition is not matching with cart rule while the user is applying a coupon.
|
||||
|
||||
* #6362 [fixed] - There should be some space between the share and delete buttons on the wishlist page.
|
||||
|
||||
* #6349 [fixed] - The filter value should be correct if the admin is trying to filter the customers by the status filter
|
||||
|
||||
* #6346 [fixed] - There should not be any extra space between the update cart and the delete all items button, on the shopping cart page.
|
||||
|
||||
* #6344 [fixed] - The calendar icon is not showing when the admin is trying to filter the orders by date in dark mode.
|
||||
|
||||
* #6341 [fixed] - There is some extra space between the product image and add to cart button in the mobile view
|
||||
|
||||
* #6340 [fixed] - By default maximum price should be selected if the user is trying to filter a product by price filter.
|
||||
|
||||
* #6339 [fixed] - The Add to cart button should not be disabled if any one product is inactive of the group product.
|
||||
|
||||
* #6335 [fixed] - The translation is missing for slot dropdown if the user is trying to book any product
|
||||
|
||||
* #6334 [fixed] - The quantity field should not take a negative value if the admin is trying to edit the quantity
|
||||
|
||||
* #6333 [fixed] - The country dropdown should be in the Ascending order when the customer is adding the delivery address on the checkout page.
|
||||
|
||||
* #6332 [fixed] - The calendar Icon should be on the left side of the input box in the Arabic locale when the customer is editing the profile.
|
||||
|
||||
* #6331 [fixed] - The location and the calendar Icon should be slightly right side in the Arabic locale when the customer is trying to book any product.
|
||||
|
||||
* #6324 [fixed] - The warning message should be correct if the admin is trying to upload an invalid image format for the profile image.
|
||||
|
||||
* #6319 [fixed] - The calendar icon is in the center of the input box. if the customer is trying to book the product.
|
||||
|
||||
* #6318 [fixed] - The add to cart button should be in proper alignment inside the compare page.
|
||||
|
||||
* #6317 [fixed] - The page should be redirected to the product view page. if the user clicks on the product image inside the mini cart.
|
||||
|
||||
* #6313 [fixed] - The warning message should be correct if the customer is selecting the PayPal Smart Button payment method with an invalid country code
|
||||
|
||||
* #6288 [fixed] - The delete button is overriding on share button if the customer is trying to view the wishlist products on mobile view.
|
||||
|
||||
* #6277 [fixed] - Checkout redirects when a carrier has more than one shipping method
|
||||
|
||||
* #6276 [fixed] - The product's image should be visible properly in mobile view.
|
||||
|
||||
* #6271 [fixed] - There should not be any warning message if the user is trying to book a rental product for multiple hours.
|
||||
|
||||
|
||||
## **v1.4.3 (20th of April 2022)** - *Release*
|
||||
|
||||
* #6213 [feature] - Command For Bagisto Publish
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ class Kernel extends HttpKernel
|
|||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\Webkul\Core\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Webkul\Core\Http\Middleware\SecureHeaders::class,
|
||||
];
|
||||
|
||||
|
|
@ -29,7 +29,9 @@ class Kernel extends HttpKernel
|
|||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
|
|
@ -52,6 +54,7 @@ class Kernel extends HttpKernel
|
|||
protected $routeMiddleware = [
|
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
|
|
|
|||
|
|
@ -146,14 +146,16 @@
|
|||
"@php artisan migrate:fresh --env=testing",
|
||||
"vendor/bin/codecept run unit",
|
||||
"vendor/bin/codecept run functional",
|
||||
"vendor/bin/codecept run trigger"
|
||||
"vendor/bin/codecept run trigger",
|
||||
"vendor/bin/codecept run api"
|
||||
],
|
||||
"test-win": [
|
||||
"@set -e",
|
||||
"@php artisan migrate:fresh --env=testing",
|
||||
"vendor\\bin\\codecept.bat run unit",
|
||||
"vendor\\bin\\codecept.bat run functional",
|
||||
"vendor\\bin\\codecept.bat run trigger"
|
||||
"vendor\\bin\\codecept.bat run trigger",
|
||||
"vendor\\bin\\codecept.bat run api"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
db-blade-compiler.php
|
||||
debugbar.php
|
||||
dompdf.php
|
||||
excel.php
|
||||
flare.php
|
||||
ignition.php
|
||||
image.php
|
||||
imagecache.php
|
||||
jwt.php
|
||||
repository.php
|
||||
scout.php
|
||||
tinker.php
|
||||
translatable.php
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -146,7 +146,7 @@ class AddressDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'closure' => function ($row) {
|
||||
if ($row->default_address == 1) {
|
||||
if ($row->default_address) {
|
||||
return '<span class="badge badge-md badge-success"">' . trans('admin::app.customers.addresses.yes') . '</span>';
|
||||
} else {
|
||||
return trans('admin::app.customers.addresses.dash');
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'closure' => function ($value) {
|
||||
if ($value->is_required == 1) {
|
||||
if ($value->is_required) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.false');
|
||||
|
|
@ -105,7 +105,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->is_unique == 1) {
|
||||
if ($value->is_unique) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.false');
|
||||
|
|
@ -121,7 +121,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->value_per_locale == 1) {
|
||||
if ($value->value_per_locale) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.false');
|
||||
|
|
@ -137,7 +137,7 @@ class AttributeDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->value_per_channel == 1) {
|
||||
if ($value->value_per_channel) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.false');
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class CampaignDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.inactive');
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class CartRuleCouponsDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->end_other_rules == 1) {
|
||||
if ($value->end_other_rules) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.false');
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class CatalogRuleDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.inactive');
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class CategoryDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.inactive');
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class CategoryProductDataGrid extends DataGrid
|
|||
'searchable' => false,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.inactive');
|
||||
|
|
|
|||
|
|
@ -145,13 +145,13 @@ class CustomerDataGrid extends DataGrid
|
|||
'closure' => function ($row) {
|
||||
$html = '';
|
||||
|
||||
if ($row->status == 1) {
|
||||
if ($row->status) {
|
||||
$html .= '<span class="badge badge-md badge-success">' . trans('admin::app.customers.customers.active') . '</span>';
|
||||
} else {
|
||||
$html .= '<span class="badge badge-md badge-danger">' . trans('admin::app.customers.customers.inactive') . '</span>';
|
||||
}
|
||||
|
||||
if ($row->is_suspended == 1) {
|
||||
if ($row->is_suspended) {
|
||||
$html .= '<span class="badge badge-md badge-danger">' . trans('admin::app.customers.customers.suspended') . '</span>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class InventorySourcesDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.inactive');
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class NewsLetterDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status === 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.true');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.false');
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class ProductDataGrid extends DataGrid
|
|||
'closure' => function ($value) {
|
||||
$html = '';
|
||||
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
$html .= '<span class="badge badge-md badge-success">' . trans('admin::app.datagrid.active') . '</span>';
|
||||
} else {
|
||||
$html .= '<span class="badge badge-md badge-danger">' . trans('admin::app.datagrid.inactive') . '</span>';
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class UserDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'closure' => function ($value) {
|
||||
if ($value->status == 1) {
|
||||
if ($value->status) {
|
||||
return trans('admin::app.datagrid.active');
|
||||
} else {
|
||||
return trans('admin::app.datagrid.inactive');
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class ConfigurationController extends Controller
|
|||
{
|
||||
if (! request()->route('slug')) {
|
||||
$firstItem = current($this->configTree->items);
|
||||
|
||||
$secondItem = current($firstItem['children']);
|
||||
|
||||
return $this->getSlugs($secondItem);
|
||||
|
|
@ -109,6 +110,7 @@ class ConfigurationController extends Controller
|
|||
foreach ($data['sales']['carriers'] as $carrier) {
|
||||
if ($carrier['active']) {
|
||||
$atLeastOneCarrierEnabled = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -116,6 +118,22 @@ class ConfigurationController extends Controller
|
|||
if (! $atLeastOneCarrierEnabled) {
|
||||
session()->flash('error', trans('admin::app.configuration.enable-atleast-one-shipping'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
} elseif (isset($data['sales']['paymentmethods'])) {
|
||||
$atLeastOnePaymentMethodEnabled = false;
|
||||
|
||||
foreach ($data['sales']['paymentmethods'] as $paymentMethod) {
|
||||
if ($paymentMethod['active']) {
|
||||
$atLeastOnePaymentMethodEnabled = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $atLeastOnePaymentMethodEnabled) {
|
||||
session()->flash('error', trans('admin::app.configuration.enable-atleast-one-payment'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers\Customer;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Rules\VatIdRule;
|
||||
use Webkul\Admin\DataGrids\AddressDataGrid;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
|
|
@ -73,8 +74,6 @@ class AddressController extends Controller
|
|||
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
|
||||
]);
|
||||
|
||||
$data = collect(request()->input())->except('_token')->toArray();
|
||||
|
||||
$this->validate(request(), [
|
||||
'company_name' => 'string',
|
||||
'address1' => 'string|required',
|
||||
|
|
@ -86,15 +85,15 @@ class AddressController extends Controller
|
|||
'vat_id' => new VatIdRule(),
|
||||
]);
|
||||
|
||||
if ($this->customerAddressRepository->create($data)) {
|
||||
session()->flash('success', trans('admin::app.customers.addresses.success-create'));
|
||||
Event::dispatch('customer.addresses.create.before');
|
||||
|
||||
return redirect()->route('admin.customer.edit', ['id' => $data['customer_id']]);
|
||||
} else {
|
||||
session()->flash('success', trans('admin::app.customers.addresses.error-create'));
|
||||
$customerAddress = $this->customerAddressRepository->create(request()->all());
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
Event::dispatch('customer.addresses.create.after', $customerAddress);
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.addresses.success-create'));
|
||||
|
||||
return redirect()->route('admin.customer.edit', ['id' => request('customer_id')]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,18 +130,15 @@ class AddressController extends Controller
|
|||
'vat_id' => new VatIdRule(),
|
||||
]);
|
||||
|
||||
$data = collect(request()->input())->except('_token')->toArray();
|
||||
Event::dispatch('customer.addresses.update.before', $id);
|
||||
|
||||
$address = $this->customerAddressRepository->find($id);
|
||||
$customerAddress = $this->customerAddressRepository->update(request()->all(), $id);
|
||||
|
||||
if ($address) {
|
||||
$this->customerAddressRepository->update($data, $id);
|
||||
Event::dispatch('customer.addresses.update.after', $customerAddress);
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.addresses.success-update'));
|
||||
session()->flash('success', trans('admin::app.customers.addresses.success-update'));
|
||||
|
||||
return redirect()->route('admin.customer.addresses.index', ['id' => $address->customer_id]);
|
||||
}
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
return redirect()->route('admin.customer.addresses.index', ['id' => $customerAddress->customer_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -153,11 +149,15 @@ class AddressController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
Event::dispatch('customer.addresses.delete.before', $id);
|
||||
|
||||
$this->customerAddressRepository->delete($id);
|
||||
|
||||
Event::dispatch('customer.addresses.delete.after', $id);
|
||||
|
||||
return response()->json([
|
||||
'redirect' => false,
|
||||
'message' => trans('admin::app.customers.addresses.success-delete')
|
||||
'message' => trans('admin::app.customers.addresses.success-delete')
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +172,11 @@ class AddressController extends Controller
|
|||
$addressIds = explode(',', request()->input('indexes'));
|
||||
|
||||
foreach ($addressIds as $addressId) {
|
||||
Event::dispatch('customer.addresses.delete.before', $addressId);
|
||||
|
||||
$this->customerAddressRepository->delete($addressId);
|
||||
|
||||
Event::dispatch('customer.addresses.delete.after', $addressId);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.addresses.success-mass-delete'));
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers\Customer;
|
||||
|
||||
use Mail;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Webkul\Admin\DataGrids\CustomerDataGrid;
|
||||
use Webkul\Admin\DataGrids\CustomerOrderDataGrid;
|
||||
use Webkul\Admin\DataGrids\CustomersInvoicesDataGrid;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\Admin\Mail\NewCustomerNotification;
|
||||
use Webkul\Core\Repositories\ChannelRepository;
|
||||
use Webkul\Customer\Repositories\CustomerAddressRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
|
||||
|
|
@ -26,15 +25,11 @@ class CustomerController extends Controller
|
|||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||
* @param \Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository
|
||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
||||
* @param \Webkul\Core\Repositories\ChannelRepository $channelRepository
|
||||
*/
|
||||
public function __construct(
|
||||
protected CustomerRepository $customerRepository,
|
||||
protected CustomerAddressRepository $customerAddressRepository,
|
||||
protected CustomerGroupRepository $customerGroupRepository,
|
||||
protected ChannelRepository $channelRepository
|
||||
protected CustomerGroupRepository $customerGroupRepository
|
||||
)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
|
@ -61,11 +56,9 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
$customerGroup = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
||||
$groups = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
||||
|
||||
$channelName = $this->channelRepository->all();
|
||||
|
||||
return view($this->_config['view'], compact('customerGroup', 'channelName'));
|
||||
return view($this->_config['view'], compact('groups'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -83,18 +76,20 @@ class CustomerController extends Controller
|
|||
'date_of_birth' => 'date|before:today',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
||||
$password = rand(100000, 10000000);
|
||||
|
||||
$data['password'] = bcrypt($password);
|
||||
Event::dispatch('customer.registration.before');
|
||||
|
||||
$data['is_verified'] = 1;
|
||||
$customer = $this->customerRepository->create(array_merge(request()->all() , [
|
||||
'password' => bcrypt($password),
|
||||
'is_verified' => 1,
|
||||
]));
|
||||
|
||||
$customer = $this->customerRepository->create($data);
|
||||
Event::dispatch('customer.registration.after', $customer);
|
||||
|
||||
try {
|
||||
$configKey = 'emails.general.notifications.emails.general.notifications.customer';
|
||||
|
||||
if (core()->getConfigData($configKey)) {
|
||||
Mail::queue(new NewCustomerNotification($customer, $password));
|
||||
}
|
||||
|
|
@ -116,11 +111,10 @@ class CustomerController extends Controller
|
|||
public function edit($id)
|
||||
{
|
||||
$customer = $this->customerRepository->findOrFail($id);
|
||||
$address = $this->customerAddressRepository->find($id);
|
||||
$customerGroup = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
||||
$channelName = $this->channelRepository->all();
|
||||
|
||||
return view($this->_config['view'], compact('customer', 'address', 'customerGroup', 'channelName'));
|
||||
$groups = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
||||
|
||||
return view($this->_config['view'], compact('customer', 'groups'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -139,13 +133,14 @@ class CustomerController extends Controller
|
|||
'date_of_birth' => 'date|before:today',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
Event::dispatch('customer.update.before', $id);
|
||||
|
||||
$customer = $this->customerRepository->update(array_merge(request()->all(), [
|
||||
'status' => request()->has('status'),
|
||||
'is_suspended' => request()->has('is_suspended'),
|
||||
]), $id);
|
||||
|
||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
||||
|
||||
$data['is_suspended'] = ! isset($data['is_suspended']) ? 0 : 1;
|
||||
|
||||
$this->customerRepository->update($data, $id);
|
||||
Event::dispatch('customer.update.after', $customer);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));
|
||||
|
||||
|
|
@ -199,15 +194,15 @@ class CustomerController extends Controller
|
|||
'notes' => 'string|nullable',
|
||||
]);
|
||||
|
||||
$customer = $this->customerRepository->find(request()->input('_customer'));
|
||||
Event::dispatch('customer.update.before', request()->input('_customer'));
|
||||
|
||||
$noteTaken = $customer->update(['notes' => request()->input('notes')]);
|
||||
$customer = $this->customerRepository->update([
|
||||
'notes' => request()->input('notes'),
|
||||
], request()->input('_customer'));
|
||||
|
||||
if ($noteTaken) {
|
||||
session()->flash('success', 'Note taken');
|
||||
} else {
|
||||
session()->flash('error', 'Note cannot be taken');
|
||||
}
|
||||
Event::dispatch('customer.update.after', $customer);
|
||||
|
||||
session()->flash('success', 'Note taken');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
|
@ -220,12 +215,17 @@ class CustomerController extends Controller
|
|||
public function massUpdate()
|
||||
{
|
||||
$customerIds = explode(',', request()->input('indexes'));
|
||||
|
||||
$updateOption = request()->input('update-options');
|
||||
|
||||
foreach ($customerIds as $customerId) {
|
||||
$customer = $this->customerRepository->find($customerId);
|
||||
Event::dispatch('customer.update.before', $customerId);
|
||||
|
||||
$customer->update(['status' => $updateOption]);
|
||||
$customer = $this->customerRepository->update([
|
||||
'status' => $updateOption,
|
||||
], $customerId);
|
||||
|
||||
Event::dispatch('customer.update.after', $customer);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.customers.mass-update-success'));
|
||||
|
|
@ -243,9 +243,12 @@ class CustomerController extends Controller
|
|||
$customerIds = explode(',', request()->input('indexes'));
|
||||
|
||||
if (! $this->customerRepository->checkBulkCustomerIfTheyHaveOrderPendingOrProcessing($customerIds)) {
|
||||
|
||||
foreach ($customerIds as $customerId) {
|
||||
$this->customerRepository->deleteWhere(['id' => $customerId]);
|
||||
Event::dispatch('customer.delete.before', $customerId);
|
||||
|
||||
$this->customerRepository->delete($customerId);
|
||||
|
||||
Event::dispatch('customer.delete.after', $customerId);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.customers.mass-destroy-success'));
|
||||
|
|
@ -254,6 +257,7 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
session()->flash('error', trans('admin::app.response.order-pending', ['name' => 'Customers']));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers\Customer;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Admin\DataGrids\CustomerGroupDataGrid;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
|
|
@ -62,11 +63,13 @@ class CustomerGroupController extends Controller
|
|||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
Event::dispatch('customer.customer_group.create.before');
|
||||
|
||||
$data['is_user_defined'] = 1;
|
||||
$customerGroup = $this->customerGroupRepository->create(array_merge(request()->all() , [
|
||||
'is_user_defined' => 1,
|
||||
]));
|
||||
|
||||
$this->customerGroupRepository->create($data);
|
||||
Event::dispatch('customer.customer_group.create.after', $customerGroup);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
|
||||
|
||||
|
|
@ -99,7 +102,11 @@ class CustomerGroupController extends Controller
|
|||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$this->customerGroupRepository->update(request()->all(), $id);
|
||||
Event::dispatch('customer.customer_group.update.before', $id);
|
||||
|
||||
$customerGroup = $this->customerGroupRepository->update(request()->all(), $id);
|
||||
|
||||
Event::dispatch('customer.customer_group.update.after', $customerGroup);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer Group']));
|
||||
|
||||
|
|
@ -116,21 +123,25 @@ class CustomerGroupController extends Controller
|
|||
{
|
||||
$customerGroup = $this->customerGroupRepository->findOrFail($id);
|
||||
|
||||
if ($customerGroup->is_user_defined == 0) {
|
||||
if (! $customerGroup->is_user_defined) {
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.customers.customers.group-default'),
|
||||
], 400);
|
||||
}
|
||||
|
||||
if (count($customerGroup->customers) > 0) {
|
||||
if ($customerGroup->customers->count()) {
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.response.customer-associate', ['name' => 'Customer Group']),
|
||||
], 400);
|
||||
}
|
||||
|
||||
try {
|
||||
Event::dispatch('customer.customer_group.delete.before', $id);
|
||||
|
||||
$this->customerGroupRepository->delete($id);
|
||||
|
||||
Event::dispatch('customer.customer_group.delete.after', $id);
|
||||
|
||||
return response()->json(['message' => trans('admin::app.response.delete-success', ['name' => 'Customer Group'])]);
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ class ExportController extends Controller
|
|||
|
||||
$gridName = explode('\\', $criteria['gridName']);
|
||||
|
||||
$path = '\Webkul\Admin\DataGrids' . '\\' . last($gridName);
|
||||
|
||||
$gridInstance = app($path);
|
||||
$gridInstance = app('\Webkul\Admin\DataGrids' . '\\' . last($gridName));
|
||||
|
||||
$records = $gridInstance->export();
|
||||
|
||||
|
|
@ -34,9 +32,7 @@ class ExportController extends Controller
|
|||
|
||||
if ($format == 'csv') {
|
||||
return Excel::download(new DataGridExport($records), last($gridName) . '.csv');
|
||||
}
|
||||
|
||||
if ($format == 'xls') {
|
||||
} elseif ($format == 'xls') {
|
||||
return Excel::download(new DataGridExport($records), last($gridName) . '.xlsx');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,21 +99,21 @@ class InvoiceController extends Controller
|
|||
'invoice.items.*' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
||||
if (! $this->invoiceRepository->haveProductToInvoice($data)) {
|
||||
if (! $this->invoiceRepository->haveProductToInvoice(request()->all())) {
|
||||
session()->flash('error', trans('admin::app.sales.invoices.product-error'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if (! $this->invoiceRepository->isValidQuantity($data)) {
|
||||
if (! $this->invoiceRepository->isValidQuantity(request()->all())) {
|
||||
session()->flash('error', trans('admin::app.sales.invoices.invalid-qty'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$this->invoiceRepository->create(array_merge($data, ['order_id' => $orderId]));
|
||||
$this->invoiceRepository->create(array_merge(request()->all(), [
|
||||
'order_id' => $orderId,
|
||||
]));
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Invoice']));
|
||||
|
||||
|
|
@ -148,15 +148,9 @@ class InvoiceController extends Controller
|
|||
|
||||
$invoice = $this->invoiceRepository->findOrFail($id);
|
||||
|
||||
if ($invoice) {
|
||||
$this->sendDuplicateInvoiceMail($invoice, $request->email);
|
||||
$this->sendDuplicateInvoiceMail($invoice, $request->email);
|
||||
|
||||
session()->flash('success', __('admin::app.sales.invoices.invoice-sent'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
session()->flash('error', __('admin::app.response.something-went-wrong'));
|
||||
session()->flash('success', trans('admin::app.sales.invoices.invoice-sent'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,15 +86,12 @@ class OrderController extends Controller
|
|||
*/
|
||||
public function comment($id)
|
||||
{
|
||||
$data = array_merge(request()->all(), [
|
||||
'order_id' => $id,
|
||||
]);
|
||||
Event::dispatch('sales.order.comment.create.before');
|
||||
|
||||
$data['customer_notified'] = isset($data['customer_notified']) ? 1 : 0;
|
||||
|
||||
Event::dispatch('sales.order.comment.create.before', $data);
|
||||
|
||||
$comment = $this->orderCommentRepository->create($data);
|
||||
$comment = $this->orderCommentRepository->create(array_merge(request()->all(), [
|
||||
'order_id' => $id,
|
||||
'customer_notified' => request()->has('customer_notified'),
|
||||
]));
|
||||
|
||||
Event::dispatch('sales.order.comment.create.after', $comment);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,9 @@ class ShipmentController extends Controller
|
|||
return redirect()->back();
|
||||
}
|
||||
|
||||
$this->shipmentRepository->create(array_merge($data, ['order_id' => $orderId]));
|
||||
$this->shipmentRepository->create(array_merge($data, [
|
||||
'order_id' => $orderId,
|
||||
]));
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Shipment']));
|
||||
|
||||
|
|
@ -141,7 +143,10 @@ class ShipmentController extends Controller
|
|||
->where('inventory_source_id', $inventorySourceId)
|
||||
->sum('qty');
|
||||
|
||||
if ($child->qty_to_ship < $finalQty || $availableQty < $finalQty) {
|
||||
if (
|
||||
$child->qty_to_ship < $finalQty
|
||||
|| $availableQty < $finalQty
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -150,7 +155,10 @@ class ShipmentController extends Controller
|
|||
->where('inventory_source_id', $inventorySourceId)
|
||||
->sum('qty');
|
||||
|
||||
if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) {
|
||||
if (
|
||||
$orderItem->qty_to_ship < $qty
|
||||
|| $availableQty < $qty
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,58 +80,68 @@ class TransactionController extends Controller
|
|||
|
||||
$invoice = $this->invoiceRepository->where('increment_id', $request->invoice_id)->first();
|
||||
|
||||
if ($invoice) {
|
||||
if ($invoice->state == 'paid') {
|
||||
session()->flash('info', trans('admin::app.sales.transactions.response.already-paid'));
|
||||
if (! $invoice) {
|
||||
session()->flash('error', trans('admin::app.sales.transactions.response.invoice-missing'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.index'));
|
||||
}
|
||||
|
||||
if ($request->amount > $invoice->base_grand_total) {
|
||||
session()->flash('info', trans('admin::app.sales.transactions.response.transaction-amount-exceeds'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.create'));
|
||||
} else {
|
||||
$order = $this->orderRepository->find($invoice->order_id);
|
||||
|
||||
$randomId = random_bytes(20);
|
||||
|
||||
$this->orderTransactionRepository->create([
|
||||
'transaction_id' => bin2hex($randomId),
|
||||
'type' => $request->payment_method,
|
||||
'payment_method' => $request->payment_method,
|
||||
'invoice_id' => $invoice->id,
|
||||
'order_id' => $invoice->order_id,
|
||||
'amount' => $request->amount,
|
||||
'status' => 'paid',
|
||||
'data' => json_encode([
|
||||
'paidAmount' => $request->amount,
|
||||
]),
|
||||
]);
|
||||
|
||||
$transactionTotal = $this->orderTransactionRepository->where('invoice_id', $invoice->id)->sum('amount');
|
||||
|
||||
if ($transactionTotal >= $invoice->base_grand_total) {
|
||||
$shipments = $this->shipmentRepository->where('order_id', $invoice->order_id)->first();
|
||||
|
||||
if (isset($shipments)) {
|
||||
$this->orderRepository->updateOrderStatus($order, 'completed');
|
||||
} else {
|
||||
$this->orderRepository->updateOrderStatus($order, 'processing');
|
||||
}
|
||||
|
||||
$this->invoiceRepository->updateState($invoice, 'paid');
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.sales.transactions.response.transaction-saved'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.index'));
|
||||
}
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
session()->flash('error', trans('admin::app.sales.transactions.response.invoice-missing'));
|
||||
$transactionAmtBefore = $this->orderTransactionRepository->where('invoice_id', $invoice->id)->sum('amount');
|
||||
|
||||
$transactionAmtfinal = $request->amount + $transactionAmtBefore;
|
||||
|
||||
return redirect()->back();
|
||||
if ($invoice->state == 'paid') {
|
||||
session()->flash('info', trans('admin::app.sales.transactions.response.already-paid'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.index'));
|
||||
}
|
||||
|
||||
if ($transactionAmtfinal > $invoice->base_grand_total) {
|
||||
session()->flash('info', trans('admin::app.sales.transactions.response.transaction-amount-exceeds'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.create'));
|
||||
}
|
||||
|
||||
if ($request->amount <= 0) {
|
||||
session()->flash('info', trans('admin::app.sales.transactions.response.transaction-amount-zero'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.create'));
|
||||
}
|
||||
|
||||
$order = $this->orderRepository->find($invoice->order_id);
|
||||
|
||||
$randomId = random_bytes(20);
|
||||
|
||||
$this->orderTransactionRepository->create([
|
||||
'transaction_id' => bin2hex($randomId),
|
||||
'type' => $request->payment_method,
|
||||
'payment_method' => $request->payment_method,
|
||||
'invoice_id' => $invoice->id,
|
||||
'order_id' => $invoice->order_id,
|
||||
'amount' => $request->amount,
|
||||
'status' => 'paid',
|
||||
'data' => json_encode([
|
||||
'paidAmount' => $request->amount,
|
||||
]),
|
||||
]);
|
||||
|
||||
$transactionTotal = $this->orderTransactionRepository->where('invoice_id', $invoice->id)->sum('amount');
|
||||
|
||||
if ($transactionTotal >= $invoice->base_grand_total) {
|
||||
$shipments = $this->shipmentRepository->where('order_id', $invoice->order_id)->first();
|
||||
|
||||
if (isset($shipments)) {
|
||||
$this->orderRepository->updateOrderStatus($order, 'completed');
|
||||
} else {
|
||||
$this->orderRepository->updateOrderStatus($order, 'processing');
|
||||
}
|
||||
|
||||
$this->invoiceRepository->updateState($invoice, 'paid');
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.sales.transactions.response.transaction-saved'));
|
||||
|
||||
return redirect(route('admin.sales.transactions.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ namespace Webkul\Admin\Listeners;
|
|||
use Illuminate\Support\Facades\Mail;
|
||||
use Webkul\User\Notifications\AdminUpdatePassword;
|
||||
use Webkul\Customer\Notifications\CustomerUpdatePassword;
|
||||
use Webkul\Customer\Models\Customer;
|
||||
use Webkul\User\Models\Admin;
|
||||
|
||||
class PasswordChange
|
||||
{
|
||||
|
|
@ -17,11 +19,9 @@ class PasswordChange
|
|||
public function sendUpdatePasswordMail($adminOrCustomer)
|
||||
{
|
||||
try {
|
||||
if ($adminOrCustomer instanceof \Webkul\Customer\Models\Customer) {
|
||||
if ($adminOrCustomer instanceof Customer) {
|
||||
Mail::queue(new CustomerUpdatePassword($adminOrCustomer));
|
||||
}
|
||||
|
||||
if ($adminOrCustomer instanceof \Webkul\User\Models\Admin) {
|
||||
} elseif ($adminOrCustomer instanceof Admin) {
|
||||
Mail::queue(new AdminUpdatePassword($adminOrCustomer));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ class CancelOrderAdminNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to(core()->getAdminEmailDetails()['email'])
|
||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||
->view('shop::emails.sales.order-cancel-admin');
|
||||
->to(core()->getAdminEmailDetails()['email'])
|
||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||
->view('shop::emails.sales.order-cancel-admin');
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@ class CancelOrderNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||
->view('shop::emails.sales.order-cancel');
|
||||
->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||
->view('shop::emails.sales.order-cancel');
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,8 @@ class DuplicateInvoiceNotification extends Mailable
|
|||
public $invoice,
|
||||
public $customerEmail
|
||||
)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
|
|
|
|||
|
|
@ -16,12 +16,15 @@ class InvoiceOverdueReminder extends Mailable
|
|||
*
|
||||
* @param \Webkul\Customer\Contracts\Customer $customer
|
||||
* @param \Webkul\Sales\Contracts\Invoice $invoice
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public $customer,
|
||||
public $invoice
|
||||
)
|
||||
{}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
|
|
@ -31,8 +34,11 @@ class InvoiceOverdueReminder extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($this->customer->email)
|
||||
->subject(trans('shop::app.mail.invoice.reminder.subject'))
|
||||
->view('shop::emails.customer.invoice-reminder')->with(['customer' => $this->customer, 'invoice' => $this->invoice]);
|
||||
->to($this->customer->email)
|
||||
->subject(trans('shop::app.mail.invoice.reminder.subject'))
|
||||
->view('shop::emails.customer.invoice-reminder')->with([
|
||||
'customer' => $this->customer,
|
||||
'invoice' => $this->invoice,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,8 +29,8 @@ class NewAdminNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to(core()->getAdminEmailDetails()['email'])
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-admin-order');
|
||||
->to(core()->getAdminEmailDetails()['email'])
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-admin-order');
|
||||
}
|
||||
}
|
||||
|
|
@ -33,8 +33,11 @@ class NewCustomerNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($this->customer->email)
|
||||
->subject(trans('shop::app.mail.customer.new.subject'))
|
||||
->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]);
|
||||
->to($this->customer->email)
|
||||
->subject(trans('shop::app.mail.customer.new.subject'))
|
||||
->view('shop::emails.customer.new-customer')->with([
|
||||
'customer' => $this->customer,
|
||||
'password' => $this->password,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ class NewInventorySourceNotification extends Mailable
|
|||
$inventory = $this->shipment->inventory_source;
|
||||
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($inventory->contact_email, $inventory->name)
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-inventorysource-shipment');
|
||||
->to($inventory->contact_email, $inventory->name)
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-inventorysource-shipment');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ class NewInvoiceNotification extends Mailable
|
|||
$order = $this->invoice->order;
|
||||
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-invoice');
|
||||
->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-invoice');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ class NewOrderNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-order');
|
||||
->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-order');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ class NewRefundNotification extends Mailable
|
|||
$order = $this->refund->order;
|
||||
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-refund');
|
||||
->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-refund');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ class NewShipmentNotification extends Mailable
|
|||
$order = $this->shipment->order;
|
||||
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-shipment');
|
||||
->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-shipment');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ class OrderCommentNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($this->comment->order->customer_email, $this->comment->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.comment.subject', ['order_id' => $this->comment->order->increment_id]))
|
||||
->view('shop::emails.sales.new-order-comment');
|
||||
->to($this->comment->order->customer_email, $this->comment->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.comment.subject', ['order_id' => $this->comment->order->increment_id]))
|
||||
->view('shop::emails.sales.new-order-comment');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,13 +105,15 @@ class AdminServiceProvider extends ServiceProvider
|
|||
&& substr_count($item['key'], '.') == 1
|
||||
) {
|
||||
foreach ($allowedPermissions as $key => $value) {
|
||||
if ($item['key'] == $value) {
|
||||
$neededItem = $allowedPermissions[$key + 1];
|
||||
if ($item['key'] != $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (config('menu.admin') as $key1 => $findMatced) {
|
||||
if ($findMatced['key'] == $neededItem) {
|
||||
$item['route'] = $findMatced['route'];
|
||||
}
|
||||
$neededItem = $allowedPermissions[$key + 1];
|
||||
|
||||
foreach (config('menu.admin') as $key1 => $findMatced) {
|
||||
if ($findMatced['key'] == $neededItem) {
|
||||
$item['route'] = $findMatced['route'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<i class="icon notification-icon active" style="margin-left:0px"></i>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-list bottom-right notification">
|
||||
<div class="dropdown-list bottom-right notification" ref="dropdownList">
|
||||
<div class="dropdown-container">
|
||||
<ul class="notif">
|
||||
<div id="notif-title">{{ title }}</div>
|
||||
|
|
@ -132,34 +132,38 @@ export default {
|
|||
read: 0
|
||||
};
|
||||
|
||||
let this_this = this;
|
||||
let self = this;
|
||||
|
||||
this.$http.get(this.getNotificationUrl, {
|
||||
params: params
|
||||
})
|
||||
.then(function (response) {
|
||||
this_this.notifications = response.data.search_results.data;
|
||||
this_this.totalUnRead = response.data.total_unread;
|
||||
self.notifications = response.data.search_results.data;
|
||||
self.totalUnRead = response.data.total_unread;
|
||||
})
|
||||
.catch(function (error) {})
|
||||
},
|
||||
|
||||
readAll: function () {
|
||||
let this_this = this;
|
||||
let self = this;
|
||||
let dropdownList = this.$refs.dropdownList;
|
||||
|
||||
this.$http.post(this.getReadAllUrl)
|
||||
.then(function (response) {
|
||||
this_this.notifications = response.data.search_results.data;
|
||||
self.notifications = response.data.search_results.data;
|
||||
|
||||
this_this.totalUnRead = response.data.total_unread;
|
||||
self.totalUnRead = response.data.total_unread;
|
||||
|
||||
window.flashMessages.push({
|
||||
'type': 'alert-success',
|
||||
'message': response.data.success_message
|
||||
});
|
||||
|
||||
this_this.$root.addFlashMessages();
|
||||
self.$root.addFlashMessages();
|
||||
})
|
||||
.catch(function (error) {})
|
||||
|
||||
dropdownList.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ $toggleColor: #3c41ff;
|
|||
min-width: 300px;
|
||||
max-width: 25vw;
|
||||
width: 100vw;
|
||||
height: 100%;
|
||||
height: 90vh;
|
||||
z-index: 1;
|
||||
padding-bottom: 10px;
|
||||
transition: transform 0.3s ease;
|
||||
|
|
|
|||
|
|
@ -523,6 +523,7 @@ return [
|
|||
'transaction-saved' => 'تم حفظ الصفقة',
|
||||
'already-paid' => 'تم دفع هذه الفاتورة بالفعل',
|
||||
'transaction-amount-exceeds' => 'المبلغ المحدد لهذه المعاملة أكبر من المبلغ الإجمالي للفاتورة.',
|
||||
'transaction-amount-zero' => 'يمكن أن يكون مبلغ الصفقة صفرًا أو أقل',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -741,6 +742,7 @@ return [
|
|||
'no' => 'لا.',
|
||||
'delete' => 'احذف',
|
||||
'enable-atleast-one-shipping' => 'تفعيل طريقة شحن واحدة على الأقل.',
|
||||
'enable-atleast-one-payment' => 'تفعيل طريقة دفع واحدة على الأقل.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'فئات الضرائب',
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -627,6 +628,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -746,6 +748,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Delete',
|
||||
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
|
||||
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
|
|
|
|||
|
|
@ -516,6 +516,7 @@ return [
|
|||
'transaction-saved' => 'Die Transaktion wurde gespeichert',
|
||||
'already-paid' => 'Diese Rechnung wurde bereits bezahlt',
|
||||
'transaction-amount-exceeds' => 'Der angegebene Betrag dieser Transaktion übersteigt den Gesamtbetrag der Rechnung.',
|
||||
'transaction-amount-zero' => 'Der Transaktionsbetrag kann Null oder weniger betragen',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -733,6 +734,8 @@ return [
|
|||
'no' => 'Nein',
|
||||
'delete' => 'Löschen',
|
||||
'enable-atleast-one-shipping' => 'Aktivieren Sie mindestens eine Versandart.',
|
||||
'enable-atleast-one-payment' => 'Aktivieren Sie mindestens eine Zahlungsmethode.',
|
||||
|
||||
'tax-categories' =>
|
||||
[
|
||||
'title' => 'Steuerkategorien',
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -627,6 +628,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -746,6 +748,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Delete',
|
||||
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
|
||||
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
|
|
|
|||
|
|
@ -524,6 +524,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -743,6 +744,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Borrar',
|
||||
'enable-atleast-one-shipping' => 'Habilite al menos un método de envío.',
|
||||
'enable-atleast-one-payment' => 'Habilite al menos un método de pago.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Categorías de impuestos',
|
||||
|
|
|
|||
|
|
@ -521,6 +521,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -726,6 +727,7 @@ return [
|
|||
'no' => 'خیر',
|
||||
'delete' => 'حذف',
|
||||
'enable-atleast-one-shipping' => 'حداقل یک روش حمل و نقل را فعال کنید.',
|
||||
'enable-atleast-one-payment' => 'حداقل یک روش پرداخت را فعال کنید.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'دسته بندی های مالیات',
|
||||
|
|
|
|||
|
|
@ -524,7 +524,8 @@ return [
|
|||
'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' => 'Le montant de cette transaction dépasse le montant total de la facture.',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less.',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -746,6 +747,7 @@ return [
|
|||
'no' => 'Non',
|
||||
'delete' => 'Effacer',
|
||||
'enable-atleast-one-shipping' => 'Activez au moins une méthode d\'expédition.',
|
||||
'enable-atleast-one-payment' => 'Activez au moins un mode de paiement.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Catégories de taxes',
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -627,6 +628,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -746,6 +748,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Delete',
|
||||
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
|
||||
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
|
|
|
|||
|
|
@ -523,6 +523,7 @@ return [
|
|||
'transaction-saved' => 'लेन-देन सहेजा गया है',
|
||||
'already-paid' => 'इस चालान का भुगतान पहले ही किया जा चुका है',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -624,6 +625,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -743,6 +745,7 @@ return [
|
|||
'no' => 'नहीं',
|
||||
'delete' => 'हटाएं',
|
||||
'enable-atleast-one-shipping' => 'कम से कम एक शिपिंग विधि सक्षम करें।',
|
||||
'enable-atleast-one-payment' => 'कम से कम एक भुगतान विधि सक्षम करें।',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'कर श्रेणियाँ',
|
||||
|
|
|
|||
|
|
@ -521,6 +521,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -731,6 +732,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Elimina',
|
||||
'enable-atleast-one-shipping' => 'Abilita almeno un metodo di spedizione.',
|
||||
'enable-atleast-one-payment' => 'Abilita almeno un metodo di pagamento.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Categorie IVA',
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -627,6 +628,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -746,6 +748,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Delete',
|
||||
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
|
||||
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ return [
|
|||
'transaction-saved' => 'De transactie is geregistreerd',
|
||||
'already-paid' => 'Dit factuur is al voldaan',
|
||||
'transaction-amount-exceeds' => 'Het opgegeven bedrag van deze transactie overschrijdt het totaalbedrag van de factuur.',
|
||||
'transaction-amount-zero' => 'Transactiebedrag kan nul of minder zijn',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -725,6 +726,7 @@ return [
|
|||
'no' => 'Nee',
|
||||
'delete' => 'Verwijder',
|
||||
'enable-atleast-one-shipping' => 'Schakel ten minste één verzendmethode in.',
|
||||
'enable-atleast-one-payment' => 'Schakel ten minste één betaalmethode in.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'BTW categorieën',
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -726,6 +727,7 @@ return [
|
|||
'no' => 'Nie',
|
||||
'delete' => 'Usuń',
|
||||
'enable-atleast-one-shipping' => 'Włącz co najmniej jedną metodę wysyłki.',
|
||||
'enable-atleast-one-payment' => 'Włącz co najmniej jedną formę płatności.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Kategorie podatkowe',
|
||||
|
|
|
|||
|
|
@ -516,6 +516,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -724,6 +725,7 @@ return [
|
|||
'no' => 'Não',
|
||||
'delete' => 'Deletar',
|
||||
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
|
||||
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Categorias de Imposto',
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -627,6 +628,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -746,6 +748,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Delete',
|
||||
'enable-atleast-one-shipping' => 'Включите хотя бы один способ доставки.',
|
||||
'enable-atleast-one-payment' => 'Включите хотя бы один способ оплаты.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ return [
|
|||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -627,6 +628,7 @@ return [
|
|||
'quantity-integer' => 'Quantity should be integer.',
|
||||
'quantity-min-zero' => 'Quantity should be greater then zero.',
|
||||
],
|
||||
'video-size' => 'Maximum video size should be like :size',
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
|
|
@ -746,6 +748,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => 'Delete',
|
||||
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
|
||||
'enable-atleast-one-payment' => 'Enable atleast one payment method.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ return [
|
|||
'transaction-saved' => 'İşlem kaydedildi',
|
||||
'already-paid' => 'Bu fatura zaten ödendi',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -731,6 +732,7 @@ return [
|
|||
'no' => 'Hayır',
|
||||
'delete' => 'Sil',
|
||||
'enable-atleast-one-shipping' => 'En az bir gönderim yöntemini etkinleştirin.',
|
||||
'enable-atleast-one-payment' => 'En az bir ödeme yöntemini etkinleştirin.',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Vergi Kategorileri',
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ return [
|
|||
'transaction-saved' => '交易已保存',
|
||||
'already-paid' => '此发票已支付',
|
||||
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.',
|
||||
'transaction-amount-zero' => 'Transaction amount can be zero or less',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
@ -726,6 +727,7 @@ return [
|
|||
'no' => 'No',
|
||||
'delete' => '删除',
|
||||
'enable-atleast-one-shipping' => '啟用至少一種運輸方式',
|
||||
'enable-atleast-one-payment' => '啟用至少一種付款方式。',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => '税分类',
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@
|
|||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(adminName(row)) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="'required'" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
||||
<input type="text" v-validate="getOptionValidation(row,'')" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
||||
<span class="control-error" v-if="errors.has(adminName(row))">@{{ errors.first(adminName(row)) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -329,7 +329,7 @@
|
|||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="'required|numeric'" :name="sortOrderName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.position') }}""/>
|
||||
<input type="text" v-validate="getOptionValidation(row,'')" :name="sortOrderName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.position') }}""/>
|
||||
<span class="control-error" v-if="errors.has(sortOrderName(row))">@{{ errors.first(sortOrderName(row)) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -458,7 +458,7 @@
|
|||
return '';
|
||||
}
|
||||
|
||||
return ('{{ app()->getLocale() }}' === localeCode) ? 'required' : '';
|
||||
return ('{{ app()->getLocale() }}' === localeCode) || localeCode == "" ? 'required' : '';
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@
|
|||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(adminName(row)) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="'required'" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
||||
<input type="text" v-validate="getOptionValidation(row, '')" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
||||
<span class="control-error" v-if="errors.has(adminName(row))" v-text="errors.first(adminName(row))"></span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -401,7 +401,7 @@
|
|||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="'required|numeric'" v-model="row['sort_order']" :name="sortOrderName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.position') }}""/>
|
||||
<input type="text" v-validate="getOptionValidation(row, '')" v-model="row['sort_order']" :name="sortOrderName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.position') }}""/>
|
||||
<span class="control-error" v-if="errors.has(sortOrderName(row))" v-text="errors.first(sortOrderName(row))"></span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -506,10 +506,12 @@
|
|||
'isDelete': false,
|
||||
};
|
||||
|
||||
if (option.label) {
|
||||
if (! option.label) {
|
||||
self.isNullOptionChecked = true;
|
||||
self.idNullOption = option.id;
|
||||
row['notRequired'] = true;
|
||||
} else {
|
||||
row['notRequired'] = false;
|
||||
}
|
||||
|
||||
option.translations.forEach((translation) => {
|
||||
|
|
@ -595,8 +597,8 @@
|
|||
if (row.notRequired === true) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (this.appLocale === localeCode) ? 'required' : '';
|
||||
|
||||
return ('{{ app()->getLocale() }}' === localeCode) || localeCode == "" ? 'required' : '';
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@
|
|||
|
||||
<script>
|
||||
var groups = @json($attributeFamily ? $attributeFamily->attribute_groups : []);
|
||||
var custom_attributes = @json($custom_attributes);
|
||||
var custom_attributes = @json($customAttributes);
|
||||
|
||||
Vue.component('group-list', {
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
<script type="text/x-template" id="group-list-template">
|
||||
<div style="margin-top: 20px">
|
||||
<button type="button" style="margin-bottom : 20px" class="btn btn-md btn-primary" @click="showModal('addGroupForm')">
|
||||
<button type="button" style="margin-bottom : 20px" class="btn btn-md btn-primary" @click="$root.showModal('addGroupForm')">
|
||||
{{ __('admin::app.catalog.families.add-group-title') }}
|
||||
</button>
|
||||
|
||||
|
|
@ -237,7 +237,7 @@
|
|||
|
||||
<script>
|
||||
var groups = @json($attributeFamily->attribute_groups);
|
||||
var custom_attributes = @json($custom_attributes);
|
||||
var custom_attributes = @json($customAttributes);
|
||||
|
||||
Vue.component('group-list', {
|
||||
|
||||
|
|
@ -461,4 +461,4 @@
|
|||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endpush
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
class="control-error"
|
||||
v-text="'{{ $errors->first('videos.files.*') }}'">
|
||||
</span>
|
||||
|
||||
<span class="control-info mt-10">{{ __('admin::app.catalog.products.video-size', ['size' => core()->getMaxUploadSize()]) }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.videos.controls.after', ['product' => $product]) !!}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
@elseif ($field['type'] == 'number')
|
||||
|
||||
<input type="number" min="0" v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($nameKey) ?: core()->getConfigData($nameKey, $channel, $locale) }}" data-vv-as=""{{ trans($field['title']) }}"">
|
||||
<input type="number" min="{{ $field['name'] == 'minimum_order_amount' ? 1 : 0 }}" v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($nameKey) ?: core()->getConfigData($nameKey, $channel, $locale) }}" data-vv-as=""{{ trans($field['title']) }}"">
|
||||
|
||||
@elseif ($field['type'] == 'color')
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
<div class="control-group">
|
||||
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
||||
<select class="control" id="customerGroup" name="customer_group_id">
|
||||
@foreach ($customerGroup as $group)
|
||||
@foreach ($groups as $group)
|
||||
<option value="{{ $group->id }}"> {{ $group->name}} </>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@
|
|||
@endif
|
||||
|
||||
<select class="control" id="customerGroup" name="customer_group_id">
|
||||
@foreach ($customerGroup as $group)
|
||||
@foreach ($groups as $group)
|
||||
<option value="{{ $group->id }}" {{ $selectedCustomerOption == $group->id ? 'selected' : '' }}>
|
||||
{{ $group->name}}
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.promotions.cart-rules.create.after') !!}
|
||||
|
||||
<accordian title="{{ __('admin::app.promotions.cart-rules.coupon-codes') }}" :active="false" v-if="coupon_type && use_auto_generation">
|
||||
<accordian title="{{ __('admin::app.promotions.cart-rules.coupon-codes') }}" :active="false" v-if="parseInt(use_auto_generation) && parseInt(coupon_type)">
|
||||
<div slot="body">
|
||||
<create-coupon-form></create-coupon-form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Attribute\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Admin\DataGrids\AttributeDataGrid;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
|
||||
|
|
@ -62,11 +63,13 @@ class AttributeController extends Controller
|
|||
'type' => 'required',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
Event::dispatch('catalog.attribute.create.before');
|
||||
|
||||
$data['is_user_defined'] = 1;
|
||||
$attribute = $this->attributeRepository->create(array_merge(request()->all(), [
|
||||
'is_user_defined' => 1,
|
||||
]));
|
||||
|
||||
$this->attributeRepository->create($data);
|
||||
Event::dispatch('catalog.attribute.create.after', $attribute);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
|
||||
|
||||
|
|
@ -113,7 +116,11 @@ class AttributeController extends Controller
|
|||
'type' => 'required',
|
||||
]);
|
||||
|
||||
$this->attributeRepository->update(request()->all(), $id);
|
||||
Event::dispatch('catalog.attribute.update.before', $id);
|
||||
|
||||
$attribute = $this->attributeRepository->update(request()->all(), $id);
|
||||
|
||||
Event::dispatch('catalog.attribute.update.after', $attribute);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
|
||||
|
||||
|
|
@ -137,8 +144,12 @@ class AttributeController extends Controller
|
|||
}
|
||||
|
||||
try {
|
||||
Event::dispatch('catalog.attribute.delete.before', $id);
|
||||
|
||||
$this->attributeRepository->delete($id);
|
||||
|
||||
Event::dispatch('catalog.attribute.delete.after', $id);
|
||||
|
||||
return response()->json(['message' => trans('admin::app.response.delete-success', ['name' => 'Attribute'])]);
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
|
|
@ -166,16 +177,18 @@ class AttributeController extends Controller
|
|||
}
|
||||
|
||||
foreach ($indexes as $index) {
|
||||
Event::dispatch('catalog.attribute.delete.before', $index);
|
||||
|
||||
$this->attributeRepository->delete($index);
|
||||
|
||||
Event::dispatch('catalog.attribute.delete.after', $index);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
session()->flash('error', trans('admin::app.datagrid.mass-ops.method-error'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Attribute\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Admin\DataGrids\AttributeFamilyDataGrid;
|
||||
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
|
|
@ -53,9 +54,9 @@ class AttributeFamilyController extends Controller
|
|||
{
|
||||
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOneByField('code', 'default');
|
||||
|
||||
$custom_attributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
||||
$customAttributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
||||
|
||||
return view($this->_config['view'], compact('custom_attributes', 'attributeFamily'));
|
||||
return view($this->_config['view'], compact('attributeFamily', 'customAttributes'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,8 +71,12 @@ class AttributeFamilyController extends Controller
|
|||
'name' => 'required',
|
||||
]);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.create.before');
|
||||
|
||||
$attributeFamily = $this->attributeFamilyRepository->create(request()->all());
|
||||
|
||||
Event::dispatch('catalog.attribute_family.create.after', $attributeFamily);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Family']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -87,9 +92,9 @@ class AttributeFamilyController extends Controller
|
|||
{
|
||||
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOrFail($id, ['*']);
|
||||
|
||||
$custom_attributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
||||
$customAttributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
||||
|
||||
return view($this->_config['view'], compact('attributeFamily', 'custom_attributes'));
|
||||
return view($this->_config['view'], compact('attributeFamily', 'customAttributes'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -105,8 +110,12 @@ class AttributeFamilyController extends Controller
|
|||
'name' => 'required',
|
||||
]);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.update.before', $id);
|
||||
|
||||
$attributeFamily = $this->attributeFamilyRepository->update(request()->all(), $id);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.update.after', $attributeFamily);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Family']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -135,8 +144,12 @@ class AttributeFamilyController extends Controller
|
|||
}
|
||||
|
||||
try {
|
||||
Event::dispatch('catalog.attribute_family.delete.before', $id);
|
||||
|
||||
$this->attributeFamilyRepository->delete($id);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.delete.after', $id);
|
||||
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.response.delete-success', ['name' => 'Family']),
|
||||
]);
|
||||
|
|
@ -161,9 +174,13 @@ class AttributeFamilyController extends Controller
|
|||
if (request()->isMethod('delete')) {
|
||||
$indexes = explode(',', request()->input('indexes'));
|
||||
|
||||
foreach ($indexes as $key => $value) {
|
||||
foreach ($indexes as $index) {
|
||||
try {
|
||||
$this->attributeFamilyRepository->delete($value);
|
||||
Event::dispatch('catalog.attribute_family.delete.before', $index);
|
||||
|
||||
$this->attributeFamilyRepository->delete($index);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.delete.after', $index);
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
$suppressFlash = true;
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ class Attribute extends TranslatableModel implements AttributeContract
|
|||
public function scopeFilterableAttributes(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_filterable', 1)
|
||||
->where('swatch_type', '<>', 'image')
|
||||
->orderBy('position');
|
||||
->where('swatch_type', '<>', 'image')
|
||||
->orderBy('position');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ class AttributeFamily extends Model implements AttributeFamilyContract
|
|||
public function custom_attributes()
|
||||
{
|
||||
return (AttributeProxy::modelClass())::join('attribute_group_mappings', 'attributes.id', '=', 'attribute_group_mappings.attribute_id')
|
||||
->join('attribute_groups', 'attribute_group_mappings.attribute_group_id', '=', 'attribute_groups.id')
|
||||
->join('attribute_families', 'attribute_groups.attribute_family_id', '=', 'attribute_families.id')
|
||||
->where('attribute_families.id', $this->id)
|
||||
->select('attributes.*');
|
||||
->join('attribute_groups', 'attribute_group_mappings.attribute_group_id', '=', 'attribute_groups.id')
|
||||
->join('attribute_families', 'attribute_groups.attribute_family_id', '=', 'attribute_families.id')
|
||||
->where('attribute_families.id', $this->id)
|
||||
->select('attributes.*');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class AttributeGroup extends Model implements AttributeGroupContract
|
|||
public function custom_attributes()
|
||||
{
|
||||
return $this->belongsToMany(AttributeProxy::modelClass(), 'attribute_group_mappings')
|
||||
->withPivot('position')
|
||||
->orderBy('pivot_position', 'asc');
|
||||
->withPivot('position')
|
||||
->orderBy('pivot_position', 'asc');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,37 +2,37 @@
|
|||
|
||||
namespace Webkul\Attribute\Repositories;
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Support\Str;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeGroupRepository;
|
||||
use Illuminate\Container\Container as App;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AttributeFamilyRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Create a new repository instance.
|
||||
*
|
||||
* @param \Webkul\Attribute\Repositories\AttributeRepository $attributeRepository
|
||||
* @param \Webkul\Attribute\Repositories\AttributeGroupRepository $attributeGroupRepository
|
||||
* @param \Illuminate\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
protected AttributeRepository $attributeRepository,
|
||||
protected AttributeGroupRepository $attributeGroupRepository,
|
||||
App $app
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($app);
|
||||
parent::__construct($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\Attribute\Contracts\AttributeFamily';
|
||||
}
|
||||
|
|
@ -43,8 +43,6 @@ class AttributeFamilyRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
Event::dispatch('catalog.attribute_family.create.before');
|
||||
|
||||
$attributeGroups = isset($data['attribute_groups']) ? $data['attribute_groups'] : [];
|
||||
|
||||
unset($data['attribute_groups']);
|
||||
|
|
@ -69,8 +67,6 @@ class AttributeFamilyRepository extends Repository
|
|||
}
|
||||
}
|
||||
|
||||
Event::dispatch('catalog.attribute_family.create.after', $family);
|
||||
|
||||
return $family;
|
||||
}
|
||||
|
||||
|
|
@ -83,9 +79,7 @@ class AttributeFamilyRepository extends Repository
|
|||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
$family = $this->find($id);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.update.before', $id);
|
||||
|
||||
|
||||
$family->update($data);
|
||||
|
||||
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
|
||||
|
|
@ -136,8 +130,6 @@ class AttributeFamilyRepository extends Repository
|
|||
$this->attributeGroupRepository->delete($attributeGroupId);
|
||||
}
|
||||
|
||||
Event::dispatch('catalog.attribute_family.update.after', $family);
|
||||
|
||||
return $family;
|
||||
}
|
||||
|
||||
|
|
@ -166,17 +158,4 @@ class AttributeFamilyRepository extends Repository
|
|||
|
||||
return $trimmed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
Event::dispatch('catalog.attribute_family.delete.before', $id);
|
||||
|
||||
parent::delete($id);
|
||||
|
||||
Event::dispatch('catalog.attribute_family.delete.after', $id);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,9 +10,9 @@ class AttributeGroupRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\Attribute\Contracts\AttributeGroup';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ class AttributeOptionRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\Attribute\Contracts\AttributeOption';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@ use Webkul\Core\Eloquent\Repository;
|
|||
|
||||
class AttributeOptionTranslationRepository extends Repository
|
||||
{
|
||||
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\Attribute\Contracts\AttributeOptionTranslation';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
namespace Webkul\Attribute\Repositories;
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Container\Container;
|
||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
|
|
@ -13,22 +12,23 @@ class AttributeRepository extends Repository
|
|||
* Create a new repository instance.
|
||||
*
|
||||
* @param \Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository
|
||||
* @param \Illuminate\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
protected AttributeOptionRepository $attributeOptionRepository,
|
||||
App $app
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($app);
|
||||
parent::__construct($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify model class name.
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public function model()
|
||||
public function model(): string
|
||||
{
|
||||
return 'Webkul\Attribute\Contracts\Attribute';
|
||||
}
|
||||
|
|
@ -41,8 +41,6 @@ class AttributeRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
Event::dispatch('catalog.attribute.create.before');
|
||||
|
||||
$data = $this->validateUserInput($data);
|
||||
|
||||
$options = isset($data['options']) ? $data['options'] : [];
|
||||
|
|
@ -62,8 +60,6 @@ class AttributeRepository extends Repository
|
|||
}
|
||||
}
|
||||
|
||||
Event::dispatch('catalog.attribute.create.after', $attribute);
|
||||
|
||||
return $attribute;
|
||||
}
|
||||
|
||||
|
|
@ -81,23 +77,21 @@ class AttributeRepository extends Repository
|
|||
|
||||
$attribute = $this->find($id);
|
||||
|
||||
Event::dispatch('catalog.attribute.update.before', $id);
|
||||
|
||||
$data['enable_wysiwyg'] = ! isset($data['enable_wysiwyg']) ? 0 : 1;
|
||||
$data['enable_wysiwyg'] = isset($data['enable_wysiwyg']);
|
||||
|
||||
$attribute->update($data);
|
||||
|
||||
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
|
||||
if (isset($data['options'])) {
|
||||
foreach ($data['options'] as $optionId => $optionInputs) {
|
||||
$isNew = $optionInputs['isNew'] == 'true' ? true : false;
|
||||
$isNew = $optionInputs['isNew'] == 'true';
|
||||
|
||||
if ($isNew) {
|
||||
$this->attributeOptionRepository->create(array_merge([
|
||||
'attribute_id' => $attribute->id,
|
||||
], $optionInputs));
|
||||
} else {
|
||||
$isDelete = $optionInputs['isDelete'] == 'true' ? true : false;
|
||||
$isDelete = $optionInputs['isDelete'] == 'true';
|
||||
|
||||
if ($isDelete) {
|
||||
$this->attributeOptionRepository->delete($optionId);
|
||||
|
|
@ -109,26 +103,9 @@ class AttributeRepository extends Repository
|
|||
}
|
||||
}
|
||||
|
||||
Event::dispatch('catalog.attribute.update.after', $attribute);
|
||||
|
||||
return $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete attribute.
|
||||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
Event::dispatch('catalog.attribute.delete.before', $id);
|
||||
|
||||
parent::delete($id);
|
||||
|
||||
Event::dispatch('catalog.attribute.delete.after', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate user input.
|
||||
*
|
||||
|
|
@ -260,29 +237,18 @@ class AttributeRepository extends Repository
|
|||
foreach ($attributes as $key => $attribute) {
|
||||
if (
|
||||
$attribute->code != 'tax_category_id'
|
||||
&& ($attribute->type == 'select'
|
||||
|| $attribute->type == 'multiselect'
|
||||
|| $attribute->code == 'sku')
|
||||
&& (
|
||||
in_array($attribute->type ,['select', 'multiselect'])
|
||||
|| $attribute->code == 'sku'
|
||||
)
|
||||
) {
|
||||
if ($attribute->options()->exists()) {
|
||||
array_push($trimmed, [
|
||||
'id' => $attribute->id,
|
||||
'name' => $attribute->admin_name,
|
||||
'type' => $attribute->type,
|
||||
'code' => $attribute->code,
|
||||
'has_options' => true,
|
||||
'options' => $attribute->options,
|
||||
]);
|
||||
} else {
|
||||
array_push($trimmed, [
|
||||
'id' => $attribute->id,
|
||||
'name' => $attribute->admin_name,
|
||||
'type' => $attribute->type,
|
||||
'code' => $attribute->code,
|
||||
'has_options' => false,
|
||||
'options' => null,
|
||||
]);
|
||||
}
|
||||
array_push($trimmed, [
|
||||
'id' => $attribute->id,
|
||||
'name' => $attribute->admin_name,
|
||||
'type' => $attribute->type,
|
||||
'code' => $attribute->code,
|
||||
'options' => $attribute->options,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -37,7 +37,15 @@ class Booking
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected $daysOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
protected $daysOfWeek = [
|
||||
'Sunday',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new helper instance.
|
||||
|
|
@ -95,7 +103,7 @@ class Booking
|
|||
|
||||
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
|
||||
|
||||
$availabileDays = $this->getAvailableWeekDays($bookingProduct);
|
||||
$availableDays = $this->getAvailableWeekDays($bookingProduct);
|
||||
|
||||
foreach ($this->daysOfWeek as $index => $isOpen) {
|
||||
$slots = [];
|
||||
|
|
@ -106,7 +114,7 @@ class Booking
|
|||
|
||||
$slotsByDays[] = [
|
||||
'name' => trans($this->daysOfWeek[$index]),
|
||||
'slots' => isset($availabileDays[$index]) ? $this->conver24To12Hours($slots) : [],
|
||||
'slots' => isset($availableDays[$index]) ? $this->conver24To12Hours($slots) : [],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -128,8 +136,8 @@ class Booking
|
|||
}
|
||||
|
||||
return count($slots)
|
||||
? implode(' | ', $slots)
|
||||
: '<span class="text-danger">' . trans('bookingproduct::app.shop.products.closed') . '</span>';
|
||||
? implode(' | ', $slots)
|
||||
: '<span class="text-danger">' . trans('bookingproduct::app.shop.products.closed') . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -162,15 +170,16 @@ class Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_from && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
|
||||
$availableTo = ! $bookingProduct->available_from && $bookingProduct->available_to
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$date = clone $currentTime;
|
||||
|
||||
$date->addDays($i);
|
||||
|
||||
if (
|
||||
|
|
@ -221,6 +230,7 @@ class Booking
|
|||
|
||||
foreach ($slots as $index => $slot) {
|
||||
$slots[$index]['from'] = Carbon::createFromTimeString($slot['from'])->format("h:i a");
|
||||
|
||||
$slots[$index]['to'] = Carbon::createFromTimeString($slot['to'])->format("h:i a");
|
||||
}
|
||||
|
||||
|
|
@ -250,16 +260,16 @@ class Booking
|
|||
$requestedDate = Carbon::createFromTimeString($date . " 00:00:00");
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
|
||||
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDurations = $bookingProductSlot->same_slot_all_days
|
||||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
|
||||
if (
|
||||
$requestedDate < $availableFrom
|
||||
|
|
@ -387,7 +397,7 @@ class Booking
|
|||
return $slot['timestamp'] == $cartItem['additional']['booking']['slot'];
|
||||
});
|
||||
|
||||
return count($filtered) ? false : true;
|
||||
return ! count($filtered);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -399,12 +409,12 @@ class Booking
|
|||
$timestamps = explode('-', $data['additional']['booking']['slot']);
|
||||
|
||||
$result = $this->bookingRepository->getModel()
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.from', $timestamps[0])
|
||||
->where('bookings.to', $timestamps[1])
|
||||
->first();
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.from', $timestamps[0])
|
||||
->where('bookings.to', $timestamps[1])
|
||||
->first();
|
||||
|
||||
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
|
||||
}
|
||||
|
|
@ -576,10 +586,6 @@ class Booking
|
|||
*/
|
||||
public function isCartItemInactive(\Webkul\Checkout\Contracts\CartItem $item): bool
|
||||
{
|
||||
if ($item->product->status === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ! $item->product->status;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ class DefaultSlot extends Booking
|
|||
protected $daysOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
|
||||
/**
|
||||
* Returns slots for a perticular day
|
||||
* Returns slots for a particular day
|
||||
*
|
||||
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
|
||||
* @param string $date
|
||||
|
|
@ -34,12 +34,12 @@ class DefaultSlot extends Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
|
||||
$availableTo = $bookingProduct->available_to
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
if (
|
||||
$requestedDate < $availableFrom
|
||||
|
|
@ -51,8 +51,8 @@ class DefaultSlot extends Booking
|
|||
$slots = [];
|
||||
|
||||
return $bookingProductSlot->booking_type == 'one'
|
||||
? $this->getOneBookingForManyDaysSlots($bookingProductSlot, $requestedDate)
|
||||
: $this->getManyBookingsforOneDaySlots($bookingProductSlot, $requestedDate);
|
||||
? $this->getOneBookingForManyDaysSlots($bookingProductSlot, $requestedDate)
|
||||
: $this->getManyBookingsForOneDaySlots($bookingProductSlot, $requestedDate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,19 +98,19 @@ class DefaultSlot extends Booking
|
|||
* @param string $requestedDate
|
||||
* @return array
|
||||
*/
|
||||
public function getManyBookingsforOneDaySlots($bookingProductSlot, $requestedDate)
|
||||
public function getManyBookingsForOneDaySlots($bookingProductSlot, $requestedDate)
|
||||
{
|
||||
$bookingProduct = $bookingProductSlot->booking_product;
|
||||
|
||||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
|
||||
$availableTo = $bookingProduct->available_to
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
|
||||
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ class EventTicket extends Booking
|
|||
public function getBookedQuantity($data)
|
||||
{
|
||||
$result = $this->bookingRepository->getModel()
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.booking_product_event_ticket_id', $data['additional']['booking']['ticket_id'])
|
||||
->first();
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.booking_product_event_ticket_id', $data['additional']['booking']['ticket_id'])
|
||||
->first();
|
||||
|
||||
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
|
||||
}
|
||||
|
|
@ -114,6 +114,7 @@ class EventTicket extends Booking
|
|||
$ticket = $bookingProduct->event_tickets()->find($product['additional']['booking']['ticket_id']);
|
||||
|
||||
$price = $ticket->price;
|
||||
|
||||
if ($this->isInSale($ticket)) {
|
||||
$price = $ticket->special_price;
|
||||
}
|
||||
|
|
@ -186,7 +187,15 @@ class EventTicket extends Booking
|
|||
{
|
||||
return $ticket->special_price !== null
|
||||
&& $ticket->special_price > 0.0
|
||||
&& ($ticket->special_price_from === null || $ticket->special_price_from === '0000-00-00 00:00:00' || $ticket->special_price_from <= Carbon::now())
|
||||
&& ($ticket->special_price_to === null || $ticket->special_price_to === '0000-00-00 00:00:00' || $ticket->special_price_to > Carbon::now());
|
||||
&& (
|
||||
$ticket->special_price_from === null
|
||||
|| $ticket->special_price_from === '0000-00-00 00:00:00'
|
||||
|| $ticket->special_price_from <= Carbon::now()
|
||||
)
|
||||
&& (
|
||||
$ticket->special_price_to === null
|
||||
|| $ticket->special_price_to === '0000-00-00 00:00:00'
|
||||
|| $ticket->special_price_to > Carbon::now()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -33,16 +33,16 @@ class RentalSlot extends Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
|
||||
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDurations = $bookingProductSlot->same_slot_all_days
|
||||
? $bookingProductSlot->slots
|
||||
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
|
||||
? $bookingProductSlot->slots
|
||||
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
|
||||
|
||||
if (
|
||||
$requestedDate < $availableFrom
|
||||
|
|
@ -139,18 +139,18 @@ class RentalSlot extends Booking
|
|||
}
|
||||
|
||||
$result = $this->bookingRepository->getModel()
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where(function ($query) use($from, $to) {
|
||||
$query->where(function ($query) use($from) {
|
||||
$query->where('bookings.from', '<=', $from)->where('bookings.to', '>=', $from);
|
||||
})
|
||||
->orWhere(function($query) use($to) {
|
||||
$query->where('bookings.from', '<=', $to)->where('bookings.to', '>=', $to);
|
||||
});
|
||||
})
|
||||
->first();
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where(function ($query) use($from, $to) {
|
||||
$query->where(function ($query) use($from) {
|
||||
$query->where('bookings.from', '<=', $from)->where('bookings.to', '>=', $from);
|
||||
})
|
||||
->orWhere(function($query) use($to) {
|
||||
$query->where('bookings.from', '<=', $to)->where('bookings.to', '>=', $to);
|
||||
});
|
||||
})
|
||||
->first();
|
||||
|
||||
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
|
||||
}
|
||||
|
|
@ -187,12 +187,12 @@ class RentalSlot extends Booking
|
|||
$requestedToDate = Carbon::createFromTimeString($cartItem['additional']['booking']['date_to'] . " 23:59:59");
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from->format('Y-m-d') . ' 00:00:00')
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from->format('Y-m-d') . ' 00:00:00')
|
||||
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
|
||||
|
||||
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
if (
|
||||
$requestedFromDate < $availableFrom
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ class BookingController extends Controller
|
|||
{
|
||||
if (request('view_type')) {
|
||||
$startDate = request()->get('startDate')
|
||||
? Carbon::createFromTimeString(request()->get('startDate') . " 00:00:01")
|
||||
: Carbon::now()->startOfWeek()->format('Y-m-d H:i:s');
|
||||
? Carbon::createFromTimeString(request()->get('startDate') . " 00:00:01")
|
||||
: Carbon::now()->startOfWeek()->format('Y-m-d H:i:s');
|
||||
|
||||
$endDate = request()->get('endDate')
|
||||
? Carbon::createFromTimeString(request()->get('endDate') . " 23:59:59")
|
||||
: Carbon::now()->endOfWeek()->format('Y-m-d H:i:s');
|
||||
? Carbon::createFromTimeString(request()->get('endDate') . " 23:59:59")
|
||||
: Carbon::now()->endOfWeek()->format('Y-m-d H:i:s');
|
||||
|
||||
$bookings = $this->bookingRepository->getBookings([strtotime($startDate), strtotime($endDate)])
|
||||
->map(function ($booking) {
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ class BookingProductController extends Controller
|
|||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\BookingProduct\Repositories\BookingProductRepository $bookingProductRepository
|
||||
* @param \Webkul\BookingProduct\Helpers\DefaultSlot $defaultSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\AppointmentSlot $appointmentSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\RentalSlot $rentalSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\EventTicket $EventTicketHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\TableSlot $tableSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\DefaultSlot $defaultSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\AppointmentSlot $appointmentSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\RentalSlot $rentalSlotHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\EventTicket $EventTicketHelper
|
||||
* @param \Webkul\BookingProduct\Helpers\TableSlot $tableSlotHelper
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ class BookingProductAppointmentSlotRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\BookingProductAppointmentSlot';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ class BookingProductDefaultSlotRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\BookingProductDefaultSlot';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,17 +11,16 @@ class BookingProductEventTicketRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\BookingProductEventTicket';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
|
||||
*
|
||||
* @param array $data
|
||||
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
|
||||
* @return void
|
||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ class BookingProductRentalSlotRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\BookingProductRentalSlot';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Webkul\BookingProduct\Repositories;
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Illuminate\Container\Container;
|
||||
use Carbon\Carbon;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ class BookingProductRepository extends Repository
|
|||
* @param \Webkul\BookingProduct\Repositories\BookingProductEventTicketRepository $bookingProductEventTicketRepository
|
||||
* @param \Webkul\BookingProduct\Repositories\BookingProductRentalSlotRepository $bookingProductRentalSlotRepository
|
||||
* @param \Webkul\BookingProduct\Repositories\BookingProductTableSlotRepository $bookingProductTableSlotRepository
|
||||
* @param \Illuminate\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -29,10 +30,10 @@ class BookingProductRepository extends Repository
|
|||
BookingProductEventTicketRepository $bookingProductEventTicketRepository,
|
||||
BookingProductRentalSlotRepository $bookingProductRentalSlotRepository,
|
||||
BookingProductTableSlotRepository $bookingProductTableSlotRepository,
|
||||
App $app
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($app);
|
||||
parent::__construct($container);
|
||||
|
||||
$this->typeRepositories['default'] = $bookingProductDefaultSlotRepository;
|
||||
|
||||
|
|
@ -48,9 +49,9 @@ class BookingProductRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\BookingProduct';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ class BookingProductTableSlotRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\BookingProductTableSlot';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Webkul\BookingProduct\Repositories;
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Carbon\Carbon;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
|
@ -12,9 +11,9 @@ class BookingRepository extends Repository
|
|||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
function model()
|
||||
function model(): string
|
||||
{
|
||||
return 'Webkul\BookingProduct\Contracts\Booking';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,4 +239,23 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
&.rtl {
|
||||
.booking-information {
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
}
|
||||
|
||||
.bp-location-icon {
|
||||
right: 60px;
|
||||
}
|
||||
|
||||
.bp-slot-icon {
|
||||
right: 140px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
padding-left: 32px;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
|
|
@ -278,6 +278,19 @@ body {
|
|||
left: 80px !important;
|
||||
right: inherit !important;
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
}
|
||||
|
||||
.bp-location-icon {
|
||||
right: 60px;
|
||||
}
|
||||
|
||||
.bp-slot-icon {
|
||||
right: 140px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue