Spaces:
Running
Running
Add 2 files
Browse files- README.md +7 -5
- index.html +884 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: privfin-vbeta1-01
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,884 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Import/Export Fin. Industry Tariffs Module</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<style>
|
10 |
+
.floating-btn {
|
11 |
+
position: fixed;
|
12 |
+
bottom: 30px;
|
13 |
+
right: 30px;
|
14 |
+
width: 60px;
|
15 |
+
height: 60px;
|
16 |
+
border-radius: 50%;
|
17 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
18 |
+
transition: all 0.3s ease;
|
19 |
+
z-index: 1000;
|
20 |
+
}
|
21 |
+
.floating-btn:hover {
|
22 |
+
transform: translateY(-5px) scale(1.05);
|
23 |
+
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
|
24 |
+
}
|
25 |
+
.floating-btn-secondary {
|
26 |
+
position: fixed;
|
27 |
+
bottom: 100px;
|
28 |
+
right: 30px;
|
29 |
+
width: 60px;
|
30 |
+
height: 60px;
|
31 |
+
border-radius: 50%;
|
32 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
33 |
+
transition: all 0.3s ease;
|
34 |
+
z-index: 1000;
|
35 |
+
}
|
36 |
+
.floating-btn-secondary:hover {
|
37 |
+
transform: translateY(-5px) scale(1.05);
|
38 |
+
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
|
39 |
+
}
|
40 |
+
.floating-btn-tertiary {
|
41 |
+
position: fixed;
|
42 |
+
bottom: 170px;
|
43 |
+
right: 30px;
|
44 |
+
width: 60px;
|
45 |
+
height: 60px;
|
46 |
+
border-radius: 50%;
|
47 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
48 |
+
transition: all 0.3s ease;
|
49 |
+
z-index: 1000;
|
50 |
+
}
|
51 |
+
.floating-btn-tertiary:hover {
|
52 |
+
transform: translateY(-5px) scale(1.05);
|
53 |
+
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
|
54 |
+
}
|
55 |
+
.modal {
|
56 |
+
transition: all 0.3s ease;
|
57 |
+
opacity: 0;
|
58 |
+
visibility: hidden;
|
59 |
+
}
|
60 |
+
.modal.active {
|
61 |
+
opacity: 1;
|
62 |
+
visibility: visible;
|
63 |
+
}
|
64 |
+
.tariff-slider::-webkit-slider-thumb {
|
65 |
+
-webkit-appearance: none;
|
66 |
+
width: 20px;
|
67 |
+
height: 20px;
|
68 |
+
border-radius: 50%;
|
69 |
+
background: #3B82F6;
|
70 |
+
cursor: pointer;
|
71 |
+
}
|
72 |
+
.animate-pulse {
|
73 |
+
animation: pulse 2s infinite;
|
74 |
+
}
|
75 |
+
@keyframes pulse {
|
76 |
+
0% { transform: scale(1); }
|
77 |
+
50% { transform: scale(1.05); }
|
78 |
+
100% { transform: scale(1); }
|
79 |
+
}
|
80 |
+
.market-share-gauge {
|
81 |
+
width: 100%;
|
82 |
+
height: 20px;
|
83 |
+
background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
|
84 |
+
border-radius: 10px;
|
85 |
+
margin-top: 10px;
|
86 |
+
position: relative;
|
87 |
+
}
|
88 |
+
.gauge-pointer {
|
89 |
+
position: absolute;
|
90 |
+
top: -5px;
|
91 |
+
width: 2px;
|
92 |
+
height: 30px;
|
93 |
+
background: black;
|
94 |
+
transform: translateX(-50%);
|
95 |
+
}
|
96 |
+
.tariff-badge {
|
97 |
+
display: inline-block;
|
98 |
+
padding: 0.25rem 0.5rem;
|
99 |
+
border-radius: 9999px;
|
100 |
+
font-size: 0.75rem;
|
101 |
+
font-weight: 600;
|
102 |
+
}
|
103 |
+
.token-progress {
|
104 |
+
height: 10px;
|
105 |
+
border-radius: 5px;
|
106 |
+
background-color: #e5e7eb;
|
107 |
+
overflow: hidden;
|
108 |
+
}
|
109 |
+
.token-progress-bar {
|
110 |
+
height: 100%;
|
111 |
+
background: linear-gradient(90deg, #8b5cf6, #6366f1);
|
112 |
+
transition: width 0.3s ease;
|
113 |
+
}
|
114 |
+
.yield-farming-card {
|
115 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
|
116 |
+
border-radius: 12px;
|
117 |
+
padding: 1.5rem;
|
118 |
+
position: relative;
|
119 |
+
overflow: hidden;
|
120 |
+
}
|
121 |
+
.yield-farming-card::before {
|
122 |
+
content: "";
|
123 |
+
position: absolute;
|
124 |
+
top: -50%;
|
125 |
+
left: -50%;
|
126 |
+
width: 200%;
|
127 |
+
height: 200%;
|
128 |
+
background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
|
129 |
+
transform: rotate(45deg);
|
130 |
+
animation: shine 3s infinite;
|
131 |
+
}
|
132 |
+
@keyframes shine {
|
133 |
+
0% { transform: translateX(-100%) rotate(45deg); }
|
134 |
+
100% { transform: translateX(100%) rotate(45deg); }
|
135 |
+
}
|
136 |
+
.bitcoin-address {
|
137 |
+
font-family: monospace;
|
138 |
+
letter-spacing: 1px;
|
139 |
+
}
|
140 |
+
.mining-estimate {
|
141 |
+
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
|
142 |
+
border-left: 4px solid #f59e0b;
|
143 |
+
}
|
144 |
+
</style>
|
145 |
+
</head>
|
146 |
+
<body class="bg-gray-50 min-h-screen">
|
147 |
+
<div class="container mx-auto px-4 py-12 max-w-4xl">
|
148 |
+
<div class="text-center mb-12">
|
149 |
+
<h1 class="text-4xl font-bold text-blue-800 mb-2">Business Loan Calculator</h1>
|
150 |
+
<p class="text-lg text-gray-600">Calculate your loan with industry-specific tariff adjustments</p>
|
151 |
+
</div>
|
152 |
+
|
153 |
+
<div class="bg-white rounded-xl shadow-lg p-6 mb-8">
|
154 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
155 |
+
<div>
|
156 |
+
<label class="block text-gray-700 font-medium mb-2">Loan Amount ($)</label>
|
157 |
+
<input type="number" id="loanAmount" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 100000" value="100000">
|
158 |
+
</div>
|
159 |
+
|
160 |
+
<div>
|
161 |
+
<label class="block text-gray-700 font-medium mb-2">Prime Interest Rate (%)</label>
|
162 |
+
<input type="number" id="primeRate" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 7.5" value="7.5" step="0.01">
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
|
166 |
+
<div class="mt-6">
|
167 |
+
<label class="block text-gray-700 font-medium mb-2">Industry/Product Category</label>
|
168 |
+
<select id="industrySelect" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
169 |
+
<option value="">Select an industry or product</option>
|
170 |
+
<option value="steel">Steel & Aluminum (25%)</option>
|
171 |
+
<option value="agriculture">Agricultural Products (15%)</option>
|
172 |
+
<option value="automotive">Automotive Parts (27.5%)</option>
|
173 |
+
<option value="electronics">Consumer Electronics (10%)</option>
|
174 |
+
<option value="textiles">Textiles & Apparel (12%)</option>
|
175 |
+
<option value="chemicals">Chemicals (8%)</option>
|
176 |
+
<option value="machinery">Industrial Machinery (7%)</option>
|
177 |
+
<option value="pharmaceuticals">Pharmaceuticals (5%)</option>
|
178 |
+
<option value="custom">Custom Tariff</option>
|
179 |
+
</select>
|
180 |
+
</div>
|
181 |
+
|
182 |
+
<div class="mt-6 hidden" id="customTariffSection">
|
183 |
+
<label class="block text-gray-700 font-medium mb-2">Custom Tariff Percentage (0-100%)</label>
|
184 |
+
<input type="range" id="tariffSlider" min="0" max="100" value="5" class="w-full tariff-slider h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
185 |
+
<div class="flex justify-between mt-2">
|
186 |
+
<span class="text-sm text-gray-500">0%</span>
|
187 |
+
<span id="tariffValue" class="font-medium text-blue-600">5%</span>
|
188 |
+
<span class="text-sm text-gray-500">100%</span>
|
189 |
+
</div>
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<div class="mt-6 bg-blue-50 p-4 rounded-lg">
|
193 |
+
<div class="flex justify-between items-center">
|
194 |
+
<span class="text-blue-700 font-medium">Total Tariff to be Paid:</span>
|
195 |
+
<span id="totalTariffDisplay" class="text-xl font-bold text-blue-800">$0 (0%)</span>
|
196 |
+
</div>
|
197 |
+
<div id="tariffBreakdown" class="mt-2 text-sm text-blue-600">
|
198 |
+
<!-- Tariff breakdown will appear here -->
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
|
202 |
+
<div class="mt-8">
|
203 |
+
<button id="calculateBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 transform hover:scale-105 animate-pulse">
|
204 |
+
Calculate Loan Terms
|
205 |
+
</button>
|
206 |
+
</div>
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<div id="results" class="bg-white rounded-xl shadow-lg p-6 hidden">
|
210 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-4">Loan Summary</h2>
|
211 |
+
|
212 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
213 |
+
<div class="bg-blue-50 p-4 rounded-lg">
|
214 |
+
<p class="text-sm text-blue-600 font-medium">Total Loan Amount</p>
|
215 |
+
<p id="totalLoan" class="text-2xl font-bold text-blue-800">$105,000</p>
|
216 |
+
</div>
|
217 |
+
<div class="bg-green-50 p-4 rounded-lg">
|
218 |
+
<p class="text-sm text-green-600 font-medium">Effective Interest Rate</p>
|
219 |
+
<p id="effectiveRate" class="text-2xl font-bold text-green-800">7.88%</p>
|
220 |
+
</div>
|
221 |
+
<div class="bg-purple-50 p-4 rounded-lg">
|
222 |
+
<p class="text-sm text-purple-600 font-medium">Monthly Payment</p>
|
223 |
+
<p id="monthlyPayment" class="text-2xl font-bold text-purple-800">$2,123</p>
|
224 |
+
</div>
|
225 |
+
</div>
|
226 |
+
|
227 |
+
<h3 class="text-lg font-semibold text-gray-700 mb-3">5-Year Amortization Schedule</h3>
|
228 |
+
<div class="overflow-x-auto">
|
229 |
+
<table class="min-w-full bg-white rounded-lg overflow-hidden">
|
230 |
+
<thead class="bg-gray-100">
|
231 |
+
<tr>
|
232 |
+
<th class="py-3 px-4 text-left text-gray-600">Year</th>
|
233 |
+
<th class="py-3 px-4 text-right text-gray-600">Principal</th>
|
234 |
+
<th class="py-3 px-4 text-right text-gray-600">Interest</th>
|
235 |
+
<th class="py-3 px-4 text-right text-gray-600">Balance</th>
|
236 |
+
</tr>
|
237 |
+
</thead>
|
238 |
+
<tbody id="amortizationTable" class="divide-y divide-gray-200">
|
239 |
+
<!-- Amortization data will be inserted here -->
|
240 |
+
</tbody>
|
241 |
+
</table>
|
242 |
+
</div>
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
+
|
246 |
+
<!-- Floating Buttons -->
|
247 |
+
<button id="buyDownBtn" class="floating-btn bg-blue-600 text-white flex items-center justify-center hover:bg-blue-700">
|
248 |
+
<i class="fas fa-percentage text-2xl"></i>
|
249 |
+
</button>
|
250 |
+
|
251 |
+
<button id="marketShareBtn" class="floating-btn-secondary bg-green-600 text-white flex items-center justify-center hover:bg-green-700">
|
252 |
+
<i class="fas fa-chart-pie text-2xl"></i>
|
253 |
+
</button>
|
254 |
+
|
255 |
+
<button id="tokenMintBtn" class="floating-btn-tertiary bg-purple-600 text-white flex items-center justify-center hover:bg-purple-700">
|
256 |
+
<i class="fas fa-coins text-2xl"></i>
|
257 |
+
</button>
|
258 |
+
|
259 |
+
<!-- Buy Down Modal -->
|
260 |
+
<div id="buyDownModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
|
261 |
+
<div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
|
262 |
+
<div class="flex justify-between items-center mb-4">
|
263 |
+
<h3 class="text-xl font-bold text-gray-800">Interest Rate Buy Down</h3>
|
264 |
+
<button id="closeModal" class="text-gray-500 hover:text-gray-700">
|
265 |
+
<i class="fas fa-times"></i>
|
266 |
+
</button>
|
267 |
+
</div>
|
268 |
+
|
269 |
+
<div class="mb-4">
|
270 |
+
<label class="block text-gray-700 font-medium mb-2">Buy Down Points (0-5)</label>
|
271 |
+
<input type="range" id="buyDownSlider" min="0" max="5" value="0" step="0.25" class="w-full tariff-slider h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
272 |
+
<div class="flex justify-between mt-2">
|
273 |
+
<span class="text-sm text-gray-500">0 points</span>
|
274 |
+
<span id="buyDownValue" class="font-medium text-blue-600">0 points</span>
|
275 |
+
<span class="text-sm text-gray-500">5 points</span>
|
276 |
+
</div>
|
277 |
+
<p class="text-sm text-gray-500 mt-2">Each point reduces rate by 0.25% (costs 1% of loan amount)</p>
|
278 |
+
</div>
|
279 |
+
|
280 |
+
<div class="mb-4">
|
281 |
+
<label class="block text-gray-700 font-medium mb-2">Fractal Bitcoin Mining Address</label>
|
282 |
+
<input type="text" id="bitcoinAddress" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bitcoin-address" placeholder="bc1qxy2kgdygjrsqtzq2n0yrf249nw3q2k6x..." pattern="^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$">
|
283 |
+
<p class="text-xs text-gray-500 mt-1">Enter your Bitcoin address to apply mining rewards to loan</p>
|
284 |
+
</div>
|
285 |
+
|
286 |
+
<div class="mining-estimate p-4 rounded-lg mb-4">
|
287 |
+
<h4 class="font-medium text-yellow-800 mb-2">Quarterly Mining Estimate</h4>
|
288 |
+
<div class="grid grid-cols-2 gap-2">
|
289 |
+
<div>
|
290 |
+
<p class="text-xs text-yellow-700">Estimated BTC Mined:</p>
|
291 |
+
<p id="estimatedBTC" class="font-bold">0.0025 BTC</p>
|
292 |
+
</div>
|
293 |
+
<div>
|
294 |
+
<p class="text-xs text-yellow-700">Buydown Points:</p>
|
295 |
+
<p id="miningPoints" class="font-bold">0.5 points</p>
|
296 |
+
</div>
|
297 |
+
<div>
|
298 |
+
<p class="text-xs text-yellow-700">Rate Reduction:</p>
|
299 |
+
<p id="miningRateReduction" class="font-bold">0.125%</p>
|
300 |
+
</div>
|
301 |
+
<div>
|
302 |
+
<p class="text-xs text-yellow-700">Loan Impact:</p>
|
303 |
+
<p id="miningLoanImpact" class="font-bold">-$1,250</p>
|
304 |
+
</div>
|
305 |
+
</div>
|
306 |
+
<p class="text-xs text-yellow-700 mt-2">* Estimates based on current mining difficulty and BTC price</p>
|
307 |
+
</div>
|
308 |
+
|
309 |
+
<div class="bg-blue-50 p-4 rounded-lg mb-4">
|
310 |
+
<p class="text-sm text-blue-600 font-medium">New Interest Rate</p>
|
311 |
+
<p id="newRate" class="text-xl font-bold text-blue-800">7.50%</p>
|
312 |
+
<p class="text-sm text-blue-600 font-medium mt-2">Buy Down Cost</p>
|
313 |
+
<p id="buyDownCost" class="text-xl font-bold text-blue-800">$0</p>
|
314 |
+
</div>
|
315 |
+
|
316 |
+
<button id="applyBuyDown" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
|
317 |
+
Apply Buy Down
|
318 |
+
</button>
|
319 |
+
</div>
|
320 |
+
</div>
|
321 |
+
|
322 |
+
<!-- Market Share Modal -->
|
323 |
+
<div id="marketShareModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
|
324 |
+
<div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
|
325 |
+
<div class="flex justify-between items-center mb-4">
|
326 |
+
<h3 class="text-xl font-bold text-gray-800">Market Share Impact</h3>
|
327 |
+
<button id="closeMarketShareModal" class="text-gray-500 hover:text-gray-700">
|
328 |
+
<i class="fas fa-times"></i>
|
329 |
+
</button>
|
330 |
+
</div>
|
331 |
+
|
332 |
+
<div class="mb-4">
|
333 |
+
<div class="flex justify-between mb-2">
|
334 |
+
<span class="font-medium text-red-600">Market Share Loss</span>
|
335 |
+
<span id="marketShareLoss" class="font-bold">5%</span>
|
336 |
+
</div>
|
337 |
+
<div class="flex justify-between mb-4">
|
338 |
+
<span class="font-medium text-green-600">Cost Savings</span>
|
339 |
+
<span id="costSavings" class="font-bold">15%</span>
|
340 |
+
</div>
|
341 |
+
|
342 |
+
<div class="market-share-gauge">
|
343 |
+
<div id="gaugePointer" class="gauge-pointer" style="left: 25%;"></div>
|
344 |
+
</div>
|
345 |
+
<div class="flex justify-between mt-2 text-xs">
|
346 |
+
<span>High Loss</span>
|
347 |
+
<span>Balanced</span>
|
348 |
+
<span>High Savings</span>
|
349 |
+
</div>
|
350 |
+
</div>
|
351 |
+
|
352 |
+
<div class="bg-gray-50 p-4 rounded-lg mb-4">
|
353 |
+
<p class="text-sm text-gray-700">
|
354 |
+
<span class="font-medium">Analysis:</span>
|
355 |
+
<span id="marketShareAnalysis">Using tariff financing results in moderate market share impact but significant cost savings.</span>
|
356 |
+
</p>
|
357 |
+
</div>
|
358 |
+
|
359 |
+
<button id="closeMarketShareBtn" class="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
|
360 |
+
Close
|
361 |
+
</button>
|
362 |
+
</div>
|
363 |
+
</div>
|
364 |
+
|
365 |
+
<!-- Token Minting Modal -->
|
366 |
+
<div id="tokenMintModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
|
367 |
+
<div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
|
368 |
+
<div class="flex justify-between items-center mb-4">
|
369 |
+
<h3 class="text-xl font-bold text-gray-800">Mint FFFUND Tokens</h3>
|
370 |
+
<button id="closeTokenModal" class="text-gray-500 hover:text-gray-700">
|
371 |
+
<i class="fas fa-times"></i>
|
372 |
+
</button>
|
373 |
+
</div>
|
374 |
+
|
375 |
+
<div class="yield-farming-card mb-6">
|
376 |
+
<div class="flex justify-between items-center mb-2">
|
377 |
+
<span class="font-bold text-purple-700">Fabric Flow Fund™ (FFFUND)</span>
|
378 |
+
<span class="bg-purple-100 text-purple-800 text-xs font-medium px-2.5 py-0.5 rounded">BRC-20</span>
|
379 |
+
</div>
|
380 |
+
<p class="text-sm text-gray-600 mb-3">Yield farming token to fund your business loan with competitive APY</p>
|
381 |
+
|
382 |
+
<div class="grid grid-cols-2 gap-4 mb-3">
|
383 |
+
<div>
|
384 |
+
<p class="text-xs text-gray-500">Total Supply</p>
|
385 |
+
<p class="font-medium">50,000,000,000</p>
|
386 |
+
</div>
|
387 |
+
<div>
|
388 |
+
<p class="text-xs text-gray-500">Min Mint</p>
|
389 |
+
<p class="font-medium">10,000</p>
|
390 |
+
</div>
|
391 |
+
<div>
|
392 |
+
<p class="text-xs text-gray-500">Current APY</p>
|
393 |
+
<p class="font-medium text-green-600">11.0%</p>
|
394 |
+
</div>
|
395 |
+
<div>
|
396 |
+
<p class="text-xs text-gray-500">Your Balance</p>
|
397 |
+
<p id="tokenBalance" class="font-medium">0 FFFUND</p>
|
398 |
+
</div>
|
399 |
+
</div>
|
400 |
+
|
401 |
+
<div class="mb-2">
|
402 |
+
<p class="text-xs text-gray-500">Tokens Minted</p>
|
403 |
+
<div class="token-progress mt-1">
|
404 |
+
<div id="tokenProgressBar" class="token-progress-bar" style="width: 0.01%"></div>
|
405 |
+
</div>
|
406 |
+
<p class="text-right text-xs mt-1"><span id="mintedPercentage">0.01</span>% of total supply</p>
|
407 |
+
</div>
|
408 |
+
</div>
|
409 |
+
|
410 |
+
<div class="mb-4">
|
411 |
+
<label class="block text-gray-700 font-medium mb-2">Amount to Mint (Min 10,000 FFFUND)</label>
|
412 |
+
<input type="number" id="mintAmount" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" placeholder="e.g. 10000" min="10000">
|
413 |
+
</div>
|
414 |
+
|
415 |
+
<div class="bg-purple-50 p-4 rounded-lg mb-4">
|
416 |
+
<div class="flex justify-between mb-2">
|
417 |
+
<span class="text-purple-700 font-medium">Current Price:</span>
|
418 |
+
<span class="font-bold">$0.0025 per FFFUND</span>
|
419 |
+
</div>
|
420 |
+
<div class="flex justify-between">
|
421 |
+
<span class="text-purple-700 font-medium">Total Cost:</span>
|
422 |
+
<span id="mintCost" class="font-bold">$0</span>
|
423 |
+
</div>
|
424 |
+
</div>
|
425 |
+
|
426 |
+
<div class="bg-blue-50 p-4 rounded-lg mb-4">
|
427 |
+
<h4 class="font-medium text-blue-700 mb-2">Yield Farming Information</h4>
|
428 |
+
<p class="text-sm text-blue-600">Your minted tokens are automatically staked in our yield farming pool earning 11.0% APY. Rewards are compounded quarterly and can be used to reduce your loan balance.</p>
|
429 |
+
</div>
|
430 |
+
|
431 |
+
<button id="mintTokensBtn" class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 flex items-center justify-center">
|
432 |
+
<i class="fas fa-coins mr-2"></i> Mint FFFUND Tokens
|
433 |
+
</button>
|
434 |
+
|
435 |
+
<div class="mt-4 text-xs text-gray-500">
|
436 |
+
<p>Transaction Hash: 05fe51dc570f24741689b074a3f10b1296fdd2c96f04d00225e3c9cf792a9990</p>
|
437 |
+
<p>Inscription #1,545,104,328 | Size: 346 bytes | Content: 78b</p>
|
438 |
+
<p>Deployed: 03/19/2025, 11:39:13</p>
|
439 |
+
</div>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
|
443 |
+
<script>
|
444 |
+
// Industry tariff data (name, percentage, description)
|
445 |
+
const industryTariffs = {
|
446 |
+
steel: { name: "Steel & Aluminum", rate: 25, desc: "Current US tariffs on imported steel and aluminum products" },
|
447 |
+
agriculture: { name: "Agricultural Products", rate: 15, desc: "Tariffs affecting soybeans, dairy, pork and other farm goods" },
|
448 |
+
automotive: { name: "Automotive Parts", rate: 27.5, desc: "Tariffs on imported auto parts and vehicles" },
|
449 |
+
electronics: { name: "Consumer Electronics", rate: 10, desc: "Tariffs on smartphones, laptops, and other electronics" },
|
450 |
+
textiles: { name: "Textiles & Apparel", rate: 12, desc: "Import duties on clothing and fabric products" },
|
451 |
+
chemicals: { name: "Chemicals", rate: 8, desc: "Tariffs on industrial chemicals and fertilizers" },
|
452 |
+
machinery: { name: "Industrial Machinery", rate: 7, desc: "Duties on manufacturing equipment and machinery" },
|
453 |
+
pharmaceuticals: { name: "Pharmaceuticals", rate: 5, desc: "Import tariffs on medicines and medical supplies" },
|
454 |
+
custom: { name: "Custom Tariff", rate: 0, desc: "Set your own tariff percentage" }
|
455 |
+
};
|
456 |
+
|
457 |
+
// Token data
|
458 |
+
const tokenData = {
|
459 |
+
ticker: "FFFD",
|
460 |
+
name: "Fabric Flow Fund",
|
461 |
+
price: 0.0025,
|
462 |
+
totalSupply: 50000000000,
|
463 |
+
minted: 6000000000, // 12% minted
|
464 |
+
minMint: 10000,
|
465 |
+
apy: 18.5,
|
466 |
+
userBalance: 0,
|
467 |
+
transactionHash: "05fe51dc570f24741689b074a3f10b1296fdd2c96f04d00225e3c9cf792a9990",
|
468 |
+
inscription: "1,545,104,328",
|
469 |
+
size: "346 bytes",
|
470 |
+
content: "78b",
|
471 |
+
deployed: "03/19/2025, 11:39:13"
|
472 |
+
};
|
473 |
+
|
474 |
+
// DOM Elements
|
475 |
+
const loanAmountInput = document.getElementById('loanAmount');
|
476 |
+
const primeRateInput = document.getElementById('primeRate');
|
477 |
+
const industrySelect = document.getElementById('industrySelect');
|
478 |
+
const customTariffSection = document.getElementById('customTariffSection');
|
479 |
+
const tariffSlider = document.getElementById('tariffSlider');
|
480 |
+
const tariffValue = document.getElementById('tariffValue');
|
481 |
+
const totalTariffDisplay = document.getElementById('totalTariffDisplay');
|
482 |
+
const tariffBreakdown = document.getElementById('tariffBreakdown');
|
483 |
+
const calculateBtn = document.getElementById('calculateBtn');
|
484 |
+
const resultsSection = document.getElementById('results');
|
485 |
+
const totalLoanDisplay = document.getElementById('totalLoan');
|
486 |
+
const effectiveRateDisplay = document.getElementById('effectiveRate');
|
487 |
+
const monthlyPaymentDisplay = document.getElementById('monthlyPayment');
|
488 |
+
const amortizationTable = document.getElementById('amortizationTable');
|
489 |
+
const buyDownBtn = document.getElementById('buyDownBtn');
|
490 |
+
const buyDownModal = document.getElementById('buyDownModal');
|
491 |
+
const closeModal = document.getElementById('closeModal');
|
492 |
+
const buyDownSlider = document.getElementById('buyDownSlider');
|
493 |
+
const buyDownValue = document.getElementById('buyDownValue');
|
494 |
+
const newRateDisplay = document.getElementById('newRate');
|
495 |
+
const buyDownCostDisplay = document.getElementById('buyDownCost');
|
496 |
+
const applyBuyDown = document.getElementById('applyBuyDown');
|
497 |
+
const marketShareBtn = document.getElementById('marketShareBtn');
|
498 |
+
const marketShareModal = document.getElementById('marketShareModal');
|
499 |
+
const closeMarketShareModal = document.getElementById('closeMarketShareModal');
|
500 |
+
const closeMarketShareBtn = document.getElementById('closeMarketShareBtn');
|
501 |
+
const marketShareLoss = document.getElementById('marketShareLoss');
|
502 |
+
const costSavings = document.getElementById('costSavings');
|
503 |
+
const marketShareAnalysis = document.getElementById('marketShareAnalysis');
|
504 |
+
const gaugePointer = document.getElementById('gaugePointer');
|
505 |
+
const tokenMintBtn = document.getElementById('tokenMintBtn');
|
506 |
+
const tokenMintModal = document.getElementById('tokenMintModal');
|
507 |
+
const closeTokenModal = document.getElementById('closeTokenModal');
|
508 |
+
const mintAmount = document.getElementById('mintAmount');
|
509 |
+
const mintCost = document.getElementById('mintCost');
|
510 |
+
const mintTokensBtn = document.getElementById('mintTokensBtn');
|
511 |
+
const tokenBalance = document.getElementById('tokenBalance');
|
512 |
+
const tokenProgressBar = document.getElementById('tokenProgressBar');
|
513 |
+
const mintedPercentage = document.getElementById('mintedPercentage');
|
514 |
+
const bitcoinAddress = document.getElementById('bitcoinAddress');
|
515 |
+
const estimatedBTC = document.getElementById('estimatedBTC');
|
516 |
+
const miningPoints = document.getElementById('miningPoints');
|
517 |
+
const miningRateReduction = document.getElementById('miningRateReduction');
|
518 |
+
const miningLoanImpact = document.getElementById('miningLoanImpact');
|
519 |
+
|
520 |
+
// Variables
|
521 |
+
let currentLoanData = null;
|
522 |
+
let currentRate = parseFloat(primeRateInput.value);
|
523 |
+
let currentTariff = 0;
|
524 |
+
let currentIndustry = null;
|
525 |
+
|
526 |
+
// Event Listeners
|
527 |
+
industrySelect.addEventListener('change', updateIndustryTariff);
|
528 |
+
tariffSlider.addEventListener('input', updateTariffValue);
|
529 |
+
calculateBtn.addEventListener('click', calculateLoan);
|
530 |
+
buyDownBtn.addEventListener('click', openBuyDownModal);
|
531 |
+
closeModal.addEventListener('click', closeBuyDownModal);
|
532 |
+
buyDownSlider.addEventListener('input', updateBuyDownValue);
|
533 |
+
applyBuyDown.addEventListener('click', applyBuyDownPoints);
|
534 |
+
marketShareBtn.addEventListener('click', openMarketShareModal);
|
535 |
+
closeMarketShareModal.addEventListener('click', closeMarketShareModalFunc);
|
536 |
+
closeMarketShareBtn.addEventListener('click', closeMarketShareModalFunc);
|
537 |
+
tokenMintBtn.addEventListener('click', openTokenMintModal);
|
538 |
+
closeTokenModal.addEventListener('click', closeTokenMintModal);
|
539 |
+
mintAmount.addEventListener('input', updateMintCost);
|
540 |
+
mintTokensBtn.addEventListener('click', mintTokens);
|
541 |
+
bitcoinAddress.addEventListener('input', updateMiningEstimates);
|
542 |
+
|
543 |
+
// Initialize
|
544 |
+
updateTariffValue();
|
545 |
+
updateBuyDownValue();
|
546 |
+
updateTokenInfo();
|
547 |
+
|
548 |
+
// Functions
|
549 |
+
function updateIndustryTariff() {
|
550 |
+
const selectedValue = industrySelect.value;
|
551 |
+
|
552 |
+
if (selectedValue === '') {
|
553 |
+
currentIndustry = null;
|
554 |
+
currentTariff = 0;
|
555 |
+
customTariffSection.classList.add('hidden');
|
556 |
+
updateTariffDisplay();
|
557 |
+
return;
|
558 |
+
}
|
559 |
+
|
560 |
+
if (selectedValue === 'custom') {
|
561 |
+
currentIndustry = industryTariffs.custom;
|
562 |
+
customTariffSection.classList.remove('hidden');
|
563 |
+
currentTariff = parseInt(tariffSlider.value);
|
564 |
+
} else {
|
565 |
+
currentIndustry = industryTariffs[selectedValue];
|
566 |
+
customTariffSection.classList.add('hidden');
|
567 |
+
currentTariff = currentIndustry.rate;
|
568 |
+
}
|
569 |
+
|
570 |
+
updateTariffDisplay();
|
571 |
+
}
|
572 |
+
|
573 |
+
function updateTariffValue() {
|
574 |
+
currentTariff = parseInt(tariffSlider.value);
|
575 |
+
tariffValue.textContent = `${currentTariff}%`;
|
576 |
+
|
577 |
+
if (currentIndustry && currentIndustry.name === "Custom Tariff") {
|
578 |
+
currentIndustry.rate = currentTariff;
|
579 |
+
updateTariffDisplay();
|
580 |
+
}
|
581 |
+
}
|
582 |
+
|
583 |
+
function updateTariffDisplay() {
|
584 |
+
const loanAmount = parseFloat(loanAmountInput.value) || 0;
|
585 |
+
const tariffAmount = loanAmount * (currentTariff / 100);
|
586 |
+
|
587 |
+
totalTariffDisplay.textContent = `$${tariffAmount.toLocaleString('en-US', {maximumFractionDigits: 2})} (${currentTariff}%)`;
|
588 |
+
|
589 |
+
if (currentIndustry) {
|
590 |
+
let badgeColor = 'bg-blue-100 text-blue-800';
|
591 |
+
if (currentTariff >= 20) badgeColor = 'bg-red-100 text-red-800';
|
592 |
+
else if (currentTariff >= 10) badgeColor = 'bg-yellow-100 text-yellow-800';
|
593 |
+
else if (currentTariff > 0) badgeColor = 'bg-green-100 text-green-800';
|
594 |
+
|
595 |
+
tariffBreakdown.innerHTML = `
|
596 |
+
<div class="flex items-center justify-between">
|
597 |
+
<span>${currentIndustry.name}</span>
|
598 |
+
<span class="${badgeColor} tariff-badge">${currentTariff}% tariff</span>
|
599 |
+
</div>
|
600 |
+
<p class="mt-1 text-xs">${currentIndustry.desc}</p>
|
601 |
+
`;
|
602 |
+
} else {
|
603 |
+
tariffBreakdown.innerHTML = '<p class="text-sm">No industry selected</p>';
|
604 |
+
}
|
605 |
+
}
|
606 |
+
|
607 |
+
function updateBuyDownValue() {
|
608 |
+
const points = parseFloat(buyDownSlider.value);
|
609 |
+
buyDownValue.textContent = `${points} point${points !== 1 ? 's' : ''}`;
|
610 |
+
|
611 |
+
// Calculate new rate and cost
|
612 |
+
const loanAmount = parseFloat(loanAmountInput.value) || 0;
|
613 |
+
const rateReduction = points * 0.25;
|
614 |
+
const newRate = currentRate - rateReduction;
|
615 |
+
const buyDownCost = loanAmount * (points * 0.01);
|
616 |
+
|
617 |
+
newRateDisplay.textContent = `${newRate.toFixed(2)}%`;
|
618 |
+
buyDownCostDisplay.textContent = `$${buyDownCost.toFixed(2)}`;
|
619 |
+
}
|
620 |
+
|
621 |
+
function updateMiningEstimates() {
|
622 |
+
const address = bitcoinAddress.value;
|
623 |
+
if (!address || address.length < 10) return;
|
624 |
+
|
625 |
+
// Simulate mining estimates (in a real app, this would call an API)
|
626 |
+
const loanAmount = parseFloat(loanAmountInput.value) || 0;
|
627 |
+
const btcMined = 0.0025; // Example BTC mined per quarter
|
628 |
+
const btcPrice = 40000; // Example BTC price in USD
|
629 |
+
const btcValue = btcMined * btcPrice;
|
630 |
+
|
631 |
+
// Each point costs 1% of loan amount
|
632 |
+
const pointsPerQuarter = btcValue / (loanAmount * 0.01);
|
633 |
+
const rateReduction = pointsPerQuarter * 0.25;
|
634 |
+
const loanImpact = btcValue * -1;
|
635 |
+
|
636 |
+
estimatedBTC.textContent = `${btcMined.toFixed(4)} BTC`;
|
637 |
+
miningPoints.textContent = `${pointsPerQuarter.toFixed(1)} points`;
|
638 |
+
miningRateReduction.textContent = `${rateReduction.toFixed(3)}%`;
|
639 |
+
miningLoanImpact.textContent = `-$${Math.abs(loanImpact).toLocaleString('en-US', {maximumFractionDigits: 0})}`;
|
640 |
+
}
|
641 |
+
|
642 |
+
function openBuyDownModal() {
|
643 |
+
buyDownModal.classList.add('active');
|
644 |
+
// Update values in case they changed
|
645 |
+
buyDownSlider.value = 0;
|
646 |
+
updateBuyDownValue();
|
647 |
+
bitcoinAddress.value = '';
|
648 |
+
updateMiningEstimates();
|
649 |
+
}
|
650 |
+
|
651 |
+
function closeBuyDownModal() {
|
652 |
+
buyDownModal.classList.remove('active');
|
653 |
+
}
|
654 |
+
|
655 |
+
function openMarketShareModal() {
|
656 |
+
if (!currentLoanData) {
|
657 |
+
alert("Please calculate loan terms first");
|
658 |
+
return;
|
659 |
+
}
|
660 |
+
|
661 |
+
marketShareModal.classList.add('active');
|
662 |
+
updateMarketShareAnalysis();
|
663 |
+
}
|
664 |
+
|
665 |
+
function closeMarketShareModalFunc() {
|
666 |
+
marketShareModal.classList.remove('active');
|
667 |
+
}
|
668 |
+
|
669 |
+
function openTokenMintModal() {
|
670 |
+
tokenMintModal.classList.add('active');
|
671 |
+
updateTokenInfo();
|
672 |
+
}
|
673 |
+
|
674 |
+
function closeTokenMintModal() {
|
675 |
+
tokenMintModal.classList.remove('active');
|
676 |
+
}
|
677 |
+
|
678 |
+
function updateMarketShareAnalysis() {
|
679 |
+
// Calculate market share impact based on tariff percentage
|
680 |
+
const tariff = currentLoanData.tariff;
|
681 |
+
|
682 |
+
// Market share loss increases with higher tariffs (0-20% range)
|
683 |
+
const shareLoss = Math.min(20, tariff * 0.4);
|
684 |
+
|
685 |
+
// Cost savings increase with higher tariffs (0-30% range)
|
686 |
+
const savings = Math.min(30, tariff * 0.6);
|
687 |
+
|
688 |
+
// Calculate position on gauge (0-100% where 0 is all loss, 100 is all savings)
|
689 |
+
const gaugePosition = 100 - (shareLoss / (shareLoss + savings) * 100);
|
690 |
+
|
691 |
+
marketShareLoss.textContent = `${shareLoss.toFixed(1)}%`;
|
692 |
+
costSavings.textContent = `${savings.toFixed(1)}%`;
|
693 |
+
gaugePointer.style.left = `${gaugePosition}%`;
|
694 |
+
|
695 |
+
// Update analysis text with industry-specific context
|
696 |
+
let analysisText = "";
|
697 |
+
if (!currentIndustry) {
|
698 |
+
analysisText = "No industry selected for tariff analysis.";
|
699 |
+
} else if (tariff < 10) {
|
700 |
+
analysisText = `Low ${currentIndustry.name} tariff (${tariff}%) results in minimal market share impact but limited cost savings.`;
|
701 |
+
} else if (tariff < 20) {
|
702 |
+
analysisText = `Moderate ${currentIndustry.name} tariff (${tariff}%) provides good balance between market share impact and cost savings.`;
|
703 |
+
} else {
|
704 |
+
analysisText = `High ${currentIndustry.name} tariff (${tariff}%) provides significant cost savings but may substantially impact market share.`;
|
705 |
+
}
|
706 |
+
|
707 |
+
marketShareAnalysis.textContent = analysisText;
|
708 |
+
}
|
709 |
+
|
710 |
+
function updateMintCost() {
|
711 |
+
const amount = parseFloat(mintAmount.value) || 0;
|
712 |
+
const cost = amount * tokenData.price;
|
713 |
+
mintCost.textContent = `$${cost.toFixed(4)}`;
|
714 |
+
}
|
715 |
+
|
716 |
+
function updateTokenInfo() {
|
717 |
+
// Calculate minted percentage
|
718 |
+
const percentage = (tokenData.minted / tokenData.totalSupply * 100).toFixed(2);
|
719 |
+
tokenProgressBar.style.width = `${percentage}%`;
|
720 |
+
mintedPercentage.textContent = percentage;
|
721 |
+
|
722 |
+
// Update user balance
|
723 |
+
tokenBalance.textContent = `${tokenData.userBalance.toLocaleString()} ${tokenData.ticker}`;
|
724 |
+
|
725 |
+
// Reset mint amount
|
726 |
+
mintAmount.value = '';
|
727 |
+
mintCost.textContent = '$0';
|
728 |
+
}
|
729 |
+
|
730 |
+
function applyBuyDownPoints() {
|
731 |
+
const points = parseFloat(buyDownSlider.value);
|
732 |
+
const rateReduction = points * 0.25;
|
733 |
+
currentRate -= rateReduction;
|
734 |
+
primeRateInput.value = currentRate.toFixed(2);
|
735 |
+
|
736 |
+
// Recalculate loan with new rate
|
737 |
+
calculateLoan();
|
738 |
+
closeBuyDownModal();
|
739 |
+
|
740 |
+
// Show mining schedule if address was provided
|
741 |
+
if (bitcoinAddress.value) {
|
742 |
+
alert(`Your Bitcoin mining rewards will be automatically applied to your loan every quarter. Estimated reduction: ${miningRateReduction.textContent} per quarter.`);
|
743 |
+
}
|
744 |
+
}
|
745 |
+
|
746 |
+
function mintTokens() {
|
747 |
+
const amount = parseFloat(mintAmount.value);
|
748 |
+
|
749 |
+
if (!amount || amount < tokenData.minMint) {
|
750 |
+
alert(`Minimum mint amount is ${tokenData.minMint} ${tokenData.ticker}`);
|
751 |
+
return;
|
752 |
+
}
|
753 |
+
|
754 |
+
// Simulate minting process
|
755 |
+
const cost = amount * tokenData.price;
|
756 |
+
|
757 |
+
// Update token data
|
758 |
+
tokenData.minted += amount;
|
759 |
+
tokenData.userBalance += amount;
|
760 |
+
|
761 |
+
// Show success message
|
762 |
+
alert(`Successfully minted ${amount.toLocaleString()} ${tokenData.ticker} for $${cost.toFixed(2)}. Your tokens have been automatically staked in our yield farming pool earning ${tokenData.apy}% APY.`);
|
763 |
+
|
764 |
+
// Update UI
|
765 |
+
updateTokenInfo();
|
766 |
+
}
|
767 |
+
|
768 |
+
function calculateLoan() {
|
769 |
+
if (!currentIndustry) {
|
770 |
+
alert("Please select an industry/product category");
|
771 |
+
return;
|
772 |
+
}
|
773 |
+
|
774 |
+
const loanAmount = parseFloat(loanAmountInput.value) || 0;
|
775 |
+
currentRate = parseFloat(primeRateInput.value) || 7.5;
|
776 |
+
const tariff = currentTariff;
|
777 |
+
|
778 |
+
// Calculate tariff-adjusted loan amount
|
779 |
+
const tariffAmount = loanAmount * (tariff / 100);
|
780 |
+
const totalLoanAmount = loanAmount + tariffAmount;
|
781 |
+
|
782 |
+
// Calculate effective interest rate (simple approximation)
|
783 |
+
const effectiveRate = currentRate * (1 + (tariff / 100));
|
784 |
+
|
785 |
+
// Calculate monthly payment (5 years = 60 months)
|
786 |
+
const monthlyRate = effectiveRate / 100 / 12;
|
787 |
+
const monthlyPayment = totalLoanAmount * monthlyRate * Math.pow(1 + monthlyRate, 60) / (Math.pow(1 + monthlyRate, 60) - 1);
|
788 |
+
|
789 |
+
// Generate amortization schedule
|
790 |
+
const amortizationData = generateAmortizationSchedule(totalLoanAmount, effectiveRate, 60);
|
791 |
+
|
792 |
+
// Update UI
|
793 |
+
totalLoanDisplay.textContent = `$${totalLoanAmount.toLocaleString('en-US', {maximumFractionDigits: 2})}`;
|
794 |
+
effectiveRateDisplay.textContent = `${effectiveRate.toFixed(2)}%`;
|
795 |
+
monthlyPaymentDisplay.textContent = `$${monthlyPayment.toLocaleString('en-US', {maximumFractionDigits: 2})}`;
|
796 |
+
|
797 |
+
// Populate amortization table
|
798 |
+
amortizationTable.innerHTML = '';
|
799 |
+
amortizationData.yearlyData.forEach yearData => {
|
800 |
+
const row = document.createElement('tr');
|
801 |
+
row.innerHTML = `
|
802 |
+
<td class="py-3 px-4">${yearData.year}</td>
|
803 |
+
<td class="py-3 px-4 text-right">$${yearData.principalPaid.toLocaleString('en-US', {maximumFractionDigits: 2})}</td>
|
804 |
+
<td class="py-3 px-4 text-right">$${yearData.interestPaid.toLocaleString('en-US', {maximumFractionDigits: 2})}</td>
|
805 |
+
<td class="py-3 px-4 text-right">$${yearData.remainingBalance.toLocaleString('en-US', {maximumFractionDigits: 2})}</td>
|
806 |
+
`;
|
807 |
+
amortizationTable.appendChild(row);
|
808 |
+
});
|
809 |
+
|
810 |
+
// Show results
|
811 |
+
resultsSection.classList.remove('hidden');
|
812 |
+
|
813 |
+
// Store current loan data
|
814 |
+
currentLoanData = {
|
815 |
+
loanAmount,
|
816 |
+
tariff,
|
817 |
+
effectiveRate,
|
818 |
+
monthlyPayment,
|
819 |
+
totalLoanAmount,
|
820 |
+
amortizationData,
|
821 |
+
industry: currentIndustry.name
|
822 |
+
};
|
823 |
+
}
|
824 |
+
|
825 |
+
function generateAmortizationSchedule(principal, annualRate, months) {
|
826 |
+
const monthlyRate = annualRate / 100 / 12;
|
827 |
+
const monthlyPayment = principal * monthlyRate * Math.pow(1 + monthlyRate, months) / (Math.pow(1 + monthlyRate, months) - 1);
|
828 |
+
|
829 |
+
let balance = principal;
|
830 |
+
let totalInterest = 0;
|
831 |
+
const schedule = [];
|
832 |
+
const yearlyData = [];
|
833 |
+
|
834 |
+
for (let month = 1; month <= months; month++) {
|
835 |
+
const interestPayment = balance * monthlyRate;
|
836 |
+
const principalPayment = monthlyPayment - interestPayment;
|
837 |
+
|
838 |
+
totalInterest += interestPayment;
|
839 |
+
balance -= principalPayment;
|
840 |
+
|
841 |
+
// Avoid negative balance due to rounding
|
842 |
+
if (balance < 0) balance = 0;
|
843 |
+
|
844 |
+
// Add to monthly schedule (not shown in UI but could be expanded)
|
845 |
+
schedule.push({
|
846 |
+
month,
|
847 |
+
payment: monthlyPayment,
|
848 |
+
principal: principalPayment,
|
849 |
+
interest: interestPayment,
|
850 |
+
balance
|
851 |
+
});
|
852 |
+
|
853 |
+
// Aggregate yearly data
|
854 |
+
if (month % 12 === 0 || month === months) {
|
855 |
+
const year = Math.ceil(month / 12);
|
856 |
+
const yearStartMonth = (year - 1) * 12 + 1;
|
857 |
+
|
858 |
+
// Calculate yearly totals
|
859 |
+
const yearPayments = schedule.slice(yearStartMonth - 1, month);
|
860 |
+
const principalPaid = yearPayments.reduce((sum, pmt) => sum + pmt.principal, 0);
|
861 |
+
const interestPaid = yearPayments.reduce((sum, pmt) => sum + pmt.interest, 0);
|
862 |
+
|
863 |
+
yearlyData.push({
|
864 |
+
year,
|
865 |
+
principalPaid,
|
866 |
+
interestPaid,
|
867 |
+
remainingBalance: balance
|
868 |
+
});
|
869 |
+
}
|
870 |
+
}
|
871 |
+
|
872 |
+
return {
|
873 |
+
monthlyPayment,
|
874 |
+
totalInterest,
|
875 |
+
schedule,
|
876 |
+
yearlyData
|
877 |
+
};
|
878 |
+
}
|
879 |
+
|
880 |
+
// Initialize industry tariff display
|
881 |
+
loanAmountInput.addEventListener('input', updateTariffDisplay);
|
882 |
+
</script>
|
883 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/privfin-vbeta1-01" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
884 |
+
</html>
|