buosam commited on
Commit
20cc475
·
verified ·
1 Parent(s): b7597f0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +736 -19
index.html CHANGED
@@ -1,19 +1,736 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Iraq Salary & Tax Calculator</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ box-sizing: border-box;
13
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
14
+ }
15
+
16
+ :root {
17
+ --primary: #1a3a6c;
18
+ --secondary: #2c5282;
19
+ --accent: #e74c3c;
20
+ --light: #f0f7ff;
21
+ --dark: #1a202c;
22
+ --success: #38a169;
23
+ --warning: #ecc94b;
24
+ --gray: #718096;
25
+ --info: #4299e1;
26
+ }
27
+
28
+ body {
29
+ background: linear-gradient(135deg, #1a3a6c, #2c5282);
30
+ color: var(--dark);
31
+ min-height: 100vh;
32
+ padding: 20px;
33
+ }
34
+
35
+ .container {
36
+ max-width: 1200px;
37
+ margin: 0 auto;
38
+ }
39
+
40
+ header {
41
+ text-align: center;
42
+ padding: 30px 0;
43
+ color: white;
44
+ }
45
+
46
+ header h1 {
47
+ font-size: 2.5rem;
48
+ margin-bottom: 10px;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ gap: 15px;
53
+ }
54
+
55
+ header p {
56
+ font-size: 1.1rem;
57
+ max-width: 700px;
58
+ margin: 0 auto;
59
+ opacity: 0.9;
60
+ line-height: 1.6;
61
+ }
62
+
63
+ .calculator-container {
64
+ display: flex;
65
+ flex-wrap: wrap;
66
+ gap: 25px;
67
+ margin-top: 20px;
68
+ }
69
+
70
+ .input-section {
71
+ background: white;
72
+ border-radius: 15px;
73
+ box-shadow: 0 10px 30px rgba(0,0,0,0.2);
74
+ padding: 30px;
75
+ flex: 1;
76
+ min-width: 300px;
77
+ }
78
+
79
+ .result-section {
80
+ background: white;
81
+ border-radius: 15px;
82
+ box-shadow: 0 10px 30px rgba(0,0,0,0.2);
83
+ padding: 30px;
84
+ flex: 1;
85
+ min-width: 300px;
86
+ display: flex;
87
+ flex-direction: column;
88
+ }
89
+
90
+ .section-title {
91
+ font-size: 1.5rem;
92
+ color: var(--primary);
93
+ margin-bottom: 25px;
94
+ padding-bottom: 10px;
95
+ border-bottom: 2px solid var(--primary);
96
+ display: flex;
97
+ align-items: center;
98
+ gap: 10px;
99
+ }
100
+
101
+ .section-title i {
102
+ background: var(--primary);
103
+ color: white;
104
+ width: 36px;
105
+ height: 36px;
106
+ border-radius: 50%;
107
+ display: flex;
108
+ align-items: center;
109
+ justify-content: center;
110
+ }
111
+
112
+ .form-group {
113
+ margin-bottom: 20px;
114
+ }
115
+
116
+ label {
117
+ display: block;
118
+ margin-bottom: 8px;
119
+ font-weight: 600;
120
+ color: var(--secondary);
121
+ font-size: 0.95rem;
122
+ }
123
+
124
+ input, select {
125
+ width: 100%;
126
+ padding: 12px;
127
+ border: 2px solid #e2e8f0;
128
+ border-radius: 8px;
129
+ font-size: 1rem;
130
+ transition: all 0.3s;
131
+ }
132
+
133
+ input:focus, select:focus {
134
+ outline: none;
135
+ border-color: var(--primary);
136
+ box-shadow: 0 0 0 3px rgba(26, 58, 108, 0.2);
137
+ }
138
+
139
+ .region-toggle {
140
+ display: flex;
141
+ gap: 12px;
142
+ margin-bottom: 25px;
143
+ }
144
+
145
+ .region-btn {
146
+ flex: 1;
147
+ padding: 14px;
148
+ background: #edf2f7;
149
+ border: none;
150
+ border-radius: 8px;
151
+ font-size: 0.95rem;
152
+ font-weight: 600;
153
+ cursor: pointer;
154
+ transition: all 0.3s;
155
+ text-align: center;
156
+ }
157
+
158
+ .region-btn.active {
159
+ background: var(--primary);
160
+ color: white;
161
+ }
162
+
163
+ .calculate-btn {
164
+ width: 100%;
165
+ padding: 15px;
166
+ background: var(--accent);
167
+ color: white;
168
+ border: none;
169
+ border-radius: 8px;
170
+ font-size: 1.1rem;
171
+ font-weight: 600;
172
+ cursor: pointer;
173
+ transition: all 0.3s;
174
+ margin-top: 10px;
175
+ box-shadow: 0 4px 6px rgba(231, 76, 60, 0.3);
176
+ }
177
+
178
+ .calculate-btn:hover {
179
+ background: #c0392b;
180
+ transform: translateY(-2px);
181
+ }
182
+
183
+ .result-item {
184
+ display: flex;
185
+ justify-content: space-between;
186
+ padding: 14px 0;
187
+ border-bottom: 1px solid #e2e8f0;
188
+ }
189
+
190
+ .result-item:last-child {
191
+ border-bottom: none;
192
+ }
193
+
194
+ .result-label {
195
+ font-weight: 600;
196
+ color: var(--secondary);
197
+ font-size: 0.95rem;
198
+ }
199
+
200
+ .result-value {
201
+ font-weight: 700;
202
+ color: var(--primary);
203
+ font-size: 1rem;
204
+ }
205
+
206
+ .highlight {
207
+ background: var(--light);
208
+ padding: 12px 15px;
209
+ border-radius: 8px;
210
+ margin: 5px 0;
211
+ border-left: 4px solid var(--accent);
212
+ }
213
+
214
+ .net-salary {
215
+ background: var(--success);
216
+ color: white;
217
+ padding: 22px;
218
+ border-radius: 10px;
219
+ margin-top: auto;
220
+ text-align: center;
221
+ }
222
+
223
+ .net-salary .label {
224
+ font-size: 1.2rem;
225
+ margin-bottom: 10px;
226
+ }
227
+
228
+ .net-salary .value {
229
+ font-size: 2.2rem;
230
+ font-weight: 700;
231
+ }
232
+
233
+ .allowances-section {
234
+ background: #f7fafc;
235
+ border-radius: 8px;
236
+ padding: 15px;
237
+ margin: 15px 0;
238
+ border: 1px solid #e2e8f0;
239
+ }
240
+
241
+ .allowance-header {
242
+ display: flex;
243
+ justify-content: space-between;
244
+ align-items: center;
245
+ margin-bottom: 10px;
246
+ }
247
+
248
+ .add-allowance-btn {
249
+ background: var(--primary);
250
+ color: white;
251
+ border: none;
252
+ border-radius: 6px;
253
+ padding: 7px 14px;
254
+ cursor: pointer;
255
+ font-weight: 600;
256
+ transition: all 0.3s;
257
+ font-size: 0.9rem;
258
+ }
259
+
260
+ .add-allowance-btn:hover {
261
+ background: var(--secondary);
262
+ }
263
+
264
+ .allowance-item {
265
+ display: flex;
266
+ gap: 10px;
267
+ margin-bottom: 10px;
268
+ align-items: center;
269
+ }
270
+
271
+ .allowance-item input {
272
+ flex: 1;
273
+ }
274
+
275
+ .allowance-item select {
276
+ flex: 1.5;
277
+ }
278
+
279
+ .remove-allowance {
280
+ background: #e53e3e;
281
+ color: white;
282
+ border: none;
283
+ border-radius: 50%;
284
+ width: 28px;
285
+ height: 28px;
286
+ display: flex;
287
+ align-items: center;
288
+ justify-content: center;
289
+ cursor: pointer;
290
+ font-size: 0.9rem;
291
+ }
292
+
293
+ .min-sos {
294
+ font-size: 0.8rem;
295
+ color: #e53e3e;
296
+ margin-top: 3px;
297
+ display: block;
298
+ }
299
+
300
+ .info-box {
301
+ background: var(--light);
302
+ border-radius: 10px;
303
+ padding: 20px;
304
+ margin-top: 30px;
305
+ }
306
+
307
+ .info-box h3 {
308
+ color: var(--primary);
309
+ margin-bottom: 15px;
310
+ display: flex;
311
+ align-items: center;
312
+ gap: 10px;
313
+ font-size: 1.3rem;
314
+ }
315
+
316
+ .info-box ul {
317
+ padding-left: 20px;
318
+ }
319
+
320
+ .info-box li {
321
+ margin-bottom: 10px;
322
+ line-height: 1.5;
323
+ font-size: 0.95rem;
324
+ }
325
+
326
+ .note-box {
327
+ background: #f0f7ff;
328
+ border-left: 4px solid var(--primary);
329
+ padding: 12px;
330
+ border-radius: 4px;
331
+ margin-top: 15px;
332
+ font-size: 0.9rem;
333
+ }
334
+
335
+ @media (max-width: 768px) {
336
+ .calculator-container {
337
+ flex-direction: column;
338
+ }
339
+
340
+ header h1 {
341
+ font-size: 2rem;
342
+ }
343
+
344
+ .allowance-item {
345
+ flex-direction: column;
346
+ align-items: stretch;
347
+ }
348
+ }
349
+ </style>
350
+ </head>
351
+ <body>
352
+ <div class="container">
353
+ <header>
354
+ <h1><i class="fas fa-calculator"></i> Iraq Salary & Tax Calculator</h1>
355
+ <p>Calculate your net salary after taxes and social security contributions for all regions of Iraq</p>
356
+ </header>
357
+
358
+ <div class="calculator-container">
359
+ <div class="input-section">
360
+ <h2 class="section-title"><i class="fas fa-edit"></i> Salary Information</h2>
361
+
362
+ <div class="region-toggle">
363
+ <button class="region-btn active" data-region="iraq">South/Central Iraq</button>
364
+ <button class="region-btn" data-region="kri">Kurdistan Region (KRI)</button>
365
+ </div>
366
+
367
+ <div class="form-group">
368
+ <label for="baseSalary">Total Base Salary (IQD)</label>
369
+ <input type="number" id="baseSalary" placeholder="Enter monthly base salary" value="2500000">
370
+ </div>
371
+
372
+ <div id="iraqInputs">
373
+ <div class="form-group">
374
+ <label for="maritalStatus">Marital Status</label>
375
+ <select id="maritalStatus">
376
+ <option value="single">Single</option>
377
+ <option value="married">Married</option>
378
+ <option value="married1">Married + 1 Child</option>
379
+ <option value="married2" selected>Married + 2 Children</option>
380
+ <option value="married3">Married + 3 Children</option>
381
+ <option value="married4">Married + 4 Children</option>
382
+ <option value="divorced">Divorced/Widowed</option>
383
+ <option value="divorced1">Divorced/Widowed + 1 Child</option>
384
+ <option value="divorced2">Divorced/Widowed + 2 Children</option>
385
+ </select>
386
+ </div>
387
+ </div>
388
+
389
+ <div class="allowances-section">
390
+ <div class="allowance-header">
391
+ <h3><i class="fas fa-plus-circle"></i> Monthly Allowances</h3>
392
+ <button class="add-allowance-btn" id="addAllowanceBtn">
393
+ <i class="fas fa-plus"></i> Add
394
+ </button>
395
+ </div>
396
+
397
+ <div id="allowancesContainer">
398
+ <div class="allowance-item">
399
+ <select class="allowance-type">
400
+ <option value="food">Food Allowance</option>
401
+ <option value="transport">Transportation</option>
402
+ <option value="housing">Housing</option>
403
+ <option value="incentive">Incentive/Commissions</option>
404
+ <option value="other">Other</option>
405
+ </select>
406
+ <input type="number" class="allowance-amount" placeholder="Amount" value="200000">
407
+ <button class="remove-allowance"><i class="fas fa-times"></i></button>
408
+ </div>
409
+ </div>
410
+ </div>
411
+
412
+ <button class="calculate-btn" id="calculateBtn">
413
+ <i class="fas fa-calculator"></i> Calculate Net Salary
414
+ </button>
415
+ </div>
416
+
417
+ <div class="result-section">
418
+ <h2 class="section-title"><i class="fas fa-chart-bar"></i> Salary Summary</h2>
419
+
420
+ <div class="result-item">
421
+ <span class="result-label">Base Salary</span>
422
+ <span class="result-value" id="baseSalaryResult">2,500,000 IQD</span>
423
+ </div>
424
+
425
+ <div class="result-item">
426
+ <span class="result-label">Total Allowances</span>
427
+ <span class="result-value" id="totalAllowances">200,000 IQD</span>
428
+ </div>
429
+
430
+ <div class="highlight">
431
+ <div class="result-item">
432
+ <span class="result-label">Total Income</span>
433
+ <span class="result-value" id="totalIncome">2,700,000 IQD</span>
434
+ </div>
435
+ </div>
436
+
437
+ <h3 style="margin: 20px 0 10px; color: var(--accent);">Deductions</h3>
438
+
439
+ <div class="result-item">
440
+ <span class="result-label" id="sosLabel">Social Security (SOS)</span>
441
+ <span class="result-value" id="sos">125,000 IQD</span>
442
+ </div>
443
+ <div class="min-sos" id="sosMinNote"></div>
444
+
445
+ <div class="result-item">
446
+ <span class="result-label">Taxable Amount</span>
447
+ <span class="result-value" id="taxableAmount">1,050,000 IQD</span>
448
+ </div>
449
+
450
+ <div class="result-item">
451
+ <span class="result-label">Income Tax</span>
452
+ <span class="result-value" id="incomeTax">125,000 IQD</span>
453
+ </div>
454
+
455
+ <div class="highlight">
456
+ <div class="result-item">
457
+ <span class="result-label">Total Deductions</span>
458
+ <span class="result-value" id="totalDeductions">250,000 IQD</span>
459
+ </div>
460
+ </div>
461
+
462
+ <div class="net-salary">
463
+ <div class="label">Your Net Salary</div>
464
+ <div class="value" id="netSalary">2,450,000 IQD</div>
465
+ </div>
466
+
467
+ <div class="note-box">
468
+ <i class="fas fa-info-circle"></i> Social Security minimums:
469
+ <ul style="margin-top: 8px; padding-left: 20px;">
470
+ <li>South/Central Iraq: 350,000 IQD/year (29,167 IQD/month)</li>
471
+ <li>Kurdistan Region: 450,000 IQD/year (37,500 IQD/month)</li>
472
+ </ul>
473
+ </div>
474
+ </div>
475
+ </div>
476
+
477
+ <div class="info-box">
478
+ <h3><i class="fas fa-info-circle"></i> How It Works</h3>
479
+ <ul>
480
+ <li><strong>Total Base Salary</strong> is your core monthly salary before any allowances</li>
481
+ <li><strong>Social Security (SOS)</strong> is calculated as:
482
+ <ul>
483
+ <li>5% of Total Base Salary for South/Central Iraq (min 29,167 IQD/month)</li>
484
+ <li>5% of (Total Base Salary/1.3) for Kurdistan Region (min 37,500 IQD/month)</li>
485
+ </ul>
486
+ </li>
487
+ <li><strong>Taxable Amount</strong> is calculated after deducting SOS and non-taxable portions</li>
488
+ <li><strong>Income Tax</strong> uses progressive brackets (3%, 5%, 10%, 15%) for South/Central Iraq and a flat 5% for KRI</li>
489
+ <li>All <strong>Monthly Allowances</strong> are added to your total income and are fully taxable</li>
490
+ </ul>
491
+ </div>
492
+ </div>
493
+
494
+ <script>
495
+ document.addEventListener('DOMContentLoaded', function() {
496
+ const regionBtns = document.querySelectorAll('.region-btn');
497
+ const iraqInputs = document.getElementById('iraqInputs');
498
+ const calculateBtn = document.getElementById('calculateBtn');
499
+ const addAllowanceBtn = document.getElementById('addAllowanceBtn');
500
+ const allowancesContainer = document.getElementById('allowancesContainer');
501
+ const sosLabel = document.getElementById('sosLabel');
502
+ const sosMinNote = document.getElementById('sosMinNote');
503
+
504
+ // Set initial region
505
+ sosLabel.textContent = 'Social Security (5% of base)';
506
+
507
+ // Region toggle functionality
508
+ regionBtns.forEach(btn => {
509
+ btn.addEventListener('click', function() {
510
+ regionBtns.forEach(b => b.classList.remove('active'));
511
+ this.classList.add('active');
512
+
513
+ if (this.dataset.region === 'iraq') {
514
+ iraqInputs.style.display = 'block';
515
+ sosLabel.textContent = 'Social Security (5% of base)';
516
+ } else {
517
+ iraqInputs.style.display = 'none';
518
+ sosLabel.textContent = 'Social Security (5% of base/1.3)';
519
+ }
520
+
521
+ calculateSalary();
522
+ });
523
+ });
524
+
525
+ // Add allowance functionality
526
+ addAllowanceBtn.addEventListener('click', function() {
527
+ const allowanceItem = document.createElement('div');
528
+ allowanceItem.className = 'allowance-item';
529
+ allowanceItem.innerHTML = `
530
+ <select class="allowance-type">
531
+ <option value="food">Food Allowance</option>
532
+ <option value="transport">Transportation</option>
533
+ <option value="housing">Housing</option>
534
+ <option value="incentive">Incentive/Commissions</option>
535
+ <option value="other">Other</option>
536
+ </select>
537
+ <input type="number" class="allowance-amount" placeholder="Amount">
538
+ <button class="remove-allowance"><i class="fas fa-times"></i></button>
539
+ `;
540
+ allowancesContainer.appendChild(allowanceItem);
541
+
542
+ // Add event listener to the new remove button
543
+ allowanceItem.querySelector('.remove-allowance').addEventListener('click', function() {
544
+ allowanceItem.remove();
545
+ calculateSalary();
546
+ });
547
+
548
+ // Add event listener to the new inputs
549
+ allowanceItem.querySelectorAll('input, select').forEach(input => {
550
+ input.addEventListener('input', calculateSalary);
551
+ });
552
+ });
553
+
554
+ // Add event listeners to existing remove buttons
555
+ document.querySelectorAll('.remove-allowance').forEach(btn => {
556
+ btn.addEventListener('click', function() {
557
+ this.closest('.allowance-item').remove();
558
+ calculateSalary();
559
+ });
560
+ });
561
+
562
+ // Set up event listeners for inputs
563
+ const inputs = document.querySelectorAll('input, select');
564
+ inputs.forEach(input => {
565
+ input.addEventListener('input', calculateSalary);
566
+ });
567
+
568
+ // Calculation function
569
+ function calculateSalary() {
570
+ const isIraq = document.querySelector('.region-btn.active').dataset.region === 'iraq';
571
+ const baseSalary = parseFloat(document.getElementById('baseSalary').value) || 0;
572
+
573
+ // Calculate total allowances
574
+ let totalAllowances = 0;
575
+ document.querySelectorAll('.allowance-item').forEach(item => {
576
+ const amount = parseFloat(item.querySelector('.allowance-amount').value) || 0;
577
+ totalAllowances += amount;
578
+ });
579
+
580
+ // Calculate total income
581
+ const totalIncome = baseSalary + totalAllowances;
582
+
583
+ if (isIraq) {
584
+ calculateIraqSalary(baseSalary, totalAllowances, totalIncome);
585
+ } else {
586
+ calculateKriSalary(baseSalary, totalAllowances, totalIncome);
587
+ }
588
+ }
589
+
590
+ function calculateIraqSalary(baseSalary, totalAllowances, totalIncome) {
591
+ const maritalStatus = document.getElementById('maritalStatus').value;
592
+
593
+ // Calculate SOS (5% of base, min 29,167 IQD/month)
594
+ const calculatedSos = baseSalary * 0.05;
595
+ const minSosIraq = 350000 / 12; // 29,167 IQD/month
596
+ const sos = Math.max(calculatedSos, minSosIraq);
597
+
598
+ // Non-taxable portion (30% of base)
599
+ const nonTaxablePortion = baseSalary * 0.3;
600
+
601
+ // Calculate taxable amount
602
+ let taxableAmount = totalIncome - nonTaxablePortion - sos;
603
+
604
+ // Apply marital status deductions
605
+ const maritalDeductions = {
606
+ single: 2500000 / 12,
607
+ married: 4500000 / 12,
608
+ married1: (4500000 + 200000) / 12,
609
+ married2: (4500000 + 400000) / 12,
610
+ married3: (4500000 + 600000) / 12,
611
+ married4: (4500000 + 800000) / 12,
612
+ divorced: 3200000 / 12,
613
+ divorced1: (3200000 + 200000) / 12,
614
+ divorced2: (3200000 + 400000) / 12
615
+ };
616
+
617
+ const maritalDeduction = maritalDeductions[maritalStatus] || 0;
618
+ taxableAmount -= maritalDeduction;
619
+ if (taxableAmount < 0) taxableAmount = 0;
620
+
621
+ // Apply tax brackets
622
+ let incomeTax = 0;
623
+
624
+ // Tax brackets (monthly)
625
+ const brackets = [
626
+ { limit: 250000 / 12, rate: 0.03 },
627
+ { limit: 500000 / 12, rate: 0.05 },
628
+ { limit: 1000000 / 12, rate: 0.10 },
629
+ { rate: 0.15 } // Above 1,000,000 IQD
630
+ ];
631
+
632
+ let remaining = taxableAmount;
633
+ let prevLimit = 0;
634
+
635
+ for (let i = 0; i < brackets.length; i++) {
636
+ if (remaining <= 0) break;
637
+
638
+ const bracket = brackets[i];
639
+ let taxableInBracket = 0;
640
+
641
+ if (bracket.limit) {
642
+ if (remaining > (bracket.limit - prevLimit)) {
643
+ taxableInBracket = bracket.limit - prevLimit;
644
+ remaining -= taxableInBracket;
645
+ } else {
646
+ taxableInBracket = remaining;
647
+ remaining = 0;
648
+ }
649
+ } else {
650
+ // Last bracket (no upper limit)
651
+ taxableInBracket = remaining;
652
+ remaining = 0;
653
+ }
654
+
655
+ incomeTax += taxableInBracket * bracket.rate;
656
+ prevLimit = bracket.limit || 0;
657
+ }
658
+
659
+ // Calculate net salary
660
+ const totalDeductions = sos + incomeTax;
661
+ const netSalary = totalIncome - totalDeductions;
662
+
663
+ // Update UI
664
+ updateResults(baseSalary, totalAllowances, totalIncome, sos, taxableAmount,
665
+ incomeTax, totalDeductions, netSalary);
666
+
667
+ // Update SOS note
668
+ if (calculatedSos < minSosIraq) {
669
+ sosMinNote.textContent = `Applied minimum: ${formatCurrency(minSosIraq)}/month`;
670
+ sosMinNote.style.display = 'block';
671
+ } else {
672
+ sosMinNote.style.display = 'none';
673
+ }
674
+ }
675
+
676
+ function calculateKriSalary(baseSalary, totalAllowances, totalIncome) {
677
+ // Calculate base for KRI (gross/1.3)
678
+ const kriBase = baseSalary / 1.3;
679
+
680
+ // Calculate SOS (5% of kriBase, min 37,500 IQD/month)
681
+ const calculatedSos = kriBase * 0.05;
682
+ const minSosKri = 450000 / 12; // 37,500 IQD/month
683
+ const sos = Math.max(calculatedSos, minSosKri);
684
+
685
+ // Calculate taxable amount (base - 1,000,000 + allowances)
686
+ let taxableAmount = Math.max(0, kriBase - 1000000) + totalAllowances;
687
+
688
+ // Calculate income tax (5% of taxable amount)
689
+ const incomeTax = taxableAmount * 0.05;
690
+
691
+ // Calculate net salary
692
+ const totalDeductions = sos + incomeTax;
693
+ const netSalary = totalIncome - totalDeductions;
694
+
695
+ // Update UI
696
+ updateResults(baseSalary, totalAllowances, totalIncome, sos, taxableAmount,
697
+ incomeTax, totalDeductions, netSalary);
698
+
699
+ // Update SOS note
700
+ if (calculatedSos < minSosKri) {
701
+ sosMinNote.textContent = `Applied minimum: ${formatCurrency(minSosKri)}/month`;
702
+ sosMinNote.style.display = 'block';
703
+ } else {
704
+ sosMinNote.style.display = 'none';
705
+ }
706
+ }
707
+
708
+ function updateResults(baseSalary, totalAllowances, totalIncome, sos,
709
+ taxableAmount, incomeTax, totalDeductions, netSalary) {
710
+ document.getElementById('baseSalaryResult').textContent = formatCurrency(baseSalary);
711
+ document.getElementById('totalAllowances').textContent = formatCurrency(totalAllowances);
712
+ document.getElementById('totalIncome').textContent = formatCurrency(totalIncome);
713
+ document.getElementById('sos').textContent = formatCurrency(sos);
714
+ document.getElementById('taxableAmount').textContent = formatCurrency(taxableAmount);
715
+ document.getElementById('incomeTax').textContent = formatCurrency(incomeTax);
716
+ document.getElementById('totalDeductions').textContent = formatCurrency(totalDeductions);
717
+ document.getElementById('netSalary').textContent = formatCurrency(netSalary);
718
+ }
719
+
720
+ function formatCurrency(amount) {
721
+ return new Intl.NumberFormat('en-IQ', {
722
+ style: 'currency',
723
+ currency: 'IQD',
724
+ maximumFractionDigits: 0
725
+ }).format(amount);
726
+ }
727
+
728
+ // Set up calculate button
729
+ calculateBtn.addEventListener('click', calculateSalary);
730
+
731
+ // Initial calculation
732
+ calculateSalary();
733
+ });
734
+ </script>
735
+ </body>
736
+ </html>