1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

Fix a bug: admin could not create new SupportingDocumentType (problem was on js side)

This commit is contained in:
Nicolas Florentin 2023-10-10 11:14:47 +02:00
parent 7365a56e51
commit 637ced05dc
3 changed files with 12 additions and 2 deletions

View File

@ -3,6 +3,7 @@
## next release
- Fix a bug: fix ReservationReminderWorker, was sending reservation reminder to users with a event reservation not validated by admin + adds tests for all scenarios
- Fix a bug: admin could not create new SupportingDocumentType (problem was on js side)
## v6.1.2 2023 October 2

View File

@ -57,13 +57,20 @@ export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormPr
onChange('name', value);
};
/**
* to know if select input for groups is display or not
*/
const displayGroupsSelect = (): boolean => {
return (supportingDocumentType == null || supportingDocumentType?.document_type === 'User') && (groups.length > 0);
};
return (
<div className="supporting-documents-type-form">
<div className="info-area">
{t('app.admin.settings.account.supporting_documents_type_form.type_form_info')}
</div>
<form name="supportingDocumentTypeForm">
{supportingDocumentType?.document_type === 'User' &&
{displayGroupsSelect() &&
<div className="field">
<Select defaultValue={groupsValues()}
placeholder={t('app.admin.settings.account.supporting_documents_type_form.select_group')}

View File

@ -49,7 +49,9 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
// get groups
useEffect(() => {
GroupAPI.index({ disabled: false }).then(data => {
setGroups(data);
if (documentType === 'User') {
setGroups(data);
}
SupportingDocumentTypeAPI.index({ document_type: documentType }).then(pData => {
setSupportingDocumentsTypes(pData);
});