-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
148 lines (134 loc) · 5.34 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>حساب الشرط الجزائي للفيلا</title>
<style>
:root {
--primary-color: #3498db;
--secondary-color: #2ecc71;
--background-color: #ecf0f1;
--text-color: #34495e;
--border-color: #bdc3c7;
}
body {
font-family: 'Arial', sans-serif;
background-color: var(--background-color);
color: var(--text-color);
line-height: 1.6;
margin: 0;
padding: 20px;
}
.container {
max-width: 600px;
margin: 0 auto;
background-color: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
h2 {
color: var(--primary-color);
text-align: center;
margin-bottom: 30px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input, button {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 16px;
}
button {
background-color: var(--secondary-color);
color: white;
border: none;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #27ae60;
}
#formattedValue {
font-weight: bold;
color: var(--primary-color);
margin-bottom: 20px;
}
#result {
background-color: #f9f9f9;
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 20px;
margin-top: 30px;
}
#result p {
margin: 10px 0;
}
#result strong {
color: var(--primary-color);
}
.footer {
text-align: center;
margin-top: 30px;
color: #7f8c8d;
font-style: italic;
}
</style>
</head>
<body>
<div class="container">
<h2>حساب الشرط الجزائي للفيلا</h2>
<label for="villaValue">قيمة الفيلا بدون الضريبة:</label>
<input type="number" id="villaValue" placeholder="أدخل قيمة الفيلا">
<div id="formattedValue"></div>
<label for="contractDate">موعد التسليم حسب العقد:</label>
<input type="date" id="contractDate">
<label for="expectedDate">موعد الاستلام المتوقع:</label>
<input type="date" id="expectedDate">
<button onclick="calculate()">احسب</button>
<div id="result">
<p>نسبة المبلغ: <strong><span id="amountPercentage">-</span></strong></p>
<p>فرق الأيام: <strong><span id="daysDifference">-</span></strong></p>
<p>المبلغ اليومي: <strong><span id="dailyAmount">-</span></strong></p>
<p>مبلغ التعويض المقدر: <strong><span id="compensationAmount">-</span></strong></p>
</div>
<div class="footer">
تم إنشاء الصفحة بواسطة أبو وسيم :)
</div>
</div>
<script>
function formatCurrency(amount) {
return new Intl.NumberFormat('ar-SA', { style: 'currency', currency: 'SAR' }).format(amount);
}
function calculate() {
const villaValue = parseFloat(document.getElementById('villaValue').value);
const contractDate = new Date(document.getElementById('contractDate').value);
const expectedDate = new Date(document.getElementById('expectedDate').value);
if (isNaN(villaValue) || isNaN(contractDate.getTime()) || isNaN(expectedDate.getTime())) {
alert('الرجاء إدخال جميع البيانات بشكل صحيح');
return;
}
document.getElementById('formattedValue').textContent = formatCurrency(villaValue);
const daysDifference = Math.ceil((expectedDate - contractDate) / (1000 * 60 * 60 * 24));
const amountPercentage = 0.07; // 7%
const dailyAmount = (villaValue * amountPercentage) / 365;
const compensationAmount = dailyAmount * daysDifference;
document.getElementById('amountPercentage').textContent = (amountPercentage * 100) + '%';
document.getElementById('daysDifference').textContent = daysDifference;
document.getElementById('dailyAmount').textContent = formatCurrency(dailyAmount);
document.getElementById('compensationAmount').textContent = formatCurrency(compensationAmount);
}
// Initialize date inputs with today's date
const today = new Date().toISOString().split('T')[0];
document.getElementById('contractDate').value = today;
document.getElementById('expectedDate').value = today;
</script>
</body>
</html>