diff --git a/resources/js/ladill-modals.js b/resources/js/ladill-modals.js index eb2bf74..0eda97a 100644 --- a/resources/js/ladill-modals.js +++ b/resources/js/ladill-modals.js @@ -33,6 +33,10 @@ export function ladillNeedsTopup(balance, price) { return normalizedBalance <= 0 || normalizedBalance < normalizedPrice; } +/** + * Alpine store mirrors window.ladillConfirm (defined in partials/confirm-prompt). + * Prefer window.ladillConfirm for new code — it works without Alpine and powers data-confirm forms. + */ export function registerLadillConfirmStore(Alpine) { Alpine.store('ladillConfirm', { open: false, @@ -44,6 +48,11 @@ export function registerLadillConfirmStore(Alpine) { _resolve: null, ask(options = {}) { + // Delegate to the global custom dialog when available (no double UI). + if (typeof window.ladillConfirm === 'function' && window.__ladillConfirmInstalled) { + return window.ladillConfirm(options); + } + return new Promise((resolve) => { this.title = options.title || 'Are you sure?'; this.message = options.message || ''; @@ -65,7 +74,9 @@ export function registerLadillConfirmStore(Alpine) { }, }); - window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options); + if (typeof window.ladillConfirm !== 'function') { + window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options); + } } export function registerLadillModalHelpers() { diff --git a/resources/views/partials/confirm-prompt.blade.php b/resources/views/partials/confirm-prompt.blade.php index 6a9d8b3..2b0af65 100644 --- a/resources/views/partials/confirm-prompt.blade.php +++ b/resources/views/partials/confirm-prompt.blade.php @@ -1,66 +1,213 @@ -
-
+{{-- + Ladill custom confirm dialog (replaces native window.confirm for app UX). -
+ Usage: + 1) Forms:
+ 2) JS: const ok = await window.ladillConfirm({ title, message, confirmLabel, variant }) + + Bottom sheet on mobile, centered card on desktop — same pattern as x-modal. +--}} +
-
+ @csrf @method('DELETE') diff --git a/resources/views/pos/devices/edit.blade.php b/resources/views/pos/devices/edit.blade.php index da6424d..6335968 100644 --- a/resources/views/pos/devices/edit.blade.php +++ b/resources/views/pos/devices/edit.blade.php @@ -79,16 +79,14 @@
@if ($device->device_token) - + @csrf @endif -
+ @csrf @method('DELETE')
@@ -45,7 +45,7 @@ @forelse ($stations as $station)
  • {{ $station->name }} -
    + @csrf @method('DELETE')
    @@ -87,7 +87,7 @@ choose {{ $group->min_select }}–{{ $group->max_select ?? 'any' }}

    -
    + @csrf @method('DELETE')
    diff --git a/resources/views/pos/pro/index.blade.php b/resources/views/pos/pro/index.blade.php index 064ebe9..12ccd0c 100644 --- a/resources/views/pos/pro/index.blade.php +++ b/resources/views/pos/pro/index.blade.php @@ -36,7 +36,7 @@ {{ $isEnterprise ? 'Business' : 'Pro' }} active until {{ $subscription->current_period_end->format('d M Y') }}
  • @if ($subscription->auto_renew) -
    @csrf
    +
    @csrf
    @elseif ($subscription->status === 'canceled')
    @csrf
    @endif diff --git a/resources/views/pos/products/edit.blade.php b/resources/views/pos/products/edit.blade.php index e9c72ce..3603104 100644 --- a/resources/views/pos/products/edit.blade.php +++ b/resources/views/pos/products/edit.blade.php @@ -8,7 +8,7 @@ @method('PUT') @include('pos.products._form')
    -
    + @csrf @method('DELETE') diff --git a/resources/views/pos/products/retail/index.blade.php b/resources/views/pos/products/retail/index.blade.php index 1680675..8261114 100644 --- a/resources/views/pos/products/retail/index.blade.php +++ b/resources/views/pos/products/retail/index.blade.php @@ -59,7 +59,7 @@
    Edit - + @csrf @method('DELETE') diff --git a/resources/views/pos/settings.blade.php b/resources/views/pos/settings.blade.php index 649b7a3..f8df6d8 100644 --- a/resources/views/pos/settings.blade.php +++ b/resources/views/pos/settings.blade.php @@ -233,8 +233,7 @@
    QR -
    + @csrf @method('DELETE') diff --git a/resources/views/pos/settings/_team-section.blade.php b/resources/views/pos/settings/_team-section.blade.php index d634c2d..be2deb5 100644 --- a/resources/views/pos/settings/_team-section.blade.php +++ b/resources/views/pos/settings/_team-section.blade.php @@ -65,7 +65,7 @@ {{ $member->location?->name ?? 'All branches' }} @if ($member->user_ref !== auth()->user()->public_id && $member->user_ref !== strtolower((string) auth()->user()->email)) - + @csrf @method('DELETE') diff --git a/resources/views/pos/team/index.blade.php b/resources/views/pos/team/index.blade.php index 47654ff..ad0af09 100644 --- a/resources/views/pos/team/index.blade.php +++ b/resources/views/pos/team/index.blade.php @@ -70,7 +70,7 @@ {{ $member->location?->name ?? 'All branches' }} @if ($member->user_ref !== auth()->user()->public_id && $member->user_ref !== strtolower((string) auth()->user()->email)) - + @csrf @method('DELETE')