From 26af74350e87f0c64f3fcdba84bd975fcf45e36d Mon Sep 17 00:00:00 2001 From: patskal <111123815+koliapatskal@users.noreply.github.com> Date: Fri, 24 Feb 2023 14:04:20 +0200 Subject: [PATCH] Added parameter to get parent in list with children (#2027) --- src/app/shared/models/child.model.ts | 5 ++-- .../services/children/children.service.ts | 8 +++-- .../create-application.component.ts | 29 ++++++++++++------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/app/shared/models/child.model.ts b/src/app/shared/models/child.model.ts index eed36d2a0e..c3f532c4c9 100644 --- a/src/app/shared/models/child.model.ts +++ b/src/app/shared/models/child.model.ts @@ -1,7 +1,7 @@ -import { ParentWithContactInfo } from './parent.model'; import { DataItem } from './item.model'; -import { Person } from './user.model'; +import { ParentWithContactInfo } from './parent.model'; import { PaginationParameters } from './queryParameters.model'; +import { Person } from './user.model'; export class Child implements Person { id: string; @@ -32,6 +32,7 @@ export class Child implements Person { export interface ChildrenParameters extends PaginationParameters { isParent?: boolean; + isGetParent?: boolean; searchString?: string; } export interface RequestParams { diff --git a/src/app/shared/services/children/children.service.ts b/src/app/shared/services/children/children.service.ts index 1dc6205be8..a5c5087beb 100644 --- a/src/app/shared/services/children/children.service.ts +++ b/src/app/shared/services/children/children.service.ts @@ -26,9 +26,13 @@ export class ChildrenService { if (typeof parameters.isParent === 'boolean') { params = params.set('isParent', parameters.isParent); } - } - params = params.set('Size', parameters.size.toString()).set('From', parameters.from.toString()); + if (typeof parameters.isGetParent === 'boolean') { + params = params.set('isGetParent', parameters.isGetParent); + } + + params = params.set('Size', parameters.size.toString()).set('From', parameters.from.toString()); + } return params; } diff --git a/src/app/shell/personal-cabinet/parent/create-application/create-application.component.ts b/src/app/shell/personal-cabinet/parent/create-application/create-application.component.ts index f93391a216..98e4e7395d 100644 --- a/src/app/shell/personal-cabinet/parent/create-application/create-application.component.ts +++ b/src/app/shell/personal-cabinet/parent/create-application/create-application.component.ts @@ -1,28 +1,36 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; +import { combineLatest, Observable, Subject } from 'rxjs'; +import { filter, takeUntil } from 'rxjs/operators'; + +import { Component, OnDestroy, OnInit } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; -import { ActivatedRoute } from '@angular/router'; -import { Select, Store } from '@ngxs/store'; -import { combineLatest, Observable, Subject } from 'rxjs'; -import { takeUntil, filter } from 'rxjs/operators'; import { MatSelectChange } from '@angular/material/select'; import { MatTabChangeEvent } from '@angular/material/tabs'; -import { ConfirmationModalWindowComponent } from '../../../../shared/components/confirmation-modal-window/confirmation-modal-window.component'; +import { ActivatedRoute } from '@angular/router'; +import { Select, Store } from '@ngxs/store'; + +import { + ConfirmationModalWindowComponent +} from '../../../../shared/components/confirmation-modal-window/confirmation-modal-window.component'; import { Constants, ModeConstants } from '../../../../shared/constants/constants'; -import { ModalConfirmationType } from '../../../../shared/enum/modal-confirmation'; import { NavBarName } from '../../../../shared/enum/enumUA/navigation-bar'; +import { ModalConfirmationType } from '../../../../shared/enum/modal-confirmation'; import { Application } from '../../../../shared/models/application.model'; import { Child, ChildrenParameters } from '../../../../shared/models/child.model'; import { ParentWithContactInfo } from '../../../../shared/models/parent.model'; +import { SearchResponse } from '../../../../shared/models/search.model'; import { Workshop } from '../../../../shared/models/workshop.model'; -import { NavigationBarService } from '../../../../shared/services/navigation-bar/navigation-bar.service'; +import { + NavigationBarService +} from '../../../../shared/services/navigation-bar/navigation-bar.service'; import { AddNavPath, DeleteNavPath } from '../../../../shared/store/navigation.actions'; -import { GetUsersChildren, CreateApplication, GetStatusIsAllowToApply } from '../../../../shared/store/parent.actions'; +import { + CreateApplication, GetStatusIsAllowToApply, GetUsersChildren +} from '../../../../shared/store/parent.actions'; import { ParentState } from '../../../../shared/store/parent.state.'; import { RegistrationState } from '../../../../shared/store/registration.state'; import { GetWorkshopById } from '../../../../shared/store/shared-user.actions'; import { SharedUserState } from '../../../../shared/store/shared-user.state'; -import { SearchResponse } from '../../../../shared/models/search.model'; @Component({ selector: 'app-create-application', @@ -63,6 +71,7 @@ export class CreateApplicationComponent implements OnInit, OnDestroy { childrenParameters: ChildrenParameters = { searchString: '', isParent: null, + isGetParent: true, from: 0, size: 0 };