Move form components out of auth directory

This commit is contained in:
Matt Young 2024-05-29 21:49:09 -05:00
parent fa524e80da
commit 7282a6b589
18 changed files with 67 additions and 61 deletions

View File

@ -74,13 +74,13 @@ class User extends Authenticatable implements MustVerifyEmail
{
return $this
->hasManyThrough(Student::class, School::class, 'id','school_id','school_id','id')
->orderBy('last_name','asc')
->orderBy('first_name','asc');
->orderBy('last_name')
->orderBy('first_name');
}
/**
* Return an array of schools using the users email domiain
* Return an array of schools using the users email domain
* @return SchoolEmailDomain[]
*/
public function possibleSchools()

View File

@ -11,8 +11,8 @@
</div>
<form class="space-y-6" action="/forgot-password" method="POST">
@csrf
<x-auth.form-field name="email" label="Email address" type="email" autocomplete="email" required />
<x-auth.form-button>Send Password Reset</x-auth.form-button>
<x-form.field name="email" label="Email address" type="email" autocomplete="email" required />
<x-form.button>Send Password Reset</x-form.button>
</form>
</div>
</div>

View File

@ -4,10 +4,10 @@
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
<form class="space-y-6" action="/login" method="POST">
@csrf
<x-auth.form-field name="email" label="Email address" type="email" autocomplete="email" required />
<x-auth.form-field name="password" label="Password" type="password" required />
<x-form.field name="email" label="Email address" type="email" autocomplete="email" required />
<x-form.field name="password" label="Password" type="password" required />
<x-auth.rememberme-forgotpassword />
<x-auth.form-button>Log In</x-auth.form-button>
<x-form.button>Log In</x-form.button>
</form>
<div class="pt-4 border-t border-gray-900/10 mt-4">
Don't have an account? <a href="/register" class="font-semibold text-indigo-600 hover:text-indigo-500"> Click here to register.

View File

@ -4,14 +4,14 @@
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
<form class="space-y-6" action="/register" method="POST">
@csrf
<x-auth.form-field name="first_name" label="First Name" type="text" autocomplete="given-name" required />
<x-auth.form-field name="last_name" label="Last Name" type="text" autocomplete="family-name" required />
<x-auth.form-field name="email" label="Email address" type="email" autocomplete="email" required />
<x-auth.form-field name="cell_phone" label="Cell Phone Number" type="tel" autocomplete="tel-national" />
<x-auth.form-field name="judging_preference" label="Judging Preference" type="text" />
<x-auth.form-field name="password" label="Password" type="password" autocomplete="new-password" required />
<x-auth.form-field name="password_confirmation" label="Confirm Password" autocomplete="new-password" type="password" required />
<x-auth.form-button>Create Account</x-auth.form-button>
<x-form.field name="first_name" label="First Name" type="text" autocomplete="given-name" required />
<x-form.field name="last_name" label="Last Name" type="text" autocomplete="family-name" required />
<x-form.field name="email" label="Email address" type="email" autocomplete="email" required />
<x-form.field name="cell_phone" label="Cell Phone Number" type="tel" autocomplete="tel-national" />
<x-form.field name="judging_preference" label="Judging Preference" type="text" />
<x-form.field name="password" label="Password" type="password" autocomplete="new-password" required />
<x-form.field name="password_confirmation" label="Confirm Password" autocomplete="new-password" type="password" required />
<x-form.button>Create Account</x-form.button>
</form>
<div class="pt-4 border-t border-gray-900/10 mt-4">
Already have an account? <a href="/login" class="font-semibold text-indigo-600 hover:text-indigo-500"> Click here to Log In.

View File

@ -4,11 +4,11 @@
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
<form class="space-y-6" action="/reset-password" method="POST">
@csrf
<x-auth.form-field name="email" label="Email address" type="email" autocomplete="email" required />
<x-auth.form-field name="password" label="Password" type="password" required />
<x-auth.form-field name="password_confirmation" label="Confirm Password" type="password" required />
<x-form.field name="email" label="Email address" type="email" autocomplete="email" required />
<x-form.field name="password" label="Password" type="password" required />
<x-form.field name="password_confirmation" label="Confirm Password" type="password" required />
<input type="hidden" name="token" id="token" value="{{ request()->route('token') }}" >
<x-auth.form-button>Reset Password</x-auth.form-button>
<x-form.button>Reset Password</x-form.button>
</form>
</div>
</div>

View File

