diff --git a/resources/js/app.js b/resources/js/app.js
index b920e01..722b689 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -1,5 +1,10 @@
import './bootstrap';
+import { registerLadillConfirmStore, registerLadillModalHelpers } from './ladill-modals';
+
+registerLadillModalHelpers();
+
+
import Alpine from 'alpinejs';
import collapse from '@alpinejs/collapse';
@@ -187,4 +192,6 @@ Alpine.data('topbarSearch', (config = {}) => ({
}));
window.Alpine = Alpine;
+registerLadillConfirmStore(Alpine);
+
Alpine.start();
diff --git a/resources/js/ladill-modals.js b/resources/js/ladill-modals.js
new file mode 100644
index 0000000..eb2bf74
--- /dev/null
+++ b/resources/js/ladill-modals.js
@@ -0,0 +1,75 @@
+/**
+ * Lightweight modal dispatch helpers (optional — balanceGate in layout is primary).
+ */
+
+export function openLadillModal(name) {
+ if (!name) {
+ return false;
+ }
+
+ window.dispatchEvent(new CustomEvent('open-modal', { detail: name, bubbles: true }));
+
+ return true;
+}
+
+export function closeLadillModal(name) {
+ if (!name) {
+ return false;
+ }
+
+ window.dispatchEvent(new CustomEvent('close-modal', { detail: name, bubbles: true }));
+
+ return true;
+}
+
+export function ladillNeedsTopup(balance, price) {
+ const normalizedBalance = Number.parseFloat(balance);
+ const normalizedPrice = Number.parseFloat(price);
+
+ if (!Number.isFinite(normalizedBalance) || !Number.isFinite(normalizedPrice)) {
+ return false;
+ }
+
+ return normalizedBalance <= 0 || normalizedBalance < normalizedPrice;
+}
+
+export function registerLadillConfirmStore(Alpine) {
+ Alpine.store('ladillConfirm', {
+ open: false,
+ title: '',
+ message: '',
+ confirmLabel: 'Confirm',
+ cancelLabel: 'Cancel',
+ variant: 'danger',
+ _resolve: null,
+
+ ask(options = {}) {
+ return new Promise((resolve) => {
+ this.title = options.title || 'Are you sure?';
+ this.message = options.message || '';
+ this.confirmLabel = options.confirmLabel || 'Confirm';
+ this.cancelLabel = options.cancelLabel || 'Cancel';
+ this.variant = options.variant || 'danger';
+ this._resolve = resolve;
+ this.open = true;
+ });
+ },
+
+ answer(confirmed) {
+ if (this._resolve) {
+ this._resolve(confirmed);
+ }
+
+ this.open = false;
+ this._resolve = null;
+ },
+ });
+
+ window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options);
+}
+
+export function registerLadillModalHelpers() {
+ window.openLadillModal = openLadillModal;
+ window.closeLadillModal = closeLadillModal;
+ window.ladillNeedsTopup = ladillNeedsTopup;
+}
diff --git a/resources/views/components/confirm-dialog.blade.php b/resources/views/components/confirm-dialog.blade.php
new file mode 100644
index 0000000..1d0ee69
--- /dev/null
+++ b/resources/views/components/confirm-dialog.blade.php
@@ -0,0 +1,69 @@
+@props([
+ 'name',
+ 'title',
+ 'message' => null,
+ 'action',
+ 'method' => 'POST',
+ 'confirmLabel' => 'Confirm',
+ 'cancelLabel' => 'Cancel',
+ 'variant' => 'danger',
+])
+
+@php
+ $confirmBtnClass = $variant === 'danger'
+ ? 'bg-red-600 hover:bg-red-700'
+ : 'bg-violet-600 hover:bg-violet-700';
+ $iconWrapClass = $variant === 'danger'
+ ? 'bg-red-100 text-red-600'
+ : 'bg-violet-100 text-violet-600';
+@endphp
+
+@if(isset($trigger))
+
+ {{ $trigger }}
+
+@endif
+
+ {{ $message }}{{ $title }}
+ @if($message)
+
No tokens yet.
diff --git a/resources/views/email/account/settings.blade.php b/resources/views/email/account/settings.blade.php index 7ec7bfc..54b854a 100644 --- a/resources/views/email/account/settings.blade.php +++ b/resources/views/email/account/settings.blade.php @@ -22,13 +22,22 @@Add and verify an email domain first.
diff --git a/resources/views/email/account/team.blade.php b/resources/views/email/account/team.blade.php index 48793ae..70c9fef 100644 --- a/resources/views/email/account/team.blade.php +++ b/resources/views/email/account/team.blade.php @@ -64,10 +64,18 @@ - +This permanently removes the mailbox and its email.
- +No tokens yet.
diff --git a/resources/views/hosting/account/team.blade.php b/resources/views/hosting/account/team.blade.php index 646671d..1045ce8 100644 --- a/resources/views/hosting/account/team.blade.php +++ b/resources/views/hosting/account/team.blade.php @@ -62,10 +62,18 @@ - +{{ $job['command'] }}