Skip to content

Commit 37dcc62

Browse files
Style Absence Form Errors (#143)
* Remove browser validation causing 'Please fill out this field' tooltip * Add error handling for user-cleared date * Improve date handling in absence forms Refactored date selection logic in DeclareAbsenceForm and EditAbsenceForm to handle null and invalid dates more robustly. Updated DateOfAbsence component to accept null date values and handle input state accordingly, ensuring better consistency and preventing errors when no date is selected. --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com>
1 parent 5d39a6d commit 37dcc62

File tree

4 files changed

+94
-200
lines changed

4 files changed

+94
-200
lines changed

prisma/seed/.snaplet/dataModel.json

Lines changed: 61 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"maxLength": null
2525
},
2626
{
27-
"id": "public.Absence.absentTeacherId",
28-
"name": "absentTeacherId",
29-
"columnName": "absentTeacherId",
30-
"type": "int4",
27+
"id": "public.Absence.lessonDate",
28+
"name": "lessonDate",
29+
"columnName": "lessonDate",
30+
"type": "timestamp",
3131
"isRequired": true,
3232
"kind": "scalar",
3333
"isList": false,
@@ -38,10 +38,10 @@
3838
"maxLength": null
3939
},
4040
{
41-
"id": "public.Absence.lessonDate",
42-
"name": "lessonDate",
43-
"columnName": "lessonDate",
44-
"type": "timestamp",
41+
"id": "public.Absence.reasonOfAbsence",
42+
"name": "reasonOfAbsence",
43+
"columnName": "reasonOfAbsence",
44+
"type": "text",
4545
"isRequired": true,
4646
"kind": "scalar",
4747
"isList": false,
@@ -52,11 +52,11 @@
5252
"maxLength": null
5353
},
5454
{
55-
"id": "public.Absence.reasonOfAbsence",
56-
"name": "reasonOfAbsence",
57-
"columnName": "reasonOfAbsence",
55+
"id": "public.Absence.notes",
56+
"name": "notes",
57+
"columnName": "notes",
5858
"type": "text",
59-
"isRequired": true,
59+
"isRequired": false,
6060
"kind": "scalar",
6161
"isList": false,
6262
"isGenerated": false,
@@ -66,10 +66,10 @@
6666
"maxLength": null
6767
},
6868
{
69-
"id": "public.Absence.substituteTeacherId",
70-
"name": "substituteTeacherId",
71-
"columnName": "substituteTeacherId",
72-
"type": "int4",
69+
"id": "public.Absence.roomNumber",
70+
"name": "roomNumber",
71+
"columnName": "roomNumber",
72+
"type": "text",
7373
"isRequired": false,
7474
"kind": "scalar",
7575
"isList": false,
@@ -80,9 +80,9 @@
8080
"maxLength": null
8181
},
8282
{
83-
"id": "public.Absence.locationId",
84-
"name": "locationId",
85-
"columnName": "locationId",
83+
"id": "public.Absence.absentTeacherId",
84+
"name": "absentTeacherId",
85+
"columnName": "absentTeacherId",
8686
"type": "int4",
8787
"isRequired": true,
8888
"kind": "scalar",
@@ -94,11 +94,11 @@
9494
"maxLength": null
9595
},
9696
{
97-
"id": "public.Absence.subjectId",
98-
"name": "subjectId",
99-
"columnName": "subjectId",
97+
"id": "public.Absence.substituteTeacherId",
98+
"name": "substituteTeacherId",
99+
"columnName": "substituteTeacherId",
100100
"type": "int4",
101-
"isRequired": true,
101+
"isRequired": false,
102102
"kind": "scalar",
103103
"isList": false,
104104
"isGenerated": false,
@@ -108,11 +108,11 @@
108108
"maxLength": null
109109
},
110110
{
111-
"id": "public.Absence.notes",
112-
"name": "notes",
113-
"columnName": "notes",
114-
"type": "text",
115-
"isRequired": false,
111+
"id": "public.Absence.locationId",
112+
"name": "locationId",
113+
"columnName": "locationId",
114+
"type": "int4",
115+
"isRequired": true,
116116
"kind": "scalar",
117117
"isList": false,
118118
"isGenerated": false,
@@ -122,11 +122,11 @@
122122
"maxLength": null
123123
},
124124
{
125-
"id": "public.Absence.roomNumber",
126-
"name": "roomNumber",
127-
"columnName": "roomNumber",
128-
"type": "text",
129-
"isRequired": false,
125+
"id": "public.Absence.subjectId",
126+
"name": "subjectId",
127+
"columnName": "subjectId",
128+
"type": "int4",
129+
"isRequired": true,
130130
"kind": "scalar",
131131
"isList": false,
132132
"isGenerated": false,
@@ -675,9 +675,9 @@
675675
"tableName": "MailingList",
676676
"fields": [
677677
{
678-
"id": "public.MailingList.subjectId",
679-
"name": "subjectId",
680-
"columnName": "subjectId",
678+
"id": "public.MailingList.userId",
679+
"name": "userId",
680+
"columnName": "userId",
681681
"type": "int4",
682682
"isRequired": true,
683683
"kind": "scalar",
@@ -689,9 +689,9 @@
689689
"maxLength": null
690690
},
691691
{
692-
"id": "public.MailingList.userId",
693-
"name": "userId",
694-
"columnName": "userId",
692+
"id": "public.MailingList.subjectId",
693+
"name": "subjectId",
694+
"columnName": "subjectId",
695695
"type": "int4",
696696
"isRequired": true,
697697
"kind": "scalar",
@@ -819,30 +819,30 @@
819819
"maxLength": null
820820
},
821821
{
822-
"id": "public.Subject.colorGroupId",
823-
"name": "colorGroupId",
824-
"columnName": "colorGroupId",
825-
"type": "int4",
822+
"id": "public.Subject.archived",
823+
"name": "archived",
824+
"columnName": "archived",
825+
"type": "bool",
826826
"isRequired": true,
827827
"kind": "scalar",
828828
"isList": false,
829829
"isGenerated": false,
830830
"sequence": false,
831-
"hasDefaultValue": false,
831+
"hasDefaultValue": true,
832832
"isId": false,
833833
"maxLength": null
834834
},
835835
{
836-
"id": "public.Subject.archived",
837-
"name": "archived",
838-
"columnName": "archived",
839-
"type": "bool",
836+
"id": "public.Subject.colorGroupId",
837+
"name": "colorGroupId",
838+
"columnName": "colorGroupId",
839+
"type": "int4",
840840
"isRequired": true,
841841
"kind": "scalar",
842842
"isList": false,
843843
"isGenerated": false,
844844
"sequence": false,
845-
"hasDefaultValue": true,
845+
"hasDefaultValue": false,
846846
"isId": false,
847847
"maxLength": null
848848
},
@@ -1019,30 +1019,30 @@
10191019
"maxLength": null
10201020
},
10211021
{
1022-
"id": "public.User.role",
1023-
"name": "role",
1024-
"columnName": "role",
1025-
"type": "Role",
1026-
"isRequired": true,
1022+
"id": "public.User.profilePicture",
1023+
"name": "profilePicture",
1024+
"columnName": "profilePicture",
1025+
"type": "text",
1026+
"isRequired": false,
10271027
"kind": "scalar",
10281028
"isList": false,
10291029
"isGenerated": false,
10301030
"sequence": false,
1031-
"hasDefaultValue": true,
1031+
"hasDefaultValue": false,
10321032
"isId": false,
10331033
"maxLength": null
10341034
},
10351035
{
1036-
"id": "public.User.profilePicture",
1037-
"name": "profilePicture",
1038-
"columnName": "profilePicture",
1039-
"type": "text",
1040-
"isRequired": false,
1036+
"id": "public.User.role",
1037+
"name": "role",
1038+
"columnName": "role",
1039+
"type": "Role",
1040+
"isRequired": true,
10411041
"kind": "scalar",
10421042
"isList": false,
10431043
"isGenerated": false,
10441044
"sequence": false,
1045-
"hasDefaultValue": false,
1045+
"hasDefaultValue": true,
10461046
"isId": false,
10471047
"maxLength": null
10481048
},
@@ -1218,132 +1218,6 @@
12181218
"nullNotDistinct": false
12191219
}
12201220
]
1221-
},
1222-
"_prisma_migrations": {
1223-
"id": "public._prisma_migrations",
1224-
"schemaName": "public",
1225-
"tableName": "_prisma_migrations",
1226-
"fields": [
1227-
{
1228-
"id": "public._prisma_migrations.id",
1229-
"name": "id",
1230-
"columnName": "id",
1231-
"type": "varchar",
1232-
"isRequired": true,
1233-
"kind": "scalar",
1234-
"isList": false,
1235-
"isGenerated": false,
1236-
"sequence": false,
1237-
"hasDefaultValue": false,
1238-
"isId": true,
1239-
"maxLength": 36
1240-
},
1241-
{
1242-
"id": "public._prisma_migrations.checksum",
1243-
"name": "checksum",
1244-
"columnName": "checksum",
1245-
"type": "varchar",
1246-
"isRequired": true,
1247-
"kind": "scalar",
1248-
"isList": false,
1249-
"isGenerated": false,
1250-
"sequence": false,
1251-
"hasDefaultValue": false,
1252-
"isId": false,
1253-
"maxLength": 64
1254-
},
1255-
{
1256-
"id": "public._prisma_migrations.finished_at",
1257-
"name": "finished_at",
1258-
"columnName": "finished_at",
1259-
"type": "timestamptz",
1260-
"isRequired": false,
1261-
"kind": "scalar",
1262-
"isList": false,
1263-
"isGenerated": false,
1264-
"sequence": false,
1265-
"hasDefaultValue": false,
1266-
"isId": false,
1267-
"maxLength": null
1268-
},
1269-
{
1270-
"id": "public._prisma_migrations.migration_name",
1271-
"name": "migration_name",
1272-
"columnName": "migration_name",
1273-
"type": "varchar",
1274-
"isRequired": true,
1275-
"kind": "scalar",
1276-
"isList": false,
1277-
"isGenerated": false,
1278-
"sequence": false,
1279-
"hasDefaultValue": false,
1280-
"isId": false,
1281-
"maxLength": 255
1282-
},
1283-
{
1284-
"id": "public._prisma_migrations.logs",
1285-
"name": "logs",
1286-
"columnName": "logs",
1287-
"type": "text",
1288-
"isRequired": false,
1289-
"kind": "scalar",
1290-
"isList": false,
1291-
"isGenerated": false,
1292-
"sequence": false,
1293-
"hasDefaultValue": false,
1294-
"isId": false,
1295-
"maxLength": null
1296-
},
1297-
{
1298-
"id": "public._prisma_migrations.rolled_back_at",
1299-
"name": "rolled_back_at",
1300-
"columnName": "rolled_back_at",
1301-
"type": "timestamptz",
1302-
"isRequired": false,
1303-
"kind": "scalar",
1304-
"isList": false,
1305-
"isGenerated": false,
1306-
"sequence": false,
1307-
"hasDefaultValue": false,
1308-
"isId": false,
1309-
"maxLength": null
1310-
},
1311-
{
1312-
"id": "public._prisma_migrations.started_at",
1313-
"name": "started_at",
1314-
"columnName": "started_at",
1315-
"type": "timestamptz",
1316-
"isRequired": true,
1317-
"kind": "scalar",
1318-
"isList": false,
1319-
"isGenerated": false,
1320-
"sequence": false,
1321-
"hasDefaultValue": true,
1322-
"isId": false,
1323-
"maxLength": null
1324-
},
1325-
{
1326-
"id": "public._prisma_migrations.applied_steps_count",
1327-
"name": "applied_steps_count",
1328-
"columnName": "applied_steps_count",
1329-
"type": "int4",
1330-
"isRequired": true,
1331-
"kind": "scalar",
1332-
"isList": false,
1333-
"isGenerated": false,
1334-
"sequence": false,
1335-
"hasDefaultValue": true,
1336-
"isId": false,
1337-
"maxLength": null
1338-
}
1339-
],
1340-
"uniqueConstraints": [
1341-
{
1342-
"name": "_prisma_migrations_pkey",
1343-
"fields": ["id"],
1344-
"nullNotDistinct": false
1345-
}
1346-
]
13471221
}
13481222
},
13491223
"enums": {

0 commit comments

Comments
 (0)