283 lines
12 KiB
PHP
283 lines
12 KiB
PHP
<x-default-layout>
|
|
@php
|
|
$route = explode('.', Route::currentRouteName());
|
|
@endphp
|
|
|
|
<!--begin::Card-->
|
|
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
|
<div class="card card-xxl-stretch mb-5 mb-xl-8">
|
|
<!--begin::Card body-->
|
|
<div class="card-body pt-6">
|
|
<div class="d-flex justify-content-end ">
|
|
<button type="button" class="btn btn-primary btn-sm " style="margin-right:35px" id="openModalBtnSigner">
|
|
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
|
|
Tambah
|
|
</button>
|
|
</div>
|
|
<div class="card-body pt-6">
|
|
<div class="table-responsive " style="overflow-x:auto;">
|
|
<div id="user_table">
|
|
@include('konfirmasibank::pages.table_signer')
|
|
</div>
|
|
<div class="d-flex justify-content-end ">
|
|
|
|
<a href="{{ route($route[0] . '.index') }}" type="button" class="btn btn-danger btn-sm redirectButton"
|
|
style="margin-top:10px">
|
|
<i class="ki-duotone ki-exit-left fs-2"><span class="path1"></span><span class="path2"></span></i>
|
|
Kembali
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--end::Card body-->
|
|
</div>
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="signerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<!-- Modal header -->
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="myModalLabel">Tambah Signer</h5>
|
|
<button type="button" class="closeButton" data-dismiss="modal" aria-label="Close"
|
|
style="display:none">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Modal body -->
|
|
<div class="modal-body">
|
|
<form class="form-horizontal" id="formSigner" action="{{ route($route[0] . '.postSigner') }}"
|
|
method="POST">
|
|
@csrf
|
|
<!-- Add your form fields here -->
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-4 col-form-label">Deputy Director</label>
|
|
<div class="col-sm-8">
|
|
<input type="text" class="form-control form-control-sm " name="deputy_director" placeholder="Nama Deputy Director">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-4 col-form-label">Executive Officer</label>
|
|
<div class="col-sm-8">
|
|
<input type="text" class="form-control form-control-sm " name="executive_officer" placeholder="Nama Executive Officer">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-4 col-form-label">Signer Type</label>
|
|
<div class="col-sm-8">
|
|
<input type="text" class="form-control form-control-sm " name="signer_type" placeholder="Nama Jenis Penandatangan">
|
|
</div>
|
|
</div>
|
|
<!-- Modal footer -->
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary btn-sm closeButtonSigner"
|
|
data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary btn-sm" id="submitSigner">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="myModalEditSigner" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<!-- Modal header -->
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="myModalLabel">Edit Signer</h5>
|
|
<button type="button" class="closeButton" data-dismiss="modal" aria-label="Close"
|
|
style="display:none">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Modal body -->
|
|
<div class="modal-body">
|
|
<form class="form-horizontal" id="formUpdateSigner" action="{{ route($route[0] . '.updateSigner') }}"
|
|
method="POST">
|
|
@csrf
|
|
<!-- Add your form fields here -->
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-4 col-form-label">Deputy Director</label>
|
|
<div class="col-sm-8">
|
|
<input type="hidden" class="form-control form-control-sm " name="id" placeholder="Nama Deputy Director">
|
|
<input type="text" class="form-control form-control-sm " name="deputy_director" placeholder="Nama Deputy Director">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-4 col-form-label">Executive Officer</label>
|
|
<div class="col-sm-8">
|
|
<input type="text" class="form-control form-control-sm " name="executive_officer" placeholder="Nama Executive Officer">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-4 col-form-label">Signer Type</label>
|
|
<div class="col-sm-8">
|
|
<input type="text" class="form-control form-control-sm " name="signer_type" placeholder="Nama Jenis Penandatangan">
|
|
</div>
|
|
</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-primary btn-sm" id="submitFormUpdateSigner">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
@push('customscript')
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Open the modal when the "Open Modal" button is clicked
|
|
$("#openModalBtnSigner").click(function() {
|
|
$("#signerModal").modal('show');
|
|
});
|
|
|
|
$(".closeButtonSigner").click(function() {
|
|
$("#signerModal").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();
|
|
|
|
// 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
|
|
});
|
|
location.reload();
|
|
}
|
|
});
|
|
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
});
|
|
</script>
|
|
@endpush
|
|
|
|
|
|
|
|
</x-default-layout>
|