const ratePerLb = 1.5; // Base rate per pound
const packingFee = 600; // Flat packing fee
const storageRatePerCuFt = 0.75; // Monthly storage rate per cu ft
const deliveryFlexFee = 300; // Fixed delivery date flexibility charge
function updateTotals() {
let totalVolume = 0;
let totalWeight = 0;
Object.keys(itemData).forEach(id => {
const el = document.getElementById(id);
if (el && el.checked) {
totalVolume += itemData[id].volume;
totalWeight += itemData[id].weight;
}
});
// Add 50 medium boxes
const boxVolume = 2.5 * 50; // ~2.5 cu ft per medium box
const boxWeight = 30 * 50; // ~30 lbs per medium box
totalVolume += boxVolume;
totalWeight += boxWeight;
const transportCost = totalWeight * ratePerLb;
const storageCost = totalVolume * storageRatePerCuFt;
const estimatedTotal = transportCost + packingFee + storageCost + deliveryFlexFee;
document.getElementById("hidden-volume").value = totalVolume.toFixed(2);
document.getElementById("hidden-weight").value = totalWeight.toFixed(2);
document.getElementById("hidden-price").value = estimatedTotal.toFixed(2);
}
// Create hidden field for pricing
const priceInput = document.createElement("input");
priceInput.type = "hidden";
priceInput.name = "estimation_prix";
priceInput.id = "hidden-price";
document.forms[0].appendChild(priceInput);