main
Ilham Wara Nugroho 2026-02-04 09:37:03 +07:00
parent f766c6f347
commit dd6612629d
2 changed files with 99 additions and 62 deletions

View File

@ -57,11 +57,11 @@ class CustomRegisterController extends Controller
$cek = Profile::where('npsn',$request->npsn)->count();
if($cek > 0){
return response()->json(['status' => false,'message' => 'Untuk NPSN :'.$request->npsn.' Sudah terdaftar! Silahkan Login','type' => 'error']);
// return redirect('register')->with([
// 'message' => 'Untuk NPSN :'.$request->npsn.' Sudah terdaftar! Silahkan Login',
// 'type' => "error"
// ]);
// return response()->json(['status' => false,'message' => 'Untuk NPSN :'.$request->npsn.' Sudah terdaftar! Silahkan Login','type' => 'error']);
return redirect('register')->with([
'message' => 'Untuk NPSN :'.$request->npsn.' Sudah terdaftar! Silahkan Login',
'type' => "error"
])->withInput();
}
$sekolah = Sekolah::where('npsn',$request->npsn)->first();
@ -150,12 +150,12 @@ class CustomRegisterController extends Controller
DB::commit();
return response()->json(['status' => true,'message' => 'Daftar Sekolah Berhasil','type' => 'success']);
// return response()->json(['status' => true,'message' => 'Daftar Sekolah Berhasil','type' => 'success']);
// return redirect('dashboard')->with([
// 'message' => trans('Selamat datang kembali'),
// 'type' => "success"
// ]);
return redirect('dashboard')->with([
'message' => trans('Selamat datang kembali'),
'type' => "success"
])->withInput();
@ -167,11 +167,11 @@ class CustomRegisterController extends Controller
} catch (Exception $e) {
DB::rollBack();
return response()->json(['status' => false,'message' => $e->getMessage(),'type' => 'error']);
// return redirect('register')->with([
// 'message' => $e->getMessage(),
// 'type' => "error"
// ]);
// return response()->json(['status' => false,'message' => $e->getMessage(),'type' => 'error']);
return redirect('register')->with([
'message' => $e->getMessage(),
'type' => "error"
])->withInput();
}
}
}

View File

@ -26,46 +26,44 @@
<main class="max-w-7xl mx-auto px-6 py-10 lg:py-16 grid lg:grid-cols-12 gap-12 items-start">
<!-- Right Content: Interactive Form Card -->
<div class="lg:col-span-12 bg-white rounded-[2.5rem] shadow-2xl shadow-emerald-100 overflow-hidden border border-emerald-50">
<div class="text-center my-16">
<div class="lg:col-span-12 mt-3 bg-white rounded-[2.5rem] shadow-2xl shadow-emerald-100 overflow-hidden border border-emerald-50">
<div class="text-center mt-16">
<h3 class="text-3xl font-extrabold text-slate-900 mb-4">Daftar Sebagai Sekolah Adiwiyata</h3>
</div>
<!-- Progress Stepper -->
<div class="bg-slate-50 px-8 py-6 border-b border-emerald-100">
<div class="flex justify-between items-center mb-6">
<h3 class="text-xl font-bold text-slate-800" id="step-title">Identitas Sekolah</h3>
<span class="text-sm font-bold text-emerald-600 bg-emerald-50 px-3 py-1 rounded-lg" id="step-counter">Langkah 1 dari 4</span>
</div>
<div class="h-2 w-full bg-slate-200 rounded-full overflow-hidden">
<div id="progress-bar" class="progress-bar h-full bg-emerald-500 w-1/4"></div>
</div>
<div class="flex justify-between mt-3">
<div class="flex flex-col items-center"><div class="w-3 h-3 rounded-full bg-emerald-500"></div></div>
<div class="flex flex-col items-center"><div class="w-3 h-3 rounded-full bg-slate-300 transition-colors duration-500" id="dot-2"></div></div>
<div class="flex flex-col items-center"><div class="w-3 h-3 rounded-full bg-slate-300 transition-colors duration-500" id="dot-3"></div></div>
<div class="flex flex-col items-center"><div class="w-3 h-3 rounded-full bg-slate-300 transition-colors duration-500" id="dot-4"></div></div>
</div>
</div>
<!-- Form Content -->
<form id="register-form" class="p-8 lg:p-10">
<form action="{{ url('register') }}" method="POST" class="p-8 lg:p-10">
{{ csrf_field() }}
<!-- STEP 1: Identification -->
<div id="step-1" class="step-transition block space-y-6">
@if(session()->get('type')=='error')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{ session('message') }}</span>
</div>
<br>
@enderror
<div id="step-1" class="step-transition block space-y-6 mb-5">
<select name="tingkat_sekolah" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:ring-4 focus:ring-emerald-100 focus:border-emerald-500 transition-all outline-none font-medium text-lg tracking-wider tingkat_sekolah select2 @error('tingkat_sekolah') is-invalid @enderror">
<option value="">-Pilih Tingkat Sekolah-</option>
<option value="1">SD</option>
<option value="2">SMP</option>
<option value="3">SMA</option>
<option value="4">SMK</option>
<option value="5">MI</option>
<option value="6">MTs</option>
<option value="7">MA</option>
<option value="8">SD LB</option>
<option value="9">SMP LB</option>
<option value="10">SMA LM</option>
<option value="11">SLB Khusus</option>
<option {{ old('tingkat_sekolah') == '1' ? 'selected' : '' }} value="1">SD</option>
<option {{ old('tingkat_sekolah') == '2' ? 'selected' : '' }} value="2">SMP</option>
<option {{ old('tingkat_sekolah') == '3' ? 'selected' : '' }} value="3">SMA</option>
<option {{ old('tingkat_sekolah') == '4' ? 'selected' : '' }} value="4">SMK</option>
<option {{ old('tingkat_sekolah') == '5' ? 'selected' : '' }} value="5">MI</option>
<option {{ old('tingkat_sekolah') == '6' ? 'selected' : '' }} value="6">MTs</option>
<option {{ old('tingkat_sekolah') == '7' ? 'selected' : '' }} value="7">MA</option>
<option {{ old('tingkat_sekolah') == '8' ? 'selected' : '' }} value="8">SD LB</option>
<option {{ old('tingkat_sekolah') == '9' ? 'selected' : '' }} value="9">SMP LB</option>
<option {{ old('tingkat_sekolah') == '10' ? 'selected' : '' }} value="10">SMA LM</option>
<option {{ old('tingkat_sekolah') == '11' ? 'selected' : '' }} value="11">SLB Khusus</option>
</select>
@error('tingkat_sekolah')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">NPSN (Nomor Pokok Sekolah Nasional) <span class="text-red-500">*</span></label>
<div class="relative group">
@ -79,6 +77,12 @@
</button> --}}
</div>
<p class="text-xs text-slate-400 mt-2">Data nama dan tingkat sekolah akan terisi otomatis dari Dapodik/EMIS.</p>
@error('npsn')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
<div id="auto-fill-data" class="hidden space-y-4 animate-[fadeIn_0.5s_ease-in-out]">
@ -91,34 +95,55 @@
</div>
<!-- STEP 2: Basic Info -->
<div id="step-2" class="step-transition hidden space-y-6">
<div id="step-2" class="step-transition space-y-6 mb-5">
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">Nama Sekolah</label>
<div class="col-12 pr-1">
<input type="text" readonly value="{{old('name')}}" name="name" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none nama_sekolah @error('name') is-invalid @enderror" placeholder="Masukan Nama Sekolah">
@error('name')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
</div>
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">Alamat Lengkap</label>
<textarea rows="3" name="alamat_sekolah" placeholder="Nama Jalan, RT/RW, Kelurahan, Kecamatan" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none resize-none"></textarea>
<textarea rows="3" name="alamat_sekolah" placeholder="Nama Jalan, RT/RW, Kelurahan, Kecamatan" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none resize-none">{{old('alamat_sekolah')}}</textarea>
@error('alamat_sekolah')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
</div>
<!-- STEP 3: Contact Details -->
<div id="step-3" class="step-transition hidden space-y-6">
<div id="step-3" class="step-transition space-y-6 mb-5">
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">Nama Kontak Person (PIC)</label>
<input type="text" placeholder="Masukkan nama lengkap penanggung jawab" name="kontak_person" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none">
<input type="text" value="{{ old('kontak_person') }}" placeholder="Masukkan nama lengkap penanggung jawab" name="kontak_person" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none">
@error('kontak_person')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">Nomor WhatsApp / Telp</label>
<div class="flex gap-2">
<span class="bg-slate-100 px-4 py-4 rounded-2xl font-bold flex items-center border-2 border-slate-100">+62</span>
<input type="tel" name="telp" placeholder="812xxxxxx" class="flex-1 px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none">
<input type="tel" name="telp" value="{{ old('telp') }}" placeholder="812xxxxxx" class="flex-1 px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none">
</div>
@error('telp')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
{{-- <div class="p-4 bg-blue-50 rounded-2xl border border-blue-100 flex gap-3">
<span class="material-symbols-outlined text-blue-500">upload_file</span>
@ -130,11 +155,17 @@
</div>
<!-- STEP 4: Account Setup -->
<div id="step-4" class="step-transition hidden space-y-6">
<div id="step-4" class="step-transition space-y-6 mb-5">
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">Email Sekolah (Aktif)</label>
<input type="email" name="email" placeholder="contoh: sdn.menteng01@jakarta.go.id" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none">
<input type="email" name="email" value="{{ old('email') }}" placeholder="contoh: sdn.menteng01@jakarta.go.id" class="w-full px-5 py-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-emerald-500 outline-none">
<p class="text-xs text-slate-400">Pastikan email benar. Akses login akan dikirim melalui email ini.</p>
@error('email')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
<div class="space-y-1">
<label class="block text-sm font-bold text-slate-700">Kata Sandi</label>
@ -147,6 +178,12 @@
</div>
<small class="text-red-500 mb-2"><i>Kata Sandi harus mengandung Minimal 8 karakter, maksimal 15 karakter, setidaknya 1 huruf kecil dan huruf besar, angka dan simbol </i></small>
<p id="strength-text" class="text-xs font-bold text-slate-400 mt-1 uppercase tracking-tighter">Sandi Sangat Lemah</p>
@error('password')
<div class="mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">{{$message}}</span>
</div>
@enderror
</div>
<div class="flex items-start gap-3 p-4 bg-slate-50 rounded-2xl">
<input type="checkbox" id="terms" name="check" class="mt-1 w-5 h-5 accent-emerald-600 rounded">
@ -156,21 +193,21 @@
</label></div>
</div>
<div id="errorMessage" class="hidden mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
{{-- <div id="errorMessage" class="hidden mt-4 p-3 bg-red-50 border border-red-100 rounded-xl flex items-center gap-2 text-red-600 text-sm font-medium">
<span class="material-symbols-outlined text-lg">error</span>
<span class="message">Username atau password salah. Silakan coba lagi.</span>
</div>
</div> --}}
<!-- Navigation Buttons -->
<div class="flex items-center justify-between pt-10">
<button type="button" id="prev-btn" onclick="prevStep()" class="hidden px-8 py-4 bg-slate-100 text-slate-600 rounded-2xl font-bold hover:bg-slate-200 transition-all flex items-center gap-2">
<div class="flex items-center justify-center pt-10">
{{-- <button type="button" id="prev-btn" onclick="prevStep()" class="hidden px-8 py-4 bg-slate-100 text-slate-600 rounded-2xl font-bold hover:bg-slate-200 transition-all flex items-center gap-2">
<span class="material-symbols-outlined">arrow_back</span> Kembali
</button>
<div class="flex-1"></div>
<button type="button" id="next-btn" onclick="nextStep()" class="px-10 py-4 bg-emerald-600 text-white rounded-2xl font-extrabold shadow-xl shadow-emerald-200 hover:bg-emerald-700 active:scale-95 transition-all flex items-center gap-2">
Lanjut <span class="material-symbols-outlined">arrow_forward</span>
</button>
<button type="submit" id="submit-btn" class="hidden px-12 py-4 bg-emerald-600 text-white rounded-2xl font-extrabold shadow-xl shadow-emerald-200 hover:bg-emerald-700 active:scale-95 transition-all">
</button> --}}
<button class="px-12 py-4 bg-emerald-600 text-white rounded-2xl font-extrabold shadow-xl shadow-emerald-200 hover:bg-emerald-700 active:scale-95 transition-all">
Daftar Sekarang
</button>
</div>
@ -181,7 +218,7 @@
</div>
</div>
</main>
<div id="success-modal" class="fixed inset-0 z-[100] hidden flex items-center justify-center p-6 bg-slate-900/60 backdrop-blur-sm">
{{-- <div id="success-modal" class="fixed inset-0 z-[100] hidden flex items-center justify-center p-6 bg-slate-900/60 backdrop-blur-sm">
<div class="bg-white rounded-[3rem] p-10 max-w-lg w-full text-center shadow-2xl animate-[zoomIn_0.3s_ease-out] relative overflow-hidden">
<div class="absolute top-0 left-0 w-full h-2 bg-emerald-500"></div>
<div class="w-24 h-24 bg-emerald-100 text-emerald-600 rounded-full flex items-center justify-center mx-auto mb-6">
@ -191,7 +228,7 @@
<p class="text-slate-600 mb-8">Data pendaftaran sekolah Anda telah diterima.</p>
<button onclick="window.location.reload()" class="w-full py-4 bg-emerald-600 text-white rounded-2xl font-bold hover:bg-emerald-700 transition-all">Selesai</button>
</div>
</div>
</div> --}}
@endsection
@section('js')
{{-- <script src="{{asset('assets/js/app.bundle.js')}}"></script> --}}