-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
201 lines (190 loc) · 7.97 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Programmer Expenses</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div class="flex items-center justify-center min-h-screen bg-gray-100">
<div class="container max-w-md bg-white rounded-xl shadow-lg p-6">
<!-- Title -->
<div
class="text-center text-2xl font-bold mb-6 text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600"
>
💻 Programmer Expenses Assistant
</div>
<!-- Tabs for Assistant and History -->
<div class="flex justify-between mb-6">
<button
id="assistant-tab"
class="w-1/2 py-2 rounded-l-md focus:outline-none transition-colors duration-200 text-white font-semibold bg-gradient-to-r from-blue-500 to-purple-600"
>
Assistant
</button>
<button
id="history-tab"
class="w-1/2 py-2 rounded-r-md focus:outline-none transition-colors duration-200 text-gray-600 font-semibold"
>
History
</button>
</div>
<!-- Expense Form -->
<div id="expense-form" class="grid grid-cols-2 gap-4">
<!-- Income -->
<div class="relative col-span-2">
<label class="block font-semibold mb-2 text-gray-700"
>Income 💰</label
>
<input
id="income"
type="number"
class="w-full border border-gray-300 px-3 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200"
placeholder="Enter income"
/>
<p id="income-error" class="text-red-500 text-xs mt-1 hidden">
⚠️ Invalid income!
</p>
</div>
<!-- Software Subscriptions -->
<div class="relative">
<label class="block font-semibold mb-2 text-gray-700"
>Software 💻</label
>
<input
type="number"
id="software"
class="w-full border border-gray-300 px-3 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200"
placeholder="Software cost"
/>
<p id="software-error" class="text-red-500 text-xs mt-1 hidden">
⚠️ Invalid amount!
</p>
</div>
<!-- Courses/Books -->
<div class="relative">
<label class="block font-semibold mb-2 text-gray-700"
>Courses 📚</label
>
<input
type="number"
id="courses"
class="w-full border border-gray-300 px-3 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200"
placeholder="Course cost"
/>
<p id="courses-error" class="text-red-500 text-xs mt-1 hidden">
⚠️ Invalid amount!
</p>
</div>
<!-- Internet -->
<div class="relative">
<label class="block font-semibold mb-2 text-gray-700"
>Internet 🌐</label
>
<input
type="number"
id="internet"
class="w-full border border-gray-300 px-3 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200"
placeholder="Internet cost"
/>
<p id="internet-error" class="text-red-500 text-xs mt-1 hidden">
⚠️ Invalid amount!
</p>
</div>
<!-- Calculate Button -->
<button
id="calculate"
class="col-span-2 text-white px-4 py-2 rounded-md font-semibold text-sm transition-all duration-200 hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-offset-2 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 focus:ring-blue-500"
>
Calculate
</button>
<!-- Savings -->
<div class="relative col-span-2">
<label class="block font-semibold mb-2 text-gray-700"
>Savings (%) 💸</label
>
<input
type="number"
id="savings"
class="w-full border border-gray-300 px-3 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200"
placeholder="Savings %"
/>
<p id="savings-error" class="text-red-500 text-xs mt-1 hidden">
⚠️ Invalid percentage!
</p>
</div>
<!-- Calculate Savings Button -->
<button
id="calculate-savings"
class="col-span-2 text-white px-4 py-2 rounded-md font-semibold text-sm transition-all duration-200 hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-offset-2 bg-gradient-to-r from-green-500 to-teal-500 hover:from-green-600 hover:to-teal-600 focus:ring-green-500"
>
Calculate Savings
</button>
</div>
<!-- Results -->
<div
id="results"
class="mt-8 hidden from-blue-50 to-purple-50 p-4 rounded-lg shadow-md border border-blue-200"
>
<h3
class="text-lg font-semibold mb-4 text-center text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600"
>
Results Summary
</h3>
<div class="grid grid-cols-2 gap-3">
<div
class="bg-white p-3 rounded-md shadow-sm border-l-2 border-blue-500"
>
<p class="text-xs text-gray-500">Total Expenses</p>
<p class="text-sm font-bold text-gray-800">
$<span id="total-expenses">00</span>
</p>
</div>
<div
class="bg-white p-3 rounded-md shadow-sm border-l-2 border-green-500"
>
<p class="text-xs text-gray-500">Balance</p>
<p class="text-sm font-bold text-gray-800">
$<span id="balance">00</span>
</p>
</div>
<div
class="bg-white p-3 rounded-md shadow-sm border-l-2 border-purple-500"
>
<p class="text-xs text-gray-500">Savings Amount</p>
<p class="text-sm font-bold text-gray-800">
$<span id="savings-amount">00</span>
</p>
</div>
<div
class="bg-white p-3 rounded-md shadow-sm border-l-2 border-yellow-500"
>
<p class="text-xs text-gray-500">Remaining Balance</p>
<p class="text-sm font-bold text-gray-800">
$<span id="remaining-balance">00</span>
</p>
</div>
</div>
</div>
<!-- Error Messages -->
<p id="logic-error" class="text-red-500 mt-4 hidden text-center">
⚠️ Total expenses cannot exceed your income!
</p>
<!-- History Section -->
<div
id="history-section"
class="bg-gradient-to-br hidden from-blue-50 to-purple-50 p-4 rounded-lg shadow-md border border-blue-200"
>
<h3
class="text-lg font-semibold mb-4 text-center text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600"
>
🕒 Expense History
</h3>
<div id="history-list" class="grid grid-cols-2 gap-3"></div>
</div>
</div>
</div>
<script src="./js/index.js"></script>
</body>
</html>