top of page
لرؤية هذا العمل، توجه إلى موقعك المباشر.
General Discussion
Share stories, ideas, pictures and more!
General Discussion
آخر نشاط | Item option menu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
٠ | ٠ | ٣٠ أغسطس | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
٠ | ٠ | ٣٠ أغسطس | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
٠ | ٠ | ٣٠ أغسطس |
bottom of page
// Define base prices for each service const basePrices = { 'serviceType1': 500, // Example service 1 price 'serviceType2': 1000, // Example service 2 price 'serviceType3': 1500, // Example service 3 price }; // Prices for extra services const extraServicesPrices = { transport: 50, accommodation: 100, food: 30, }; // Function to calculate the estimated cost function calculateEstimatedCost() { let estimatedCost = 0; // Get the selected service type and base price const selectedService = $w('#serviceTypeDropdown').value; estimatedCost += basePrices[selectedService] || 0; // Get the duration of the treatment and number of travelers const treatmentDuration = $w('#treatmentDurationSlider').value; const numberOfTravelers = $w('#travelerNumberSlider').value; // Example: Add cost per day of treatment and per traveler estimatedCost += treatmentDuration * 50; // Add €50 per day of treatment estimatedCost += numberOfTravelers * 100; // Add €100 per traveler // Check extra services (transport, accommodation, food) if ($w('#transportToggle').checked) { estimatedCost += extraServicesPrices.transport; } if ($w('#accommodationToggle').checked) { estimatedCost += extraServicesPrices.accommodation * treatmentDuration; // Accommodation is based on days } if ($w('#foodToggle').checked) { estimatedCost += extraServicesPrices.food * numberOfTravelers; // Food is based on travelers } // Display the calculated cost $w('#estimatedCostText').text = `Estimated Cost: €${estimatedCost}`; } // Attach event handlers to update the cost in real time $w.onReady(function () { // When sliders or toggles are changed, recalculate the cost $w('#treatmentDurationSlider').onChange(calculateEstimatedCost); $w('#travelerNumberSlider').onChange(calculateEstimatedCost); $w('#transportToggle').onChange(calculateEstimatedCost); $w('#accommodationToggle').onChange(calculateEstimatedCost); $w('#foodToggle').onChange(calculateEstimatedCost); $w('#serviceTypeDropdown').onChange(calculateEstimatedCost); });