diff --git a/RIT-EMS-main/frontend/src/components/dashboard/StudentDashboard.tsx b/RIT-EMS-main/frontend/src/components/dashboard/StudentDashboard.tsx index 05a2ad0..35d18eb 100644 --- a/RIT-EMS-main/frontend/src/components/dashboard/StudentDashboard.tsx +++ b/RIT-EMS-main/frontend/src/components/dashboard/StudentDashboard.tsx @@ -414,8 +414,7 @@ export const StudentDashboard: React.FC = () => { if (isLoading) { return (
-
-

Syncing with Firestore Database...

+
); } diff --git a/RIT-EMS-main/frontend/src/components/dashboard/StudentRegistrationsView.tsx b/RIT-EMS-main/frontend/src/components/dashboard/StudentRegistrationsView.tsx index de18586..07c4e80 100644 --- a/RIT-EMS-main/frontend/src/components/dashboard/StudentRegistrationsView.tsx +++ b/RIT-EMS-main/frontend/src/components/dashboard/StudentRegistrationsView.tsx @@ -439,7 +439,7 @@ export const StudentRegistrationsView: React.FC = () => { disabled={isProcessing} className="px-6 py-2.5 bg-brand-navy text-white rounded-xl font-black text-[10px] uppercase tracking-widest hover:scale-[1.02] transition-all shadow-md" > - {isProcessing ? 'Syncing...' : 'Save Attendance'} + {isProcessing ? 'Saving...' : 'Save Attendance'} diff --git a/RIT-EMS-main/frontend/src/components/student/StatusTrackerView.tsx b/RIT-EMS-main/frontend/src/components/student/StatusTrackerView.tsx index 8869fa4..f9fc723 100644 --- a/RIT-EMS-main/frontend/src/components/student/StatusTrackerView.tsx +++ b/RIT-EMS-main/frontend/src/components/student/StatusTrackerView.tsx @@ -499,7 +499,7 @@ const StatusTrackerView: React.FC = ({ event, registrati isUploading ? 'bg-gray-200 text-gray-400 cursor-wait' : 'bg-[#1A202C] text-white hover:bg-black' }`} > - {isUploading ? <> SYNCING... : + {isUploading ? <> UPLOADING... : liveCertStatus === 'APPROVED' ? <> VERIFIED : liveCertUrl ? <> RE-UPLOAD PROOF : <> UPLOAD PROOF} diff --git a/RIT-EVENT-MANAGEMENT--main/App.tsx b/RIT-EVENT-MANAGEMENT--main/App.tsx index 201ac64..07e809a 100644 --- a/RIT-EVENT-MANAGEMENT--main/App.tsx +++ b/RIT-EVENT-MANAGEMENT--main/App.tsx @@ -732,6 +732,15 @@ const App: React.FC = () => { return; } + // Validate registration deadline + if (targetEvent.registrationDeadline) { + const deadline = new Date(targetEvent.registrationDeadline); + if (new Date() > deadline) { + alert("Registration Blocked: The registration deadline for this event has passed."); + return; + } + } + // Try to fetch from Studentusers first, then externalusers let student = null; const { data: internalStudent } = await supabase.from('Studentusers').select('*').eq('id', user.id).single(); diff --git a/RIT-EVENT-MANAGEMENT--main/components/CreateEventForm.tsx b/RIT-EVENT-MANAGEMENT--main/components/CreateEventForm.tsx index d2d6686..48b668f 100644 --- a/RIT-EVENT-MANAGEMENT--main/components/CreateEventForm.tsx +++ b/RIT-EVENT-MANAGEMENT--main/components/CreateEventForm.tsx @@ -27,6 +27,22 @@ const CreateEventForm: React.FC = ({ onCancel, onSuccess, } }; + const parseDateTimeForInput = (dateStr?: string) => { + if (!dateStr) return ''; + try { + const date = new Date(dateStr); + if (isNaN(date.getTime())) return ''; + const yyyy = date.getFullYear(); + const mm = String(date.getMonth() + 1).padStart(2, '0'); + const dd = String(date.getDate()).padStart(2, '0'); + const hh = String(date.getHours()).padStart(2, '0'); + const min = String(date.getMinutes()).padStart(2, '0'); + return `${yyyy}-${mm}-${dd}T${hh}:${min}`; + } catch { + return ''; + } + }; + const mapDBRowToEvent = (row: any): Event => ({ ...row, registrationDeadline: row.registration_deadline, @@ -88,7 +104,7 @@ const CreateEventForm: React.FC = ({ onCancel, onSuccess, coordinator: eventToEdit?.coordinator || '', club: eventToEdit?.club || '', image: eventToEdit?.image || '', - registrationDeadline: eventToEdit?.registrationDeadline || '', + registrationDeadline: eventToEdit?.registrationDeadline ? parseDateTimeForInput(eventToEdit.registrationDeadline) : '', maxParticipants: eventToEdit?.maxParticipants?.toString() || '', durationDays: eventToEdit?.durationDays?.toString() || '1', event_summary: eventToEdit?.event_summary || '', @@ -347,6 +363,23 @@ const CreateEventForm: React.FC = ({ onCancel, onSuccess, return; } + if (formData.registrationDeadline) { + const deadline = new Date(formData.registrationDeadline); + if (isNaN(deadline.getTime())) { + alert("Please enter a valid registration deadline."); + return; + } + if (!eventToEdit && deadline < new Date()) { + alert("Validation Error: Registration deadline cannot be in the past."); + return; + } + const eventStart = new Date(formData.dayConfigs[0]?.date || formData.date); + if (!isNaN(eventStart.getTime()) && deadline > eventStart) { + alert("Validation Error: Registration deadline cannot be after the event start date."); + return; + } + } + setIsSubmitting(true); try { // Keep Base64 string directly in the database, ignoring Firebase/Supabase storage @@ -869,7 +902,7 @@ const CreateEventForm: React.FC = ({ onCancel, onSuccess,
- + setFormData({ ...formData, registrationDeadline: e.target.value })} />
diff --git a/RIT-EVENT-MANAGEMENT--main/components/EventCard.tsx b/RIT-EVENT-MANAGEMENT--main/components/EventCard.tsx index 283ee28..c77d112 100644 --- a/RIT-EVENT-MANAGEMENT--main/components/EventCard.tsx +++ b/RIT-EVENT-MANAGEMENT--main/components/EventCard.tsx @@ -193,6 +193,19 @@ const EventCard: React.FC = ({ event, isBooked, onToggle, onTrac {event.date}{event.schedule?.[0]?.start_time ? ` • ${event.schedule[0].start_time}` : ''}
+ {event.registrationDeadline && ( +
+ + + {admissionStatus === 'DEADLINE_PASSED' ? 'Deadline Passed' : 'Register Before'}: {new Date(event.registrationDeadline).toLocaleDateString([], { + month: 'short', + day: '2-digit', + hour: '2-digit', + minute: '2-digit' + })} + +
+ )} {event.durationDays && event.durationDays > 1 && (
diff --git a/image.png b/image.png new file mode 100644 index 0000000..e138de1 Binary files /dev/null and b/image.png differ