-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdcaid.html
More file actions
466 lines (396 loc) · 17.6 KB
/
sdcaid.html
File metadata and controls
466 lines (396 loc) · 17.6 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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Claims and Notifications Web App</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #f4f6f8;
font-family: Arial, sans-serif;
}
.section {
margin: 30px 0;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="container">
<h1 class="text-center my-4">Claims and Notifications Web App</h1>
<!-- File a Claim Section -->
<div class="section" id="fileClaimSection">
<h3>File a Claim</h3>
<form id="fileClaimForm">
<div class="mb-3">
<label for="claimTitle" class="form-label">Claim Title</label>
<input type="text" class="form-control" id="claimTitle" placeholder="Enter claim title" required>
</div>
<div class="mb-3">
<label for="claimDescription" class="form-label">Claim Description</label>
<textarea class="form-control" id="claimDescription" rows="4" placeholder="Enter claim details" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit Claim</button>
</form>
</div>
<!-- Lodge Return Section -->
<div class="section" id="lodgeReturnSection">
<h3>Lodge a Return</h3>
<form id="lodgeReturnForm">
<div class="mb-3">
<label for="returnDetails" class="form-label">Return Details</label>
<textarea class="form-control" id="returnDetails" rows="4" placeholder="Enter return details" required></textarea>
</div>
<button type="submit" class="btn btn-success">Submit Return</button>
</form>
</div>
<!-- Submit Request Section -->
<div class="section" id="submitRequestSection">
<h3>Submit a Request</h3>
<form id="submitRequestForm">
<div class="mb-3">
<label for="requestTitle" class="form-label">Request Title</label>
<input type="text" class="form-control" id="requestTitle" placeholder="Enter request title" required>
</div>
<div class="mb-3">
<label for="requestDescription" class="form-label">Request Description</label>
<textarea class="form-control" id="requestDescription" rows="4" placeholder="Enter request details" required></textarea>
</div>
<button type="submit" class="btn btn-info">Submit Request</button>
</form>
</div>
<!-- Election Management Section -->
<div class="section" id="electionManagementSection">
<h3>Manage Elections</h3>
<form id="electionForm">
<div class="mb-3">
<label for="electionAction" class="form-label">Action</label>
<select class="form-control" id="electionAction" required>
<option value="make">Make Election</option>
<option value="cancel">Cancel Election</option>
<option value="vary">Vary Election</option>
</select>
</div>
<button type="submit" class="btn btn-warning">Submit Election Action</button>
</form>
</div>
<!-- Submit Objection Section -->
<div class="section" id="submitObjectionSection">
<h3>Submit an Objection</h3>
<form id="submitObjectionForm">
<div class="mb-3">
<label for="objectionReason" class="form-label">Objection Reason</label>
<textarea class="form-control" id="objectionReason" rows="4" placeholder="Enter reason for objection" required></textarea>
</div>
<button type="submit" class="btn btn-danger">Submit Objection</button>
</form>
</div>
</div>
<!-- JS and Bootstrap Scripts -->
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Set up the Supabase client for backend interaction
const supabase = supabaseJs.createClient(
"https://jbhhfzbhcvzxtthhmfhz.supabase.co",
"YOUR_SUPABASE_ANON_KEY"
);
// Form submissions for various sections
document.getElementById('fileClaimForm').addEventListener('submit', async function (e) {
e.preventDefault();
const title = document.getElementById('claimTitle').value;
const description = document.getElementById('claimDescription').value;
// Add data to Supabase
const { data, error } = await supabase
.from('claims')
.insert([{ title, description }]);
if (error) {
alert('Error submitting claim: ' + error.message);
} else {
alert('Claim submitted successfully!');
}
});
document.getElementById('lodgeReturnForm').addEventListener('submit', async function (e) {
e.preventDefault();
const returnDetails = document.getElementById('returnDetails').value;
// Add data to Supabase
const { data, error } = await supabase
.from('returns')
.insert([{ details: returnDetails }]);
if (error) {
alert('Error lodging return: ' + error.message);
} else {
alert('Return lodged successfully!');
}
});
document.getElementById('submitRequestForm').addEventListener('submit', async function (e) {
e.preventDefault();
const title = document.getElementById('requestTitle').value;
const description = document.getElementById('requestDescription').value;
// Add data to Supabase
const { data, error } = await supabase
.from('requests')
.insert([{ title, description }]);
if (error) {
alert('Error submitting request: ' + error.message);
} else {
alert('Request submitted successfully!');
}
});
document.getElementById('electionForm').addEventListener('submit', function (e) {
e.preventDefault();
const action = document.getElementById('electionAction').value;
alert(`Election action '${action}' submitted successfully!`);
});
document.getElementById('submitObjectionForm').addEventListener('submit', function (e) {
e.preventDefault();
const objectionReason = document.getElementById('objectionReason').value;
alert(`Objection submitted: ${objectionReason}`);
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Public Debt Projections</title>
<!-- jsPDF for PDF export -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<style>
body { font-family: Arial, sans-serif; background: #f4f6f9; padding: 20px; }
nav a { margin-right: 15px; text-decoration: none; color: #003366; font-weight: bold; }
.form-container { background: #fff; padding: 20px; max-width: 950px; margin: 20px auto; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,0.08); }
h2 { color: #003366; text-align: center; margin: 0 0 8px 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display:block; margin-top:10px; font-weight:600; color:#234; }
input, textarea, select { width:100%; padding:8px; margin-top:6px; border:1px solid #ccc; border-radius:6px; font-size:14px; box-sizing:border-box; }
textarea { min-height:90px; }
button { margin-top:14px; background:#003366; color:#fff; padding:10px 12px; border:none; border-radius:6px; cursor:pointer; font-weight:700; }
button.secondary { background:#0b69ff; }
.small { font-size:12px; color:#666; }
table { width:100%; border-collapse:collapse; margin-top:12px; font-size:13px; }
th,td { border:1px solid #e6edf3; padding:6px 8px; text-align:right; }
th:first-child, td:first-child { text-align:left; }
.out { background:#fafbfd; padding:10px; border-radius:6px; border:1px dashed #e3eefc; white-space:pre-wrap; }
.controls { display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
</style>
</head>
<body>
<nav>
<a href="citizenswallet.html">SDC Wallet</a>|
<a href="Sadicoinapi.js">SadicoinApi</a>|
<a href="SadiCoin.html">SadiCoin DApp</a>|
<a href="tokenomics.html">Tokenomics</a>
</nav>
<!-- SME Credit Form -->
<div class="form-container">
<h2>SME Credit Data Submission</h2>
<form id="creditForm">
<label for="name">Company Name</label>
<input type="text" id="name" required>
<label for="taxID">Tax Identification Number</label>
<input type="text" id="taxID" required>
<label for="country">Country</label>
<input type="text" id="country" required>
<label for="financials">Financial Summary</label>
<textarea id="financials" required></textarea>
<label for="docURL">Document URL (PDF)</label>
<input type="url" id="docURL" required>
<button type="submit">Submit Credit Record</button>
</form>
<div id="status" class="small"></div>
</div>
<!-- Debt Projection -->
<div class="form-container" id="debtPanel">
<h2>SadiCoin Tech Debt Projection (multi-year)</h2>
<div class="grid">
<div>
<label>Select Country for Debt Projection</label>
<select id="countrySelect" onchange="showDebtProjectionForm()">
<option value="South Africa">South Africa</option>
<option value="India">India</option>
<option value="Brazil">Brazil</option>
<option value="Kenya">Kenya</option>
<option value="Pakistan">Pakistan</option>
<option value="Nigeria">Nigeria</option>
<option value="Indonesia">Indonesia</option>
<option value="Mexico">Mexico</option>
<option value="Egypt">Egypt</option>
<option value="Vietnam">Vietnam</option>
</select>
<label>Starting Debt (t=0)</label>
<input id="debt0" type="number" step="0.01" value="1000000000">
<label>GDP (current)</label>
<input id="gdp0" type="number" step="0.01" value="5000000000">
<label>Nominal Interest Rate (%)</label>
<input id="i_nom" type="number" step="0.0001" value="5.00">
<label>Nominal GDP Growth Rate (%)</label>
<input id="g_nom" type="number" step="0.0001" value="3.00">
<label>Inflation Rate (%)</label>
<input id="inflation" type="number" step="0.0001" value="2.00">
</div>
<div>
<label>Primary Balance (annual; positive = surplus)</label>
<input id="primaryBal" type="number" step="0.01" value="-20000000">
<label>Overall Balance (annual)</label>
<input id="overallBal" type="number" step="0.01" value="-50000000">
<label>Amortizations (mode)</label>
<select id="amortMode">
<option value="absolute">Absolute annual amount</option>
<option value="pctDebt">Percent of debt (beginning of year)</option>
</select>
<label id="amortLabel">Amortization Amount (abs)</label>
<input id="amortInput" type="number" step="0.01" value="30000000">
<label>Projection Years</label>
<input id="years" type="number" min="1" max="50" value="10">
</div>
</div>
<div class="controls">
<button id="btnProject">Run Projection</button>
<button id="btnDownloadPDF" class="secondary">Download PDF</button>
<button id="btnDownloadXML" class="secondary">Download XML</button>
<button id="btnClear" class="secondary">Clear Results</button>
</div>
<div id="summary" class="out" style="margin-top:12px">Run projection to see results here.</div>
<div id="tableWrapper" style="margin-top:12px; overflow:auto;"></div>
</div>
<!-- UNDP Data Section -->
<div class="form-container">
<h2>UNDP Data (SDG Index)</h2>
<div>
<label>Select Country for SDG Data</label>
<select id="countrySelectSDG" onchange="fetchSDGDataForCountry()">
<option value="South Africa">South Africa</option>
<option value="India">India</option>
<option value="Brazil">Brazil</option>
<option value="Kenya">Kenya</option>
<option value="Pakistan">Pakistan</option>
<option value="Nigeria">Nigeria</option>
<option value="Indonesia">Indonesia</option>
<option value="Mexico">Mexico</option>
<option value="Egypt">Egypt</option>
<option value="Vietnam">Vietnam</option>
</select>
</div>
<div id="sdgDataReport" class="out" style="margin-top:12px;"></div>
</div>
<script>
// Show or hide debt projection form based on selected country
function showDebtProjectionForm() {
document.getElementById('debtPanel').style.display = 'block'; // Show debt projection section
}
// Fetch SDG Data from UNDP API
async function fetchSDGData(country) {
const apiUrl = `https://api.open.undp.org/api/sdg-index.json`; // SDG Index API
try {
const response = await fetch(apiUrl);
const data = await response.json();
const countryData = data.find(item => item.sdg_name === country); // Fetch country-specific data
if (countryData) {
displaySDGData(countryData); // Display SDG data in the report section
} else {
alert('No SDG data found for this country');
}
} catch (error) {
console.error('Error fetching SDG data:', error);
}
}
// Display SDG Data
function displaySDGData(countryData) {
let detailsHTML = `
<h3>SDG Data for ${countryData.sdg_name}</h3>
<p>Total Projects: ${fmt(countryData.total_projects)}</p>
<p>Total Donors: ${fmt(countryData.total_donors)}</p>
<p>Total Budget: $${fmt(countryData.total_budget)}</p>
<p>Total Expenses: $${fmt(countryData.total_expense)}</p>
<p>Progress: ${fmt(countryData.percentage)}%</p>
<h4>Target Details:</h4>
<ul>
`;
countryData.target_details.forEach(target => {
detailsHTML += `
<li>
<strong>${target.target_id}:</strong> ${target.description}<br>
Target Budget: $${fmt(target.target_budget)}<br>
Target Expense: $${fmt(target.target_expense)}<br>
Projects: ${fmt(target.total_projects)}<br>
Donors: ${fmt(target.total_donors)}<br>
</li>
`;
});
detailsHTML += '</ul>';
document.getElementById('sdgDataReport').innerHTML = detailsHTML;
}
// Format numbers with commas
function fmt(num) {
return (typeof num === 'number' && isFinite(num)) ? num.toLocaleString(undefined, { minimumFractionDigits: 2 }) : num;
}
// Run IMF Debt Projection
document.getElementById('btnProject').addEventListener('click', async function() {
const country = document.getElementById('countrySelect').value;
const debt0 = parseFloat(document.getElementById('debt0').value);
const gdp0 = parseFloat(document.getElementById('gdp0').value);
const i_nom = parseFloat(document.getElementById('i_nom').value) / 100;
const g_nom = parseFloat(document.getElementById('g_nom').value) / 100;
const inflation = parseFloat(document.getElementById('inflation').value) / 100;
const primaryBal = parseFloat(document.getElementById('primaryBal').value);
const overallBal = parseFloat(document.getElementById('overallBal').value);
const amortMode = document.getElementById('amortMode').value;
const amortInput = parseFloat(document.getElementById('amortInput').value);
const years = parseInt(document.getElementById('years').value);
let debt = debt0;
let gdp = gdp0;
let results = '';
for (let t = 1; t <= years; t++) {
debt += debt * i_nom + primaryBal + overallBal;
gdp *= (1 + g_nom);
let amortization = amortMode === 'absolute' ? amortInput : debt * amortInput / 100;
debt -= amortization;
results += `Year ${t}: Debt = ${fmt(debt)}, GDP = ${fmt(gdp)}\n`;
}
document.getElementById('summary').innerText = results;
generateTable(debt, gdp, years);
});
// Generate the Debt Projection Table
function generateTable(debt, gdp, years) {
let tableHTML = `<table><thead><tr><th>Year</th><th>Debt</th><th>GDP</th></tr></thead><tbody>`;
for (let i = 1; i <= years; i++) {
tableHTML += `<tr><td>${i}</td><td>${fmt(debt)}</td><td>${fmt(gdp)}</td></tr>`;
debt *= (1 + 0.05); // Growth factor for example
gdp *= (1 + 0.03);
}
tableHTML += `</tbody></table>`;
document.getElementById('tableWrapper').innerHTML = tableHTML;
}
// Download PDF
document.getElementById('btnDownloadPDF').addEventListener('click', function() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.text("IMF Debt Projection Report", 20, 10);
doc.text(document.getElementById('summary').innerText, 20, 30);
doc.save('Debt_Projection_Report.pdf');
});
// Download XML
document.getElementById('btnDownloadXML').addEventListener('click', function() {
let xmlContent = '<?xml version="1.0" encoding="UTF-8"?>\n<DebtProjection>\n';
xmlContent += `<Debt>${fmt(debt)}</Debt>\n<GDP>${fmt(gdp)}</GDP>\n</DebtProjection>`;
const blob = new Blob([xmlContent], { type: 'application/xml' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'Debt_Projection_Report.xml';
link.click();
});
// Clear Results
document.getElementById('btnClear').addEventListener('click', function() {
document.getElementById('summary').innerText = 'Run projection to see results here.';
document.getElementById('tableWrapper').innerHTML = '';
});
</script>
</body>
</html>