183 lines
12 KiB
PHP
183 lines
12 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<h2 class="text-xl font-semibold leading-tight text-gray-800">
|
|
{{ __('Members') }}
|
|
</h2>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
|
<div class="bg-white shadow sm:rounded-lg">
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<form method="GET" action="{{ route('admin.members.index') }}" class="mb-4 space-y-4" role="search" aria-label="{{ __('Search and filter members') }}">
|
|
<div>
|
|
<label for="search" class="block text-sm font-medium text-gray-700">
|
|
{{ __('Search by name, email, phone, or national ID') }}
|
|
</label>
|
|
<input
|
|
type="text"
|
|
name="search"
|
|
id="search"
|
|
value="{{ $filters['search'] ?? '' }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
placeholder="{{ __('Enter search term...') }}"
|
|
>
|
|
<p class="mt-1 text-xs text-gray-500">
|
|
{{ __('Searches in name, email, phone number, and national ID') }}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
|
|
<div>
|
|
<label for="status" class="block text-sm font-medium text-gray-700">
|
|
{{ __('Membership status') }}
|
|
</label>
|
|
<select
|
|
id="status"
|
|
name="status"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
>
|
|
<option value="">{{ __('All') }}</option>
|
|
<option value="active" @selected(($filters['status'] ?? '') === 'active')>{{ __('Active') }}</option>
|
|
<option value="expired" @selected(($filters['status'] ?? '') === 'expired')>{{ __('Expired') }}</option>
|
|
<option value="expiring_soon" @selected(($filters['status'] ?? '') === 'expiring_soon')>{{ __('Expiring Soon (30 days)') }}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="payment_status" class="block text-sm font-medium text-gray-700">
|
|
{{ __('Payment status') }}
|
|
</label>
|
|
<select
|
|
id="payment_status"
|
|
name="payment_status"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
>
|
|
<option value="">{{ __('All') }}</option>
|
|
<option value="has_payments" @selected(($filters['payment_status'] ?? '') === 'has_payments')>{{ __('Has Payments') }}</option>
|
|
<option value="no_payments" @selected(($filters['payment_status'] ?? '') === 'no_payments')>{{ __('No Payments') }}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">
|
|
{{ __('Date range') }}
|
|
</label>
|
|
<button
|
|
type="button"
|
|
onclick="document.getElementById('dateFilters').classList.toggle('hidden')"
|
|
class="mt-1 inline-flex w-full items-center justify-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
|
|
>
|
|
{{ __('Toggle Date Filters') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="dateFilters" class="{{ (($filters['started_from'] ?? '') || ($filters['started_to'] ?? '')) ? '' : 'hidden' }} grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
<div>
|
|
<label for="started_from" class="block text-sm font-medium text-gray-700">
|
|
{{ __('Joined from') }}
|
|
</label>
|
|
<input
|
|
type="date"
|
|
name="started_from"
|
|
id="started_from"
|
|
value="{{ $filters['started_from'] ?? '' }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="started_to" class="block text-sm font-medium text-gray-700">
|
|
{{ __('Joined to') }}
|
|
</label>
|
|
<input
|
|
type="date"
|
|
name="started_to"
|
|
id="started_to"
|
|
value="{{ $filters['started_to'] ?? '' }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap items-center gap-2 justify-between">
|
|
<div class="flex gap-2">
|
|
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
|
{{ __('Apply filters') }}
|
|
</button>
|
|
<a href="{{ route('admin.members.export', request()->only('search','status')) }}" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
|
{{ __('Export CSV') }}
|
|
</a>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<a href="{{ route('admin.members.create') }}" class="inline-flex items-center rounded-md border border-transparent bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2">
|
|
{{ __('Create Member') }}
|
|
</a>
|
|
<a href="{{ route('admin.members.import-form') }}" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
|
{{ __('Import CSV') }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="mt-4 overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200" role="table">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
|
|
{{ __('Name') }}
|
|
</th>
|
|
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
|
|
{{ __('Email') }}
|
|
</th>
|
|
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
|
|
{{ __('Membership Expires') }}
|
|
</th>
|
|
<th scope="col" class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500">
|
|
<span class="sr-only">{{ __('Actions') }}</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 bg-white">
|
|
@forelse ($members as $member)
|
|
<tr>
|
|
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-900">
|
|
{{ $member->full_name }}
|
|
</td>
|
|
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-900">
|
|
{{ $member->email }}
|
|
</td>
|
|
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-900">
|
|
@if ($member->membership_expires_at)
|
|
{{ $member->membership_expires_at->toDateString() }}
|
|
@else
|
|
<span class="text-gray-500">{{ __('Not set') }}</span>
|
|
@endif
|
|
</td>
|
|
<td class="whitespace-nowrap px-4 py-3 text-right text-sm font-medium">
|
|
<a href="{{ route('admin.members.show', $member) }}" class="text-indigo-600 hover:text-indigo-900">
|
|
{{ __('View') }}
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="4" class="px-4 py-4 text-sm text-gray-500">
|
|
{{ __('No members found.') }}
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
{{ $members->links() }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout>
|