|
|
@ -7,6 +7,11 @@ import { PlusIcon } from '@heroicons/react/20/solid';
|
|
|
|
import { TrashIcon } from '@heroicons/react/24/outline';
|
|
|
|
import { TrashIcon } from '@heroicons/react/24/outline';
|
|
|
|
import { Button, Dialog } from '@tih/ui';
|
|
|
|
import { Button, Dialog } from '@tih/ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
defaultFullTimeOfferValues,
|
|
|
|
|
|
|
|
defaultInternshipOfferValues,
|
|
|
|
|
|
|
|
} from '~/pages/offers/submit';
|
|
|
|
|
|
|
|
|
|
|
|
import FormMonthYearPicker from './components/FormMonthYearPicker';
|
|
|
|
import FormMonthYearPicker from './components/FormMonthYearPicker';
|
|
|
|
import FormSelect from './components/FormSelect';
|
|
|
|
import FormSelect from './components/FormSelect';
|
|
|
|
import FormTextArea from './components/FormTextArea';
|
|
|
|
import FormTextArea from './components/FormTextArea';
|
|
|
@ -479,7 +484,13 @@ function OfferDetailsFormArray({
|
|
|
|
label="Add another offer"
|
|
|
|
label="Add another offer"
|
|
|
|
size="lg"
|
|
|
|
size="lg"
|
|
|
|
variant="tertiary"
|
|
|
|
variant="tertiary"
|
|
|
|
onClick={() => append({})}
|
|
|
|
onClick={() =>
|
|
|
|
|
|
|
|
append(
|
|
|
|
|
|
|
|
jobType === JobType.FullTime
|
|
|
|
|
|
|
|
? defaultFullTimeOfferValues
|
|
|
|
|
|
|
|
: defaultInternshipOfferValues,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -488,16 +499,18 @@ function OfferDetailsFormArray({
|
|
|
|
export default function OfferDetailsForm() {
|
|
|
|
export default function OfferDetailsForm() {
|
|
|
|
const [jobType, setJobType] = useState(JobType.FullTime);
|
|
|
|
const [jobType, setJobType] = useState(JobType.FullTime);
|
|
|
|
const [isDialogOpen, setDialogOpen] = useState(false);
|
|
|
|
const [isDialogOpen, setDialogOpen] = useState(false);
|
|
|
|
const { control, register } = useFormContext();
|
|
|
|
const { control } = useFormContext();
|
|
|
|
const fieldArrayValues = useFieldArray({ control, name: 'offers' });
|
|
|
|
const fieldArrayValues = useFieldArray({ control, name: 'offers' });
|
|
|
|
|
|
|
|
|
|
|
|
const toggleJobType = () => {
|
|
|
|
const toggleJobType = () => {
|
|
|
|
|
|
|
|
fieldArrayValues.remove();
|
|
|
|
if (jobType === JobType.FullTime) {
|
|
|
|
if (jobType === JobType.FullTime) {
|
|
|
|
setJobType(JobType.Internship);
|
|
|
|
setJobType(JobType.Internship);
|
|
|
|
|
|
|
|
fieldArrayValues.append(defaultInternshipOfferValues);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setJobType(JobType.FullTime);
|
|
|
|
setJobType(JobType.FullTime);
|
|
|
|
|
|
|
|
fieldArrayValues.append(defaultFullTimeOfferValues);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fieldArrayValues.remove();
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const switchJobTypeLabel = () =>
|
|
|
|
const switchJobTypeLabel = () =>
|
|
|
@ -523,7 +536,6 @@ export default function OfferDetailsForm() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setDialogOpen(true);
|
|
|
|
setDialogOpen(true);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
{...register(`offers.${0}.jobType`)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="mx-5 w-1/3">
|
|
|
|
<div className="mx-5 w-1/3">
|
|
|
@ -538,7 +550,6 @@ export default function OfferDetailsForm() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setDialogOpen(true);
|
|
|
|
setDialogOpen(true);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
{...register(`offers.${0}.jobType`)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|