Issue #6002 fixed
This commit is contained in:
parent
2587f7f349
commit
fd7c6f1e98
|
|
@ -125,13 +125,14 @@ class WishlistController extends Controller
|
|||
$updateCounts = $this->currentCustomer->wishlist_items()->update(['shared' => $data['shared']]);
|
||||
|
||||
if ($updateCounts && $updateCounts > 0) {
|
||||
session()->flash('success', __('shop::app.customer.account.wishlist.update-message'));
|
||||
|
||||
return redirect()->back();
|
||||
return response()->json([
|
||||
'isWishlistShared' => $this->currentCustomer->isWishlistShared(),
|
||||
'wishlistSharedLink' => $this->currentCustomer->getWishlistSharedLink()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
return response()->json([], 400);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,51 +66,8 @@
|
|||
{{ __('shop::app.customer.account.wishlist.share-wishlist') }}
|
||||
</h3>
|
||||
|
||||
<i class="rango-close"></i>
|
||||
|
||||
<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>
|
||||
|
||||
<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
|
||||
</div>
|
||||
</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>
|
||||
<share-component></share-component>
|
||||
</div>
|
||||
</modal>
|
||||
</div>
|
||||
|
|
@ -122,6 +79,48 @@
|
|||
|
||||
@push('scripts')
|
||||
@if ($isSharingEnabled)
|
||||
<script type="text/x-template" id="share-component-template">
|
||||
<form method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="control-group">
|
||||
<label for="shared" class="required">{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}</label>
|
||||
|
||||
<select name="shared" class="control" @change="shareWishlist($event.target.value)">
|
||||
<option value="0" :selected="! isWishlistShared">{{ __('shop::app.customer.account.wishlist.disable') }}</option>
|
||||
<option value="1" :selected="isWishlistShared">{{ __('shop::app.customer.account.wishlist.enable') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="required">{{ __('shop::app.customer.account.wishlist.visibility') }}</label>
|
||||
|
||||
<div style="margin-top: 10px; margin-bottom: 5px;">
|
||||
<span class="badge badge-sm badge-success" v-if="isWishlistShared">
|
||||
{{ __('shop::app.customer.account.wishlist.public') }}
|
||||
</span>
|
||||
|
||||
<span class="badge badge-sm badge-danger" v-else>
|
||||
{{ __('shop::app.customer.account.wishlist.private') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="required">{{ __('shop::app.customer.account.wishlist.shared-link') }}</label>
|
||||
|
||||
<div style="margin-top: 10px; margin-bottom: 5px;">
|
||||
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank" v-if="isWishlistShared" v-text="wishlistSharedLink">
|
||||
</a>
|
||||
|
||||
<p class="alert alert-danger" v-else>
|
||||
{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* Show share wishlist modal.
|
||||
|
|
@ -131,6 +130,44 @@
|
|||
|
||||
window.app.showModal('shareWishlist');
|
||||
}
|
||||
|
||||
Vue.component('share-component', {
|
||||
template: '#share-component-template',
|
||||
|
||||
inject: ['$validator'],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
isWishlistShared: parseInt("{{ $isWishlistShared }}"),
|
||||
|
||||
wishlistSharedLink: "{{ $wishlistSharedLink }}",
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
shareWishlist: function(val) {
|
||||
var self = this;
|
||||
|
||||
this.$root.showLoader();
|
||||
|
||||
this.$http.post("{{ route('customer.wishlist.share') }}", {
|
||||
shared: val
|
||||
})
|
||||
.then(function(response) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
self.isWishlistShared = response.data.isWishlistShared;
|
||||
|
||||
self.wishlistSharedLink = response.data.wishlistSharedLink;
|
||||
})
|
||||
.catch(function (error) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=db13b903fbeec282d4f6",
|
||||
"/css/ui.css": "/css/ui.css?id=c8a7ade09358a1d61a4a"
|
||||
"/js/ui.js": "/js/ui.js?id=e8457a62399c39389e50",
|
||||
"/css/ui.css": "/css/ui.css?id=35f409e9ac92e008f443"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
var body = document.querySelector("body");
|
||||
|
||||
if (this.isOpen) {
|
||||
body.classList.add("modal-open");
|
||||
body.classList.add("loader-open");
|
||||
} else {
|
||||
body.classList.remove("modal-open");
|
||||
body.classList.remove("loader-open");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1203,6 +1203,10 @@ modal {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.loader-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-overlay {
|
||||
display: none;
|
||||
overflow-y: auto;
|
||||
|
|
@ -1220,6 +1224,10 @@ modal {
|
|||
display: block;
|
||||
}
|
||||
|
||||
.loader-open .loader-overlay {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.modal-container {
|
||||
background: $white-color;
|
||||
top: 100px;
|
||||
|
|
@ -1425,7 +1433,7 @@ modal {
|
|||
|
||||
.overlay-loader {
|
||||
position: fixed;
|
||||
z-index: 11;
|
||||
z-index: 10000;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -24px;
|
||||
|
|
|
|||
|
|
@ -70,62 +70,7 @@
|
|||
<i class="rango-close"></i>
|
||||
|
||||
<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>
|
||||
|
||||
<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
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 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>
|
||||
<share-component></share-component>
|
||||
</div>
|
||||
</modal>
|
||||
</div>
|
||||
|
|
@ -136,6 +81,54 @@
|
|||
|
||||
@push('scripts')
|
||||
@if($isSharingEnabled)
|
||||
<script type="text/x-template" id="share-component-template">
|
||||
<form method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="form-group">
|
||||
<label class="label-style mandatory">
|
||||
{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}
|
||||
</label>
|
||||
|
||||
<select name="shared" class="form-control" @change="shareWishlist($event.target.value)">
|
||||
<option value="0" :selected="! isWishlistShared">{{ __('shop::app.customer.account.wishlist.disable') }}</option>
|
||||
<option value="1" :selected="isWishlistShared">{{ __('shop::app.customer.account.wishlist.enable') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="label-style mandatory">
|
||||
{{ __('shop::app.customer.account.wishlist.visibility') }}
|
||||
</label>
|
||||
|
||||
<div>
|
||||
<span class="badge badge-success" v-if="isWishlistShared">
|
||||
{{ __('shop::app.customer.account.wishlist.public') }}
|
||||
</span>
|
||||
|
||||
<span class="badge badge-danger" v-else>
|
||||
{{ __('shop::app.customer.account.wishlist.private') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="label-style mandatory">
|
||||
{{ __('shop::app.customer.account.wishlist.shared-link') }}
|
||||
</label>
|
||||
|
||||
<div>
|
||||
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank" v-if="isWishlistShared" v-text="wishlistSharedLink">
|
||||
</a>
|
||||
|
||||
<p class="alert alert-danger" v-else>
|
||||
{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* Show share wishlist modal.
|
||||
|
|
@ -145,6 +138,44 @@
|
|||
|
||||
window.app.showModal('shareWishlist');
|
||||
}
|
||||
|
||||
Vue.component('share-component', {
|
||||
template: '#share-component-template',
|
||||
|
||||
inject: ['$validator'],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
isWishlistShared: parseInt("{{ $isWishlistShared }}"),
|
||||
|
||||
wishlistSharedLink: "{{ $wishlistSharedLink }}",
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
shareWishlist: function(val) {
|
||||
var self = this;
|
||||
|
||||
this.$root.showLoader();
|
||||
|
||||
this.$http.post("{{ route('customer.wishlist.share') }}", {
|
||||
shared: val
|
||||
})
|
||||
.then(function(response) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
self.isWishlistShared = response.data.isWishlistShared;
|
||||
|
||||
self.wishlistSharedLink = response.data.wishlistSharedLink;
|
||||
})
|
||||
.catch(function (error) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue