REGISTER

@csrf
{{-- Nama --}}
{{-- Email --}}
{{-- Username --}}
{{-- Password --}}
{{-- Confirm Password --}}
{{-- Lokasi --}}
{{-- Roles --}}
{{ __('Masuk') }}
Sudah punya akun ? Login
$(document).ready(function() { $('#password_confirmation').on('blur', function() { const pass = $('#password').val(); const confirm = $(this).val(); if (confirm.length > 0 && pass !== confirm) { Swal.fire({ icon: 'error', title: 'Password Tidak Sama!', text: 'Pastikan konfirmasi password sesuai dengan password.', confirmButtonText: 'OK', confirmButtonColor: '#3085d6' }); $(this).val(''); } }); $('#registerForm').on('submit', function(e) { e.preventDefault(); let form = $(this); let url = form.attr('action'); let data = form.serializeArray().filter(item => item.name !== 'password_confirmation'); $.ajax({ url: url, type: 'POST', data: $.param(data), success: function(response) { Swal.fire({ icon: 'success', title: 'Berhasil!', text: 'Registrasi berhasil, silakan login.', timer: 2000, showConfirmButton: false }).then(() => { window.location.href = "{{ route('login') }}"; }); }, error: function(xhr) { let message = 'Terjadi kesalahan, silakan coba lagi.'; if (xhr.responseJSON && xhr.responseJSON.message) { message = xhr.responseJSON.message; } Swal.fire({ icon: 'error', title: 'Gagal!', text: message, confirmButtonText: 'OK', confirmButtonColor: '#d33' }); } }); }); });