apix-interior.co.id

kalkulator

Kalkulator Harga Apix Interior
:root { –primary-color: #ffd700; /* gold */ –secondary-color: navy; –background-color: #ffffff; –navbar-background: #ffd700; –button-hover-bg: navy; –text-color: #ffd700; –font-family: “Poppins”, sans-serif; –detail-text-color: #555555; –result-background: rgba(0, 0, 0, 0.05); –result-border: 5px solid #ffd700; –result-text-color: navy; } @import url(“https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap”); /* Navbar */ .navbar { display: flex; justify-content: space-between; align-items: center; background-color: var(–navbar-background); padding: 15px 30px; width: 100%; max-width: 1200px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); margin-bottom: 30px; } .navbarLogoText { display: flex; align-items: center; } .navbarText { color: white; font-weight: 700; font-family: var(–font-family); font-size: 19px; } .navbarLogo { height: 50px; margin-right: 10px; filter: brightness(0) invert(1); drop-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5); } .backButton { background: none; border: 2px solid var(–secondary-color); color: var(–secondary-color); font-size: 18px; cursor: pointer; padding: 8px 16px; border-radius: 5px; display: flex; align-items: center; transition: all 0.3s ease; } /* Form */ .formContainer h1, .kalkulasiContainer h1 { color: var(–primary-color); font-weight: bold; font-size: 28px; margin-bottom: 25px; text-align: center; font-family: var(–font-family); } .customDropdown { background-color: gold; border: 2px solid #000000; border-radius: 8px; padding: 12px 16px; font-size: 16px; font-weight: bold; color: navy; width: 100%; font-family: var(–font-family); } /* Kalkulasi Harga */ .kalkulasiContainer { margin-top: 20px; padding: 20px; background-color: var(–result-background); border-left: var(–result-border); color: var(–detail-text-color); text-align: left; font-family: var(–font-family); } .inputField { width: 100%; padding: 8px; margin-bottom: 12px; font-size: 14px; border-radius: 4px; border: 1px solid var(–primary-color); } .totalBiaya { font-size: 20px; font-weight: 700; color: var(–result-text-color); text-align: center; margin-top: 15px; } /* Tombol Tampilkan Deskripsi */ .descriptionButton { background-color: var(–primary-color); color: navy; font-weight: bold; border: none; padding: 6px 12px; font-size: 14px; border-radius: 6px; cursor: pointer; margin-top: 10px; font-family: var(–font-family); transition: background-color 0.3s ease; } .descriptionButton:hover { background-color: var(–button-hover-bg); color: var(–primary-color); } /* Deskripsi hasil */ #description-container h2, #description-container p { color: var(–primary-color); font-family: var(–font-family); } #description-container h2 { margin-top: 15px; font-weight: bold; font-size: 20px; } #description-container p { margin-top: 8px; font-size: 16px; } /* Animasi */ @keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} } .kalkulasiContainer { animation: fadeIn 0.5s ease-in-out; }

Kalkulator Harga Apix Interior

Pilih Kategori Item
Pilih Kategori Opsi

Total Biaya: Rp 0

Total Biaya Keseluruhan: Rp 0

document.addEventListener(‘DOMContentLoaded’, function () { // API Keys terbaru const apiKey = ‘ck_3f30171cd5f70432041216e677cd8fcff70d89f4’; const consumerSecret = ‘cs_eb24a8684509adbf5c67fdb75d48564627ed8745’; // Fungsi untuk mendapatkan harga atau data lain dari API function getPriceFromAPI() { fetch(‘https://api.example.com/get-price’, { method: ‘GET’, headers: { ‘Authorization’: `Bearer ${apiKey}`, ‘Consumer-Secret’: consumerSecret } }) .then(response => response.json()) .then(data => { console.log(‘Harga dari API:’, data); // Update harga di kalkulator jika diperlukan }) .catch(error => console.error(‘Error:’, error)); } // Data dan fungsi kalkulator Anda const items = [ { name: ‘Sample Item’, options: [ { description: ‘Option 1’, price: 100, detailDescription: ‘Detailed description’ }, { description: ‘Option 2’, price: 150, detailDescription: ‘Detailed description’ } ] } ]; let selectedItemIndex = -1; let selectedOptionIndex = -1; let description = ”; let detailDescription = ”; let hargaPerMeter = 0; let panjangProduk = ”; function handleItemChange(e) { selectedItemIndex = Number(e.target.value); updateOptions(); resetDescriptionAndPrice(); } function handleOptionChange(e) { selectedOptionIndex = Number(e.target.value); updateDescription(); updateHargaPerMeter(); updatePrice(); } function handleDescription() { updateDescription(); } function handleUserInput() { panjangProduk = document.getElementById(‘panjangProduk’).value; updatePrice(); } function updateOptions() { const optionSelect = document.getElementById(‘option-select’); optionSelect.innerHTML = ‘Pilih Kategori Opsi’; if (selectedItemIndex >= 0 && items[selectedItemIndex]) { items[selectedItemIndex].options.forEach((option, index) => { const optionElem = document.createElement(‘option’); optionElem.value = index; optionElem.textContent = `${option.description} – Rp ${option.price.toLocaleString()}`; optionSelect.appendChild(optionElem); }); } } function updateDescription() { const selectedItem = items[selectedItemIndex]; if (selectedItem && selectedItem.options[selectedOptionIndex]) { const selectedOption = selectedItem.options[selectedOptionIndex]; description = `Deskripsi: ${selectedOption.description} – Harga: Rp ${selectedOption.price.toLocaleString()}`; detailDescription = selectedOption.detailDescription || ‘Tidak ada deskripsi detail.’; } else { description = ”; detailDescription = ”; } document.getElementById(‘description’).textContent = description; document.getElementById(‘detail-description’).textContent = detailDescription; } function updateHargaPerMeter() { if (selectedItemIndex >= 0 && selectedOptionIndex >= 0) { hargaPerMeter = items[selectedItemIndex].options[selectedOptionIndex].price; document.getElementById(‘hargaPerMeter’).value = hargaPerMeter; } else { hargaPerMeter = 0; document.getElementById(‘hargaPerMeter’).value = ”; } } function updatePrice() { const panjang = parseFloat(panjangProduk) || 0; const total = panjang * hargaPerMeter; document.getElementById(‘total-biaya’).textContent = `Total Biaya: Rp ${total.toLocaleString()}`; } function resetDescriptionAndPrice() { description = ”; detailDescription = ”; document.getElementById(‘description’).textContent = ”; document.getElementById(‘detail-description’).textContent = ”; hargaPerMeter = 0; panjangProduk = ”; document.getElementById(‘hargaPerMeter’).value = ”; document.getElementById(‘panjangProduk’).value = ”; document.getElementById(‘total-biaya’).textContent = ‘Total Biaya: Rp 0’; } // Initialize dropdown const itemSelect = document.getElementById(‘item-select’); items.forEach((item, idx) => { const option = document.createElement(‘option’); option.value = idx; option.textContent = item.name; itemSelect.appendChild(option); }); });