|
|
|
@ -124,28 +124,6 @@ export default function SubmitResumeForm({
|
|
|
|
|
onDrop: onFileDrop,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const fetchFilePdf = useCallback(async () => {
|
|
|
|
|
const fileUrl = initFormDetails?.url;
|
|
|
|
|
|
|
|
|
|
if (fileUrl == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data = await axios
|
|
|
|
|
.get(fileUrl, {
|
|
|
|
|
responseType: 'blob',
|
|
|
|
|
})
|
|
|
|
|
.then((res) => res.data);
|
|
|
|
|
|
|
|
|
|
const keyAndFileName = fileUrl.substring(fileUrl.indexOf('resumes'));
|
|
|
|
|
const fileName = keyAndFileName.substring(keyAndFileName.indexOf('-') + 1);
|
|
|
|
|
|
|
|
|
|
const file = new File([data], fileName);
|
|
|
|
|
setValue('file', file, {
|
|
|
|
|
shouldDirty: false,
|
|
|
|
|
});
|
|
|
|
|
}, [initFormDetails?.url, setValue]);
|
|
|
|
|
|
|
|
|
|
// Route user to sign in if not logged in
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (status !== 'loading') {
|
|
|
|
@ -155,11 +133,6 @@ export default function SubmitResumeForm({
|
|
|
|
|
}
|
|
|
|
|
}, [router, session, status]);
|
|
|
|
|
|
|
|
|
|
// Fetch initial file PDF for edit form
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchFilePdf();
|
|
|
|
|
}, [fetchFilePdf]);
|
|
|
|
|
|
|
|
|
|
const onSubmit: SubmitHandler<IFormInput> = async (data) => {
|
|
|
|
|
setIsLoading(true);
|
|
|
|
|
let fileUrl = initFormDetails?.url ?? '';
|
|
|
|
@ -313,7 +286,9 @@ export default function SubmitResumeForm({
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
{/* Upload Resume Section */}
|
|
|
|
|
{/* Upload resume form */}
|
|
|
|
|
{isNewForm && (
|
|
|
|
|
<>
|
|
|
|
|
<p className="text-sm font-medium text-slate-700">
|
|
|
|
|
Upload resume (PDF format)
|
|
|
|
|
<span aria-hidden="true" className="text-danger-500">
|
|
|
|
@ -321,12 +296,13 @@ export default function SubmitResumeForm({
|
|
|
|
|
*
|
|
|
|
|
</span>
|
|
|
|
|
</p>
|
|
|
|
|
{/* Upload Resume Box */}
|
|
|
|
|
<div className="mb-4">
|
|
|
|
|
<div
|
|
|
|
|
{...getRootProps()}
|
|
|
|
|
className={clsx(
|
|
|
|
|
fileUploadError ? 'border-danger-600' : 'border-gray-300',
|
|
|
|
|
fileUploadError
|
|
|
|
|
? 'border-danger-600'
|
|
|
|
|
: 'border-gray-300',
|
|
|
|
|
'mt-2 flex justify-center rounded-md border-2 border-dashed px-6 pt-5 pb-6',
|
|
|
|
|
)}>
|
|
|
|
|
<div className="space-y-1 text-center">
|
|
|
|
@ -375,9 +351,13 @@ export default function SubmitResumeForm({
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{fileUploadError && (
|
|
|
|
|
<p className="text-danger-600 text-sm">{fileUploadError}</p>
|
|
|
|
|
<p className="text-danger-600 text-sm">
|
|
|
|
|
{fileUploadError}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
{/* Additional Info Section */}
|
|
|
|
|
<div className="mb-8">
|
|
|
|
|
<TextArea
|
|
|
|
|