auditionadmin-7 Confirmation on delete with trash icon

This commit is contained in:
Matt Young 2024-07-14 17:46:36 -05:00
parent 4a7f8c13d1
commit 833e04b557
2 changed files with 26 additions and 11 deletions

View File

@ -1,4 +1,15 @@
<x-layout.app> <x-layout.app>
@if($school->students()->count() === 0)
<x-slot:title_bar_right>
<x-delete-resource-modal
title="Delete School"
action="{{route('admin.schools.destroy',$school)}}"
>
Confirm you would like to delete the school {{ $school->name }}.
This action cannot be undone.
</x-delete-resource-modal>
</x-slot:title_bar_right>
@endif
<x-slot:page_title>School: {{ $school->name }}</x-slot:page_title> <x-slot:page_title>School: {{ $school->name }}</x-slot:page_title>
<div class="grid md:grid-cols-4 gap-3"> <div class="grid md:grid-cols-4 gap-3">
<div x-data="{ showModal: false }"> <div x-data="{ showModal: false }">

View File

@ -4,25 +4,29 @@
Edit User Edit User
<x-slot:right_side> <x-slot:right_side>
@if($user->id != Auth::user()->id) @if($user->id != Auth::user()->id)
<form method="POST" action="{{ route('admin.users.destroy',['user' => $user->id]) }}"> <x-delete-resource-modal
@csrf action="{{ route('admin.users.destroy',['user' => $user->id]) }}"
@method('DELETE') title="Delete user {{$user->full_name()}}">
<x-form.red-trash-button type="submit" /> Confirm you would like to delete the user {{ $user->full_name() }} having
</form> email {{ $user->email }}.
This action cannot be undone.
</x-delete-resource-modal>
@endif @endif
</x-slot:right_side> </x-slot:right_side>
</x-card.heading> </x-card.heading>
<x-form.form method="PATCH" action="{{ route('admin.users.update', $user) }}"> <x-form.form method="PATCH" action="{{ route('admin.users.update', $user) }}">
<x-form.body-grid> <x-form.body-grid>
<x-form.field name="first_name" label_text="First Name" colspan="3" value="{{ $user->first_name }}" /> <x-form.field name="first_name" label_text="First Name" colspan="3" value="{{ $user->first_name }}"/>
<x-form.field name="last_name" label_text="Last Name" colspan="3" value="{{ $user->last_name }}" /> <x-form.field name="last_name" label_text="Last Name" colspan="3" value="{{ $user->last_name }}"/>
<x-form.field name="email" label_text="Email Address" colspan="3" value="{{ $user->email }}" /> <x-form.field name="email" label_text="Email Address" colspan="3" value="{{ $user->email }}"/>
<x-form.field name="cell_phone" label_text="Cell Phone" colspan="3" value="{{ $user->cell_phone }}" /> <x-form.field name="cell_phone" label_text="Cell Phone" colspan="3" value="{{ $user->cell_phone }}"/>
<x-form.field name="judging_preference" label_text="Judging Preference" colspan="6" value="{{ $user->judging_preference }}" /> <x-form.field name="judging_preference" label_text="Judging Preference" colspan="6"
value="{{ $user->judging_preference }}"/>
<x-form.select name="school_id" colspan="6"> <x-form.select name="school_id" colspan="6">
<x-slot:label>School</x-slot:label> <x-slot:label>School</x-slot:label>
@foreach ($schools as $school) @foreach ($schools as $school)
<option value="{{ $school->id }}" @if ($user->school_id == $school->id) selected @endif>{{ $school->name }}</option> <option value="{{ $school->id }}"
@if ($user->school_id == $school->id) selected @endif>{{ $school->name }}</option>
@endforeach @endforeach
</x-form.select> </x-form.select>