Skip to content

Commit 9b66858

Browse files
Fix: field level validation with inline errors for Add Log Modal
1 parent 0bb8e92 commit 9b66858

1 file changed

Lines changed: 0 additions & 39 deletions

File tree

src/components/ResourceManagement/ResourceManagement.jsx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ function AddLogModal({ isOpen, onClose, onAdd }) {
6666
};
6767

6868
const validateForm = () => {
69-
<<<<<<< HEAD
7069
const newErrors = {};
7170
const timeRegex = /^([0-1]\d|2[0-3]):([0-5]\d):([0-5]\d)$/;
7271

@@ -91,30 +90,6 @@ function AddLogModal({ isOpen, onClose, onAdd }) {
9190
if (!formData.date) newErrors.date = 'Date is required';
9291

9392
return newErrors;
94-
=======
95-
if (!formData.user.trim()) {
96-
return 'User is required';
97-
}
98-
99-
const timeRegex = /^([0-1]\d|2[0-3]):([0-5]\d):([0-5]\d)$/;
100-
if (!timeRegex.test(formData.timeDuration)) {
101-
return 'Time must be in HH:MM:SS format';
102-
}
103-
104-
if (!formData.facilities.trim()) {
105-
return 'Facilities is required';
106-
}
107-
108-
if (!formData.materials.trim()) {
109-
return 'Materials is required';
110-
}
111-
112-
if (!formData.date) {
113-
return 'Date is required';
114-
}
115-
116-
return '';
117-
>>>>>>> e10aa7ca1 (Fix: prettier formatting for ResourceManagement)
11893
};
11994

12095
const handleSubmit = e => {
@@ -127,7 +102,6 @@ function AddLogModal({ isOpen, onClose, onAdd }) {
127102
return;
128103
}
129104

130-
<<<<<<< HEAD
131105
const validationErrors = validateForm();
132106

133107
if (Object.keys(validationErrors).length > 0) {
@@ -145,19 +119,6 @@ function AddLogModal({ isOpen, onClose, onAdd }) {
145119
date: '',
146120
});
147121

148-
=======
149-
onAdd(formData);
150-
151-
setFormData({
152-
user: '',
153-
timeDuration: '',
154-
facilities: '',
155-
materials: '',
156-
date: '',
157-
});
158-
159-
setValidationError('');
160-
>>>>>>> e10aa7ca1 (Fix: prettier formatting for ResourceManagement)
161122
onClose();
162123
};
163124

0 commit comments

Comments
 (0)