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/components/app-layout.blade.php b/resources/views/components/app-layout.blade.php index 96a7909..dd13f70 100644 --- a/resources/views/components/app-layout.blade.php +++ b/resources/views/components/app-layout.blade.php @@ -29,5 +29,6 @@ @auth @include('partials.afia') @endauth + @include('partials.confirm-prompt') diff --git a/resources/views/components/hosting-panel-layout.blade.php b/resources/views/components/hosting-panel-layout.blade.php index 978ac9e..e5e68e6 100644 --- a/resources/views/components/hosting-panel-layout.blade.php +++ b/resources/views/components/hosting-panel-layout.blade.php @@ -69,5 +69,6 @@ @stack('scripts') + @include('partials.confirm-prompt') diff --git a/resources/views/components/user-layout.blade.php b/resources/views/components/user-layout.blade.php index 8d2a348..644addb 100644 --- a/resources/views/components/user-layout.blade.php +++ b/resources/views/components/user-layout.blade.php @@ -30,5 +30,6 @@ @include('partials.sso-keepalive') @include('partials.afia') @endauth + @include('partials.confirm-prompt') diff --git a/resources/views/layouts/user.blade.php b/resources/views/layouts/user.blade.php index 188b799..729f2e8 100644 --- a/resources/views/layouts/user.blade.php +++ b/resources/views/layouts/user.blade.php @@ -53,5 +53,6 @@ @include('partials.sso-keepalive') @include('partials.afia') @endauth + @include('partials.confirm-prompt') diff --git a/resources/views/partials/confirm-prompt.blade.php b/resources/views/partials/confirm-prompt.blade.php index c519339..2b0af65 100644 --- a/resources/views/partials/confirm-prompt.blade.php +++ b/resources/views/partials/confirm-prompt.blade.php @@ -1,65 +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. +--}} +
@if ($subscription->auto_renew) -
@csrf
+
@csrf
@elseif ($subscription->status === 'canceled')
@csrf
@endif diff --git a/resources/views/woo/settings/_store-team-section.blade.php b/resources/views/woo/settings/_store-team-section.blade.php index 76b1e2b..7318d6e 100644 --- a/resources/views/woo/settings/_store-team-section.blade.php +++ b/resources/views/woo/settings/_store-team-section.blade.php @@ -55,7 +55,7 @@ {{ $roles[$member->role] ?? $member->role }} @if ($member->user_ref !== auth()->user()->public_id && $member->user_ref !== strtolower((string) auth()->user()->email)) -
+ @csrf @method('DELETE') diff --git a/resources/views/woo/stores/index.blade.php b/resources/views/woo/stores/index.blade.php index 0dcb701..3ccdaa6 100644 --- a/resources/views/woo/stores/index.blade.php +++ b/resources/views/woo/stores/index.blade.php @@ -61,7 +61,7 @@
@endif @if($isStoreOwner ?? true) -
+ @csrf @method('delete')