<h3 style="text-align:center;">🔧 محاسبهگر قیمت پنجره UPVC</h3>
<label>عرض (cm):</label>
<input type="number" id="width" placeholder="مثلاً 120" style="width:100%;padding:8px;margin-bottom:10px"/>
<label>ارتفاع (cm):</label>
<input type="number" id="height" placeholder="مثلاً 150" style="width:100%;padding:8px;margin-bottom:10px"/>
<label>نوع پنجره:</label>
<select id="windowType" style="width:100%;padding:8px;margin-bottom:10px">
<option value="1">تکلنگه</option>
<option value="1.2">دو لنگه</option>
<option value="1.3">کشویی</option>
</select>
<label>نوع شیشه:</label>
<select id="glassType" style="width:100%;padding:8px;margin-bottom:10px">
<option value="600000">ساده (600,000 تومان / m²)</option>
<option value="800000">دوجداره (800,000 تومان / m²)</option>
<option value="900000">دودی (900,000 تومان / m²)</option>
</select>
<label>رنگ پروفیل:</label>
<select id="colorType" style="width:100%;padding:8px;margin-bottom:15px">
<option value="1">سفید (بدون افزایش)</option>
<option value="1.15">لمینیت (15٪ افزایش)</option>
<option value="1.25">طرح چوب (25٪ افزایش)</option>
</select>
<button onclick="calculatePrice()" style="width:100%;background:#0073e6;color:white;padding:10px;border:none;border-radius:5px;font-size:16px;cursor:pointer">محاسبه قیمت</button>
<div id="result" style="margin-top:20px;text-align:center;font-size:18px;font-weight:bold;color:#007300"></div>
</div>
<script>
function calculatePrice() {
const width = parseFloat(document.getElementById("width").value) || 0;
const height = parseFloat(document.getElementById("height").value) || 0;
const area = (width * height) / 10000; // تبدیل cm² به m²
const glassPrice = parseFloat(document.getElementById("glassType").value);
const windowTypeFactor = parseFloat(document.getElementById("windowType").value);
const colorFactor = parseFloat(document.getElementById("colorType").value);
if (width <= 0 || height <= 0) {
document.getElementById("result").innerHTML = "لطفاً عرض و ارتفاع معتبر وارد کنید.";
return;
}
const basePrice = area * glassPrice;
const finalPrice = Math.round(basePrice * windowTypeFactor * colorFactor);
document.getElementById("result").innerHTML =
💰 قیمت تخمینی: ${finalPrice.toLocaleString()} تومان;}
</script>