<x-app-layout><x-slot name="header"><h1 class="text-2xl font-bold">{{ $member->exists ? 'Edit member' : 'Add member' }}</h1></x-slot><div class="mx-auto max-w-3xl px-4 py-8"><form method="POST" action="{{ $member->exists ? route('members.update',$member) : route('members.store') }}" class="space-y-5 rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900">@csrf @if($member->exists)@method('PUT')@endif @php($input='mt-1 block w-full rounded-xl border-slate-300 bg-transparent shadow-sm focus:border-emerald-500 focus:ring-emerald-500 dark:border-slate-700')
<div class="grid gap-5 sm:grid-cols-2"><div><x-input-label for="member_number" value="Member number"/><input class="{{ $input }}" id="member_number" name="member_number" value="{{ old('member_number',$member->member_number) }}" required></div><div><x-input-label for="full_name" value="Full name"/><input class="{{ $input }}" id="full_name" name="full_name" value="{{ old('full_name',$member->full_name) }}" required></div><div><x-input-label for="phone" value="Phone"/><input class="{{ $input }}" id="phone" name="phone" value="{{ old('phone',$member->phone) }}" required></div><div><x-input-label for="whatsapp" value="WhatsApp"/><input class="{{ $input }}" id="whatsapp" name="whatsapp" value="{{ old('whatsapp',$member->whatsapp) }}"></div><div><x-input-label for="email" value="Email"/><input class="{{ $input }}" type="email" id="email" name="email" value="{{ old('email',$member->email) }}"></div><div><x-input-label for="gender" value="Gender"/><select class="{{ $input }}" id="gender" name="gender"><option value="">Prefer not to say</option>@foreach(['male','female','other'] as $gender)<option value="{{ $gender }}" @selected(old('gender',$member->gender)===$gender)>{{ ucfirst($gender) }}</option>@endforeach</select></div></div><div><x-input-label for="address" value="Address"/><textarea class="{{ $input }}" id="address" name="address" rows="2">{{ old('address',$member->address) }}</textarea></div><div><x-input-label for="notes" value="Notes"/><textarea class="{{ $input }}" id="notes" name="notes" rows="3">{{ old('notes',$member->notes) }}</textarea></div><label class="flex items-center gap-2"><input type="hidden" name="is_active" value="0"><input type="checkbox" name="is_active" value="1" @checked(old('is_active',$member->exists ? $member->is_active : true)) class="rounded border-slate-300 text-emerald-600"><span class="text-sm">Active member</span></label>@if($errors->any())<div class="rounded-xl bg-red-50 p-3 text-sm text-red-700">Please correct the form: {{ $errors->first() }}</div>@endif<div class="flex justify-end gap-3"><a href="{{ route('members.index') }}" class="rounded-xl px-4 py-2 text-sm">Cancel</a><button class="rounded-xl bg-emerald-600 px-5 py-2 text-sm font-semibold text-white">Save member</button></div></form></div></x-app-layout>
