diff --git a/src/components/dashboard/Officer_EventRequestForm/ASFundingSection.tsx b/src/components/dashboard/Officer_EventRequestForm/ASFundingSection.tsx index 372ff7b..9d20e69 100644 --- a/src/components/dashboard/Officer_EventRequestForm/ASFundingSection.tsx +++ b/src/components/dashboard/Officer_EventRequestForm/ASFundingSection.tsx @@ -41,7 +41,7 @@ const ASFundingSection: React.FC = ({ formData, onDataCha // Handle multiple invoice files upload const handleMultipleInvoiceFilesChange = (e: React.ChangeEvent) => { if (e.target.files && e.target.files.length > 0) { - const files = Array.from(e.target.files); + const files = Array.from(e.target.files) as File[]; // Check file sizes const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB limit per file diff --git a/src/components/dashboard/Officer_EventRequestForm/EventRequestForm.tsx b/src/components/dashboard/Officer_EventRequestForm/EventRequestForm.tsx index d070b9d..7293096 100644 --- a/src/components/dashboard/Officer_EventRequestForm/EventRequestForm.tsx +++ b/src/components/dashboard/Officer_EventRequestForm/EventRequestForm.tsx @@ -6,6 +6,7 @@ import { Update } from '../../../scripts/pocketbase/Update'; import { FileManager } from '../../../scripts/pocketbase/FileManager'; import { Get } from '../../../scripts/pocketbase/Get'; import type { EventRequest } from '../../../schemas/pocketbase'; +import { EventRequestStatus } from '../../../schemas/pocketbase'; // Form sections import PRSection from './PRSection'; @@ -238,7 +239,7 @@ const EventRequestForm: React.FC = () => { vendor: formData.invoiceData.vendor }, // Set the initial status to "submitted" - status: "submitted", + status: EventRequestStatus.SUBMITTED, }; toast.loading('Creating event request record...', { id: submittingToast }); diff --git a/src/components/dashboard/Officer_EventRequestForm/EventRequestFormPreview.tsx b/src/components/dashboard/Officer_EventRequestForm/EventRequestFormPreview.tsx index eaa4175..ac29a63 100644 --- a/src/components/dashboard/Officer_EventRequestForm/EventRequestFormPreview.tsx +++ b/src/components/dashboard/Officer_EventRequestForm/EventRequestFormPreview.tsx @@ -3,6 +3,7 @@ import { motion } from 'framer-motion'; import type { EventRequestFormData } from './EventRequestForm'; import type { InvoiceItem } from './InvoiceBuilder'; import type { EventRequest } from '../../../schemas/pocketbase'; +import { FlyerTypes, LogoOptions, EventRequestStatus } from '../../../schemas/pocketbase'; interface EventRequestFormPreviewProps { formData?: EventRequestFormData; // Optional prop to directly pass form data diff --git a/src/components/dashboard/Officer_EventRequestForm/PRSection.tsx b/src/components/dashboard/Officer_EventRequestForm/PRSection.tsx index 3f3f9d2..507f7d8 100644 --- a/src/components/dashboard/Officer_EventRequestForm/PRSection.tsx +++ b/src/components/dashboard/Officer_EventRequestForm/PRSection.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import type { EventRequestFormData } from './EventRequestForm'; import type { EventRequest } from '../../../schemas/pocketbase'; +import { FlyerTypes, LogoOptions } from '../../../schemas/pocketbase'; // Animation variants const itemVariants = { @@ -19,24 +20,24 @@ const itemVariants = { // Flyer type options const FLYER_TYPES = [ - { value: 'digital_with_social', label: 'Digital flyer (with social media advertising: Facebook, Instagram, Discord)' }, - { value: 'digital_no_social', label: 'Digital flyer (with NO social media advertising)' }, - { value: 'physical_with_advertising', label: 'Physical flyer (with advertising)' }, - { value: 'physical_no_advertising', label: 'Physical flyer (with NO advertising)' }, - { value: 'newsletter', label: 'Newsletter (IEEE, ECE, IDEA)' }, - { value: 'other', label: 'Other' } + { value: FlyerTypes.DIGITAL_WITH_SOCIAL, label: 'Digital flyer (with social media advertising: Facebook, Instagram, Discord)' }, + { value: FlyerTypes.DIGITAL_NO_SOCIAL, label: 'Digital flyer (with NO social media advertising)' }, + { value: FlyerTypes.PHYSICAL_WITH_ADVERTISING, label: 'Physical flyer (with advertising)' }, + { value: FlyerTypes.PHYSICAL_NO_ADVERTISING, label: 'Physical flyer (with NO advertising)' }, + { value: FlyerTypes.NEWSLETTER, label: 'Newsletter (IEEE, ECE, IDEA)' }, + { value: FlyerTypes.OTHER, label: 'Other' } ]; // Logo options const LOGO_OPTIONS = [ - { value: 'IEEE', label: 'IEEE' }, - { value: 'AS', label: 'AS (required if funded by AS)' }, - { value: 'HKN', label: 'HKN' }, - { value: 'TESC', label: 'TESC' }, - { value: 'PIB', label: 'PIB' }, - { value: 'TNT', label: 'TNT' }, - { value: 'SWE', label: 'SWE' }, - { value: 'OTHER', label: 'OTHER (please upload transparent logo files)' } + { value: LogoOptions.IEEE, label: 'IEEE' }, + { value: LogoOptions.AS, label: 'AS (required if funded by AS)' }, + { value: LogoOptions.HKN, label: 'HKN' }, + { value: LogoOptions.TESC, label: 'TESC' }, + { value: LogoOptions.PIB, label: 'PIB' }, + { value: LogoOptions.TNT, label: 'TNT' }, + { value: LogoOptions.SWE, label: 'SWE' }, + { value: LogoOptions.OTHER, label: 'OTHER (please upload transparent logo files)' } ]; // Format options @@ -76,7 +77,7 @@ const PRSection: React.FC = ({ formData, onDataChange }) => { // Handle file upload for other logos const handleLogoFileChange = (e: React.ChangeEvent) => { if (e.target.files && e.target.files.length > 0) { - const newFiles = Array.from(e.target.files); + const newFiles = Array.from(e.target.files) as File[]; setOtherLogoFiles(newFiles); onDataChange({ other_logos: newFiles }); } @@ -113,7 +114,7 @@ const PRSection: React.FC = ({ formData, onDataChange }) => { {/* Other flyer type input */} - {formData.flyer_type.includes('other') && ( + {formData.flyer_type.includes(FlyerTypes.OTHER) && (
= ({ formData, onDataChange }) => { {/* Advertising start date */} {formData.flyer_type.some(type => - type === 'digital_with_social' || - type === 'physical_with_advertising' || - type === 'newsletter' + type === FlyerTypes.DIGITAL_WITH_SOCIAL || + type === FlyerTypes.PHYSICAL_WITH_ADVERTISING || + type === FlyerTypes.NEWSLETTER ) && ( {/* Logo file upload */} - {formData.required_logos.includes('OTHER') && ( + {formData.required_logos.includes(LogoOptions.OTHER) && (