@ -28,14 +28,14 @@
@csrf
<div>
<x-auth.form-button>Resend Verification Email</x-auth.form-button>
<x-form.button>Resend Verification Email</x-form.button>
</div>
</form>
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-auth.form-button>Logout</x-auth.form-button>
<x-form.button>Logout</x-form.button>
</form>
</div>
</div>

View File

@ -21,8 +21,8 @@
{{ $buttons }}
@else
<!-- TODO make the cancel button do something -->
<x-auth.form-button-nocolor type="button">Cancel</x-auth.form-button-nocolor>
<x-auth.form-button>{{ $submitButtonText }}</x-auth.form-button>
<x-form.button-nocolor type="button">Cancel</x-form.button-nocolor>
<x-form.button>{{ $submitButtonText }}</x-form.button>
@endif
{{ $buttons }}

View File

@ -18,6 +18,7 @@
<div class="{{ $div_classes }}">
<label for="{{ $name }}" class="{{ $labelClasses }}">{{ $label }}</label>
<div class="mt-2">
<!--suppress HtmlFormInputWithoutLabel -->
<input {{$attributes->merge($inputAttributes)}}>
</div>
@error($name)

View File

@ -15,11 +15,10 @@
<div class="min-h-full">
<x-layout.navbar />
<header class="bg-white shadow-sm">
<div class="mx-auto max-w-7xl px-4 py-4 sm:px-6 lg:px-8">
<h1 class="text-lg font-semibold leading-6 text-gray-900">{{ $page_title }}</h1>
</div>
</header>
@if($page_title)
<x-layout.page-header>{{ $page_title }}</x-layout.page-header>
@endif
<main>
<div class="mx-auto max-w-7xl py-6 sm:px-6 lg:px-8">
{{ $slot }}

View File

@ -1,4 +1,5 @@
@php use Illuminate\Support\Facades\Auth; @endphp
{{--TODO Clean up mobile menu area--}}
<nav class="bg-indigo-600"
x-data="{
mobile_menu_open: false

View File

@ -0,0 +1,5 @@
<header class="bg-white shadow-sm">
<div class="mx-auto max-w-7xl px-4 py-4 sm:px-6 lg:px-8">
<h1 class="text-lg font-semibold leading-6 text-gray-900">{{ $slot }}</h1>
</div>
</header>

View File

@ -17,16 +17,16 @@
@method('PUT')
<div class="px-4 py-6 sm:p-8">
<div class="grid max-w-2xl grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
<x-auth.form-field name="first_name" label="First Name" value="{{ Auth::user()->first_name }}" div_classes="sm:col-span-3" />
<x-auth.form-field name="last_name" label="Last Name" value="{{ Auth::user()->last_name }}" div_classes="sm:col-span-3" />
<x-auth.form-field name="email" label="Email Address" value="{{ Auth::user()->email }}" div_classes="sm:col-span-3" />
<x-auth.form-field name="cell_phone" label="Cell Phone" value="{{ Auth::user()->cell_phone }}" div_classes="sm:col-span-3" />
<x-auth.form-field name="judging_preference" label="Judging Preference" value="{{ Auth::user()->judging_preference }}" div_classes="sm:col-span-5" />
<x-form.field name="first_name" label="First Name" value="{{ Auth::user()->first_name }}" div_classes="sm:col-span-3" />
<x-form.field name="last_name" label="Last Name" value="{{ Auth::user()->last_name }}" div_classes="sm:col-span-3" />
<x-form.field name="email" label="Email Address" value="{{ Auth::user()->email }}" div_classes="sm:col-span-3" />
<x-form.field name="cell_phone" label="Cell Phone" value="{{ Auth::user()->cell_phone }}" div_classes="sm:col-span-3" />
<x-form.field name="judging_preference" label="Judging Preference" value="{{ Auth::user()->judging_preference }}" div_classes="sm:col-span-5" />
</div>
</div>
<div class="flex items-center justify-end gap-x-6 border-t border-gray-900/10 px-4 py-4 sm:px-8">
<x-auth.form-button-nocolor type="button">Cancel</x-auth.form-button-nocolor>
<x-auth.form-button>Update Profile</x-auth.form-button>
<x-form.button-nocolor type="button">Cancel</x-form.button-nocolor>
<x-form.button>Update Profile</x-form.button>
</div>
</form>
@ -42,11 +42,11 @@
</div>
@endif
<x-auth.form-card method="PUT" action="/user/password" cols="1" submit-button-text="Change Password">
<x-auth.form-field name="current_password" label="Current Password" type="password" autocomplete="current-password" required />
<x-auth.form-field name="password" label="New Password" type="password" autocomplete="new-password" required />
<x-auth.form-field name="password_confirmation" label="Confirm New Password" autocomplete="new-password" type="password" required />
</x-auth.form-card>
<x-form.card method="PUT" action="/user/password" cols="1" submit-button-text="Change Password">
<x-form.field name="current_password" label="Current Password" type="password" autocomplete="current-password" required />
<x-form.field name="password" label="New Password" type="password" autocomplete="new-password" required />
<x-form.field name="password_confirmation" label="Confirm New Password" autocomplete="new-password" type="password" required />
</x-form.card>
</x-layout.page-section>
</div>

