diff --git a/src/api/counselor/addCounselorData.ts b/src/api/counselor/addCounselorData.ts index 600ab81d..a59718cb 100644 --- a/src/api/counselor/addCounselorData.ts +++ b/src/api/counselor/addCounselorData.ts @@ -10,7 +10,8 @@ import { putAgenciesForCounselor } from '../agency/putAgenciesForCounselor'; * @return data */ export const addCounselorData = (counselorData: Record): Promise => { - const { firstname, lastname, formalLanguage, email, absent, username, twoFactorAuth } = counselorData; + const { firstname, lastname, formalLanguage, email, absent, username, twoFactorAuth, isGroupchatConsultant } = + counselorData; // just use needed data from whole form data const strippedCounselor = { @@ -21,6 +22,7 @@ export const addCounselorData = (counselorData: Record): Promise): Promise { diff --git a/src/api/counselor/editCounselorData.ts b/src/api/counselor/editCounselorData.ts index c90a7e16..abe34bac 100644 --- a/src/api/counselor/editCounselorData.ts +++ b/src/api/counselor/editCounselorData.ts @@ -12,7 +12,17 @@ import { putAgenciesForCounselor } from '../agency/putAgenciesForCounselor'; * @return data */ export const editCounselorData = async (id: string, formData: CounselorData): Promise => { - const { firstname, lastname, formalLanguage, email, absent, username, absenceMessage, twoFactorAuth } = formData; + const { + firstname, + lastname, + formalLanguage, + email, + absent, + username, + absenceMessage, + twoFactorAuth, + isGroupchatConsultant, + } = formData; // just use needed data from whole form data const strippedCounselor = { @@ -24,6 +34,7 @@ export const editCounselorData = async (id: string, formData: CounselorData): Pr username: encodeUsername(username), ...(absent ? { absenceMessage } : {}), twoFactorAuth, + isGroupchatConsultant, }; const ids = ((formData.agencies as LabeledValue[])?.map(({ value }) => value) || []) as string[]; diff --git a/src/context/FeatureContext.tsx b/src/context/FeatureContext.tsx index 0144d832..216655ab 100644 --- a/src/context/FeatureContext.tsx +++ b/src/context/FeatureContext.tsx @@ -38,6 +38,10 @@ const FeatureProvider = ({ children, tenantData, publicTenantData }: FeatureProv name: FeatureFlag.ConsultingTypesForAgencies, active: !!featureFlags.useConsultingTypesForAgencies, }, + { + name: FeatureFlag.GroupChatV2, + active: !!publicTenantData?.settings.featureGroupChatV2Enabled, + }, ]); return {children}; diff --git a/src/enums/FeatureFlag.ts b/src/enums/FeatureFlag.ts index 06ebe140..46b2cea0 100644 --- a/src/enums/FeatureFlag.ts +++ b/src/enums/FeatureFlag.ts @@ -5,4 +5,5 @@ export enum FeatureFlag { Topics = 'topics', TopicsInRegistration = 'topicsInRegistration', ConsultingTypesForAgencies = 'consultingTypesForAgencies', + GroupChatV2 = 'featureGroupChatV2Enabled', } diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json index ce4a98a0..2c33678e 100644 --- a/src/locales/de/translation.json +++ b/src/locales/de/translation.json @@ -325,6 +325,7 @@ "counselor.formalLanguage": "Formale Sprache", "counselor.absent": "Abwesend", "counselor.absenceMessage": "Abwesenheitsnotiz", + "counselor.isGroupChatConsultant": "Dem Benutzer erlauben, Gruppenchats zu erstellen", "counselor.title.text": "Erstellen und bearbeiten Sie Daten Ihrer Berater", "counselor.modal.headline.delete": "Nutzer wirklich löschen", "counselor.modal.headline.edit": "Berater bearbeiten", diff --git a/src/pages/Statistic.tsx b/src/pages/Statistic.tsx index bda3dea3..81c5e4a3 100644 --- a/src/pages/Statistic.tsx +++ b/src/pages/Statistic.tsx @@ -1,5 +1,5 @@ import { FileDownloadOutlined } from '@mui/icons-material'; -import { Col, Row } from 'antd'; +import { Col, Row, Spin } from 'antd'; import { useEffect, useState } from 'react'; import { CSVLink } from 'react-csv'; import { useTranslation } from 'react-i18next'; @@ -93,12 +93,20 @@ export const Statistic = () => {
{t('statistic.title.text')}
{t('statistic.download.text')}
- - - - - {t('statistic.download.link')} - {' '} + {isRequestInProgress ? ( + + ) : ( + + + + + {t('statistic.download.link')} + + )}
diff --git a/src/pages/users/Edit/index.tsx b/src/pages/users/Edit/index.tsx index 43150994..4abafb46 100644 --- a/src/pages/users/Edit/index.tsx +++ b/src/pages/users/Edit/index.tsx @@ -20,12 +20,15 @@ import { useUserPermissions } from '../../../hooks/useUserPermission'; import { convertToOptions } from '../../../utils/convertToOptions'; import { decodeUsername } from '../../../utils/encryptionHelpers'; import { FormSwitchField } from '../../../components/FormSwitchField'; +import { useFeatureContext } from '../../../context/FeatureContext'; +import { FeatureFlag } from '../../../enums/FeatureFlag'; export const UserEditOrAdd = () => { const navigate = useNavigate(); const [form] = useForm(); const { can } = useUserPermissions(); const { t } = useTranslation(); + const { isEnabled } = useFeatureContext(); const { typeOfUsers, id } = useParams<{ id: string; typeOfUsers: TypeOfUser }>(); const { data: consultantsResponse, isLoading: isLoadingConsultants } = useConsultantsOrAdminsData({ search: id, @@ -92,6 +95,7 @@ export const UserEditOrAdd = () => { initialValues={{ ...(singleData || { formalLanguage: true, + isGroupchatConsultant: isEnabled(FeatureFlag.GroupChatV2), }), username: decodeUsername(singleData?.username || ''), agencies: convertToOptions(singleData?.agencies || [], ['postcode', 'name', 'city'], 'id'), @@ -142,6 +146,12 @@ export const UserEditOrAdd = () => { {isEditing && } + {isEnabled(FeatureFlag.GroupChatV2) && ( + + )} {isAbsentEnabled && ( diff --git a/src/types/counselor.d.ts b/src/types/counselor.d.ts index be3c8c17..3eb34b90 100644 --- a/src/types/counselor.d.ts +++ b/src/types/counselor.d.ts @@ -19,4 +19,5 @@ export interface CounselorData { deleteDate?: string; status: Status; twoFactorAuth?: boolean; + isGroupchatConsultant?: boolean; } diff --git a/src/types/tenant.d.ts b/src/types/tenant.d.ts index 33cfdb98..c2ba81cd 100644 --- a/src/types/tenant.d.ts +++ b/src/types/tenant.d.ts @@ -22,6 +22,7 @@ export interface BasicTenantData { featureTopicsEnabled?: boolean | null; topicsInRegistrationEnabled?: boolean | null; featureStatisticsEnabled?: boolean; + featureGroupChatV2Enabled?: boolean; }; }