Merge remote-tracking branch 'upstream/master' into issue-4399

This commit is contained in:
devansh bawari 2021-01-13 18:51:31 +05:30
commit af78612c54
18 changed files with 136 additions and 100 deletions

View File

@ -122,9 +122,9 @@ class CartRuleDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
'wrapper' => function ($value) {
if ($value->status == 'active') {
if ($value->status == 1) {
return trans('admin::app.datagrid.active');
} else if ($value->status == 'inactive') {
} else if ($value->status == 0) {
return trans('admin::app.datagrid.inactive');
} else {
return trans('admin::app.datagrid.draft');

View File

@ -1,4 +1 @@
<input type="text" v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" {{ in_array($attribute->code, ['sku', 'url_key']) ? 'v-slugify' : '' }} data-vv-as="&quot;{{ $attribute->admin_name }}&quot;" {{ $attribute->code == 'name' && ! $product[$attribute->code] ? 'v-slugify-target=\'url_key\'' : '' }} />
<input type="text" v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" {{ in_array($attribute->code, ['sku', 'url_key']) ? 'v-slugify' : '' }} data-vv-as="&quot;{{ $attribute->admin_name }}&quot;" {{ $attribute->code == 'name' && ! $product[$attribute->code] ? 'v-slugify-target=\'url_key\'' : '' }} />

View File

@ -180,7 +180,6 @@ class CartRuleController extends Controller
'customer_groups' => 'required|array|min:1',
'coupon_type' => 'required',
'use_auto_generation' => 'required_if:coupon_type,==,1',
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code,' . $id,
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
@ -189,6 +188,12 @@ class CartRuleController extends Controller
$cartRule = $this->cartRuleRepository->findOrFail($id);
if ($cartRule->coupon_type) {
$this->validate(request(), [
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code,' . $cartRule->cart_rule_coupon->id,
]);
}
Event::dispatch('promotions.cart_rule.update.before', $cartRule);
$cartRule = $this->cartRuleRepository->update(request()->all(), $id);

View File

@ -59,6 +59,10 @@ class WishlistController extends Controller
{
$wishlistItems = $this->wishlistRepository->getCustomerWhishlist();
if (! core()->getConfigData('general.content.shop.wishlist_option')) {
abort(404);
}
return view($this->_config['view'])->with('items', $wishlistItems);
}

View File

@ -53,7 +53,10 @@ class ProductsCategoriesProxyController extends Controller
{
$slugOrPath = trim($request->getPathInfo(), '/');
if (preg_match('/^([a-z0-9-]+\/?)+$/', $slugOrPath)) {
$slugOrPath = urldecode($slugOrPath);
// support url for chinese, japanese, arbic and english with numbers.
if (preg_match('/^([\x{0621}-\x{064A}\x{4e00}-\x{9fa5}\x{3402}-\x{FA6D}\x{3041}-\x{30A0}\x{30A0}-\x{31FF}_a-z0-9-]+\/?)+$/u', $slugOrPath)) {
if ($category = $this->categoryRepository->findByPath($slugOrPath)) {
@ -71,7 +74,7 @@ class ProductsCategoriesProxyController extends Controller
}
$sliderRepository = app('Webkul\Core\Repositories\SliderRepository');
$sliderData = $sliderRepository
->where('channel_id', core()->getCurrentChannel()->id)
->where('locale', core()->getCurrentLocale()->code)

View File

@ -219,10 +219,10 @@
return false;
},
validateForm: function(scope) {
validateForm: async function(scope) {
var this_this = this;
this.$validator.validateAll(scope).then(function (result) {
await this.$validator.validateAll(scope).then(function (result) {
if (result) {
if (scope == 'address-form') {
this_this.saveAddress();
@ -286,7 +286,7 @@
.catch(function (error) {})
},
saveAddress: function() {
saveAddress: async function() {
var this_this = this;
this.disable_button = true;
@ -327,7 +327,7 @@
})
},
saveShipping: function() {
saveShipping: async function() {
var this_this = this;
this.disable_button = true;
@ -351,7 +351,7 @@
})
},
savePayment: function() {
savePayment: async function() {
var this_this = this;
this.disable_button = true;
@ -373,7 +373,7 @@
});
},
placeOrder: function() {
placeOrder: async function() {
var this_this = this;
this.disable_button = true;
@ -610,4 +610,4 @@
})
</script>
@endpush
@endpush

View File

@ -21,15 +21,13 @@
<span>{{ __('shop::app.search.no-results') }}</span>
</div>
@else
@if ($results->total() == 1)
<div class="search-result-status mb-20">
<span><b>{{ $results->total() }} </b>{{ __('shop::app.search.found-result') }}</span>
</div>
@else
<div class="search-result-status mb-20">
<span><b>{{ $results->total() }} </b>{{ __('shop::app.search.found-results') }}</span>
</div>
@endif
<div class="search-result-status mb-20">
<span>
<b>{{ $results->total() }} </b>
{{ ($results->total() == 1) ? __('shop::app.search.found-result') : __('shop::app.search.found-results') }}
</span>
</div>
<div class="product-grid-4">
@foreach ($results as $productFlat)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,18 @@
/* flatpickr v4.6.6, @license MIT */
/* flatpickr v4.6.3, @license MIT */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=2cf17b86ea451828fd09",
"/css/ui.css": "/css/ui.css?id=5673703005b2ac3d0889"
"/js/ui.js": "/js/ui.js?id=9480d375da1da8eb3366",
"/css/ui.css": "/css/ui.css?id=6555a7029beea2bc5c1e"
}

View File

@ -7,10 +7,10 @@
target.value = e.target.value.toString()
.toLowerCase()
.normalize('NFKD') // Normalize Unicode
.replace(/[^\w- ]+/g, '')
.replace(/[^\w\u0621-\u064A\u4e00-\u9fa5\u3402-\uFA6D\u3041-\u30A0\u30A0-\u31FF- ]+/g, '')
// replace whitespaces with dashes
.replace(/ +/g, '-')

View File

@ -6,7 +6,7 @@
e.target.value = e.target.value
.toString()
.toLowerCase()
.replace(/[^\w- ]+/g, '')
.replace(/[^\w\u0621-\u064A\u4e00-\u9fa5\u3402-\uFA6D\u3041-\u30A0\u30A0-\u31FF- ]+/g, '')
// replace whitespaces with dashes
.replace(/ +/g, '-')

View File

@ -705,11 +705,15 @@ h5 {
&.date, &.datetime {
&::after {
top: 6px;
left: unset;
left: 100%;
}
}
.cross-icon {
top: 10px;
&.has-error.date, &.has-error.date {
&.date, &.datetime {
&::after {
top: 18px;
}
}
}
}
@ -740,12 +744,9 @@ h5 {
&.date, &.datetime {
&::after {
right: unset !important;
left: auto;
}
}
.cross-icon {
top: 10px;
}
}
}
}
@ -1240,14 +1241,14 @@ modal {
.tooltip {
display: block !important;
z-index: 10000;
.tooltip-inner {
background: black;
color: white;
border-radius: 4px;
padding: 5px 10px 4px;
}
.tooltip-arrow {
width: 0;
height: 0;
@ -1257,10 +1258,10 @@ modal {
border-color: black;
z-index: 1;
}
&[x-placement^="top"] {
margin-bottom: 5px;
.tooltip-arrow {
border-width: 5px 5px 0 5px;
border-left-color: transparent !important;
@ -1272,10 +1273,10 @@ modal {
margin-bottom: 0;
}
}
&[x-placement^="bottom"] {
margin-top: 5px;
.tooltip-arrow {
border-width: 0 5px 5px 5px;
border-left-color: transparent !important;
@ -1287,10 +1288,10 @@ modal {
margin-bottom: 0;
}
}
&[x-placement^="right"] {
margin-left: 5px;
.tooltip-arrow {
border-width: 5px 5px 5px 0;
border-left-color: transparent !important;
@ -1302,10 +1303,10 @@ modal {
margin-right: 0;
}
}
&[x-placement^="left"] {
margin-right: 5px;
.tooltip-arrow {
border-width: 5px 0 5px 5px;
border-top-color: transparent !important;

View File

@ -3,12 +3,10 @@
namespace Webkul\User\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\User\Models\Admin;
use Webkul\User\Contracts\Role as RoleContract;
class Role extends Model implements RoleContract
{
/**
* The attributes that are mass assignable.
*

View File

@ -15,4 +15,29 @@ class RoleRepository extends Repository
{
return 'Webkul\User\Contracts\Role';
}
/**
* Update method.
*
* @param array $data
* @param int $id
*
* @return \Webkul\User\Model\Role
*/
public function update(array $data, $id)
{
/* making collection for ease */
$requestedData = collect($data);
/* updating role data */
$role = $this->find($id);
$role->name = $requestedData['name'];
$role->description = $requestedData['description'];
$role->permission_type = $requestedData['permission_type'];
$role->permissions = $requestedData->has('permissions') ? $requestedData['permissions'] : [];
$role->update();
/* returning updated role */
return $role;
}
}

View File

@ -15,47 +15,52 @@ class ComparisonController extends Controller
*/
public function getComparisonList()
{
if (request()->get('data')) {
$productSlugs = null;
if (! core()->getConfigData('general.content.shop.compare_option')) {
$productCollection = [];
abort(404);
} else {
if (request()->get('data')) {
$productSlugs = null;
if (auth()->guard('customer')->user()) {
$productCollection = $this->compareProductsRepository
->leftJoin(
'product_flat',
'velocity_customer_compare_products.product_flat_id',
'product_flat.id'
)
->where('customer_id', auth()->guard('customer')->user()->id)
->get()
->toArray();
$productCollection = [];
$items = [];
if (auth()->guard('customer')->user()) {
$productCollection = $this->compareProductsRepository
->leftJoin(
'product_flat',
'velocity_customer_compare_products.product_flat_id',
'product_flat.id'
)
->where('customer_id', auth()->guard('customer')->user()->id)
->get()
->toArray();
foreach ($productCollection as $index => $customerCompare) {
array_push($items, $customerCompare['id']);
}
$items = [];
$items = implode('&', $items);
$productCollection = $this->velocityHelper->fetchProductCollection($items);
foreach ($productCollection as $index => $customerCompare) {
array_push($items, $customerCompare['id']);
}
} else {
// for product details
if ($items = request()->get('items')) {
$items = implode('&', $items);
$productCollection = $this->velocityHelper->fetchProductCollection($items);
} else {
// for product details
if ($items = request()->get('items')) {
$productCollection = $this->velocityHelper->fetchProductCollection($items);
}
}
$response = [
'status' => 'success',
'products' => $productCollection,
];
} else {
$response = view($this->_config['view']);
}
$response = [
'status' => 'success',
'products' => $productCollection,
];
} else {
$response = view($this->_config['view']);
return $response;
}
return $response;
}
/**

View File

@ -225,7 +225,7 @@
return false;
},
validateForm: function (scope) {
validateForm: async function (scope) {
var isManualValidationFail = false;
if (scope == 'address-form') {
@ -233,7 +233,7 @@
}
if (! isManualValidationFail) {
this.$validator.validateAll(scope)
await this.$validator.validateAll(scope)
.then(result => {
if (result) {
switch (scope) {
@ -365,7 +365,7 @@
.catch(function (error) {})
},
saveAddress: function () {
saveAddress: async function () {
this.disable_button = true;
if (this.allAddress.length > 0) {
@ -438,7 +438,7 @@
})
},
saveShipping: function () {
saveShipping: async function () {
this.disable_button = true;
this.$http.post("{{ route('shop.checkout.save-shipping') }}", {'shipping_method': this.selected_shipping_method})
@ -468,7 +468,7 @@
})
},
savePayment: function () {
savePayment: async function () {
this.disable_button = true;
if (this.isCheckPayment) {
@ -498,7 +498,7 @@
}
},
placeOrder: function () {
placeOrder: async function () {
if (this.isPlaceOrderEnabled) {
this.disable_button = false;
this.isPlaceOrderEnabled = false;
@ -759,4 +759,4 @@
})()
</script>
@endpush
@endpush