perbaikan hasil sit

This commit is contained in:
KhatamNugraha
2023-09-04 13:24:29 +07:00
parent 466f38540b
commit 2fe8499fbb
9 changed files with 310 additions and 66 deletions

View File

@ -17,7 +17,7 @@
<div class="col-md-6" style="border: 1px solid grey;padding: 20px;background-color:#f4f4f4">
<form id="myForm">
<div class="row mb-3">
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">No CIF</label>
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">No CIF <span style="color:red">*</span></label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-sm" name="cif" id="cif" placeholder="No CIF" >
</div>
@ -29,7 +29,7 @@
</div>
</div>
<div class="row mb-3">
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Periode</label>
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Periode <span style="color:red">*</span></label>
<div class="col-sm-10">
<input type="number" class="form-control form-control-sm" min="{{$data['pastYear']}}" max="{{$data['currentYear']}}" name="periode" clear id="periode" placeholder="Periode">
</div>
@ -41,17 +41,17 @@
</form>
</div>
<div class="col-md-3 d-flex justify-content-end">
<form class="form_customer2" method="POST" action="{{ route($route[0] . '.export') }}">
<form class="form_customer2" id="exportForm">
@csrf
<div class="d-flex flex-column mb-8 fv-row">
<input type="hidden" style="margin-bottom: 5px" name="cus_no" id="acc_no2" />
<input type="hidden" style="margin-bottom: 5px" name="acc_no" />
<input type="hidden" style="margin-bottom: 5px" name="kode_cabang" />
<input type="hidden" style="margin-bottom: 5px" name="periode" />
{{-- <input type="text" style="margin-bottom: 5px" name="cus_no" id="acc_no2" /> --}}
<input type="hidden" style="margin-bottom: 5px" name="acc_no" />
{{-- <input type="hidden" style="margin-bottom: 5px" name="kode_cabang" />
<input type="hidden" style="margin-bottom: 5px" name="periode" /> --}}
<div class="text-right ">
<div class="d-flex justify-content-end ">
<button type="submit" class="btn btn-light-primary btn-sm exportPdf" style="display:none">
<button type="button" class="btn btn-light-primary btn-sm exportPdf" style="display:none" id="buttonExport1">
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span
class="path2"></span></i>
Export Report
@ -98,6 +98,7 @@
</div>
<!--end::Card body-->
</div>
<!-- The Modal -->
<div class="modal" id="myModal">
<div class="modal-dialog">
@ -154,15 +155,62 @@
</div>
</div>
</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">&times;</span>
</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<form class="form-horizontal" id="formSigner">
@csrf
<!-- Add your form fields here -->
<input type="hidden" style="margin-bottom: 5px" name="cus_no" id="acc_no2" />
<input type="hidden" style="margin-bottom: 5px" name="kode_cabang" />
<input type="hidden" style="margin-bottom: 5px" name="periode" />
<select class="form-select form-select-sm" aria-label="Small select example" id="signer-select" name="signer">
<option selected>Select Signer</option>
@foreach ($data['signer'] as $item)
<option value="{{$item->id}}">{{$item->signer_type}}</option>
@endforeach
</select>
<!-- 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>
@push('customscript')
<script>
$(function() {
$('.mycheck').hide();
$('#cif_null').hide();
$("#myForm").submit(function (event) {
event.preventDefault(); // Prevent the form from submitting normally
if ($("#cif").val() === "") {
alert("Nomor CIF harus diisi.");
return; // Stop form submission
}
if ($("#periode").val() === "") {
alert("periode harus diisi.");
alert("Periode harus diisi.");
return; // Stop form submission
}
@ -254,10 +302,67 @@
$("#myModal").modal('hide');
});
$("#cancelBtn").click(function() {
$("#cancelBtn").click(function() {
$("#myModal").modal('hide');
});
$(".closeButtonSigner").click(function() {
$("#signerModal").modal('hide');
});
//submit signer
$("#buttonExport1").click(function(){
$("#signerModal").modal('show');
})
// Handle form submission when the "Submit" button inside the modal is clicked
$("#submitSigner").click(function(e) {
e.preventDefault();
var cif = $('input[name="cus_no"]').val();
var cabang = $('input[name="kode_cabang"]').val();
var periode = $('input[name="periode"]').val();
var acc_no = $('input[name="acc_no"]').val();
var signer = $("#signer-select").find('option:selected').val();
// var formData = $("#formSigner").serialize();
var dataToSend = {
_token: $('meta[name="csrf-token"]').attr('content'),
cus_no: cif,
kode_cabang: cabang,
periode:periode,
acc_no:acc_no,
signer:signer
};
$.ajax({
type: "POST",
url: "{{ route('konfirmasibank.export') }}",
data: dataToSend, // serializes the form's elements.
xhrFields: {
responseType: 'blob'
},
success: function(response) {
$("#signerModal").modal('hide');
var blob = new Blob([response]);
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "techsolutionstuff.pdf";
link.click();
},
error: function(data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
$.each(errors, function(key, value) {
toastr.error(value);
});
}
});
});
});