Skip to content

Commit

Permalink
fix: ne pas afficher les détails quandon crée un nouveau groupe alors…
Browse files Browse the repository at this point in the history
… que tout était caché
  • Loading branch information
Arnaud AMBROSELLI committed Feb 1, 2024
1 parent 7e3491c commit 16a4aba
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const ActionCategoriesSettings = () => {
title={<h3 className="tw-mb-0 tw-text-xl tw-font-extrabold">Catégories d'action</h3>}
data={dataFormatted}
addButtonCaption="Ajouter un groupe"
sectionId='action-categories'
onAddGroup={onAddGroup}
onGroupTitleChange={onGroupTitleChange}
dataItemKey={(cat) => cat}
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/scenes/organisation/ConsultationsSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const ConsultationsSettings = () => {
<DragAndDropSettings
title={<h3 className="tw-mb-0 tw-text-xl tw-font-extrabold">Consultations</h3>}
data={dataFormatted}
sectionId="consultations"
addButtonCaption="Ajouter un type de consultations"
onAddGroup={onAddConsultationType}
onGroupTitleChange={onConsultationTypeChange}
Expand Down
13 changes: 12 additions & 1 deletion dashboard/src/scenes/organisation/DragAndDropSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,22 @@ const Group = ({
setIsEditingGroupTitle(false);
};

const isOpened = useMemo(() => {
return window.sessionStorage.getItem(`drag-and-drop-setting-${sectionId}-${groupTitle}-open`) === 'true';
});

return (
<>
<div className={['tw-min-h-full tw-break-all tw-p-1 ', isAlone ? '' : 'tw-basis-1/2 xl:tw-basis-1/3'].join(' ')}>
<details
open
open={!!isOpened}
onToggle={(e) => {
if (e.target.open) {
window.sessionStorage.setItem(`drag-and-drop-setting-${sectionId}-${groupTitle}-open`, 'true');
} else {
window.sessionStorage.removeItem(`drag-and-drop-setting-${sectionId}-${groupTitle}-open`);
}
}}
key={groupTitle}
id={groupTitle}
data-group={groupTitle}
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/scenes/organisation/MedicalFileSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const MedicalFileSettings = () => {
<DragAndDropSettings
title={<h3 className="tw-mb-0 tw-text-xl tw-font-extrabold">Dossier médical</h3>}
data={dataFormatted}
sectionId='medical-file'
dataItemKey={(cat) => cat.name}
ItemComponent={MedicalFileCustomField}
NewItemComponent={AddField}
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/scenes/organisation/ObservationsSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const ObservationsSettings = () => {
<DragAndDropSettings
title={<h3 className="tw-mb-0 tw-text-xl tw-font-extrabold">Observations de territoire</h3>}
data={dataFormatted}
sectionId="customFieldsObs"
dataItemKey={(cat) => cat.name}
ItemComponent={ObservationCustomField}
NewItemComponent={AddField}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const PersonCustomFieldsSettings = () => {
data={dataFormatted}
addButtonCaption="Ajouter un groupe de champs personnalisés"
onAddGroup={onAddGroup}
sectionId="customFieldsPersons"
onGroupTitleChange={onGroupTitleChange}
dataItemKey={(cat) => cat.name}
ItemComponent={ConsultationCustomField}
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/scenes/organisation/ServicesSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const ServicesSettings = () => {
data={dataFormatted}
addButtonCaption="Ajouter un groupe"
onAddGroup={onAddGroup}
sectionId="services"
onGroupTitleChange={onGroupTitleChange}
dataItemKey={(cat) => cat}
ItemComponent={Service}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const StructuresCategoriesSettings = () => {
<DragAndDropSettings
title="Catégories de structures"
data={dataFormatted}
sectionId="structuresGroupedCategories"
dataItemKey={(cat) => cat}
ItemComponent={Category}
NewItemComponent={AddCategory}
Expand Down

0 comments on commit 16a4aba

Please sign in to comment.