58 lines
2.7 KiB
PHP
58 lines
2.7 KiB
PHP
<?php $__env->startSection('content'); ?>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
Swal.fire({
|
|
title: "Update Email Anda",
|
|
text: "Anda diwajibkan untuk update email aktif anda.",
|
|
icon: "warning",
|
|
input: "email",
|
|
inputPlaceholder: "Masukkan email aktif anda:",
|
|
confirmButtonText: "Update",
|
|
showCancelButton: true,
|
|
cancelButtonText: "Logout",
|
|
allowOutsideClick: false,
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
fetch("<?php echo e(route('email.update')); ?>", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"X-CSRF-TOKEN": "<?php echo e(csrf_token()); ?>"
|
|
},
|
|
body: JSON.stringify({
|
|
email: result.value
|
|
})
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
Swal.fire({
|
|
title: "Email Berhasil Diubah!",
|
|
text: "Silakan periksa email Anda untuk verifikasi.",
|
|
icon: "info",
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: "Error!",
|
|
text: "Email gagal diperbarui. Silahkan dicoba lagi.",
|
|
icon: "error",
|
|
});
|
|
}
|
|
})
|
|
.catch(error => {
|
|
Swal.fire({
|
|
title: "Error!",
|
|
text: "Email gagal diperbarui. Silahkan dicoba lagi.",
|
|
icon: "error",
|
|
});
|
|
});
|
|
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
|
document.getElementById('logout-form').submit();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<?php $__env->stopSection(); ?>
|
|
|
|
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/sigd/resources/views/auth/update-email-popup.blade.php ENDPATH**/ ?>
|