1jQuery(document).ready(function($) { 2 let foundationChart = null; 3 4 function calculateFoundation() { 5 let length = parseFloat($('#sf_length').val()) || 0; 6 let width = parseFloat($('#sf_width').val()) || 0; 7 let height = parseFloat($('#sf_height').val()) || 0; 8 let rebarLong = parseFloat($('#sf_rebar_long').val()) || 4; 9 let hookLen = parseFloat($('#sf_hook_len').val()) || 1.2; 10 let hookStep = parseFloat($('#sf_hook_step').val()) || 0.5; 11 12 // ÐбÑем беÑона 13 let volume = length * width * height; 14 let weight = volume * 2400; // кг 15 16 // ÐÑодолÑÐ½Ð°Ñ Ð°ÑмаÑÑÑа 17 let rebarLongM = length * rebarLong; 18 19 // ÐопеÑеÑÐ½Ð°Ñ Ð°ÑмаÑÑÑа (Ñ Ð¾Ð¼ÑÑов) 20 let hooksQty = Math.ceil(length / hookStep) + 1; 21 let rebarHookM = hooksQty * hookLen; 22 23 let totalRebarM = rebarLongM + rebarHookM; 24 25 // СÑоимоÑÑÑ 26 let concretePricePerCube = 5500; 27 let rebarPricePerM = 60; 28 29 let costConcrete = volume * concretePricePerCube; 30 let costRebar = totalRebarM * rebarPricePerM; 31 let totalCost = costConcrete + costRebar; 32 33 // ÐÑвод ÑезÑлÑÑаÑов 34 $('#sf_volume').text(volume.toFixed(2)); 35 $('#sf_weight').text(weight.toFixed(0)); 36 $('#sf_rebar_long_m').text(rebarLongM.toFixed(1)); 37 $('#sf_hooks_qty').text(hooksQty); 38 $('#sf_rebar_hook_m').text(rebarHookM.toFixed(1));
39 $('#sf_cost_concrete').text(costConcrete.toFixed(0)); 40 $('#sf_cost_rebar').text(costRebar.toFixed(0)); 41 $('#sf_total').text(totalCost.toFixed(0)); 42 43 // ÐбновлÑем гÑаÑик 44 if(foundationChart) { 45 foundationChart.data.datasets[0].data = [costConcrete, costRebar]; 46 foundationChart.update(); 47 } 48 } 49 50 function initFoundationChart() { 51 let ctx = document.getElementById('sf_costChart').getContext('2d'); 52 foundationChart = new Chart(ctx, { 53 type: 'bar', 54 data: { 55 labels: ['ÐеÑон', 'ÐÑмаÑÑÑа'], 56 datasets: [{ 57 label: 'СÑоимоÑÑÑ (ÑÑб)', 58 data: [0, 0], 59 backgroundColor: ['#4caf50', '#ffa726'], 60 borderRadius: 12 61 }] 62 }, 63 options: { 64 responsive: true, 65 plugins: { 66 legend: { position: 'top' }, 67 } 68 } 69 }); 70 calculateFoundation(); 71 } 72 73 $('#sf_calc_btn').on('click', function(e) { 74 e.preventDefault(); 75 calculateFoundation(); 76 $(this).css('transform', 'scale(0.98)'); 77 setTimeout(() => $(this).css('transform', ''), 150); 78 }); 79 80 if($('#sf_costChart').length) { 81 initFoundationChart(); 82 } 83 84 // FAQ анимаÑÐ¸Ñ 85 $('.faq-q').on('click', function() { 86 $(this).next('.faq-a').slideToggle(200); 87 }); 88 $('.faq-a').hide(); 89});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.