diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html index a8ae0ec5aa..5da4e1e70e 100644 --- a/src/app/header/header.component.html +++ b/src/app/header/header.component.html @@ -98,8 +98,8 @@

{{roles[user.role]}} - + + diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index 337fdfbb37..95e499ac3e 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -17,6 +17,7 @@ import { SidenavToggle } from '../shared/store/navigation.actions'; import { AppState } from '../shared/store/app.state'; import { FeaturesList } from '../shared/models/featuresList.model'; import { AdminState } from '../shared/store/admin.state'; +import { providerAdminRoleUkr } from '../shared/enum/enumUA/provider-admin'; @Component({ selector: 'app-header', @@ -62,6 +63,7 @@ export class HeaderComponent implements OnInit, OnDestroy { isMobile: boolean; navigationPaths: Navigation[]; subrole: string; + btnView: string = providerAdminRoleUkr.all; private destroy$: Subject = new Subject(); @@ -79,16 +81,28 @@ export class HeaderComponent implements OnInit, OnDestroy { this.isLoadingResultPage$, this.isLoadingMetaData$, this.isLoadingCabinet$, - ]) + ]); - combineLatest([this.isLoadingResultPage$, this.isLoadingMetaData$, this.isLoadingCabinet$, this.isLoadingAdminData$]) + combineLatest([ + this.isLoadingResultPage$, + this.isLoadingMetaData$, + this.isLoadingCabinet$, + this.isLoadingAdminData$, + ]) .pipe(takeUntil(this.destroy$), delay(0)) - .subscribe(([isLoadingResult, isLoadingMeta, isLoadingCabinet, isLoadingAdminData]) => { - this.isLoadingResultPage = isLoadingResult; - this.isLoadingMetaData = isLoadingMeta; - this.isLoadingCabinet = isLoadingCabinet; - this.isLoadingAdminData = isLoadingAdminData - }); + .subscribe( + ([ + isLoadingResult, + isLoadingMeta, + isLoadingCabinet, + isLoadingAdminData, + ]) => { + this.isLoadingResultPage = isLoadingResult; + this.isLoadingMetaData = isLoadingMeta; + this.isLoadingCabinet = isLoadingCabinet; + this.isLoadingAdminData = isLoadingAdminData; + } + ); combineLatest([this.isMobileScreen$, this.navigationPaths$]) .pipe(takeUntil(this.destroy$), delay(0)) diff --git a/src/app/shell/personal-cabinet/personal-cabinet-routing.module.ts b/src/app/shell/personal-cabinet/personal-cabinet-routing.module.ts index 46a6defdee..71599451af 100644 --- a/src/app/shell/personal-cabinet/personal-cabinet-routing.module.ts +++ b/src/app/shell/personal-cabinet/personal-cabinet-routing.module.ts @@ -6,7 +6,7 @@ import { MessagesComponent } from './messages/messages.component'; import { ParentGuard } from './parent/parent.guard'; import { ProviderGuard } from './provider/provider.guard'; import { WorkshopsComponent } from './workshops/workshops.component'; -import { ProviderAdminsComponent } from './provider-admins/provider-admins.component'; +import { ProviderAdminsComponent } from './provider/provider-admins/provider-admins.component'; const routes: Routes = [ { diff --git a/src/app/shell/personal-cabinet/personal-cabinet.module.ts b/src/app/shell/personal-cabinet/personal-cabinet.module.ts index 302c10f9c2..1047db6bda 100644 --- a/src/app/shell/personal-cabinet/personal-cabinet.module.ts +++ b/src/app/shell/personal-cabinet/personal-cabinet.module.ts @@ -11,7 +11,7 @@ import { UserConfigComponent } from './user-config/user-config.component'; import { UserConfigEditComponent } from './user-config/user-config-edit/user-config-edit.component'; import { ApplicationCardComponent } from './applications/application-card/application-card.component'; import { SharedModule } from 'src/app/shared/shared.module'; -import { ProviderAdminsComponent } from './provider-admins/provider-admins.component'; +import { ProviderAdminsComponent } from './provider/provider-admins/provider-admins.component'; @NgModule({ declarations: [ diff --git a/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.html b/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.html index ea59e60ee8..18135f2f46 100644 --- a/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.html +++ b/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.html @@ -97,9 +97,13 @@

{{(isDeputy) ? 'ДОДАТИ ЗАСТУПНИКА ДИ - + class="step-required">* + + diff --git a/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.spec.ts b/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.spec.ts index 8ec7d55cb7..e6c6cff177 100644 --- a/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.spec.ts +++ b/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.spec.ts @@ -10,7 +10,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { NgxsModule } from '@ngxs/store'; import { Workshop } from 'src/app/shared/models/workshop.model'; - import { CreateProviderAdminComponent } from './create-provider-admin.component'; describe('CreateProviderAdminComponent', () => { @@ -34,7 +33,7 @@ describe('CreateProviderAdminComponent', () => { CreateProviderAdminComponent, MockValidationHintForInputComponent, MockWorkshopChekcboxDropdownComponent - ] + ] }) .compileComponents(); }); @@ -49,7 +48,6 @@ describe('CreateProviderAdminComponent', () => { phoneNumber: new FormControl(), email: new FormControl(), }); - fixture.detectChanges(); }); it('should create', () => { @@ -74,6 +72,7 @@ class MockValidationHintForInputComponent { }) class MockWorkshopChekcboxDropdownComponent { - @Input() workshops: Workshop[]; + @Input() entities: Workshop[]; @Input() dropdownContainerClass: string; + @Input() declination: string; } \ No newline at end of file diff --git a/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.ts b/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.ts index 6d13837e9d..b5a897652c 100644 --- a/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.ts +++ b/src/app/shell/personal-cabinet/provider/create-provider-admin/create-provider-admin.component.ts @@ -19,6 +19,7 @@ import { ModalConfirmationType } from 'src/app/shared/enum/modal-confirmation'; import { providerAdminRole } from 'src/app/shared/enum/provider-admin'; import { NAME_REGEX } from 'src/app/shared/constants/regex-constants'; import { ValidationConstants } from 'src/app/shared/constants/validation'; +import { WorkshopDeclination } from 'src/app/shared/enum/enumUA/declinations/declination'; const defaultValidators: ValidatorFn[] = [ Validators.required, @@ -35,6 +36,7 @@ export class CreateProviderAdminComponent extends CreateFormComponent implements readonly validationConstants = ValidationConstants; readonly phonePrefix = Constants.PHONE_PREFIX; readonly mailFormPlaceholder = Constants.MAIL_FORMAT_PLACEHOLDER; + readonly WorkshopDeclination = WorkshopDeclination; @Select(RegistrationState.provider) provider$: Observable; @@ -74,8 +76,13 @@ export class CreateProviderAdminComponent extends CreateFormComponent implements } ngOnInit(): void { + this.provider$.pipe( + filter((provider: Provider) => !!provider), + takeUntil(this.destroy$) + ).subscribe((provider: Provider) => this.provider = provider); + if(!this.isDeputy){ - this.getProviderWorkshops(); + this.store.dispatch(new GetWorkshopsByProviderId(this.provider.id)); } } @@ -85,16 +92,6 @@ export class CreateProviderAdminComponent extends CreateFormComponent implements addNavPath(): void { } //TODO: add nav path - getProviderWorkshops(): void { - this.provider$.pipe( - filter((provider: Provider) => !!provider), - takeUntil(this.destroy$) - ).subscribe((provider: Provider) => { - this.provider = provider; - this.store.dispatch(new GetWorkshopsByProviderId(this.provider.id)); - }); - } - onWorkshopsSelect(workshopsId: string[]): void { this.managedWorkshopIds = workshopsId; } diff --git a/src/app/shell/personal-cabinet/provider-admins/provider-admins.component.html b/src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.html similarity index 92% rename from src/app/shell/personal-cabinet/provider-admins/provider-admins.component.html rename to src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.html index 7ed9ed3437..1902e42414 100644 --- a/src/app/shell/personal-cabinet/provider-admins/provider-admins.component.html +++ b/src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.html @@ -12,7 +12,7 @@ placeholder="Пошук за ПІБ, електронною поштою, телефоном, містом чи статусом" /> - + @@ -21,10 +21,10 @@ - + - + diff --git a/src/app/shell/personal-cabinet/provider-admins/provider-admins.component.scss b/src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.scss similarity index 100% rename from src/app/shell/personal-cabinet/provider-admins/provider-admins.component.scss rename to src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.scss diff --git a/src/app/shell/personal-cabinet/provider-admins/provider-admins.component.spec.ts b/src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.spec.ts similarity index 100% rename from src/app/shell/personal-cabinet/provider-admins/provider-admins.component.spec.ts rename to src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.spec.ts diff --git a/src/app/shell/personal-cabinet/provider-admins/provider-admins.component.ts b/src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.ts similarity index 98% rename from src/app/shell/personal-cabinet/provider-admins/provider-admins.component.ts rename to src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.ts index 4dc937bae5..3c3c834d50 100644 --- a/src/app/shell/personal-cabinet/provider-admins/provider-admins.component.ts +++ b/src/app/shell/personal-cabinet/provider/provider-admins/provider-admins.component.ts @@ -55,7 +55,7 @@ export class ProviderAdminsComponent implements OnInit { provider: Provider; filter = new FormControl(''); filterValue: string; - btnView: string= providerAdminRoleUkr.all; + btnView: string = providerAdminRoleUkr.all; destroy$: Subject = new Subject(); tabIndex: number; subrole: string; @@ -88,11 +88,11 @@ export class ProviderAdminsComponent implements OnInit { .subscribe((providerAdmins: ProviderAdmin[]) => { this.providerAdmins = this.updateStructureForTheTable(providerAdmins); }); + this.route.queryParams .pipe(takeUntil(this.destroy$)) .subscribe((params: Params) => { this.tabIndex = Object.keys(this.providerAdminRole).indexOf(params['role']); - this.btnView = providerAdminRoleUkr[params['role']]; }); this.provider$ @@ -101,7 +101,7 @@ export class ProviderAdminsComponent implements OnInit { takeUntil(this.destroy$) ) .subscribe((provider: Provider) => (this.provider = provider)); - + this.subrole = this.store.selectSnapshot(RegistrationState.subrole); }