@php $product = \App\Models\Product::with('images')->findOrFail($product_id); $settings = \App\Models\Setting::first(); $watermarkUrl = $settings->watermark_image ? config('app.asset_url')."/storage/".$settings->watermark_image : null; @endphp
images->first()->url : "" }}', thumbnails: {{ json_encode($product->images->map(fn($image) => config('app.asset_url')."/storage/".$image->url)->toArray()) }}, showModal: false, currentIndex: 0, watermarkUrl: '{{ $watermarkUrl }}', changeImage(image, index) { this.mainImage = image; this.currentIndex = index; }, previousImage() { this.currentIndex = (this.currentIndex - 1 + this.thumbnails.length) % this.thumbnails.length; this.mainImage = this.thumbnails[this.currentIndex]; }, nextImage() { this.currentIndex = (this.currentIndex + 1) % this.thumbnails.length; this.mainImage = this.thumbnails[this.currentIndex]; }, handleSwipe: { ['@touchstart'](e) { this.touchstartX = e.changedTouches[0].screenX }, ['@touchend'](e) { const touchendX = e.changedTouches[0].screenX; const diff = touchendX - this.touchstartX; if (Math.abs(diff) > 50) { if (diff > 0) this.previousImage(); else this.nextImage(); } } }, closeModal(e) { if (e.target.classList.contains('modal-backdrop')) { this.showModal = false; } }, init() { window.addEventListener('version-changed', (e) => { this.mainImage = e.detail.image; }); } }" class="space-y-6">
@if($watermarkUrl)
watermark watermark watermark watermark watermark
@endif