View File

@ -6,18 +6,18 @@
section_description=""
:first="true">
<x-auth.form-card
<x-form.card
submit-button-text="Create School"
method="POST"
action="/schools"
cols="9"
>
<x-auth.form-field name="name" label="School Name" div_classes="sm:col-span-6"/>
<x-auth.form-field name="address" label="School Address" div_classes="sm:col-span-6"/>
<x-auth.form-field name="city" label="City" div_classes="sm:col-span-3"/>
<x-auth.form-field name="state" label="State" div_classes="sm:col-span-2"/>
<x-auth.form-field name="zip" label="Zip" div_classes="sm:col-span-1"/>
</x-auth.form-card>
<x-form.field name="name" label="School Name" div_classes="sm:col-span-6"/>
<x-form.field name="address" label="School Address" div_classes="sm:col-span-6"/>
<x-form.field name="city" label="City" div_classes="sm:col-span-3"/>
<x-form.field name="state" label="State" div_classes="sm:col-span-2"/>
<x-form.field name="zip" label="Zip" div_classes="sm:col-span-1"/>
</x-form.card>
</x-layout.page-section>
</div>

View File

@ -6,17 +6,17 @@
section_description=""
:first="true">
<x-auth.form-card
<x-form.card
submit-button-text="Update School"
method="PATCH"
action="/schools/{{ $school->id }}"
>
<x-auth.form-field name="name" label="School Name" value="{{ $school->name }}" div_classes="sm:col-span-6"/>
<x-auth.form-field name="address" label="School Address" value="{{ $school->address }}" div_classes="sm:col-span-6"/>
<x-auth.form-field name="city" label="City" value="{{ $school->city }}" div_classes="sm:col-span-3"/>
<x-auth.form-field name="state" label="State" value="{{ $school->state }}" div_classes="sm:col-span-2"/>
<x-auth.form-field name="zip" label="Zip" value="{{ $school->zip }}" div_classes="sm:col-span-1"/>
</x-auth.form-card>
<x-form.field name="name" label="School Name" value="{{ $school->name }}" div_classes="sm:col-span-6"/>
<x-form.field name="address" label="School Address" value="{{ $school->address }}" div_classes="sm:col-span-6"/>
<x-form.field name="city" label="City" value="{{ $school->city }}" div_classes="sm:col-span-3"/>
<x-form.field name="state" label="State" value="{{ $school->state }}" div_classes="sm:col-span-2"/>
<x-form.field name="zip" label="Zip" value="{{ $school->zip }}" div_classes="sm:col-span-1"/>
</x-form.card>
</x-layout.page-section>
</div>

View File

@ -9,9 +9,9 @@
<x-layout.page-section>
<x-slot:section_name>Create Student</x-slot:section_name>
<x-slot:section_description>Student full names must be unique. Add a middle initial to the first name if necessary.</x-slot:section_description>
<x-auth.form-card method="POST" action="/students/create" submit-button-text="Create Student" >
<x-auth.form-field name="first_name" label="First Name" div_classes="sm:col-span-3" required />
<x-auth.form-field name="last_name" label="Last Name" div_classes="sm:col-span-3" required />
</x-auth.form-card>
<x-form.card method="POST" action="/students/create" submit-button-text="Create Student" >
<x-form.field name="first_name" label="First Name" div_classes="sm:col-span-3" required />
<x-form.field name="last_name" label="Last Name" div_classes="sm:col-span-3" required />
</x-form.card>
</x-layout.page-section>
</x-layout.app>

View File

@ -5,8 +5,8 @@
<div class="flex justify-center">
<div class="overflow-hidden rounded-lg bg-white shadow mt-4">
<div class="px-4 py-5 sm:p-6">
<x-auth.form-button href="/login" class="px-40">Login</x-auth.form-button>
<x-auth.form-button href="/register" class="px-40 mt-3">Create Account</x-auth.form-button>
<x-form.button href="/login" class="px-40">Login</x-form.button>
<x-form.button href="/register" class="px-40 mt-3">Create Account</x-form.button>
</div>
</div>
</div>