Skip to content

Commit

Permalink
Update ownership type (#821)
Browse files Browse the repository at this point in the history
* type from number to string

* fix drop-down

* feat: add providerOwnership field to the card (#822)

* feat: add providerOwnership field

* add and display variable ownershipType
  • Loading branch information
perepichai authored Jan 29, 2022
1 parent a9332e3 commit b68f306
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
<p class="card_text_label" [matTooltip]="workshop.providerTitle" showTooltipIfTruncated matTooltipClass="tooltip"
[matTooltipPosition]="below">{{ workshop.providerTitle }}</p>
</div>
<p class="card_text" *ngIf="ownershipType">
<mat-icon class="card_icon">account_balance</mat-icon> Форма власності: {{ ownershipType }}
</p>
<p class="card_text" [ngClass]="isCreateApplicationView ? 'hide': ''">
<mat-icon class="card_icon">person</mat-icon>{{ workshop.minAge }} - {{ workshop.maxAge }} років
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Observable, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { MatDialog } from '@angular/material/dialog';
import { CategoryIcons } from '../../enum/category-icons';
import { OwnershipTypeUkr } from 'src/app/shared/enum/provider';

@Component({
selector: 'app-workshop-card',
Expand All @@ -31,6 +32,7 @@ export class WorkshopCardComponent implements OnInit, OnDestroy {
isFavorite: boolean;
favoriteWorkshopId: Favorite;
pendingApplicationAmount: number;
ownershipType: string;

@Input() workshop: WorkshopCard;
@Input() userRoleView: string;
Expand Down Expand Up @@ -65,6 +67,7 @@ export class WorkshopCardComponent implements OnInit, OnDestroy {
public dialog: MatDialog) { }

ngOnInit(): void {
this.ownershipType = OwnershipTypeUkr[this.workshop.providerOwnership];
this.favoriteWorkshops$
.pipe(takeUntil(this.destroy$))
.subscribe((favorites: Favorite[]) => {
Expand Down
6 changes: 3 additions & 3 deletions src/app/shared/enum/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export enum OwnershipType {
}

export enum OwnershipTypeUkr {
'Державна',
'Громадська організація',
'Приватна',
State = 'Державна',
Common = 'Громадська організація',
Private = 'Приватна',
}

export enum WorkshopType {
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/models/provider.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class Provider {
directorDateOfBirth?: string | Date;
phoneNumber?: string;
founder?: string;
ownership?: number;
ownership?: string;
type?: number;
status?: boolean;
legalAddress?: Address;
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/models/workshop.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface WorkshopCard {
price: number;
providerId: string;
providerTitle: string;
providerOwnership: string;
rating: number;
title: string;
workshopId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<mat-select disableOptionCentering panelClass="dropdown-panel" class="step-input" formControlName="ownership"
name="ownership" placeholder="Оберіть форму властності">
<ng-container *ngFor="let type of ownershipType | keyvalue">
<mat-option *ngIf="ownershipTypeUkr[type.key]" [value]="+type.key" class="dropdown-option">
<mat-option *ngIf="ownershipTypeUkr[type.key]" [value]="type.key" class="dropdown-option">
{{ ownershipTypeUkr[type.key] }}
</mat-option>
</ng-container>
Expand Down

0 comments on commit b68f306

Please sign in to comment.