- {getLabelForJobTitleType(title as JobTitleType)}
+ {getLabelForJobTitleType(title as JobTitleType)}{' '}
+ {`(${JobTypeLabel[jobType]})`}
Company: {company.name}, {location}
diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
index d5aee9b0..82b4895f 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
@@ -22,6 +22,7 @@ export default function OffersSubmissionAnalysis({
allAnalysis={analysis}
isError={isError}
isLoading={isLoading}
+ isSubmission={true}
/>
);
diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx
index 2e9c90aa..4de2911d 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx
@@ -27,6 +27,7 @@ import { trpc } from '~/utils/trpc';
const defaultOfferValues = {
comments: '',
companyId: '',
+ jobTitle: '',
jobType: JobType.FULLTIME,
location: '',
monthYearReceived: {
@@ -39,11 +40,38 @@ const defaultOfferValues = {
export const defaultFullTimeOfferValues = {
...defaultOfferValues,
jobType: JobType.FULLTIME,
+ offersFullTime: {
+ baseSalary: {
+ currency: 'SGD',
+ value: null,
+ },
+ bonus: {
+ currency: 'SGD',
+ value: null,
+ },
+ level: '',
+ stocks: {
+ currency: 'SGD',
+ value: null,
+ },
+ totalCompensation: {
+ currency: 'SGD',
+ value: null,
+ },
+ },
};
export const defaultInternshipOfferValues = {
...defaultOfferValues,
jobType: JobType.INTERN,
+ offersIntern: {
+ internshipCycle: null,
+ monthlySalary: {
+ currency: 'SGD',
+ value: null,
+ },
+ startYear: null,
+ },
};
const defaultOfferProfileValues = {
@@ -198,6 +226,32 @@ export default function OffersSubmissionForm({
scrollToTop();
}, [step]);
+ useEffect(() => {
+ const warningText =
+ 'Leave this page? Changes that you made will not be saved.';
+ const handleWindowClose = (e: BeforeUnloadEvent) => {
+ e.preventDefault();
+ return (e.returnValue = warningText);
+ };
+ const handleRouteChange = (url: string) => {
+ if (url.includes('/offers/submit/result')) {
+ return;
+ }
+ if (window.confirm(warningText)) {
+ return;
+ }
+ router.events.emit('routeChangeError');
+ throw 'routeChange aborted.';
+ };
+ window.addEventListener('beforeunload', handleWindowClose);
+ router.events.on('routeChangeStart', handleRouteChange);
+ return () => {
+ window.removeEventListener('beforeunload', handleWindowClose);
+ router.events.off('routeChangeStart', handleRouteChange);
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
return (
@@ -210,7 +264,7 @@ export default function OffersSubmissionForm({
/>
-
;
}>();
-
const offerFields = formState.errors.offers?.[index];
+ const watchJobTitle = useWatch({
+ name: `offers.${index}.offersIntern.title`,
+ });
+ const watchCompanyId = useWatch({
+ name: `offers.${index}.companyId`,
+ });
+ const watchCompanyName = useWatch({
+ name: `offers.${index}.companyName`,
+ });
+
return (
- setValue(`offers.${index}.offersIntern.title`, value)
- }
+ value={{
+ id: watchJobTitle,
+ label: getLabelForJobTitleType(watchJobTitle as JobTitleType),
+ value: watchJobTitle,
+ }}
+ onSelect={(option) => {
+ if (option) {
+ setValue(`offers.${index}.offersIntern.title`, option.value);
+ }
+ }}
/>
@@ -290,10 +329,17 @@ function InternshipOfferDetailsForm({
- setValue(`offers.${index}.companyId`, value)
- }
+ value={{
+ id: watchCompanyId,
+ label: watchCompanyName,
+ value: watchCompanyId,
+ }}
+ onSelect={(option) => {
+ if (option) {
+ setValue(`offers.${index}.companyId`, option.value);
+ setValue(`offers.${index}.companyName`, option.label);
+ }
+ }}
/>
-
{jobLevel ? `${jobTitle}, ${jobLevel}` : jobTitle}
+
+ {jobLevel ? `${jobTitle}, ${jobLevel}` : jobTitle}{' '}
+ {jobType && `(${JobTypeLabel[jobType]})`}
+
{!duration && receivedMonth && (
diff --git a/apps/portal/src/components/offers/profile/ProfileHeader.tsx b/apps/portal/src/components/offers/profile/ProfileHeader.tsx
index 4a0d944b..dc5e8ddb 100644
--- a/apps/portal/src/components/offers/profile/ProfileHeader.tsx
+++ b/apps/portal/src/components/offers/profile/ProfileHeader.tsx
@@ -10,6 +10,7 @@ import { Button, Dialog, Spinner, Tabs } from '@tih/ui';
import ProfilePhotoHolder from '~/components/offers/profile/ProfilePhotoHolder';
import type { BackgroundDisplayData } from '~/components/offers/types';
+import { JobTypeLabel } from '~/components/offers/types';
import { getProfileEditPath } from '~/utils/offers/link';
@@ -95,8 +96,8 @@ export default function ProfileHeader({
title="Are you sure you want to delete this offer profile?"
onClose={() => setIsDialogOpen(false)}>
- All comments will be gone. You will not be able to access or
- recover it.
+ All information and comments in this offer profile will be
+ deleted. You will not be able to access or recover them.
)}
@@ -144,7 +145,11 @@ export default function ProfileHeader({