Skip to content
Snippets Groups Projects
Unverified Commit eefa462e authored by vmaubert's avatar vmaubert Committed by GitHub
Browse files

fix(étape): initialise correctement le statut lors de l'édition (#1389)

* fix(étape): initialise correctement le statut lors de l'édition

* ajoute test
parent 3b2c33bd
No related branches found
No related tags found
No related merge requests found
......@@ -150,6 +150,8 @@ const etapeEditFormApiClient: Props['apiClient'] = {
{ etapeTypeId: 'mfr', etapeStatutId: 'fai', mainStep: true },
{ etapeTypeId: 'mdp', etapeStatutId: 'fai', mainStep: true },
{ etapeTypeId: 'asc', etapeStatutId: 'fai', mainStep: true },
{ etapeTypeId: 'aca', etapeStatutId: 'fav', mainStep: true },
{ etapeTypeId: 'aca', etapeStatutId: 'def', mainStep: true },
])
},
getEtapeHeritagePotentiel(etape, titreDemarcheId) {
......@@ -309,3 +311,27 @@ export const EtapeModificationAvis: StoryFn = () => (
goToDemarche={goToDemarcheAction}
/>
)
export const EtapeDecisionAdministration: StoryFn = () => (
<EtapeEditForm
initTab="points"
apiClient={etapeEditFormApiClient}
demarcheId={demarcheIdValidator.parse('demarcheId')}
demarcheTypeId="oct"
titreSlug={titreSlugValidator.parse('titre-slug')}
titreTypeId="cxw"
perimetre={{ sdomZoneIds: [], superposition_alertes: [], communes: [] }}
etape={{
...etape,
typeId: 'aca',
statutId: 'fav',
isBrouillon: ETAPE_IS_NOT_BROUILLON,
contenu: {},
}}
user={{
role: 'super',
...testBlankUser,
}}
entreprises={entreprises}
goToDemarche={goToDemarcheAction}
/>
)
<form>
<div>
<div>
<h2 class="fr-pt-6w">Informations principales
<!---->
</h2>
<!---->
</div>
<div>
<div class="fr-grid-row">
<div class="fr-col-12 fr-col-xl-6">
<div class="fr-input-group" style="margin-bottom: 0px;"><label class="fr-label" for="input_271">Date
<!---->
<!---->
</label><input class="fr-input" name="input_271" id="input_271" type="date">
<!---->
</div>
<div class="fr-mt-2w">
<div class="fr-input-group"><label class="fr-label fr-mb-1w" for="select-etape-type">Type *</label>
<div id="select-etape-type_wrapper" class="_typeahead_8eddf1">
<div class="flex"><input id="select-etape-type" type="text" name="select-etape-type" disabled="" class="fr-input" placeholder="" autocomplete="off"></div>
<!---->
</div>
</div>
<div class="fr-select-group"><label class="fr-label" for="select-etape-statut-id">Statut *
<!---->
</label><select class="fr-select" id="select-etape-statut-id" aria-label="Statut" name="select-etape-statut-id">
<option disabled="" value="fav">favorable</option>
<option value="def">défavorable</option>
<option disabled="" hidden="" value="">Selectionnez une option</option>
</select></div>
</div>
</div>
</div>
</div>
</div>
<div gotodemarche="function(...args){if(options.implicit){let storyRenderer=(&quot;__STORYBOOK_PREVIEW__&quot;in global.global?global.global.__STORYBOOK_PREVIEW__:void 0)?.storyRenders.find(render=>render.phase===&quot;playing&quot;||render.phase===&quot;rendering&quot;);if(storyRenderer){let deprecated=!window?.FEATURES?.disallowImplicitActionsInRenderV8,error=new previewErrors.ImplicitActionsDuringRendering({phase:storyRenderer.phase,name,deprecated});if(deprecated)console.warn(error);else throw error}}let channel=previewApi.addons.getChannel(),id=generateId(),minDepth=5,serializedArgs=args.map(serializeArg),normalizedArgs=args.length>1?serializedArgs:serializedArgs[0],actionDisplayToEmit={id,count:0,data:{name,args:normalizedArgs},options:{...actionOptions,maxDepth:minDepth+(actionOptions.depth||3),allowFunction:actionOptions.allowFunction||!1}};channel.emit(EVENT_ID,actionDisplayToEmit);}">
<div>
<div>
<h2 class="fr-pt-6w">Propriétés
<!---->
</h2>
<!---->
</div>
<div>
<div class="fr-grid-row">
<div class="fr-col-12 fr-col-xl-6">
<div class="fr-mb-1w">
<div style="display: flex;">
<div class="fr-input-group" style="margin-bottom: 0px;"><label class="fr-label" for="input_74">Durée (années)
<!---->
<!---->
</label><input class="fr-input" name="input_74" id="input_74" type="number">
<!---->
</div>
<div class="fr-input-group fr-ml-2w" style="margin-bottom: 0px;"><label class="fr-label" for="input_878">Durée (mois)
<!---->
<!---->
</label><input class="fr-input" name="input_878" id="input_878" type="number">
<!---->
</div>
</div>
<div>
<div class="fr-toggle"><input type="checkbox" class="fr-toggle__input" id="toggle_967"><label class="fr-toggle__label" for="toggle_967" data-fr-checked-label="Activé" data-fr-unchecked-label="Désactivé"><span class=" fr-ml-4w">Hériter de l’étape "Demande" du 01-01-2022</span></label>
<!---->
</div>
</div>
</div>
<div class="fr-mb-1w">
<div class="fr-input-group" style="margin-bottom: 0px;"><label class="fr-label" for="input_128">Date de début
<!---->
<!---->
</label><input class="fr-input" name="input_128" id="input_128" type="date">
<!---->
</div>
<!---->
</div>
<div class="fr-mb-1w">
<div class="fr-input-group" style="margin-bottom: 0px;"><label class="fr-label" for="input_453">Date d’échéance
<!---->
<!---->
</label><input class="fr-input" name="input_453" id="input_453" type="date">
<!---->
</div>
<div>
<div class="fr-toggle"><input type="checkbox" class="fr-toggle__input" id="toggle_556"><label class="fr-toggle__label" for="toggle_556" data-fr-checked-label="Activé" data-fr-unchecked-label="Désactivé"><span class=" fr-ml-4w">Hériter de l’étape "Demande" du 01-01-2022</span></label>
<!---->
</div>
</div>
</div>
<div class="fr-mb-1w">
<div class="fr-input-group fr-mb-0"><label class="fr-label" for="filters_autocomplete_titulaires">Titulaires</label>
<div id="filters_autocomplete_titulaires_wrapper" class="_typeahead_8eddf1 fr-mt-1w">
<div style="display: flex; max-height: unset; flex-wrap: wrap; gap: 8px; outline-offset: 2px; outline-width: 2px; outline-color: rgb(10, 118, 246);" class="fr-input _fake-input_8eddf1"><input id="filters_autocomplete_titulaires" type="text" name="filters_autocomplete_titulaires" style="outline: none;" placeholder="titulaires" autocomplete="off"></div>
<!---->
</div>
</div>
<!---->
</div>
<div class="fr-mb-1w">
<div>
<div class="fr-input-group fr-input-group--disabled fr-mb-0"><label class="fr-label">Amodiataires</label>
<div class="fr-mt-1w">
<p class="fr-tag fr-tag--md fr-mr-1w" title="Nom de l'entreprise 0" aria-label="Nom de l'entreprise 0">Nom de l'entreprise 0</p>
<p class="fr-tag fr-tag--md fr-mr-1w" title="Nom de l'entreprise 1" aria-label="Nom de l'entreprise 1">Nom de l'entreprise 1</p>
<p class="fr-tag fr-tag--md fr-mr-1w" title="Nom de l'entreprise 2" aria-label="Nom de l'entreprise 2">Nom de l'entreprise 2</p>
</div>
</div>
</div>
<div>
<div class="fr-toggle"><input type="checkbox" class="fr-toggle__input" id="toggle_216"><label class="fr-toggle__label" for="toggle_216" data-fr-checked-label="Activé" data-fr-unchecked-label="Désactivé"><span class=" fr-ml-4w">Hériter de l’étape "Demande" du 01-01-2022</span></label>
<!---->
</div>
</div>
</div>
<div class="fr-mb-1w">
<div>
<div class="fr-input-group fr-input-group--disabled fr-mb-0"><label class="fr-label">Substances</label>
<div class="fr-mt-1w">
<p class="fr-tag fr-tag--md fr-mr-1w" title="Argent" aria-label="Argent">Argent</p>
</div>
</div>
</div>
<div>
<div class="fr-toggle"><input type="checkbox" class="fr-toggle__input" id="toggle_585"><label class="fr-toggle__label" for="toggle_585" data-fr-checked-label="Activé" data-fr-unchecked-label="Désactivé"><span class=" fr-ml-4w">Hériter de l’étape "Demande" du 01-01-2022</span></label>
<!---->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!---->
<div>
<div>
<h2 class="fr-pt-6w">Périmètre
<!---->
</h2>
<!---->
</div>
<div>
<div>
<div class="fr-mb-1w">
<div><button class="fr-btn fr-btn--primary fr-btn--md" title="Importer un périmètre" aria-label="Importer un périmètre" type="button">Importer un périmètre</button>
<!---->
<!---->
<!---->
</div>
<!---->
</div>
<!---->
<!---->
<!---->
</div>
</div>
</div>
<div>
<div>
<h2 class="fr-pt-6w">Liste des documents
<!---->
</h2>
<!---->
</div>
<div>
<!---->
<div style="display: flex; flex-direction: column;" class="fr-mt-3w">
<div class="fr-table fr-mb-0">
<table style="display: table;">
<caption>Documents complémentaires</caption>
<thead>
<tr>
<th scope="col">Nom</th>
<th scope="col">Description</th>
<th scope="col">Visibilité</th>
<th scope="col" style="display: flex; justify-content: end;">Action</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div><button class="fr-btn fr-btn--secondary fr-btn--md fr-icon-add-line fr-btn--icon-right fr-mt-1w" title="Ajouter un document complémentaire" aria-label="Ajouter un document complémentaire" type="button" style="align-self: end;">Ajouter</button>
</div>
<!---->
<!---->
<!---->
</div>
</div>
<!---->
<!---->
<div class="fr-input-group fr-mt-2w" style="flex-grow: 1;"><label class="fr-label" for="textarea_58">Notes
<!---->
<!---->
</label><textarea class="fr-input" name="textarea_58" id="textarea_58"></textarea></div>
<div class="fr-checkbox-group"><input name="archive" id="checkbox_661" type="checkbox"><label class="fr-label" for="checkbox_661">Cette note est un avertissement<span class="fr-hint-text">Apparait sur le résumé de la démarche</span></label></div>
</div>
<div class="fr-mt-2w fr-pt-2w fr-pb-2w" style="position: sticky; bottom: 0px; z-index: 100000; background: white;">
<div style="display: flex; flex-direction: column;">
<!---->
<div style="display: flex; justify-content: end; align-items: center;" class="fr-mt-2w">
<!----><button class="fr-btn fr-btn--primary fr-btn--md fr-ml-2w" title="Enregistrer l'étape" aria-label="Enregistrer l'étape" type="submit">Enregistrer l'étape</button>
<!---->
</div>
</div>
</div>
<!---->
</form>
\ No newline at end of file
......@@ -76,7 +76,7 @@ export const TypeEdit = defineComponent<Props>(props => {
if (possibleStatuts.value.length === 1 || typeId === ETAPES_TYPES.participationDuPublic) {
newEtapeStatutId = possibleStatuts.value[0]
} else {
newEtapeStatutId = null
newEtapeStatutId = possibleStatuts.value.find(value => value === etapeStatutId.value) ?? null
}
if (newEtapeStatutId !== etapeStatutId.value || typeId !== etapeTypeId.value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment