fix error export pdf
This commit is contained in:
@ -40,7 +40,7 @@
|
||||
<div class="card-body pt-6">
|
||||
<div class="container">
|
||||
<div class="row" >
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-6" style="border: 1px solid grey;padding: 20px;background-color:#f4f4f4">
|
||||
<form id="myForm">
|
||||
<div class="row mb-3">
|
||||
@ -79,7 +79,8 @@
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex justify-content-end">
|
||||
<div class="col-md-4 d-flex justify-content-end">
|
||||
|
||||
<form class="form_customer2" id="exportForm">
|
||||
@csrf
|
||||
|
||||
@ -90,27 +91,36 @@
|
||||
<input type="hidden" style="margin-bottom: 5px" name="periode" /> --}}
|
||||
<div class="text-right ">
|
||||
<div class="d-flex justify-content-end ">
|
||||
<button type="button" class="btn btn-light-primary btn-sm exportPdf" style="display:none" id="buttonExport1">
|
||||
{{-- <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
|
||||
Export
|
||||
</button> --}}
|
||||
<button type="button" class="btn btn-light-primary btn-sm exportPdf" style="display:none" id="buttonPostInfoSurat">
|
||||
<i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span
|
||||
class="path2"></span></i>
|
||||
Surat
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form class="formFasilitas" action="{{ route($route[0].'.fasilitas') }}" >
|
||||
@csrf
|
||||
<input type="hidden" style="margin-bottom: 5px" name="cus_no_fasilitas" id="cus_no_fasilitas" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="startDateFasilitas" id="startDateFasilitas" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="endDateFasilitas" id="endDateFasilitas" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="company_name" id="company_name" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="status" value="1" />
|
||||
<button type="submit" class="btn btn-light-info btn-sm fasilitasButton " style="margin-left:5px;display:none">
|
||||
<form class="fasilitas">
|
||||
<button type="submit" class="btn btn-light-info btn-sm " style="margin-left:5px;">
|
||||
<i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span class="path2"></span></i>
|
||||
Fasilitas
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
<form method="POST" action="{{ route($route[0].'.export') }}" target="_blank" >
|
||||
@csrf
|
||||
<input type="hidden" style="margin-bottom: 5px" name="cusNo" id="cusNo" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="accNo" id="accNo" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="cabang" id="cabang" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="signerId" id="signerId" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="startDate2" id="startDate2" />
|
||||
<button type="submit" class="btn btn-light-info btn-sm exportButton" style="margin-left:5px;display:none" ><i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span class="path2"></span></i>
|
||||
Export</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -276,7 +286,7 @@
|
||||
<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>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="submitInfoSurat">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -306,22 +316,6 @@
|
||||
$('.mycheck').hide();
|
||||
$('#cif_null').hide();
|
||||
|
||||
// $("#phoneNumber").on("input", function () {
|
||||
// validatePhoneNumber($(this).val());
|
||||
// });
|
||||
|
||||
// function validatePhoneNumber(phoneNumber) {
|
||||
// var regex = /^\d{12}$/;
|
||||
// if (regex.test(phoneNumber)) {
|
||||
// $("#phoneNumber").css("border", "1px solid green");
|
||||
// $("#error-message").text("");
|
||||
// } else {
|
||||
// $("#phoneNumber").css("border", "1px solid red");
|
||||
// $("#error-message").text("Invalid phone number. Please enter a valid 10-digit number.");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
$("#myForm").submit(function (event) {
|
||||
event.preventDefault(); // Prevent the form from submitting normally
|
||||
if ($("#cif").val() === "") {
|
||||
@ -365,12 +359,15 @@
|
||||
$('.loading1').hide();
|
||||
let dateString ='';
|
||||
$.each(items, function(i, index) {
|
||||
var reverse = items[i]['WORKING_BALANCE'].toString().split('').reverse().join(''),
|
||||
rp = reverse.match(/\d{1,3}/g);
|
||||
rp = rp.join('.').split('').reverse().join('');
|
||||
$('#dataBody').append('<tr class="secondrow"><td>' + (
|
||||
no++) +
|
||||
'</td><td>' + items[i]['ACCOUNT_NUMBER'] +
|
||||
'</td><td>' + items[i]['COMPANY_NAME'] +
|
||||
'</td><td>' + items[i]['SHORT_NAME'] +
|
||||
'</td><td>' + items[i]['WORKING_BALANCE'] +
|
||||
'</td><td>' + rp +
|
||||
// '</td><td>' + items[i]['PRODUCT'] +
|
||||
'</td><td>' + items[i]['CURRENCY'] + '</td>'+
|
||||
'<td class="tes">'+
|
||||
@ -387,6 +384,14 @@
|
||||
$("input[name=endDateFasilitas]").val(endDate);
|
||||
$(".selected-values").val('');
|
||||
|
||||
$('#cusNo').val();
|
||||
$('#accNo').val();
|
||||
$('#cabang').val();
|
||||
|
||||
$('.exportButton').hide();
|
||||
$('#buttonPostInfoSurat').hide();
|
||||
$('#selectAll').prop('checked', false);;
|
||||
|
||||
},
|
||||
error: function (error) {
|
||||
console.error("Form submission failed!");
|
||||
@ -400,14 +405,6 @@
|
||||
var selectedValues = [];
|
||||
$('#table4 tbody').on('change', 'tr td.tes input[type=checkbox]', function() {
|
||||
$('.exportPdf').show();
|
||||
// if ($(this).is(':checked')) {
|
||||
// // Do something...
|
||||
// acc_no.push($(this).val());
|
||||
// $("input[name=acc_no]").val(acc_no)
|
||||
// }else{
|
||||
// acc_no.push($(this).val());
|
||||
// $("input[name=acc_no]").val(acc_no)
|
||||
// };
|
||||
|
||||
var value = $(this).val();
|
||||
|
||||
@ -461,13 +458,19 @@
|
||||
});
|
||||
|
||||
//submit signer
|
||||
$("#buttonExport1").click(function(){
|
||||
$("#buttonPostInfoSurat").click(function(){
|
||||
$("#signerModal").modal('show');
|
||||
|
||||
})
|
||||
|
||||
//submit signer
|
||||
// $("#exportButton").click(function(){
|
||||
// $("#signerModal").modal('show');
|
||||
|
||||
// })
|
||||
|
||||
// Handle form submission when the "Submit" button inside the modal is clicked
|
||||
$("#submitSigner").click(function(e) {
|
||||
$("#submitInfoSurat").click(function(e) {
|
||||
e.preventDefault();
|
||||
var cif = $('input[name="cus_no"]').val();
|
||||
var cabang = $('input[name="kode_cabang"]').val();
|
||||
@ -482,7 +485,7 @@
|
||||
var alamat = $.trim($("#alamat").val());
|
||||
var signer = $("#signer-select").find('option:selected').val();
|
||||
$("#signerModal").modal('hide');
|
||||
$('.modalSpiner').modal('show');
|
||||
// $('.modalSpiner').modal('show');
|
||||
var dt = new Date();
|
||||
var date = dt.getYear() + ":" + dt.getDate() + ":" + dt.getHours();
|
||||
|
||||
@ -507,36 +510,22 @@
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ route('konfirmasibank.export') }}",
|
||||
url: "{{ route('konfirmasibank.postInfoSurat') }}",
|
||||
data: dataToSend, // serializes the form's elements.
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
dataType: 'json', // Mengatur tipe data yang diharapkan dari respons
|
||||
success: function(data) {
|
||||
|
||||
// $('.modalSpiner').modal('hide');
|
||||
// Create a Blob from the response data
|
||||
var blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
||||
var dt = new Date();
|
||||
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
|
||||
|
||||
// Create a link element
|
||||
var link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
|
||||
// Set the download attribute with the desired file name
|
||||
link.download = 'KonfirmasiBank_' + time +'.pdf';
|
||||
|
||||
// Append the link to the document body
|
||||
document.body.appendChild(link);
|
||||
|
||||
// Programmatically click the link to trigger the download
|
||||
link.click();
|
||||
|
||||
// Remove the link from the document
|
||||
document.body.removeChild(link);
|
||||
$('#cusNo').val(cif);
|
||||
$('input[name="email"]').val();
|
||||
$('#accNo').val(acc_no);
|
||||
$('#cabang').val(cabang);
|
||||
$('#startDate2').val(startDate);
|
||||
$('#signerId').val(signer);
|
||||
// location.reload();
|
||||
$('.exportButton').show();
|
||||
$('#signerModal')[0].reset();
|
||||
toastr.success(data.message);
|
||||
// location.reload();
|
||||
$('.modalSpiner').modal('hide');
|
||||
},
|
||||
error: function(data, textStatus, errorThrown) {
|
||||
$('.modalSpiner').modal('hide');
|
||||
|
Reference in New Issue
Block a user