diff --git a/src/views/connected/structure/popins/PopinEditionContrat.js b/src/views/connected/structure/popins/PopinEditionContrat.js index b53ec6f2..fcc93786 100644 --- a/src/views/connected/structure/popins/PopinEditionContrat.js +++ b/src/views/connected/structure/popins/PopinEditionContrat.js @@ -4,7 +4,7 @@ import DatePicker, { registerLocale } from 'react-datepicker'; import fr from 'date-fns/locale/fr'; import { validTypeDeContratWithoutEndDate } from '../../../../utils/formatagesUtils'; import { ModalMode } from '../../../../utils/enumUtils'; -import { DatePickerPortal, getDateFin } from '../utils/functionUtils'; +import { DatePickerPortal, getDateFin, getSalaire } from '../utils/functionUtils'; registerLocale('fr', fr); @@ -49,7 +49,7 @@ function PopinEditionContrat({ setOpenModalContrat, updateContract, extendContra setIsRecrutementCoordinateur(conseiller?.contratCoordinateur ?? false); setDateDebut(conseiller?.dateDebutDeContrat ? new Date(conseiller?.dateDebutDeContrat) : null); setDateFin(getDateFin(conseiller)); - setSalaire(conseiller?.salaire ? String(conseiller?.salaire) : ''); + setSalaire(getSalaire(conseiller)); } }, [mode, conseiller]); diff --git a/src/views/connected/structure/utils/functionUtils.js b/src/views/connected/structure/utils/functionUtils.js index fcba48d5..85814cdd 100644 --- a/src/views/connected/structure/utils/functionUtils.js +++ b/src/views/connected/structure/utils/functionUtils.js @@ -141,6 +141,16 @@ export function getDateFin(conseiller) { return null; } +export function getSalaire(conseiller) { + const demandeInitiee = getDemandeInitiee(conseiller); + if (demandeInitiee) { + return String(demandeInitiee.salaireSouhaitee); + } else if (conseiller?.salaire) { + return String(conseiller?.salaire); + } + return ''; +} + export function getDemandeInitiee(contrat) { return contrat.demandesDeProlongation?.find(demande => demande.statut === 'initiee'); }