From 4ae6a1a7c543fff400e06ce89452c4cf59a755d2 Mon Sep 17 00:00:00 2001 From: Dragos-Paul Strat Date: Wed, 7 Aug 2024 17:39:36 +0300 Subject: [PATCH 1/8] feat: [476] wip edit application + label --- .../controllers/application.controller.ts | 18 --- .../src/shared/entities/application-labels.ts | 8 ++ .../src/assets/locales/ro/translation.json | 9 ++ .../components/AddApplicationConfig.ts | 27 ++++ .../apps-store/components/ApplicationForm.tsx | 9 +- .../components/ApplicationListTable.tsx | 122 +----------------- .../application/Application.queries.ts | 11 -- 7 files changed, 57 insertions(+), 147 deletions(-) create mode 100644 backend/src/shared/entities/application-labels.ts diff --git a/backend/src/modules/application/controllers/application.controller.ts b/backend/src/modules/application/controllers/application.controller.ts index 28fae5c1..9dd3843b 100644 --- a/backend/src/modules/application/controllers/application.controller.ts +++ b/backend/src/modules/application/controllers/application.controller.ts @@ -108,24 +108,6 @@ export class ApplicationController { ); } - @Roles(Role.SUPER_ADMIN) - @ApiParam({ name: 'id', type: String }) - @Patch(':id/activate') - activate(@Param('id') id: number) { - return this.appService.update(id, { - status: ApplicationStatus.ACTIVE, - }); - } - - @Roles(Role.SUPER_ADMIN) - @ApiParam({ name: 'id', type: String }) - @Patch(':id/deactivate') - deactivate(@Param('id') id: number) { - return this.appService.update(id, { - status: ApplicationStatus.DISABLED, - }); - } - @Roles(Role.SUPER_ADMIN) @ApiParam({ name: 'id', type: String }) @ApiQuery({ type: () => ApplicationAccessFilterDto }) diff --git a/backend/src/shared/entities/application-labels.ts b/backend/src/shared/entities/application-labels.ts new file mode 100644 index 00000000..74b687b8 --- /dev/null +++ b/backend/src/shared/entities/application-labels.ts @@ -0,0 +1,8 @@ +import { BaseEntity } from 'src/common/base/base-entity.class'; +import { Column, Entity } from 'typeorm'; + +@Entity({ name: '_application-label' }) +export class ApplicationLabel extends BaseEntity { + @Column({ type: 'text', name: 'name' }) + name: string; +} diff --git a/frontend/src/assets/locales/ro/translation.json b/frontend/src/assets/locales/ro/translation.json index 0e215641..467a974c 100644 --- a/frontend/src/assets/locales/ro/translation.json +++ b/frontend/src/assets/locales/ro/translation.json @@ -1062,6 +1062,15 @@ "label": "Descriere scurtă", "helper": "Descrie aplicația în maxim 200 de caractere" }, + "status": { + "label": "Status aplicație", + "options": { + "active": "Activă (aplicația poate fi adăugată de organizații în profilul lor)", + "disabled": "Inactivă (aplicația nu poate fi adăugată de organizații în profilul lor)" + }, + "section_title": "Status aplicație", + "section_subtitle": "Statusul aplicației influențează disponibilitatea acesteia pentru organizații" + }, "description": { "required": "Descrierea extinsă este obligatorie", "max": "Descrierea extinsă poate avea maxim 7000 de caractere", diff --git a/frontend/src/pages/apps-store/components/AddApplicationConfig.ts b/frontend/src/pages/apps-store/components/AddApplicationConfig.ts index 7bbc8681..949a6f6e 100644 --- a/frontend/src/pages/apps-store/components/AddApplicationConfig.ts +++ b/frontend/src/pages/apps-store/components/AddApplicationConfig.ts @@ -3,6 +3,7 @@ import InputFieldHttpAddon from '../../../components/InputField/components/Input import { ApplicationTypeEnum, ApplicationTypeNaming } from '../constants/ApplicationType.enum'; import i18n from '../../../common/config/i18n'; import { ApplicationPullingType } from '../enums/application-pulling-type.enum'; +import { ApplicationStatus } from '../../../services/application/interfaces/Application.interface'; const translations = { name: { @@ -17,6 +18,9 @@ const translations = { label: i18n.t('appstore:config.type.label'), required: i18n.t('appstore:config.type.required'), }, + status: { + label: i18n.t('appstore:config.status.label'), + }, short: { required: i18n.t('appstore:config.short.required'), max: i18n.t('appstore:config.short.max'), @@ -139,6 +143,29 @@ export const AddAppConfig: Record = { }, ], }, + status: { + key: 'status', + label: translations.status.label, + rules: { + required: { + value: true, + message: translations.type.required, + }, + }, + helperText: '', + radioConfigs: [ + { + label: i18n.t('appstore:config.status.options.active'), + name: 'status', + value: ApplicationStatus.ACTIVE, + }, + { + label: i18n.t('appstore:config.status.options.disabled'), + name: 'status', + value: ApplicationStatus.DISABLED, + }, + ], + }, shortDescription: { key: 'shortDescription', rules: { diff --git a/frontend/src/pages/apps-store/components/ApplicationForm.tsx b/frontend/src/pages/apps-store/components/ApplicationForm.tsx index f73eb0cd..f8ff9522 100644 --- a/frontend/src/pages/apps-store/components/ApplicationForm.tsx +++ b/frontend/src/pages/apps-store/components/ApplicationForm.tsx @@ -20,10 +20,11 @@ import { CreateApplicationDto } from '../../../services/application/interfaces/A import { ApplicationTypeEnum } from '../constants/ApplicationType.enum'; import { AddAppConfig } from './AddApplicationConfig'; import RichText from '../../../components/RichText/RichText'; +import { ApplicationStatus } from '../../../services/application/interfaces/Application.interface'; interface ApplicationFormProps { control: Control; - errors: FieldErrorsImpl>; + errors: FieldErrorsImpl & { status?: ApplicationStatus }>; watch: UseFormWatch; file: File | null; setFile: (file: File) => void; @@ -264,6 +265,12 @@ const ApplicationForm = ({ )} {/* End Logo */} +
+ + {readonly && ( + + )} +
{fields.map((item, index) => { diff --git a/frontend/src/pages/apps-store/components/ApplicationListTable.tsx b/frontend/src/pages/apps-store/components/ApplicationListTable.tsx index 7fb9ffae..6613c7c8 100644 --- a/frontend/src/pages/apps-store/components/ApplicationListTable.tsx +++ b/frontend/src/pages/apps-store/components/ApplicationListTable.tsx @@ -5,17 +5,13 @@ import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import { PaginationConfig } from '../../../common/config/pagination.config'; import { OrderDirection } from '../../../common/enums/sort-direction.enum'; -import { useErrorToast, useSuccessToast } from '../../../common/hooks/useToast'; -import ConfirmationModal from '../../../components/confim-removal-modal/ConfirmationModal'; +import { useErrorToast } from '../../../common/hooks/useToast'; import DataTableFilters from '../../../components/data-table-filters/DataTableFilters'; import DataTableComponent from '../../../components/data-table/DataTableComponent'; import PopoverMenu, { PopoverMenuRowType } from '../../../components/popover-menu/PopoverMenu'; import Select from '../../../components/Select/Select'; import { - useActivateApplication, useApplicationsQuery, - useDectivateApplication, - useRemoveApplication, } from '../../../services/application/Application.queries'; import { Application, @@ -34,13 +30,12 @@ const ApplicationListTable = () => { const [searchWord, setSearchWord] = useState(null); const [status, setStatus] = useState<{ status: ApplicationStatus; label: string } | null>(); const [type, setType] = useState<{ type: ApplicationTypeEnum; label: string } | null>(); - const [applicationToBeRemoved, setApplicationToBeRemoved] = useState(null); const navigate = useNavigate(); const { t } = useTranslation(['appstore', 'common']); - const { isLoading, error, refetch } = useApplicationsQuery( + const { isLoading, error } = useApplicationsQuery( rowsPerPage as number, page as number, orderByColumn as string, @@ -50,26 +45,8 @@ const ApplicationListTable = () => { type?.type, ); - const { - mutateAsync: activateApplication, - error: activateApplicationError, - isLoading: activateApplicationLoading, - } = useActivateApplication(); - - const { - mutateAsync: deactivateApplication, - error: deactivateApplicationError, - isLoading: deactivateApplicationLoading, - } = useDectivateApplication(); - const { applications } = useApplications(); - const { - mutateAsync: removeApplication, - error: removeApplicationError, - isLoading: removeApplicationLoading, - } = useRemoveApplication(); - useEffect(() => { if (applications?.meta) { setPage(applications.meta.currentPage); @@ -84,35 +61,9 @@ const ApplicationListTable = () => { useErrorToast(t('list.load_error')); } - if (activateApplicationError || deactivateApplicationError) { - useErrorToast(t('list.access_error')); - } - - if (removeApplicationError) { - useErrorToast(t('list.remove_error')); - } - }, [error, deactivateApplicationError, activateApplicationError, removeApplicationError]); + }, [error]); const buildUserActionColumn = (): TableColumn => { - const restrictedApplicationMenu = [ - { - name: t('list.view'), - icon: EyeIcon, - onClick: onView, - }, - { - name: t('list.activate'), - icon: ArrowPathIcon, - onClick: onActivateApplication, - type: PopoverMenuRowType.SUCCESS, - }, - { - name: t('list.remove'), - icon: TrashIcon, - onClick: onDeleteApplication, - type: PopoverMenuRowType.REMOVE, - }, - ]; const activeApplicationMenu = [ { @@ -121,12 +72,6 @@ const ApplicationListTable = () => { onClick: onView, type: PopoverMenuRowType.INFO, }, - { - name: t('list.restrict'), - icon: NoSymbolIcon, - onClick: onRestrictApplication, - type: PopoverMenuRowType.REMOVE, - }, ]; return { @@ -134,11 +79,7 @@ const ApplicationListTable = () => { cell: (row: Application) => ( ), width: '50px', @@ -179,52 +120,12 @@ const ApplicationListTable = () => { selected.type === ApplicationTypeEnum.ALL ? setType(null) : setType(selected); }; - const onActivateApplication = (row: Application) => { - activateApplication( - { applicationId: row.id.toString() }, - { - onSuccess: () => refetch(), - }, - ); - }; - - const onRestrictApplication = (row: Application) => { - deactivateApplication( - { applicationId: row.id.toString() }, - { - onSuccess: () => refetch(), - }, - ); - }; - const onResetFilters = () => { setStatus(null); setType(null); setSearchWord(null); }; - const onDeleteApplication = (row: Application) => { - setApplicationToBeRemoved(row.id); - }; - - const onConfirmDeleteApplication = () => { - if (applicationToBeRemoved) - removeApplication( - { applicationId: applicationToBeRemoved }, - { - onSuccess: () => { - useSuccessToast(t('list.remove_success')); - refetch(); - }, - onSettled: () => setApplicationToBeRemoved(null), - }, - ); - }; - - const onCancelRemoveApplication = () => { - setApplicationToBeRemoved(null); - }; - return (
{ columns={[...ApplicationtListTableHeaders, buildUserActionColumn()]} data={applications.items} loading={ - isLoading || - activateApplicationLoading || - deactivateApplicationLoading || - removeApplicationLoading + isLoading } pagination sortServer @@ -284,16 +182,6 @@ const ApplicationListTable = () => { onRowClicked={onView} />
- {applicationToBeRemoved && ( - - )}
); }; diff --git a/frontend/src/services/application/Application.queries.ts b/frontend/src/services/application/Application.queries.ts index 088dfa58..f0d4fc37 100644 --- a/frontend/src/services/application/Application.queries.ts +++ b/frontend/src/services/application/Application.queries.ts @@ -143,17 +143,6 @@ export const useUpdateApplicationMutation = () => { ); }; -export const useActivateApplication = () => { - return useMutation(({ applicationId }: { applicationId: string }) => - activateApplication(applicationId), - ); -}; - -export const useDectivateApplication = () => { - return useMutation(({ applicationId }: { applicationId: string }) => - deactivateApplication(applicationId), - ); -}; export const useRestrictApplicationMutation = () => { return useMutation( From a8bf1e98ca2e60b1b53739920c95ecbba0fe280d Mon Sep 17 00:00:00 2001 From: Dragos-Paul Strat Date: Mon, 12 Aug 2024 10:43:37 +0300 Subject: [PATCH 2/8] feat: [476] wip application label --- .../1723119327053-ApplicationLabel.ts | 33 ++++++++++ .../application/dto/create-application.dto.ts | 4 ++ .../entities/application.entity.ts | 17 +++++- .../services/application.service.ts | 47 ++++++++++++++- .../controllers/nomenclatures.controller.ts | 5 ++ ...labels.ts => application-labels.entity.ts} | 0 .../shared/services/nomenclatures.service.ts | 13 ++++ backend/src/shared/shared.module.ts | 2 + frontend/src/common/helpers/format.helper.ts | 5 ++ .../interfaces/application-label.interface.ts | 3 + .../content-wrapper/ContentWrapper.tsx | 2 +- .../CreatableMultiSelect.tsx | 6 +- .../application/ApplicationWithOngList.tsx | 60 ++++++++++++++++++- .../components/AddApplicationConfig.ts | 10 ++++ .../apps-store/components/ApplicationForm.tsx | 41 +++++++++++-- .../apps-store/components/EditApplication.tsx | 7 +++ .../application/Application.queries.ts | 3 - .../application/Application.service.ts | 15 ++++- .../application/interfaces/Application.dto.ts | 1 + .../interfaces/Application.interface.ts | 2 + .../nomenclature/Nomenclature.queries.ts | 10 ++++ .../nomenclature/Nomenclatures.service.ts | 4 ++ .../nomenclature/nomenclature.selectors.ts | 2 + .../store/nomenclature/nomenclature.slice.ts | 5 ++ frontend/src/store/store.ts | 3 + 25 files changed, 281 insertions(+), 19 deletions(-) create mode 100644 backend/src/migrations/1723119327053-ApplicationLabel.ts rename backend/src/shared/entities/{application-labels.ts => application-labels.entity.ts} (100%) create mode 100644 frontend/src/common/interfaces/application-label.interface.ts diff --git a/backend/src/migrations/1723119327053-ApplicationLabel.ts b/backend/src/migrations/1723119327053-ApplicationLabel.ts new file mode 100644 index 00000000..4f343033 --- /dev/null +++ b/backend/src/migrations/1723119327053-ApplicationLabel.ts @@ -0,0 +1,33 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class ApplicationLabel1723119327053 implements MigrationInterface { + name = 'ApplicationLabel1723119327053'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "_application-label" ("id" SERIAL NOT NULL, "deleted_on" TIMESTAMP WITH TIME ZONE, "created_on" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_on" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "name" text NOT NULL, CONSTRAINT "PK_c0aaf1127ad3beeaf0d3ad70096" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e4a4e4b1582c4e665cff9be33e" ON "_application-label" ("created_on") `, + ); + await queryRunner.query( + `ALTER TABLE "application" ADD "application_label_id" integer`, + ); + await queryRunner.query( + `ALTER TABLE "application" ADD CONSTRAINT "FK_318029631a770782ba1c66721fd" FOREIGN KEY ("application_label_id") REFERENCES "_application-label"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "application" DROP CONSTRAINT "FK_318029631a770782ba1c66721fd"`, + ); + await queryRunner.query( + `ALTER TABLE "application" DROP COLUMN "application_label_id"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_e4a4e4b1582c4e665cff9be33e"`, + ); + await queryRunner.query(`DROP TABLE "_application-label"`); + } +} diff --git a/backend/src/modules/application/dto/create-application.dto.ts b/backend/src/modules/application/dto/create-application.dto.ts index 1726aacb..78a303fe 100644 --- a/backend/src/modules/application/dto/create-application.dto.ts +++ b/backend/src/modules/application/dto/create-application.dto.ts @@ -10,6 +10,7 @@ import { import { REGEX } from 'src/common/constants/patterns.constant'; import { ApplicationPullingType } from '../enums/application-pulling-type.enum'; import { ApplicationTypeEnum } from '../enums/ApplicationType.enum'; +import { ApplicationLabel } from 'src/shared/entities/application-labels.entity'; export class CreateApplicationDto { @IsString() @@ -56,4 +57,7 @@ export class CreateApplicationDto { @IsOptional() @Length(2, 100, { each: true }) steps?: string[]; + + @IsOptional() + applicationLabel: Partial; } diff --git a/backend/src/modules/application/entities/application.entity.ts b/backend/src/modules/application/entities/application.entity.ts index b88beb87..05ebbc07 100644 --- a/backend/src/modules/application/entities/application.entity.ts +++ b/backend/src/modules/application/entities/application.entity.ts @@ -1,9 +1,17 @@ import { BaseEntity } from 'src/common/base/base-entity.class'; -import { Column, Entity, OneToMany } from 'typeorm'; +import { + Column, + Entity, + JoinColumn, + JoinTable, + ManyToOne, + OneToMany, +} from 'typeorm'; import { ApplicationPullingType } from '../enums/application-pulling-type.enum'; import { ApplicationStatus } from '../enums/application-status.enum'; import { ApplicationTypeEnum } from '../enums/ApplicationType.enum'; import { OngApplication } from './ong-application.entity'; +import { ApplicationLabel } from 'src/shared/entities/application-labels.entity'; @Entity() export class Application extends BaseEntity { @@ -60,4 +68,11 @@ export class Application extends BaseEntity { @OneToMany(() => OngApplication, (ongApp) => ongApp.application) ongApplications: OngApplication[]; + + @Column({ type: 'integer', name: 'application_label_id', nullable: true }) + applicationLabelId: number; + + @ManyToOne((type) => ApplicationLabel) + @JoinColumn({ name: 'application_label_id' }) + applicationLabel: ApplicationLabel; } diff --git a/backend/src/modules/application/services/application.service.ts b/backend/src/modules/application/services/application.service.ts index 901e8637..9db9e131 100644 --- a/backend/src/modules/application/services/application.service.ts +++ b/backend/src/modules/application/services/application.service.ts @@ -37,6 +37,8 @@ import { ApplicationTableViewRepository } from '../repositories/application-tabl import { ApplicationRepository } from '../repositories/application.repository'; import { OngApplicationRepository } from '../repositories/ong-application.repository'; import { UserOngApplicationRepository } from '../repositories/user-ong-application.repository'; +import { ApplicationLabel } from 'src/shared/entities/application-labels.entity'; +import { NomenclaturesService } from 'src/shared/services'; @Injectable() export class ApplicationService { @@ -49,6 +51,7 @@ export class ApplicationService { private readonly ongApplicationRepository: OngApplicationRepository, private readonly userOngApplicationRepository: UserOngApplicationRepository, private readonly applicationOngViewRepository: ApplicationOngViewRepository, + private readonly nomenclatureService: NomenclaturesService, ) {} public async create( @@ -250,6 +253,7 @@ export class ApplicationService { 'application.video_link as "videoLink"', 'application.pulling_type as "pullingType"', 'application.status as "applicationStatus"', + 'applicationLabel', ]) .leftJoin( 'ong_application', @@ -262,6 +266,11 @@ export class ApplicationService { 'userOngApp', 'userOngApp.ong_application_id = ongApp.id', ) + .leftJoin( + '_application-label', + 'applicationLabel', + 'applicationLabel.id = application.application_label_id', + ) .where('application.id = :applicationId', { applicationId }); // for employee add further filtersin by user id @@ -292,8 +301,19 @@ export class ApplicationService { ); } + const applicationLabel = { + id: applicationWithDetails.applicationLabel_id, + name: applicationWithDetails.applicationLabel_name, + }; + + delete applicationWithDetails.applicationLabel_id; + delete applicationWithDetails.applicationLabel_name; + delete applicationWithDetails.applicationLabel_created_on; + delete applicationWithDetails.applicationLabel_updated_on; + return { ...applicationWithDetails, + applicationLabel, logo, }; } @@ -346,7 +366,19 @@ export class ApplicationService { }; } - return this.applicationRepository.update({ id }, applicationPayload); + let applicationLabel = null; + if (applicationPayload.applicationLabel) { + applicationLabel = await this.saveAndGetApplicationLabel( + applicationPayload.applicationLabel, + ); + } + + console.log(applicationLabel); + + return this.applicationRepository.update( + { id }, + { ...applicationPayload, applicationLabel }, + ); } catch (error) { this.logger.error({ error: { error }, @@ -502,4 +534,17 @@ export class ApplicationService { return applicationCount; } + + private async saveAndGetApplicationLabel( + label: Partial, + ): Promise { + if (label.id) { + return label as ApplicationLabel; + } + + const newLabel = + await this.nomenclatureService.createApplicationLabel(label); + + return newLabel; + } } diff --git a/backend/src/shared/controllers/nomenclatures.controller.ts b/backend/src/shared/controllers/nomenclatures.controller.ts index 26060590..c5adc2fd 100644 --- a/backend/src/shared/controllers/nomenclatures.controller.ts +++ b/backend/src/shared/controllers/nomenclatures.controller.ts @@ -78,4 +78,9 @@ export class NomenclaturesController { getIssuers() { return this.nomenclaturesService.getIssuers({}); } + + @Get('application-labels') + getApplicationLabels() { + return this.nomenclaturesService.getApplicationLabels({}); + } } diff --git a/backend/src/shared/entities/application-labels.ts b/backend/src/shared/entities/application-labels.entity.ts similarity index 100% rename from backend/src/shared/entities/application-labels.ts rename to backend/src/shared/entities/application-labels.entity.ts diff --git a/backend/src/shared/services/nomenclatures.service.ts b/backend/src/shared/services/nomenclatures.service.ts index af2d3746..790afe0c 100644 --- a/backend/src/shared/services/nomenclatures.service.ts +++ b/backend/src/shared/services/nomenclatures.service.ts @@ -17,6 +17,7 @@ import { Federation } from '../entities/federation.entity'; import { PracticeDomain } from 'src/modules/practice-program/entities/practice_domain.entity'; import { ServiceDomain } from 'src/modules/civic-center-service/entities/service-domain.entity'; import { Beneficiary } from 'src/modules/civic-center-service/entities/beneficiary.entity'; +import { ApplicationLabel } from '../entities/application-labels.entity'; @Injectable() export class NomenclaturesService { @@ -45,6 +46,8 @@ export class NomenclaturesService { private readonly beneficiaryRepository: Repository, @InjectRepository(Issuer) private readonly issuersRepository: Repository, + @InjectRepository(ApplicationLabel) + private readonly applicationLabelRepository: Repository, ) {} public getCity(conditions: FindOneOptions) { @@ -169,4 +172,14 @@ export class NomenclaturesService { public getIssuers(conditions: FindManyOptions) { return this.issuersRepository.find(conditions); } + + public getApplicationLabels(conditions: FindManyOptions) { + return this.applicationLabelRepository.find(conditions); + } + + public createApplicationLabel( + applicationLabel: Partial, + ): Promise { + return this.applicationLabelRepository.save(applicationLabel); + } } diff --git a/backend/src/shared/shared.module.ts b/backend/src/shared/shared.module.ts index dc13eab0..31086f82 100644 --- a/backend/src/shared/shared.module.ts +++ b/backend/src/shared/shared.module.ts @@ -20,6 +20,7 @@ import { FileManagerService } from './services/file-manager.service'; import { PracticeDomain } from 'src/modules/practice-program/entities/practice_domain.entity'; import { ServiceDomain } from 'src/modules/civic-center-service/entities/service-domain.entity'; import { Beneficiary } from 'src/modules/civic-center-service/entities/beneficiary.entity'; +import { ApplicationLabel } from './entities/application-labels.entity'; @Global() @Module({ @@ -37,6 +38,7 @@ import { Beneficiary } from 'src/modules/civic-center-service/entities/beneficia ServiceDomain, Beneficiary, Issuer, + ApplicationLabel, ]), HttpModule, ], diff --git a/frontend/src/common/helpers/format.helper.ts b/frontend/src/common/helpers/format.helper.ts index 818b93e6..d9f0e302 100644 --- a/frontend/src/common/helpers/format.helper.ts +++ b/frontend/src/common/helpers/format.helper.ts @@ -70,6 +70,11 @@ export const mapSelectToSkill = ( ): { id?: number; name: string } => item?.__isNew__ ? { name: item.label } : { id: item.value, name: item.label }; +export const mapSelectToApplicationLabel = ( + item: ISelectData & { __isNew__?: boolean }, +): { id?: number; name: string } => + item?.__isNew__ ? { name: item.label } : { id: item.value, name: item.label }; + // Cities / Counties export const mapCitiesToSelect = (item: any): ISelectData => ({ value: item?.id, diff --git a/frontend/src/common/interfaces/application-label.interface.ts b/frontend/src/common/interfaces/application-label.interface.ts new file mode 100644 index 00000000..d3b37248 --- /dev/null +++ b/frontend/src/common/interfaces/application-label.interface.ts @@ -0,0 +1,3 @@ +import { BaseNomenclatureEntity } from './base-nomenclature-entity.interface'; + +export interface ApplicationLabel extends BaseNomenclatureEntity {} diff --git a/frontend/src/components/content-wrapper/ContentWrapper.tsx b/frontend/src/components/content-wrapper/ContentWrapper.tsx index 1ad0b486..6eb62927 100644 --- a/frontend/src/components/content-wrapper/ContentWrapper.tsx +++ b/frontend/src/components/content-wrapper/ContentWrapper.tsx @@ -53,7 +53,7 @@ const ContentWrapper = ({ {fields.length > 0 && (