Merge branch 'white-form-list-upload-bank-slips' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into development

# Conflicts:
#	app/Console/Kernel.php
This commit is contained in:
Jia Sheng
2024-10-31 19:43:27 +08:00
4 changed files with 129 additions and 21 deletions
+19 -19
View File
@@ -31,27 +31,27 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('mail:EmailDoToVTCommand')->dailyAt('10:00')->withoutOverlapping();
// // $schedule->command('inspire')->hourly();
// $schedule->command('mail:EmailDoToVTCommand')->dailyAt('10:00')->withoutOverlapping();
$schedule->command('seasonalSegmantCompany:remove')
->hourly()
->appendOutputTo(storage_path().'/logs/soft-delete-seasonal-segmant-company.log')
->withoutOverlapping();
$schedule->command('delete:bulk-download-files')
->hourly()
->appendOutputTo(storage_path().'/logs/delete-bulk-download-files.log')
->withoutOverlapping();
$schedule->command('booking:expired')
->dailyAt('02:00')
->appendOutputTo(storage_path().'/logs/expire-booking.log')
->withoutOverlapping();
// $schedule->command('purchaseOrder:autoFill')
// ->dailyAt('03:00')
// $schedule->command('seasonalSegmantCompany:remove')
// ->dailyAt('01:00')
// ->appendOutputTo(storage_path().'/logs/soft-delete-seasonal-segmant-company.log')
// ->withoutOverlapping();
// $schedule->command('delete:bulk-download-files')
// ->hourly()
// ->appendOutputTo(storage_path().'/logs/delete-bulk-download-files.log')
// ->withoutOverlapping();
// $schedule->command('booking:expired')
// ->dailyAt('02:00')
// ->appendOutputTo(storage_path().'/logs/expire-booking.log')
// ->withoutOverlapping();
// // $schedule->command('purchaseOrder:autoFill')
// // ->dailyAt('03:00')
// // ->withoutOverlapping();
}
/**
@@ -6,7 +6,7 @@
<div class="row m-b-20">
<div class="col-12 col-md-7">
<a :href="route('orders.pending')" target="_blank">
<button class="btn btn-success btn-xs">Export Pending Orders.</button>
<button class="btn btn-success btn-xs">Export Pending Orders</button>
</a>
<div class="row m-b-15">
<div class="col">
+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Site Under Maintenance</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
padding: 50px;
}
.content {
background: white;
padding: 20px;
border-radius: 10px;
display: inline-block;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="content">
<h1>We'll be back soon!</h1>
<p>Sorry for the inconvenience but we're performing some maintenance at the moment. We'll be back online shortly!</p>
<p>&mdash; CIEF EXCHANGE</p>
</div>
</body>
</html>
+79 -1
View File
@@ -1104,6 +1104,7 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
echo '<th style="border: 1px solid black;">PO approve date</th>';
echo '<th style="border: 1px solid black;">Remark</th>';
echo '<th style="border: 1px solid black;">Add Remarks</th>';
echo '<th style="border: 1px solid black;">Upload Bank Slip</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
@@ -1121,7 +1122,7 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
echo '<td style="border: 1px solid black;">' . $bill->created_at->format('d-m-Y h:i A') . '</td>';
echo '<td style="border: 1px solid black;">' . $bill->issuerCompany->name . '</td>';
echo '<td style="border: 1px solid black; color: '.($bill->status === ApprovalStatus::APPROVED ? "green" : "red").';">' . ($bill->status === ApprovalStatus::APPROVED ? $bill->updated_at->format('d-m-Y h:i A') : 'Pending Upload') . '</td>';
echo '<td style="border: 1px solid black; color: '.($po ? "green" : "red").';">' . ($po ? $po->updated_at->format('d-m-Y h:i A') : 'Pending Submission') . '</td>';
echo '<td style="border: 1px solid black; color: '.($po ? "green" : "red").';">' . ($po ? $po->updated_at->format('d-m-Y h:i A') : '<a href="' . \route('booking.details', $bill->owner->owner->marking) . '" target="_blank">Pending Submission</a>') . '</td>';
echo '<td style="border: 1px solid black;">' . ($po ? ($po->status === ApprovalStatus::APPROVED ? $po->updated_at->format('d-m-Y h:i A') : '' ) : '' ). '</td>';
$remarks = $bill->remarks;
echo '<td style="border: 1px solid black;">';
@@ -1138,11 +1139,88 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
echo csrf_field();
echo '</form>';
echo '</td>';
echo '<td style="border: 1px solid black;">' ;
if ($bill->status !== ApprovalStatus::APPROVED) {
echo '<form id="uploadForm-'.$bill->id.'" enctype="multipart/form-data" style="display:flex; margin: 10px">';
echo '<input type="file" name="files[]" multiple required>';
echo '<button type="button" onclick="uploadFiles('.$bill->id.')">Upload</button>';
echo csrf_field();
echo '</form>';
}
echo '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
// script
echo '<script>
function uploadFiles(billId) {
const form = document.getElementById("uploadForm-" + billId);
const fileInput = form.querySelector("input[type=\'file\']");
const files = fileInput.files;
const userToken = localStorage.getItem("user-token");
if (files.length === 0) {
alert("Please select at least one file to upload.");
return;
}
const fileReaders = [];
let totalFiles = files.length;
// Create a promise for each file to read it as Base64
Array.from(files).forEach((file) => {
const reader = new FileReader();
// Create a promise that resolves when the file is read
const fileReadPromise = new Promise((resolve, reject) => {
reader.onload = (event) => {
resolve(event.target.result);
};
reader.onerror = (error) => {
reject(error);
};
reader.readAsDataURL(file); // Read the file as Data URL (Base64)
});
fileReaders.push(fileReadPromise);
});
// Wait for all files to be read
Promise.all(fileReaders)
.then((fileData) => {
const payload = {
files: fileData, // Array of objects with name, type, and Base64 content
};
// Send the payload as JSON
return fetch(`/api/v1/transactions/${billId}/bill/verification`, {
method: "POST",
headers: {
"Authorization": "Bearer " + userToken,
"Content-Type": "application/json" // Sending JSON payload
},
body: JSON.stringify(payload),
});
})
.then(response => {
console.log(response);
if (response.ok) {
alert("Files uploaded successfully!");
location.reload();
} else {
alert("Upload failed");
}
})
.catch(error => {
console.error("Error:", error);
alert("An error occurred during the upload.");
});
}
</script>';
});
Route::get('check-duplicate-refunds', function () {