Replace native browser confirms with Ladill confirm dialogs.
Deploy Ladill Care / deploy (push) Successful in 49s
Deploy Ladill Care / deploy (push) Successful in 49s
Appointment cancel and other destructive actions now use the shared modal UI instead of window.confirm. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,10 +32,18 @@
|
||||
<td class="px-4 py-3">{{ $member->branch?->name ?? 'All branches' }}</td>
|
||||
<td class="px-4 py-3 text-right">
|
||||
@if ($member->user_ref !== auth()->user()->public_id)
|
||||
<form method="POST" action="{{ route('care.members.destroy', $member) }}" class="inline" onsubmit="return confirm('Remove this member?')">
|
||||
@csrf @method('DELETE')
|
||||
<x-btn type="submit" variant="danger" size="sm">Remove</x-btn>
|
||||
</form>
|
||||
<x-confirm-dialog
|
||||
:name="'remove-member-'.$member->id"
|
||||
title="Remove this member?"
|
||||
message="They will lose access to this Care organization."
|
||||
:action="route('care.members.destroy', $member)"
|
||||
method="DELETE"
|
||||
confirm-label="Remove member"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<x-btn type="button" variant="danger" size="sm">Remove</x-btn>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -47,10 +47,17 @@
|
||||
@endif
|
||||
@endif
|
||||
@if ($canManage && ! in_array($appointment->status, [\App\Models\Appointment::STATUS_COMPLETED, \App\Models\Appointment::STATUS_CANCELLED], true))
|
||||
<form method="POST" action="{{ route('care.appointments.cancel', $appointment) }}" onsubmit="return confirm('Cancel this appointment?')">
|
||||
@csrf
|
||||
<x-btn type="submit" variant="danger">Cancel</x-btn>
|
||||
</form>
|
||||
<x-confirm-dialog
|
||||
:name="'cancel-appointment-'.$appointment->id"
|
||||
title="Cancel this appointment?"
|
||||
message="The appointment will be marked cancelled. This cannot be undone from here."
|
||||
:action="route('care.appointments.cancel', $appointment)"
|
||||
confirm-label="Cancel appointment"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<x-btn type="button" variant="danger">Cancel</x-btn>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,17 @@
|
||||
<div class="flex gap-2">
|
||||
<a href="{{ route('care.bills.print', $bill) }}" target="_blank" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">Print</a>
|
||||
@if ($canManage && ! in_array($bill->status, [\App\Models\Bill::STATUS_PAID, \App\Models\Bill::STATUS_VOID]))
|
||||
<form method="POST" action="{{ route('care.bills.void', $bill) }}" onsubmit="return confirm('Void this bill?')">@csrf<x-btn type="submit" variant="danger">Void</x-btn></form>
|
||||
<x-confirm-dialog
|
||||
:name="'void-bill-'.$bill->id"
|
||||
title="Void this bill?"
|
||||
message="The invoice will be voided and can no longer be paid."
|
||||
:action="route('care.bills.void', $bill)"
|
||||
confirm-label="Void bill"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<x-btn type="button" variant="danger">Void</x-btn>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,10 +11,18 @@
|
||||
</p>
|
||||
</div>
|
||||
@if ($canManage && ! $isCompleted)
|
||||
<form method="POST" action="{{ route('care.consultations.complete', $consultation) }}" onsubmit="return confirm('Complete this consultation?')">
|
||||
@csrf
|
||||
<button type="submit" class="btn-primary">Complete consultation</button>
|
||||
</form>
|
||||
<x-confirm-dialog
|
||||
:name="'complete-consultation-'.$consultation->id"
|
||||
title="Complete this consultation?"
|
||||
message="Mark the consultation as finished. You can still prescribe or generate a bill afterward."
|
||||
:action="route('care.consultations.complete', $consultation)"
|
||||
confirm-label="Complete consultation"
|
||||
variant="primary"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<button type="button" class="btn-primary">Complete consultation</button>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
@endif
|
||||
@if ($canPrescribe)
|
||||
<a href="{{ route('care.prescriptions.create', $consultation) }}" class="rounded-lg border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Prescribe</a>
|
||||
|
||||
@@ -47,10 +47,19 @@
|
||||
</div>
|
||||
</form>
|
||||
@if ($credential->sms_api_key_encrypted || $credential->hasValidSms())
|
||||
<form method="POST" action="{{ route('care.integrations.sms.disconnect') }}" class="mt-3" onsubmit="return confirm('Disconnect Ladill SMS?')">
|
||||
@csrf
|
||||
<button type="submit" class="text-sm text-rose-700 hover:underline">Disconnect SMS</button>
|
||||
</form>
|
||||
<div class="mt-3">
|
||||
<x-confirm-dialog
|
||||
name="disconnect-sms"
|
||||
title="Disconnect Ladill SMS?"
|
||||
message="Patient SMS will stop working until you connect a new key."
|
||||
:action="route('care.integrations.sms.disconnect')"
|
||||
confirm-label="Disconnect SMS"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<button type="button" class="text-sm text-rose-700 hover:underline">Disconnect SMS</button>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</x-settings.card>
|
||||
@@ -98,10 +107,19 @@
|
||||
</div>
|
||||
</form>
|
||||
@if ($credential->bird_api_key_encrypted || $credential->hasValidBird())
|
||||
<form method="POST" action="{{ route('care.integrations.bird.disconnect') }}" class="mt-3" onsubmit="return confirm('Disconnect Ladill Bird?')">
|
||||
@csrf
|
||||
<button type="submit" class="text-sm text-rose-700 hover:underline">Disconnect Bird</button>
|
||||
</form>
|
||||
<div class="mt-3">
|
||||
<x-confirm-dialog
|
||||
name="disconnect-bird"
|
||||
title="Disconnect Ladill Bird?"
|
||||
message="Patient email will stop working until you connect a new key."
|
||||
:action="route('care.integrations.bird.disconnect')"
|
||||
confirm-label="Disconnect Bird"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<button type="button" class="text-sm text-rose-700 hover:underline">Disconnect Bird</button>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</x-settings.card>
|
||||
|
||||
@@ -15,10 +15,18 @@
|
||||
@if ($canManage)
|
||||
<div class="flex gap-2">
|
||||
<a href="{{ route('care.patients.edit', $patient) }}" class="btn-primary">Edit</a>
|
||||
<form method="POST" action="{{ route('care.patients.destroy', $patient) }}" onsubmit="return confirm('Archive this patient record?')">
|
||||
@csrf @method('DELETE')
|
||||
<x-btn type="submit" variant="danger">Archive</x-btn>
|
||||
</form>
|
||||
<x-confirm-dialog
|
||||
:name="'archive-patient-'.$patient->id"
|
||||
title="Archive this patient?"
|
||||
message="The patient record will be archived and hidden from active lists."
|
||||
:action="route('care.patients.destroy', $patient)"
|
||||
method="DELETE"
|
||||
confirm-label="Archive patient"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<x-btn type="button" variant="danger">Archive</x-btn>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,17 @@
|
||||
<form method="POST" action="{{ route('care.prescriptions.dispense', $prescription) }}">@csrf<button class="btn-primary">Dispense</button></form>
|
||||
@endif
|
||||
@if ($canManage && ! in_array($prescription->status, [\App\Models\Prescription::STATUS_DISPENSED, \App\Models\Prescription::STATUS_CANCELLED]))
|
||||
<form method="POST" action="{{ route('care.prescriptions.cancel', $prescription) }}" onsubmit="return confirm('Cancel prescription?')">@csrf<x-btn type="submit" variant="danger">Cancel</x-btn></form>
|
||||
<x-confirm-dialog
|
||||
:name="'cancel-prescription-'.$prescription->id"
|
||||
title="Cancel this prescription?"
|
||||
message="The prescription will be cancelled and can no longer be dispensed."
|
||||
:action="route('care.prescriptions.cancel', $prescription)"
|
||||
confirm-label="Cancel prescription"
|
||||
>
|
||||
<x-slot:trigger>
|
||||
<x-btn type="button" variant="danger">Cancel</x-btn>
|
||||
</x-slot:trigger>
|
||||
</x-confirm-dialog>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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-indigo-600 hover:bg-indigo-700';
|
||||
$iconWrapClass = $variant === 'danger'
|
||||
? 'bg-red-100 text-red-600'
|
||||
: 'bg-indigo-100 text-indigo-600';
|
||||
@endphp
|
||||
|
||||
@if(isset($trigger))
|
||||
<span @click.stop="$dispatch('open-modal', {{ Js::from($name) }})" class="inline-flex">
|
||||
{{ $trigger }}
|
||||
</span>
|
||||
@endif
|
||||
|
||||
<x-modal :name="$name" maxWidth="md">
|
||||
<div class="px-5 pb-6 pt-2 sm:px-6 sm:pb-6 sm:pt-4">
|
||||
<div class="flex flex-col items-center text-center sm:items-start sm:text-left">
|
||||
<div @class(['flex h-12 w-12 items-center justify-center rounded-full', $iconWrapClass])>
|
||||
@if($variant === 'danger')
|
||||
<svg class="h-6 w-6" fill="none" stroke="currentColor" stroke-width="1.75" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"/>
|
||||
</svg>
|
||||
@else
|
||||
<svg class="h-6 w-6" fill="none" stroke="currentColor" stroke-width="1.75" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"/>
|
||||
</svg>
|
||||
@endif
|
||||
</div>
|
||||
<h2 class="mt-4 text-lg font-semibold text-slate-900">{{ $title }}</h2>
|
||||
@if($message)
|
||||
<p class="mt-2 text-sm leading-relaxed text-slate-500">{{ $message }}</p>
|
||||
@endif
|
||||
@isset($details)
|
||||
<div class="mt-3 w-full">{{ $details }}</div>
|
||||
@endisset
|
||||
</div>
|
||||
|
||||
<form method="post" action="{{ $action }}" class="mt-6 flex flex-col-reverse gap-2.5 sm:flex-row sm:justify-end">
|
||||
@csrf
|
||||
@if(strtoupper($method) !== 'POST')
|
||||
@method($method)
|
||||
@endif
|
||||
@isset($fields)
|
||||
{{ $fields }}
|
||||
@endisset
|
||||
<button type="button"
|
||||
@click="$dispatch('close-modal', {{ Js::from($name) }})"
|
||||
class="rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700 transition hover:bg-slate-50">
|
||||
{{ $cancelLabel }}
|
||||
</button>
|
||||
<button type="submit"
|
||||
@class(['rounded-xl px-4 py-2.5 text-sm font-semibold text-white transition', $confirmBtnClass])>
|
||||
{{ $confirmLabel }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</x-modal>
|
||||
Reference in New Issue
Block a user