update Index_signer
This commit is contained in:
@ -48,7 +48,7 @@
|
||||
|
||||
<!-- Modal body -->
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="formSigner" action="{{ route($route[0] . '.postSigner') }}"
|
||||
<form class="form-horizontal" id="formSigner"
|
||||
method="POST">
|
||||
@csrf
|
||||
<!-- Add your form fields here -->
|
||||
@ -98,8 +98,7 @@
|
||||
|
||||
<!-- Modal body -->
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="formUpdateSigner" action="{{ route($route[0] . '.updateSigner') }}"
|
||||
method="POST">
|
||||
<form class="form-horizontal" id="formUpdateSigner" >
|
||||
@csrf
|
||||
<!-- Add your form fields here -->
|
||||
<div class="form-group row">
|
||||
@ -123,8 +122,7 @@
|
||||
</div>
|
||||
<!-- Modal footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-sm closeButtonUpdateSigner"
|
||||
data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm closeButtonUpdateSigner" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="submitFormUpdateSigner">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
@ -133,150 +131,143 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@push('customscript')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Open the modal when the "Open Modal" button is clicked
|
||||
$("#openModalBtnSigner").click(function() {
|
||||
$("#signerModal").modal('show');
|
||||
});
|
||||
<script>
|
||||
$(function () {
|
||||
// Open the modal when the "Open Modal" button is clicked
|
||||
$("#openModalBtnSigner").click(function() {
|
||||
$("#signerModal").modal("show");
|
||||
});
|
||||
$(".closeButtonSigner").click(function() {
|
||||
$("#signerModal").modal("hide");
|
||||
});
|
||||
|
||||
$(".closeButtonSigner").click(function() {
|
||||
$("#signerModal").modal('hide');
|
||||
});
|
||||
$(".closeButtonUpdateSigner").click(function() {
|
||||
$("#myModalEditSigner").modal('hide');
|
||||
});
|
||||
$(".closeButtonUpdateSigner").click(function() {
|
||||
$("#myModalEditSigner").modal("hide");
|
||||
});
|
||||
|
||||
// Handle form submission when the "Submit" button inside the modal is clicked
|
||||
$("#submitSigner").click(function(e) {
|
||||
// Serialize the form data
|
||||
e.preventDefault();
|
||||
var formData = $("#formSigner").serialize();
|
||||
// Handle form submission when the "Submit" button inside the modal is clicked
|
||||
$("#submitSigner").click(function(e) {
|
||||
// Serialize the form data
|
||||
e.preventDefault();
|
||||
var formData = $("#formSigner").serialize();
|
||||
|
||||
// Send an AJAX request to the form submission route
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ route('konfirmasibank.postSigner') }}",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$("#signerModal").modal('hide');
|
||||
// var _data = JSON.parse(data);
|
||||
toastr.success(data.message);
|
||||
location.reload();
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response (if applicable)
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
toastr.error(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(".btnEditSigner").click(function(e) {
|
||||
// Serialize the form data
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
var dataToSend = {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
id: id
|
||||
};
|
||||
// Send an AJAX request to the form submission route
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ route('konfirmasibank.editSigner') }}",
|
||||
data: dataToSend,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('input[name="executive_officer"]').val(response.executive_officer_name);
|
||||
$('input[name="deputy_director"]').val(response.deputy_director_name);
|
||||
$('input[name="signer_type"]').val(response.signer_type);
|
||||
$('input[name="id"]').val(id);
|
||||
$("#myModalEditSigner").modal('show');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response (if applicable)
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
toastr.error(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#submitFormUpdateSigner").click(function(e) {
|
||||
// Serialize the form data
|
||||
e.preventDefault();
|
||||
var formData = $("#formUpdateSigner").serialize();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ route('konfirmasibank.updateSigner') }}",
|
||||
data: formData, // serializes the form's elements.
|
||||
success: function(data) {
|
||||
$("#myModalEditSigner").modal('hide');
|
||||
var _data = JSON.parse(data);
|
||||
toastr.success(_data.message);
|
||||
location.reload();
|
||||
|
||||
},
|
||||
error: function(data, textStatus, errorThrown) {
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
toastr.error(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(".btnDeleteSigner").click(function(e) {
|
||||
// var form = $(this).closest("form");
|
||||
var id = $(this).data('id');
|
||||
var dataToSend = {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
id: id
|
||||
};
|
||||
e.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ route('konfirmasibank.destroySigner') }}",
|
||||
data: dataToSend, // serializes the form's elements.
|
||||
success: function(data) {
|
||||
toastr.success('has been deleted.', 'Success!', {
|
||||
timeOut: 5000
|
||||
});
|
||||
// Send an AJAX request to the form submission route
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ route('konfirmasibank.postSigner') }}",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$("#signerModal").modal('hide');
|
||||
// var _data = JSON.parse(data);
|
||||
toastr.success(data.message);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response (if applicable)
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
toastr.error(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(".btnEditSigner").click(function(e) {
|
||||
// Serialize the form data
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
var dataToSend = {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
id: id
|
||||
};
|
||||
// Send an AJAX request to the form submission route
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ route('konfirmasibank.editSigner') }}",
|
||||
data: dataToSend,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('input[name="executive_officer"]').val(response.executive_officer_name);
|
||||
$('input[name="deputy_director"]').val(response.deputy_director_name);
|
||||
$('input[name="signer_type"]').val(response.signer_type);
|
||||
$('input[name="id"]').val(id);
|
||||
$("#myModalEditSigner").modal('show');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response (if applicable)
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
toastr.error(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
$("#submitFormUpdateSigner").click(function(e) {
|
||||
// Serialize the form data
|
||||
e.preventDefault();
|
||||
var formData = $("#formUpdateSigner").serialize();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ route('konfirmasibank.updateSigner') }}",
|
||||
data: formData, // serializes the form's elements.
|
||||
success: function(data) {
|
||||
$("#myModalEditSigner").modal('hide');
|
||||
var _data = JSON.parse(data);
|
||||
toastr.success(_data.message);
|
||||
location.reload();
|
||||
|
||||
},
|
||||
error: function(data, textStatus, errorThrown) {
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
toastr.error(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(".btnDeleteSigner").click(function(e) {
|
||||
// var form = $(this).closest("form");
|
||||
var id = $(this).data('id');
|
||||
var dataToSend = {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
id: id
|
||||
};
|
||||
e.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ route('konfirmasibank.destroySigner') }}",
|
||||
data: dataToSend, // serializes the form's elements.
|
||||
success: function(data) {
|
||||
toastr.success('has been deleted.', 'Success!', {
|
||||
timeOut: 5000
|
||||
});
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
</x-default-layout>
|
||||
|
Reference in New Issue
Block a user