From 71033a519365254f5af5383a3232102441542fbb Mon Sep 17 00:00:00 2001 From: KhatamNugraha Date: Wed, 24 Apr 2024 17:01:53 +0700 Subject: [PATCH] fixing validasi signer --- Http/Controllers/KonfirmasiBankController.php | 2 +- Resources/views/pages/index_signer.blade.php | 133 +++++++++++++----- 2 files changed, 100 insertions(+), 35 deletions(-) diff --git a/Http/Controllers/KonfirmasiBankController.php b/Http/Controllers/KonfirmasiBankController.php index b3ffb59..3abe585 100644 --- a/Http/Controllers/KonfirmasiBankController.php +++ b/Http/Controllers/KonfirmasiBankController.php @@ -755,4 +755,4 @@ - } + } \ No newline at end of file diff --git a/Resources/views/pages/index_signer.blade.php b/Resources/views/pages/index_signer.blade.php index a24db66..f9af66f 100644 --- a/Resources/views/pages/index_signer.blade.php +++ b/Resources/views/pages/index_signer.blade.php @@ -55,14 +55,16 @@
- + +
- - + + +
@@ -105,15 +107,17 @@
- - + + +
- - + + +
@@ -148,34 +152,95 @@ $("#myModalEditSigner").modal("hide"); }); - $('#executive_officer').on('keyup', function() { - let deputy_eirector = $('input[name="deputy_director"]').val(); - let executive_officer = $(this).val(); - if (executive_officer == deputy_eirector ) { - // alert('Penandatangan Tidak Boleh Sama'); - $('#executive_officer').css('border-color', 'red'); - $('#submitSigner').attr('disabled', 'disabled'); - $('#note').show(); - }else{ - $('#executive_officer').css('border-color', ''); - $('#submitSigner').attr('disabled', false); - $('#note').hide(); - } - }); + // $('#executive_officer').on('keyup', function() { + // let deputy_eirector = $('input[name="deputy_director"]').val(); + // let executive_officer = $(this).val(); + // var value = $(this).val(); + // // var valid = /^[A-Za-z ]+$/.test(value); - $('#executive_officer2').on('keyup', function() { - let deputy_eirector = $('input[name="deputy_director"]').val().toUpperCase(); - let executive_officer = $(this).val(); - if (executive_officer == deputy_eirector ) { - $('#executive_officer2').css('border-color', 'red'); - $('#submitFormUpdateSigner').attr('disabled', 'disabled'); - $('#note2').show(); - }else{ - $('#executive_officer2').css('border-color', ''); - $('#submitFormUpdateSigner').attr('disabled', false); - $('#note2').hide(); - } - }); + // // if (!valid) { + // // $(this).css('border-color', 'red'); // Ubah warna border menjadi merah jika input tidak valid + // // $('#submitSigner, #submitFormUpdateSigner').prop('disabled', true); // Non-aktifkan tombol submit + // // alert('Input hanya boleh berisi huruf.'); + // // } else { + // // $(this).css('border-color', ''); // Kembalikan warna border + // // $('#submitSigner, #submitFormUpdateSigner').prop('disabled', false); // Aktifkan tombol submit + // // } + // if (executive_officer == deputy_eirector ) { + // // alert('Penandatangan Tidak Boleh Sama'); + // $('#executive_officer').css('border-color', 'red'); + // $('#submitSigner').attr('disabled', 'disabled'); + // $('#note').show(); + // }else{ + // $('#executive_officer').css('border-color', ''); + // $('#submitSigner').attr('disabled', false); + // $('#note').hide(); + // } + // }); + + // $('#executive_officer2').on('keyup', function() { + // let deputy_eirector = $('input[name="deputy_director"]').val().toUpperCase(); + // let executive_officer = $(this).val(); + // if (executive_officer == deputy_eirector ) { + // $('#executive_officer2').css('border-color', 'red'); + // $('#submitFormUpdateSigner').attr('disabled', 'disabled'); + // $('#note2').show(); + // }else{ + // $('#executive_officer2').css('border-color', ''); + // $('#submitFormUpdateSigner').attr('disabled', false); + // $('#note2').hide(); + // } + // }); + + + $('input[name="deputy_director"]').on('input', function() { + let executive_officer = $('input[name="executive_officer"]').val(); + var deputy_eirector = $(this).val(); + var valid = /^[A-Za-z ]+$/.test(deputy_eirector); + + if (!valid) { + $(this).css('border-color', 'red'); // Ubah warna border menjadi merah jika input tidak valid + $('#submitSigner, #submitFormUpdateSigner').prop('disabled', true); // Non-aktifkan tombol submit + $('#deputy_director').css('border-color', 'red'); + $('.noteDir').show(); + // alert('Input hanya boleh berisi huruf.'); + } else { + $(this).css('border-color', ''); // Kembalikan warna border + $('#submitSigner, #submitFormUpdateSigner').prop('disabled', false); // Aktifkan tombol submit + $('.noteDir').hide(); + } + + }); + + $('input[name="executive_officer"]').on('input', function() { + let deputy_eirector = $('input[name="deputy_director"]').val(); + var executive_officer = $(this).val(); + var valid = /^[A-Za-z ]+$/.test(executive_officer); + + if (!valid) { + $(this).css('border-color', 'red'); // Ubah warna border menjadi merah jika input tidak valid + $('#submitSigner, #submitFormUpdateSigner').prop('disabled', true); // Non-aktifkan tombol submit + $('#executive_officer').css('border-color', 'red'); + $('.noteEx').show(); + // alert('Input hanya boleh berisi huruf.'); + } else { + $(this).css('border-color', ''); // Kembalikan warna border + $('#submitSigner, #submitFormUpdateSigner').prop('disabled', false); // Aktifkan tombol submit + $('.noteEx').hide(); + } + + if (executive_officer == deputy_eirector ) { + // alert('Penandatangan Tidak Boleh Sama'); + $('#executive_officer').css('border-color', 'red'); + $('#submitSigner').attr('disabled', 'disabled'); + $('.note').show(); + }else{ + $('#executive_officer').css('border-color', ''); + $('#submitSigner').attr('disabled', false); + $('.note').hide(); + } + + }); // Handle form submission when the "Submit" button inside the modal is clicked $("#submitSigner").click(function(e) {