From d9987e51a8e65efc3089d3061eaa737408d233c7 Mon Sep 17 00:00:00 2001 From: MishaZhem Date: Thu, 15 Aug 2024 22:03:28 +0300 Subject: [PATCH] chore: add calendar range --- .../administrator.component.html | 225 +++++++++--------- .../administrator.component.less | 12 + .../administrator/administrator.component.ts | 18 +- 3 files changed, 140 insertions(+), 115 deletions(-) diff --git a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.html b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.html index c41731825..279345bf2 100644 --- a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.html +++ b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.html @@ -1,119 +1,126 @@ -
-
- -
-

- Administrator -
- Status: - +
+
+ +
+

+ Administrator +
- Online - -
- Number of animals: {{ animals.length }} -

-
-
- - - - {{ value[index] | tuiAmount: 'RUB' | async }} -
{{ labels[index] }}
-
+ Status: + + Online + +
+ Number of animals: {{ animals.length }} +

+
+
+ - - - - - - @if (calendarValue) { -
Chosen date: {{ calendarValue }}
- } + + {{ value[index] | tuiAmount: 'RUB' | async }} +
{{ labels[index] }}
-
-
-
-
- @for (animal of animals; track $index) { -
- -
-

- {{ animal.title }} -

-
+ +
+ +
+
+ @for (animal of animals; track $index) {
- +
+

+ {{ animal.title }} +

+
+
- {{ animal.health }} - - @for (tag of animal.tags; track $index) { - {{ tag }} - } + + {{ animal.health }} + + @for (tag of animal.tags; track $index) { + {{ tag }} + } +
-
- } + } +
+
+
+
+
+ + + + + +
+ @if (calendarValue) { +
Chosen date: {{ calendarValue }}
+ }
diff --git a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.less b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.less index 23acd2153..b3705d7f0 100644 --- a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.less +++ b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.less @@ -1,4 +1,16 @@ :host { + display: flex; + flex-direction: column; +} + +.events { + display: flex; + padding: 1rem; + justify-content: space-between; + align-items: center; +} + +.top { display: flex; flex-wrap: wrap; justify-content: space-between; diff --git a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.ts b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.ts index 4748f6925..0d9a09f60 100644 --- a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.ts +++ b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/administrator/administrator.component.ts @@ -2,17 +2,22 @@ import {AsyncPipe, CommonModule} from '@angular/common'; import {ChangeDetectionStrategy, Component, EventEmitter, Output} from '@angular/core'; import {TuiPieChart} from '@taiga-ui/addon-charts'; import {TuiAmountPipe} from '@taiga-ui/addon-commerce'; -import type {TuiDay} from '@taiga-ui/cdk'; +import type {TuiDayRange} from '@taiga-ui/cdk'; import { TuiAppearance, TuiButton, - TuiCalendar, TuiExpand, TuiHint, TuiLink, TuiTitle, } from '@taiga-ui/core'; -import {TuiAvatar, TuiBadge, TuiStatus} from '@taiga-ui/kit'; +import { + TuiAvatar, + TuiBadge, + TuiCalendarRange, + tuiCreateDefaultDayRangePeriods, + TuiStatus, +} from '@taiga-ui/kit'; import {TuiCardLarge, TuiHeader} from '@taiga-ui/layout'; @Component({ @@ -26,7 +31,7 @@ import {TuiCardLarge, TuiHeader} from '@taiga-ui/layout'; TuiAvatar, TuiBadge, TuiButton, - TuiCalendar, + TuiCalendarRange, TuiCardLarge, TuiExpand, TuiHeader, @@ -41,9 +46,10 @@ import {TuiCardLarge, TuiHeader} from '@taiga-ui/layout'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class AdministratorComponent { + protected items = tuiCreateDefaultDayRangePeriods(); protected readonly value = [13769, 12367, 10172, 3018, 2592]; protected readonly labels = ['Food', 'Сleaning', 'Electricity', 'Water', 'Other']; - protected calendarValue: TuiDay | null = null; + protected calendarValue: TuiDayRange | null = null; protected expanded = false; protected animals = [ @@ -80,7 +86,7 @@ export class AdministratorComponent { this.openTableChange.emit(true); } - protected onDayClick(day: TuiDay): void { + protected onDayClick(day: TuiDayRange | null): void { this.calendarValue = day; } }