Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add institution type data #1290

Merged
merged 10 commits into from
Jun 14, 2022
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ <h5>Будинок</h5>
</mat-tab>

<mat-tab label="Опис">
<h5>Статус</h5>
<p class="description">{{ this.currentStatus }}</p>
<h5>Тип закладу</h5>
<p class="description">{{ institutionType[provider.institutionType] }}</p>
<h5>Про заклад</h5>
<p class="description">{{ provider?.description }}</p>
</mat-tab>
Expand Down
24 changes: 4 additions & 20 deletions src/app/shared/components/provider-info/provider-info.component.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Constants } from 'src/app/shared/constants/constants';
import { MatTabChangeEvent } from '@angular/material/tabs';
import {
CreateProviderSteps,
InstitutionType,
OwnershipType,
OwnershipTypeUkr,
ProviderType,
ProviderTypeUkr,
} from '../../enum/provider';
import { Provider } from '../../models/provider.model';
import { Select, Store } from '@ngxs/store';
import { GetInstitutionStatus } from '../../store/meta-data.actions';
import { MetaDataState } from '../../store/meta-data.state';
import { Observable, Subject } from 'rxjs';
import { InstitutionStatus } from '../../models/institutionStatus.model';
import { filter, takeUntil } from 'rxjs/operators';
import { RegistrationState } from '../../store/registration.state';
import { ActivateEditMode } from 'src/app/shared/store/app.actions';

@Component({
selector: 'app-provider-info',
templateUrl: './provider-info.component.html',
styleUrls: ['./provider-info.component.scss'],
})
export class ProviderInfoComponent implements OnInit {
export class ProviderInfoComponent {
readonly constants: typeof Constants = Constants;
readonly providerType: typeof ProviderType = ProviderType;
readonly ownershipType: typeof OwnershipType = OwnershipType;
readonly ownershipTypeUkr = OwnershipTypeUkr;
readonly providerTypeUkr = ProviderTypeUkr;
readonly institutionType = InstitutionType;
editLink: string = CreateProviderSteps[0];

@Input() provider: Provider;
Expand All @@ -44,21 +43,6 @@ export class ProviderInfoComponent implements OnInit {

constructor(private store: Store) {}

ngOnInit(): void {
this.store.dispatch(new GetInstitutionStatus());
this.institutionStatuses$
.pipe(
filter((institutionStatuses) => !!institutionStatuses.length),
takeUntil(this.destroy$)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this change please, this field is still needed.
image
image

).subscribe((institutionStatuses) => {
const provider = this.store.selectSnapshot(RegistrationState.provider);
this.currentStatus =
institutionStatuses
.find((item) => +item.id === provider?.institutionStatusId)
?.name.toString() ?? 'Відсутній';
});
}

onTabChanged(tabChangeEvent: MatTabChangeEvent): void {
this.editLink = CreateProviderSteps[tabChangeEvent.index];
this.tabChanged.emit(tabChangeEvent);
Expand Down
6 changes: 6 additions & 0 deletions src/app/shared/enum/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@ export enum ProviderWorkshopSameValues {
website = 'website',
facebook = 'facebook',
instagram = 'instagram'
}

export enum InstitutionType {
Complex = 'Комплексний',
Profile = 'Профільний',
Specialized = 'Спеціалізований'
}
1 change: 1 addition & 0 deletions src/app/shared/models/provider.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class Provider {
image?: File[];
imageIds?: string[];
institutionStatusId?: number | null;
institutionType: string;

constructor(info, legalAddress: Address, actualAddress: Address, description, user: User, provider?: Provider) {
this.shortTitle = info.shortTitle;
Expand Down