-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript.js
More file actions
36 lines (28 loc) · 1.28 KB
/
Script.js
File metadata and controls
36 lines (28 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function showform(){
let form = document.getElementById('form');
let button = document.getElementById('continuebutton'); // Get the button
let buttonText = button.querySelector('p'); // Get the paragraph inside button
form.hidden = !form.hidden;
//اذا form غير موجود
if (form.hidden) {
buttonText.innerHTML = '<b>متابعة</b>'; //الزر مكتوب عليه متاعبة
} else {
buttonText.innerHTML = '<b>إغلاق</b>'; //اذا موجود = اغلاق
}
}
function submitOrder() {
let selectedMeals = [];
let totalPrice = 0;
document.querySelectorAll('.checkfoodbutton:checked').forEach(checkbox => {
const price = parseInt(checkbox.value);
const mealName = checkbox.dataset.name;
selectedMeals.push(`${mealName} (${price} ل.س)`);
totalPrice += price;
});
if (selectedMeals.length === 0) {
alert('⚠️ لم يتم اختيار أي وجبة');
return;
}
const tax = totalPrice * 0.10;
alert(`✅ ${selectedMeals.join('\n')}\n\n💰 المجموع: ${totalPrice} ل.س\n🧾 الضريبة: ${tax} ل.س\n💵 الإجمالي: ${totalPrice + tax} ل.س`);
}