352 lines
20 KiB
PHP
352 lines
20 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Daftar - Sistem Antrian Puskesmas')
|
|
|
|
@section('content')
|
|
<div
|
|
class="min-h-screen flex items-center justify-center bg-gradient-to-br from-primary via-blue-600 to-secondary py-6 px-4 sm:px-6 lg:px-8">
|
|
<div class="max-w-md w-full space-y-8 animate-fade-in">
|
|
<!-- Header -->
|
|
<div class="text-center">
|
|
<div class="mx-auto h-20 w-20 bg-white rounded-full flex items-center justify-center mb-6 shadow-lg">
|
|
<span class="text-4xl">🏥</span>
|
|
</div>
|
|
<h2 class="text-3xl md:text-4xl font-bold text-white mb-3">Daftar</h2>
|
|
<p class="text-blue-100 text-lg">Buat akun untuk mengakses sistem antrian</p>
|
|
</div>
|
|
|
|
<!-- Register Form -->
|
|
<div class="bg-white rounded-2xl shadow-2xl p-6 md:p-8 animate-slide-up">
|
|
<form method="POST" action="{{ route('register') }}" class="space-y-6">
|
|
@csrf
|
|
|
|
<!-- Nama Lengkap Field -->
|
|
<div>
|
|
<label for="nama" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Nama Lengkap
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
|
|
</svg>
|
|
</div>
|
|
<input id="nama" name="nama" type="text" required
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm"
|
|
placeholder="Masukkan nama lengkap" value="{{ old('nama') }}">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Alamat Field -->
|
|
<div>
|
|
<label for="alamat" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Alamat
|
|
</label>
|
|
<textarea id="alamat" name="alamat" required rows="3"
|
|
class="block w-full px-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm resize-none"
|
|
placeholder="Masukkan alamat lengkap">{{ old('alamat') }}</textarea>
|
|
</div>
|
|
|
|
<!-- Jenis Kelamin Field -->
|
|
<div>
|
|
<label for="jenis_kelamin" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Jenis Kelamin
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
|
|
</svg>
|
|
</div>
|
|
<select id="jenis_kelamin" name="jenis_kelamin" required
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm appearance-none">
|
|
<option value="">Pilih jenis kelamin</option>
|
|
<option value="laki-laki" {{ old('jenis_kelamin') == 'laki-laki' ? 'selected' : '' }}>
|
|
Laki-laki</option>
|
|
<option value="perempuan" {{ old('jenis_kelamin') == 'perempuan' ? 'selected' : '' }}>
|
|
Perempuan</option>
|
|
</select>
|
|
<div class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M19 9l-7 7-7-7"></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- No HP Field -->
|
|
<div>
|
|
<label for="no_hp" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Nomor HP
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z">
|
|
</path>
|
|
</svg>
|
|
</div>
|
|
<input id="no_hp" name="no_hp" type="tel" required
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm"
|
|
placeholder="Masukkan nomor HP" value="{{ old('no_hp') }}" pattern="[0-9]*"
|
|
inputmode="numeric" oninput="this.value = this.value.replace(/[^0-9]/g, '')">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- No KTP Field -->
|
|
<div>
|
|
<label for="no_ktp" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Nomor KTP <span class="text-red-500">*</span>
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">
|
|
</path>
|
|
</svg>
|
|
</div>
|
|
<input id="no_ktp" name="no_ktp" type="text" required maxlength="16" minlength="16"
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm"
|
|
placeholder="Masukkan 16 digit nomor KTP" value="{{ old('no_ktp') }}"
|
|
oninput="this.value = this.value.replace(/[^0-9]/g, '')">
|
|
</div>
|
|
<p class="text-xs text-gray-500 mt-1">NIK harus tepat 16 digit angka</p>
|
|
</div>
|
|
|
|
<!-- Pekerjaan Field -->
|
|
<div>
|
|
<label for="pekerjaan" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Pekerjaan
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor"
|
|
viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2-2v2m8 0V6a2 2 0 012 2v6a2 2 0 01-2 2H8a2 2 0 01-2-2V8a2 2 0 012-2V6">
|
|
</path>
|
|
</svg>
|
|
</div>
|
|
<input id="pekerjaan" name="pekerjaan" type="text" required
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm"
|
|
placeholder="Masukkan pekerjaan" value="{{ old('pekerjaan') }}">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Password Field -->
|
|
<div>
|
|
<label for="password" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Password
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor"
|
|
viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z">
|
|
</path>
|
|
</svg>
|
|
</div>
|
|
<input id="password" name="password" type="password" required
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm"
|
|
placeholder="Masukkan password">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Password Confirmation Field -->
|
|
<div>
|
|
<label for="password_confirmation" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
Konfirmasi Password
|
|
</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor"
|
|
viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z">
|
|
</path>
|
|
</svg>
|
|
</div>
|
|
<input id="password_confirmation" name="password_confirmation" type="password" required
|
|
class="block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-xl placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition duration-200 text-sm"
|
|
placeholder="Konfirmasi password">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Submit Button -->
|
|
<div>
|
|
<button type="submit"
|
|
class="group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-semibold rounded-xl text-white bg-primary hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-200 transform hover:scale-105">
|
|
<span class="absolute left-0 inset-y-0 flex items-center pl-3">
|
|
<svg class="h-5 w-5 text-blue-200 group-hover:text-blue-100 transition duration-200"
|
|
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
|
<path
|
|
d="M8 9a3 3 0 100-6 3 3 0 000 6zM8 11a6 6 0 016 6H2a6 6 0 016-6zM16 7a1 1 0 10-2 0v1h-1a1 1 0 100 2h1v1a1 1 0 102 0v-1h1a1 1 0 100-2h-1V7z" />
|
|
</svg>
|
|
</span>
|
|
Daftar
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Login Link -->
|
|
<div class="text-center">
|
|
<p class="text-sm text-gray-600">
|
|
Sudah punya akun?
|
|
<a href="{{ route('login') }}"
|
|
class="font-semibold text-primary hover:text-secondary transition duration-200">
|
|
Login di sini
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Back to Home -->
|
|
<div class="text-center">
|
|
<a href="{{ route('landing') }}"
|
|
class="text-blue-100 hover:text-white text-sm transition duration-200 flex items-center justify-center">
|
|
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
|
|
</svg>
|
|
Kembali ke Beranda
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@push('scripts')
|
|
<script>
|
|
// Show SweetAlert2 for errors
|
|
@if ($errors->any())
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Oops...',
|
|
text: '{{ $errors->first() }}',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#EF4444'
|
|
});
|
|
@endif
|
|
|
|
// Show SweetAlert2 for session errors
|
|
@if (session('error'))
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Error!',
|
|
text: '{{ session('error') }}',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#EF4444',
|
|
timer: 4000,
|
|
timerProgressBar: true
|
|
});
|
|
@endif
|
|
|
|
// Show register error message
|
|
@if (session('error') && str_contains(session('error'), 'No KTP'))
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Pendaftaran Gagal!',
|
|
text: '{{ session('error') }}',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#EF4444',
|
|
timer: 4000,
|
|
timerProgressBar: true
|
|
});
|
|
@endif
|
|
|
|
// Show SweetAlert2 for success messages
|
|
@if (session('success'))
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Berhasil!',
|
|
text: '{{ session('success') }}',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#10B981',
|
|
timer: 3000,
|
|
timerProgressBar: true
|
|
});
|
|
@endif
|
|
|
|
// Form validation with SweetAlert2
|
|
document.querySelector('form').addEventListener('submit', function(e) {
|
|
const requiredFields = ['nama', 'alamat', 'jenis_kelamin', 'no_hp', 'no_ktp', 'pekerjaan',
|
|
'password', 'password_confirmation'
|
|
];
|
|
let emptyFields = [];
|
|
|
|
requiredFields.forEach(field => {
|
|
const element = document.getElementById(field);
|
|
if (!element.value.trim()) {
|
|
emptyFields.push(field);
|
|
}
|
|
});
|
|
|
|
if (emptyFields.length > 0) {
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Perhatian!',
|
|
text: 'Mohon lengkapi semua field yang diperlukan.',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#F59E0B'
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Check NIK validation
|
|
const nik = document.getElementById('no_ktp').value;
|
|
if (nik.length !== 16) {
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'NIK Tidak Valid!',
|
|
text: 'Nomor KTP harus tepat 16 digit.',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#EF4444'
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Check password confirmation
|
|
const password = document.getElementById('password').value;
|
|
const passwordConfirmation = document.getElementById('password_confirmation').value;
|
|
|
|
if (password !== passwordConfirmation) {
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Password Tidak Cocok!',
|
|
text: 'Konfirmasi password tidak sama dengan password.',
|
|
confirmButtonText: 'OK',
|
|
confirmButtonColor: '#EF4444'
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Show confirmation dialog
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
title: 'Konfirmasi Pendaftaran',
|
|
text: 'Apakah Anda yakin ingin mendaftar dengan data yang telah diisi?',
|
|
icon: 'question',
|
|
showCancelButton: true,
|
|
confirmButtonText: 'Ya, Daftar',
|
|
cancelButtonText: 'Batal',
|
|
confirmButtonColor: '#10B981',
|
|
cancelButtonColor: '#6B7280'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
// Submit the form
|
|
document.querySelector('form').submit();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|
|
@endsection
|