progress
This commit is contained in:
parent
d9b87b8672
commit
3e5fb5be1d
@ -248,7 +248,7 @@ class CustomerController extends Controller
|
||||
foreach ($dataCart as $cart) {
|
||||
$payloadOrderDetail = [
|
||||
'order_id' => $order->order_id,
|
||||
'harga_satuan' => $jenisCustomer === "Karyawan RSAB Harapan Kita" ? $cart['harga_karyawan'] : $cart['harga_kp'],
|
||||
'harga_satuan' => $jenisCustomer === "Karyawan RSAB Harapan Kita" ? $cart['harga_karyawan'] : $cart['harga_public'],
|
||||
'status_order' => "Pending"
|
||||
];
|
||||
foreach ($cart['pesanan'] as $value) {
|
||||
|
||||
@ -32,7 +32,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
alert(errorMessage);
|
||||
return
|
||||
}
|
||||
let checkout_biodata = JSON.parse(sessionStorage.getItem('checkout_biodata') || '{}');
|
||||
|
||||
if (!checkout_biodata.nama_pemesan) {
|
||||
Swal.fire({
|
||||
title: 'Biodata Belum Terisi!',
|
||||
text: 'Lakukan Pengisian biodata terlebih dahulu.',
|
||||
icon: 'warning',
|
||||
confirmButtonText: 'oke!',
|
||||
}).then(() => {
|
||||
window.location.href = "/checkout";
|
||||
});
|
||||
return
|
||||
}
|
||||
let cart = JSON.parse(sessionStorage.getItem('cart') || '[]');
|
||||
for (const item of cart) {
|
||||
for (const p of item.pesanan) {
|
||||
@ -45,12 +57,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
}
|
||||
|
||||
let checkout_biodata = JSON.parse(sessionStorage.getItem('checkout_biodata') || '{}');
|
||||
|
||||
if (!checkout_biodata.nama_pemesan) {
|
||||
window.location.href = "/";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sessionStorage.getItem('order_id')) {
|
||||
await submitOrderToServer(); // async function simpan ke server
|
||||
|
||||
@ -232,7 +239,6 @@ function renderCartSummary() {
|
||||
const disableSiang = isToday && jam >= 10;
|
||||
const disableSore = isToday && jam >= 13;
|
||||
const countDate = pesananList.length;
|
||||
console.log(item.apakah_someday);
|
||||
|
||||
pesananHTML += `
|
||||
<div class=" rounded p-2 mb-2" data-item-id="${item.id}" data-index="${i}">
|
||||
@ -352,11 +358,13 @@ function renderCartSummary() {
|
||||
: ''}
|
||||
<div class="mb-2 small text-muted"><strong>Silakan isi tanggal pemesanan dan pilih karbohidrat yang diinginkan</strong></div>
|
||||
${pesananHTML}
|
||||
|
||||
<div class="mt-3 d-flex justify-content-between align-items-center flex-wrap gap-2">
|
||||
<button class="btn btn-sm btn-outline-success"
|
||||
onclick="addOrderDate(${item.id}, ${item.apakah_menu_sore})">
|
||||
+ Tambah Tanggal
|
||||
</button>
|
||||
</button>'
|
||||
|
||||
<div><strong>Total:</strong> <span class="text-success">Rp ${itemTotal.toLocaleString('id-ID')}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -611,9 +619,9 @@ function initFlatpickrTersedia(item, i) {
|
||||
const totalMenitFlatSekarang = jamFlat * 60 + menitFlat;
|
||||
|
||||
const menitBatasFlat = 13 * 60;
|
||||
|
||||
|
||||
const lewatBatasNormal = totalMenitFlatSekarang >= menitBatasFlat;
|
||||
|
||||
|
||||
// Ambil string tgl_tersedia dan ubah jadi array tanggal lengkap
|
||||
const dayNumbers = (item.tgl_tersedia || "")
|
||||
.split(',')
|
||||
@ -642,8 +650,8 @@ function initFlatpickrTersedia(item, i) {
|
||||
availableDates.push(fullDateStr);
|
||||
} else {
|
||||
const selisihHari = Math.floor((fullDate - now) / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (selisihHari >= 1 || (selisihHari === 1 && !lewatBatasNormal)) {
|
||||
|
||||
if (selisihHari >= 1 || (selisihHari === 1 && !lewatBatasNormal)) {
|
||||
availableDates.push(fullDateStr);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user