Configuration Added

This commit is contained in:
Devansh 2021-11-16 09:35:03 +05:30
parent d42b21a6e4
commit 2992f682a6
9 changed files with 214 additions and 172 deletions

View File

@ -70,6 +70,7 @@ class WishlistController extends Controller
return view($this->_config['view'], [
'items' => $this->wishlistRepository->getCustomerWishlist(),
'isSharingEnabled' => $this->isSharingEnabled(),
'isWishlistShared' => $this->currentCustomer->isWishlistShared(),
'wishlistSharedLink' => $this->currentCustomer->getWishlistSharedLink()
]);
@ -136,16 +137,18 @@ class WishlistController extends Controller
*/
public function share()
{
$data = $this->validate(request(), [
'shared' => 'required|boolean'
]);
if ($this->isSharingEnabled()) {
$data = $this->validate(request(), [
'shared' => 'required|boolean'
]);
$updateCounts = $this->currentCustomer->wishlist_items()->update(['shared' => $data['shared']]);
$updateCounts = $this->currentCustomer->wishlist_items()->update(['shared' => $data['shared']]);
if ($updateCounts && $updateCounts > 0) {
session()->flash('success', 'Shared wishlist settings updated successfully');
if ($updateCounts && $updateCounts > 0) {
session()->flash('success', 'Shared wishlist settings updated successfully');
return redirect()->back();
return redirect()->back();
}
}
return redirect()->back();
@ -159,7 +162,8 @@ class WishlistController extends Controller
public function shared(CustomerRepository $customerRepository)
{
if (
! request()->hasValidSignature()
! $this->isSharingEnabled()
|| ! request()->hasValidSignature()
|| ! core()->getConfigData('general.content.shop.wishlist_option')
) {
abort(404);
@ -261,4 +265,16 @@ class WishlistController extends Controller
return redirect()->back();
}
/**
* Is sharing enabled.
*
* @return bool
*/
public function isSharingEnabled(): bool
{
return (bool) core()->getConfigData('customer.settings.wishlist.share')
? true
: false;
}
}

View File

@ -13,21 +13,24 @@
@if (isset($item->additional['attributes']))
<div class="item-options">
@foreach ($item->additional['attributes'] as $attribute)
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
<b>{{ $attribute['attribute_name'] }} : </b> {{ $attribute['option_label'] }}
</br>
@endforeach
</div>
@endif
</div>
<div class="mb-2">
<span class="fs16">
{{ __('shop::app.customer.account.wishlist.visibility') }} :
@if ($visibility ?? false)
<div class="mb-2">
<span class="fs16">
{{ __('shop::app.customer.account.wishlist.visibility') }} :
<span class="badge badge-sm {{ $item->shared ? 'badge-success' : 'badge-danger' }}">
{{ $item->shared ? __('shop::app.customer.account.wishlist.public') : __('shop::app.customer.account.wishlist.private') }}
<span class="badge badge-sm {{ $item->shared ? 'badge-success' : 'badge-danger' }}">
{{ $item->shared ? __('shop::app.customer.account.wishlist.public') : __('shop::app.customer.account.wishlist.private') }}
</span>
</span>
</span>
</div>
</div>
@endif
<span class="stars" style="display: inline">
@for ($i = 1; $i <= $reviewHelper->getAverageRating($item->product); $i++)

View File

@ -19,11 +19,13 @@
@csrf
</form>
<a
href="javascript:void(0);"
onclick="window.showShareWishlistModal();">
{{ __('shop::app.customer.account.wishlist.share') }}
</a>
@if ($isSharingEnabled)
<a
href="javascript:void(0);"
onclick="window.showShareWishlistModal();">
{{ __('shop::app.customer.account.wishlist.share') }}
</a>
@endif
<a
href="javascript:void(0);"
@ -42,7 +44,8 @@
@if ($items->count())
@foreach ($items as $item)
@include('shop::customers.account.wishlist.wishlist-product', [
'item' => $item
'item' => $item,
'visibility' => $isSharingEnabled
])
@endforeach
@ -56,74 +59,78 @@
@endif
</div>
<div id="shareWishlistModal" class="d-none">
<modal id="shareWishlist" :is-open="modalIds.shareWishlist">
<h3 slot="header">
{{ __('shop::app.customer.account.wishlist.share-wishlist') }}
</h3>
@if ($isSharingEnabled)
<div id="shareWishlistModal" class="d-none">
<modal id="shareWishlist" :is-open="modalIds.shareWishlist">
<h3 slot="header">
{{ __('shop::app.customer.account.wishlist.share-wishlist') }}
</h3>
<i class="rango-close"></i>
<i class="rango-close"></i>
<div slot="body">
<form method="POST" action="{{ route('customer.wishlist.share') }}">
@csrf
<div slot="body">
<form method="POST" action="{{ route('customer.wishlist.share') }}">
@csrf
<div class="control-group">
<label for="shared" class="required">{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}</label>
<div class="control-group">
<label for="shared" class="required">{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}</label>
<select name="shared" class="control">
<option value="0" {{ $isWishlistShared ? '' : 'selected="selected"' }}>{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" {{ $isWishlistShared ? 'selected="selected"' : '' }}>{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.visibility') }}</label>
<div class="mt-5">
@if ($isWishlistShared)
<span class="badge badge-sm badge-success">{{ __('shop::app.customer.account.wishlist.public') }}</span>
@else
<span class="badge badge-sm badge-danger">{{ __('shop::app.customer.account.wishlist.private') }}</span>
@endif
<select name="shared" class="control">
<option value="0" {{ $isWishlistShared ? '' : 'selected="selected"' }}>{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" {{ $isWishlistShared ? 'selected="selected"' : '' }}>{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.shared-link') }}</label>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.visibility') }}</label>
<div>
@if ($isWishlistShared)
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank">{{ $wishlistSharedLink }}</a>
@else
<p>{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}</p>
@endif
<div class="mt-5">
@if ($isWishlistShared)
<span class="badge badge-sm badge-success">{{ __('shop::app.customer.account.wishlist.public') }}</span>
@else
<span class="badge badge-sm badge-danger">{{ __('shop::app.customer.account.wishlist.private') }}</span>
@endif
</div>
</div>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary mt-10 pull-right">
{{ __('shop::app.customer.account.wishlist.save') }}
</button>
</div>
</form>
</div>
</modal>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.shared-link') }}</label>
<div>
@if ($isWishlistShared)
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank">{{ $wishlistSharedLink }}</a>
@else
<p>{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}</p>
@endif
</div>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary mt-10 pull-right">
{{ __('shop::app.customer.account.wishlist.save') }}
</button>
</div>
</form>
</div>
</modal>
</div>
@endif
{!! view_render_event('bagisto.shop.customers.account.wishlist.list.after', ['wishlist' => $items]) !!}
</div>
@endsection
@push('scripts')
<script>
/**
* Show share wishlist modal.
*/
function showShareWishlistModal() {
document.getElementById('shareWishlistModal').classList.remove('d-none');
@if ($isSharingEnabled)
<script>
/**
* Show share wishlist modal.
*/
function showShareWishlistModal() {
document.getElementById('shareWishlistModal').classList.remove('d-none');
window.app.showModal('shareWishlist');
}
</script>
window.app.showModal('shareWishlist');
}
</script>
@endif
@endpush

File diff suppressed because one or more lines are too long

View File

@ -2,5 +2,5 @@
"/js/velocity.js": "/js/velocity.js?id=49b29efa452a8942811a",
"/js/velocity-core.js": "/js/velocity-core.js?id=5c0fe2bf195ee94576fd",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
"/css/velocity.css": "/css/velocity.css?id=2b1a8a0d0ef926899989"
"/css/velocity.css": "/css/velocity.css?id=7be53710e05ea176e48a"
}

View File

@ -424,6 +424,15 @@
&.grid-card,
&.list-card {
.wishlist-icon i {
padding-left: 10px;
}
.product-price span:first-child, .product-price span:last-child {
font-size: 18px;
font-weight: 600;
}
.card-current-price {
font-size: 18px;
}

View File

@ -22,6 +22,15 @@
<span class="fs16">{{ $item->product->name }}</span>
</a>
@if (isset($item->product->additional['attributes']))
<div class="item-options">
@foreach ($item->product->additional['attributes'] as $attribute)
<b>{{ $attribute['attribute_name'] }} : </b> {{ $attribute['option_label'] }}
</br>
@endforeach
</div>
@endif
</div>
<div class="product-price">
@ -29,15 +38,17 @@
</div>
<div class="cart-wish-wrap mt5">
<div class="mb-2">
<span class="fs16">
{{ __('shop::app.customer.account.wishlist.visibility') }} :
@if ($visibility ?? false)
<div class="mb-2">
<span class="fs16">
{{ __('shop::app.customer.account.wishlist.visibility') }} :
<span class="badge {{ $item->shared ? 'badge-success' : 'badge-danger' }}">
{{ $item->shared ? __('shop::app.customer.account.wishlist.public') : __('shop::app.customer.account.wishlist.private') }}
<span class="badge {{ $item->shared ? 'badge-success' : 'badge-danger' }}">
{{ $item->shared ? __('shop::app.customer.account.wishlist.public') : __('shop::app.customer.account.wishlist.private') }}
</span>
</span>
</span>
</div>
</div>
@endif
<div>
@include('shop::products.add-to-cart', [

View File

@ -28,14 +28,16 @@
<div class="account-action float-right w-10">&nbsp;</div>
<div class="account-action float-right">
<a
class="remove-decoration theme-btn light"
href="javascript:void(0);"
@click="window.showShareWishlistModal();">
{{ __('shop::app.customer.account.wishlist.share') }}
</a>
</div>
@if ($isSharingEnabled)
<div class="account-action float-right">
<a
class="remove-decoration theme-btn light"
href="javascript:void(0);"
@click="window.showShareWishlistModal();">
{{ __('shop::app.customer.account.wishlist.share') }}
</a>
</div>
@endif
@endif
</div>
@ -44,7 +46,10 @@
<div class="wishlist-container">
@if ($items->count())
@foreach ($items as $item)
@include ('shop::customers.account.wishlist.wishlist-product', ['item' => $item])
@include ('shop::customers.account.wishlist.wishlist-product', [
'item' => $item,
'visibility' => $isSharingEnabled
])
@endforeach
<div>
@ -57,87 +62,91 @@
@endif
</div>
<div id="shareWishlistModal" class="d-none">
<modal id="shareWishlist" :is-open="modalIds.shareWishlist">
<h3 slot="header">
{{ __('shop::app.customer.account.wishlist.share-wishlist') }}
</h3>
@if($isSharingEnabled)
<div id="shareWishlistModal" class="d-none">
<modal id="shareWishlist" :is-open="modalIds.shareWishlist">
<h3 slot="header">
{{ __('shop::app.customer.account.wishlist.share-wishlist') }}
</h3>
<i class="rango-close"></i>
<i class="rango-close"></i>
<div slot="body">
<form method="POST" action="{{ route('customer.wishlist.share') }}">
@csrf
<div slot="body">
<form method="POST" action="{{ route('customer.wishlist.share') }}">
@csrf
<div class="row">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}
</label>
<div class="row">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}
</label>
<select name="shared" class="form-control">
<option value="0" {{ $isWishlistShared ? '' : 'selected="selected"' }}>{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" {{ $isWishlistShared ? 'selected="selected"' : '' }}>{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.visibility') }}
</label>
<div>
@if ($isWishlistShared)
<span class="badge badge-success">{{ __('shop::app.customer.account.wishlist.public') }}</span>
@else
<span class="badge badge-danger">{{ __('shop::app.customer.account.wishlist.private') }}</span>
@endif
<select name="shared" class="form-control">
<option value="0" {{ $isWishlistShared ? '' : 'selected="selected"' }}>{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" {{ $isWishlistShared ? 'selected="selected"' : '' }}>{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.shared-link') }}
</label>
<div class="row mt-2">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.visibility') }}
</label>
<div>
@if ($isWishlistShared)
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank">{{ $wishlistSharedLink }}</a>
@else
<p class="alert alert-danger">{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}</p>
@endif
<div>
@if ($isWishlistShared)
<span class="badge badge-success">{{ __('shop::app.customer.account.wishlist.public') }}</span>
@else
<span class="badge badge-danger">{{ __('shop::app.customer.account.wishlist.private') }}</span>
@endif
</div>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<button type="submit" class="theme-btn float-right">
{{ __('shop::app.customer.account.wishlist.save') }}
</button>
<div class="row mt-2">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.shared-link') }}
</label>
<div>
@if ($isWishlistShared)
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank">{{ $wishlistSharedLink }}</a>
@else
<p class="alert alert-danger">{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}</p>
@endif
</div>
</div>
</div>
</div>
</form>
</div>
</modal>
</div>
<div class="row mt-2">
<div class="col-12">
<button type="submit" class="theme-btn float-right">
{{ __('shop::app.customer.account.wishlist.save') }}
</button>
</div>
</div>
</form>
</div>
</modal>
</div>
@endif
{!! view_render_event('bagisto.shop.customers.account.wishlist.list.after', ['wishlist' => $items]) !!}
@endsection
@push('scripts')
<script>
/**
* Show share wishlist modal.
*/
function showShareWishlistModal() {
document.getElementById('shareWishlistModal').classList.remove('d-none');
@if($isSharingEnabled)
<script>
/**
* Show share wishlist modal.
*/
function showShareWishlistModal() {
document.getElementById('shareWishlistModal').classList.remove('d-none');
window.app.showModal('shareWishlist');
}
</script>
window.app.showModal('shareWishlist');
}
</script>
@endif
@endpush

View File

@ -1,19 +1,6 @@
@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')
@push('css')
<style type="text/css">
.list-card .wishlist-icon i {
padding-left: 10px;
}
.product-price span:first-child, .product-price span:last-child {
font-size: 18px;
font-weight: 600;
}
</style>
@endpush
@php
if (isset($checkmode) && $checkmode && $toolbarHelper->getCurrentMode() == "list") {
$list = true;