-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
166 lines (156 loc) · 5.53 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>حساب معاش التقاعد</title>
<style>
body {
font-family: 'Cairo', sans-serif;
direction: rtl;
text-align: right;
padding: 20px;
background-color: #f4f4f4;
color: #333;
margin: 0;
}
h2 {
background-color: #007bff;
color: white;
padding: 15px;
border-radius: 5px;
text-align: center;
margin-bottom: 20px;
}
form {
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 500px;
margin: auto;
}
label {
font-size: 16px;
font-weight: bold;
margin-top: 10px;
display: block;
}
input[type="number"] {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
direction: rtl;
}
select {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
}
button {
width: 100%;
padding: 12px;
font-size: 16px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
margin-top: 20px;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
.result {
margin-top: 20px;
padding: 15px;
background-color: #e9ecef;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
font-size: 18px;
}
.result p {
margin: 10px 0;
}
.result p span {
font-weight: bold;
color: #007bff;
}
.footer {
text-align: center;
margin-top: 40px;
font-size: 14px;
color: #555;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap" rel="stylesheet">
</head>
<body>
<h2>حساب معاش التقاعد</h2>
<form id="retirementForm">
<label for="lastSalary">الراتب الأساسي الأخير:</label>
<input type="number" id="lastSalary" placeholder="أدخل الراتب الأساسي الأخير" required>
<label for="serviceDuration">مدة الخدمة (بالأشهر):</label>
<input type="number" id="serviceDuration" placeholder="أدخل مدة الخدمة بالأشهر" required>
<label for="retirementType">نوع التقاعد:</label>
<select id="retirementType" required>
<option value="">اختر نوع التقاعد</option>
<option value="civilian">التقاعد المدني</option>
<option value="military">التقاعد العسكري</option>
</select>
<button type="button" onclick="calculatePension()">احسب</button>
</form>
<div class="result" id="result">
<p>قيمة المعاش التقاعدي: <span id="pensionAmount">-</span> ريال</p>
</div>
<div class="footer">
<p>تم إنشاء الصفحة بواسطة أبو وسيم :)</p>
</div>
<script>
// دالة لتحويل الأرقام الإنجليزية إلى أرقام عربية
function convertToArabicNumbers(input) {
const arabicNumbers = {
0: '٠',
1: '١',
2: '٢',
3: '٣',
4: '٤',
5: '٥',
6: '٦',
7: '٧',
8: '٨',
9: '٩'
};
return input.toString().replace(/\d/g, (digit) => arabicNumbers[digit]);
}
function formatNumberWithCommas(number) {
// Format the number with Arabic digits and add commas
return convertToArabicNumbers(number.toLocaleString('en-US'));
}
function calculatePension() {
const lastSalary = parseFloat(document.getElementById('lastSalary').value);
const serviceDuration = parseFloat(document.getElementById('serviceDuration').value);
const retirementType = document.getElementById('retirementType').value;
let pensionAmount = 0;
if (retirementType === 'civilian') {
pensionAmount = (lastSalary * serviceDuration) / 480;
} else if (retirementType === 'military') {
pensionAmount = (lastSalary * serviceDuration) / 420;
} else {
alert("يرجى اختيار نوع التقاعد");
return;
}
// Display the result with Arabic numbers and formatted with commas
document.getElementById('pensionAmount').innerText = formatNumberWithCommas(pensionAmount.toFixed(2));
}
</script>
</body>
</html>