@@ -201,19 +201,22 @@ <h3 class="text-xl font-bold">
201201 < i class ="fa-solid fa-xmark "> </ i >
202202 </ button >
203203 </ div >
204+
204205 < div class ="space-y-4 mb-6 ">
205206 < div >
206207 < label class ="block mb-2 text-sm opacity-60 font-medium "> Amount (₹)</ label >
207208 < div class ="relative ">
208209 < span class ="absolute left-4 top-3.5 opacity-40 "> < i class ="fa-solid fa-money-bill-wave "> </ i > </ span >
209- < input type ="number " [(ngModel)] ="savingForm.amount " placeholder ="0.00 " autofocus
210+ < input type ="number " [(ngModel)] ="savingForm.amount " placeholder ="0.00 " autofocus min ="1 "
211+ max ="100000000 "
210212 class ="w-full py-3 pl-10 pr-4 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 text-lg font-medium "
213+ [class.border-red-500] ="savingFormSubmitted && savingAmountError "
211214 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
212215 </ div >
213- @if (savingForm.amount !== null && savingForm.amount !== undefined && savingForm.amount < = 0 ) { < p
214- class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
215- class ="fa-solid fa-circle-exclamation mr-1 "> </ i > Amount must be greater than zero. </ p >
216- }
216+ @if (savingFormSubmitted && savingAmountError ) {
217+ < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
218+ class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ savingAmountError }} </ p >
219+ }
217220 </ div >
218221
219222 < div >
@@ -222,9 +225,10 @@ <h3 class="text-xl font-bold">
222225 < span class ="absolute left-4 top-3.5 opacity-40 "> < i class ="fa-solid fa-calendar-day "> </ i > </ span >
223226 < input type ="date " [(ngModel)] ="savingForm.date " [max] ="todayDateStr "
224227 class ="w-full py-3 pl-10 pr-4 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 font-medium color-scheme-dynamic "
228+ [class.border-red-500] ="savingFormSubmitted && savingDateError "
225229 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
226230 </ div >
227- @if (savingDateError) {
231+ @if (savingFormSubmitted && savingDateError) {
228232 < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
229233 class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ savingDateError }}</ p >
230234 }
@@ -235,16 +239,23 @@ <h3 class="text-xl font-bold">
235239 < div class ="relative ">
236240 < span class ="absolute left-4 top-3.5 opacity-40 "> < i class ="fa-solid fa-pen "> </ i > </ span >
237241 < input type ="text " [(ngModel)] ="savingForm.note " placeholder ="e.g. Salary, Bonus, Extra cash "
242+ maxlength ="100 "
238243 class ="w-full py-3 pl-10 pr-4 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 "
244+ [class.border-red-500] ="savingFormSubmitted && savingNoteError "
239245 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
240246 </ div >
247+ @if (savingFormSubmitted && savingNoteError) {
248+ < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
249+ class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ savingNoteError }}</ p >
250+ }
241251 </ div >
242252 </ div >
243253
244254 < div class ="flex gap-3 ">
245- < button (click) ="closeModals() " class ="flex-1 py-4 font-medium transition rounded-xl hover:opacity-80 "
246- style ="background-color: var(--color-bg-500); color: inherit; "> Cancel</ button >
247- < button (click) ="saveSavingsData() " [disabled] ="!isSavingFormValid " [class.opacity-50] ="!isSavingFormValid "
255+ < button (click) ="closeModals() "
256+ class ="flex-1 py-4 font-medium transition rounded-xl hover:opacity-80 border "
257+ style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; "> Cancel</ button >
258+ < button (click) ="saveSavingsData() "
248259 class ="flex-1 py-4 font-medium text-white transition bg-indigo-500 rounded-xl shadow-lg active:scale-95 ">
249260 {{ editingSavingId ? 'Update' : 'Save' }}
250261 </ button >
@@ -337,66 +348,89 @@ <h3 class="text-xl font-medium">
337348 < i class ="fa-solid fa-xmark "> </ i >
338349 </ button >
339350 </ div >
351+
340352 < div class ="space-y-4 mb-6 ">
341353 < div >
342354 < label class ="block mb-2 text-sm opacity-60 font-medium "> Goal Name</ label >
343355 < div class ="relative ">
344356 < span class ="absolute left-4 top-3.5 opacity-40 "> < i class ="fa-solid fa-flag-checkered "> </ i > </ span >
345357 < input type ="text " [(ngModel)] ="goalForm.goal_name " placeholder ="e.g. Dream Car, Vacation "
358+ maxlength ="50 "
346359 class ="w-full py-3 pl-10 pr-4 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 font-medium "
360+ [class.border-red-500] ="goalFormSubmitted && goalNameError "
347361 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
348362 </ div >
363+ @if (goalFormSubmitted && goalNameError) {
364+ < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
365+ class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ goalNameError }}</ p >
366+ }
349367 </ div >
350368
351369 < div >
352370 < label class ="block mb-2 text-sm opacity-60 font-medium "> Target Amount (₹)</ label >
353371 < div class ="relative ">
354372 < span class ="absolute left-4 top-3.5 opacity-40 "> < i class ="fa-solid fa-bullseye "> </ i > </ span >
355- < input type ="number " [(ngModel)] ="goalForm.target_amount " placeholder ="0.00 "
373+ < input type ="number " [(ngModel)] ="goalForm.target_amount " placeholder ="0.00 " min =" 1 " max =" 100000000 "
356374 class ="w-full py-3 pl-10 pr-4 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 text-lg font-medium "
375+ [class.border-red-500] ="goalFormSubmitted && goalAmountError "
357376 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
358377 </ div >
378+ @if (goalFormSubmitted && goalAmountError) {
379+ < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
380+ class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ goalAmountError }}</ p >
381+ }
359382 </ div >
360383
361384 < div class ="grid grid-cols-2 gap-3 ">
362385 < div >
363386 < label class ="block mb-2 text-sm opacity-60 font-medium "> Start Date</ label >
364387 < input type ="date " [(ngModel)] ="goalForm.start_date " [max] ="goalForm.target_date " required
365388 class ="w-full py-3 px-3 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 font-medium text-sm color-scheme-dynamic "
389+ [class.border-red-500] ="goalFormSubmitted && goalStartDateError "
366390 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
391+
392+ @if (goalFormSubmitted && goalStartDateError) {
393+ < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
394+ class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ goalStartDateError }}</ p >
395+ }
367396 </ div >
368397
369398 < div >
370399 < label class ="block mb-2 text-sm opacity-60 font-medium "> Target Date</ label >
371400 < input type ="date " [(ngModel)] ="goalForm.target_date " [min] ="goalForm.start_date " required
372401 class ="w-full py-3 px-3 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 font-medium text-sm color-scheme-dynamic "
402+ [class.border-red-500] ="goalFormSubmitted && goalTargetDateError "
373403 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
374- </ div >
375- </ div >
376404
377- @if (goalDateError ) {
378- < div
379- class =" p-3 text-xs text-red-500 rounded-lg bg-red-500/10 animate-fade-in border border-red-500/20 flex items-center gap-2 " >
380- < i class =" fa-solid fa-circle-exclamation " > </ i >
381- {{ goalDateError }}
405+ @if (goalFormSubmitted && goalTargetDateError ) {
406+ < p class =" text-xs text-red-500 mt-1.5 animate-fade-in " > < i
407+ class =" fa-solid fa-circle-exclamation mr-1 " > </ i > {{ goalTargetDateError }} </ p >
408+ }
409+ </ div >
382410 </ div >
383- }
384411
385412 < div >
386413 < label class ="block mb-2 text-sm opacity-60 font-medium "> Note</ label >
387414 < div class ="relative ">
388415 < span class ="absolute left-4 top-3.5 opacity-40 "> < i class ="fa-solid fa-pen "> </ i > </ span >
389416 < input type ="text " [(ngModel)] ="goalForm.note " placeholder ="Any additional details... "
417+ maxlength ="100 "
390418 class ="w-full py-3 pl-10 pr-4 transition-colors border rounded-xl focus:outline-none focus:border-indigo-500 "
419+ [class.border-red-500] ="goalFormSubmitted && goalNoteError "
391420 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; ">
392421 </ div >
422+ @if (goalFormSubmitted && goalNoteError) {
423+ < p class ="text-xs text-red-500 mt-1.5 animate-fade-in "> < i
424+ class ="fa-solid fa-circle-exclamation mr-1 "> </ i > {{ goalNoteError }}</ p >
425+ }
393426 </ div >
394427 </ div >
395428
396429 < div class ="flex gap-3 ">
397- < button (click) ="closeModals() " class ="flex-1 py-4 font-medium transition rounded-xl hover:opacity-80 border "
430+ < button (click) ="closeModals() "
431+ class ="flex-1 py-4 font-medium transition rounded-xl hover:opacity-80 border "
398432 style ="background-color: var(--color-bg-500); border-color: var(--color-bg-600); color: inherit; "> Cancel</ button >
399- < button (click) ="saveGoalData() " [disabled] =" !isGoalFormValid " [class.opacity-50] =" !isGoalFormValid "
433+ < button (click) ="saveGoalData() "
400434 class ="flex-1 py-4 font-medium text-white transition bg-indigo-500 rounded-xl shadow-lg active:scale-95 ">
401435 Save Goal
402436 </ button >
0 commit comments