- updated zustand and react libraries;
- added 'put in draft' btn;
This commit is contained in:
@@ -6,7 +6,7 @@ import { useForm } from 'react-hook-form';
|
||||
import 'quill/dist/quill.core.css';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
import { storeSet, useStoreValue } from '../../store';
|
||||
|
||||
// api
|
||||
import ApplicationService from '../../service/application-service';
|
||||
@@ -50,9 +50,9 @@ const BandoApplicationPreview = () => {
|
||||
const [totalSteps, setTotalSteps] = useState(0);
|
||||
const [applicationStatus, setApplicationStatus] = useState('');
|
||||
const [activeStep, setActiveStep] = useState(1);
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const role = useStore().main.getRole();
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const chosenCompanyId = useStoreValue('chosenCompanyId');
|
||||
const role = useStoreValue('getRole');
|
||||
const isAsyncRequest = useStoreValue('isAsyncRequest');
|
||||
const toast = useRef(null);
|
||||
const formMsgs = useRef(null);
|
||||
const {
|
||||
@@ -90,7 +90,7 @@ const BandoApplicationPreview = () => {
|
||||
|
||||
const onValidate = () => {
|
||||
const applId = getApplicationId();
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
formMsgs.current.clear();
|
||||
|
||||
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
|
||||
@@ -107,7 +107,7 @@ const BandoApplicationPreview = () => {
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errValidateApplicationCallback = (data) => {
|
||||
@@ -118,7 +118,7 @@ const BandoApplicationPreview = () => {
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const saveDraft = (saveAndMove = '') => {
|
||||
@@ -131,7 +131,7 @@ const BandoApplicationPreview = () => {
|
||||
}
|
||||
|
||||
const goBackward = () => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
const queryParams = 'ROLE_BENEFICIARY' === role
|
||||
? [
|
||||
['formId', formId],
|
||||
@@ -147,7 +147,7 @@ const BandoApplicationPreview = () => {
|
||||
}
|
||||
|
||||
const goForward = () => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
const queryParams = 'ROLE_BENEFICIARY' === role
|
||||
? [
|
||||
['formId', formId],
|
||||
@@ -172,8 +172,8 @@ const BandoApplicationPreview = () => {
|
||||
setApplicationStatus(data.data.applicationStatus)
|
||||
setActiveStep(data.data.currentStep);
|
||||
|
||||
/*const chosenCompanyId = storeGet.main.chosenCompanyId();
|
||||
const companies = storeGet.main.companies();
|
||||
/*const chosenCompanyId = storeGet('chosenCompanyId');
|
||||
const companies = storeGet('companies');
|
||||
const company = head(companies.filter(o => o.id === chosenCompanyId));*/
|
||||
let formDataInitial = {};
|
||||
let dynamicData = {
|
||||
@@ -206,11 +206,11 @@ const BandoApplicationPreview = () => {
|
||||
reset();
|
||||
setFormInitialData(formDataInitial);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errGetApplFormCallbacks = (data) => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
if (data.status === 'VALIDATION_ERROR') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
@@ -226,7 +226,7 @@ const BandoApplicationPreview = () => {
|
||||
|
||||
const onDownloadApplicationPdf = () => {
|
||||
const applId = getApplicationId();
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
|
||||
ApplicationService.downloadApplicationPdf(applId, {}, getPdfCallback, errPdfCallback);
|
||||
}
|
||||
@@ -241,12 +241,12 @@ const BandoApplicationPreview = () => {
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errPdfCallback = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const actionBtns = <div className="appPageSection__actions">
|
||||
@@ -327,7 +327,7 @@ const BandoApplicationPreview = () => {
|
||||
const applId = getApplicationId();
|
||||
|
||||
if (applId) {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
const queryParams = ['ROLE_BENEFICIARY', 'ROLE_CONFIDI'].includes(role)
|
||||
? [
|
||||
['companyId', chosenCompanyId]
|
||||
|
||||
Reference in New Issue
Block a user