From 2230cf2e7b7719243ec215696a376c8710260fd2 Mon Sep 17 00:00:00 2001 From: Lorenz Hilpert Date: Fri, 26 May 2023 11:15:59 +0200 Subject: [PATCH] Header Anpassungen --- .../application/src/lib/application.service.ts | 14 ++++++++------ apps/isa-app/src/config/config.json | 5 +++++ .../assortment/src/lib/assortment.component.ts | 4 +--- .../catalog/src/lib/page-catalog.component.ts | 2 -- .../checkout/src/lib/page-checkout.component.ts | 4 +--- .../src/lib/customer-order.component.ts | 2 -- .../customer/src/lib/page-customer.component.ts | 4 +--- .../dashboard/src/lib/dashboard.component.ts | 2 -- .../page/goods-in/src/lib/goods-in.component.ts | 7 ++----- .../goods-out/src/lib/goods-out.component.ts | 7 ++----- .../src/lib/package-inspection.component.ts | 4 +--- .../remission/src/lib/remission.component.ts | 2 -- .../src/lib/page-task-calendar.component.ts | 9 +-------- .../lib/process-bar/process-bar.component.ts | 5 +++-- apps/shared/shell/src/lib/shell.component.html | 2 +- .../src/lib/top-bar/top-bar.component.html | 14 ++++++++++---- .../shell/src/lib/top-bar/top-bar.component.ts | 17 +++++++++++++++-- .../shell/src/lib/top-bar/top-bar.module.ts | 3 ++- tailwind-plugins/button.plugin.js | 10 +++++++++- 19 files changed, 62 insertions(+), 55 deletions(-) diff --git a/apps/core/application/src/lib/application.service.ts b/apps/core/application/src/lib/application.service.ts index 97c41b73d..9efccbaf9 100644 --- a/apps/core/application/src/lib/application.service.ts +++ b/apps/core/application/src/lib/application.service.ts @@ -31,14 +31,8 @@ export class ApplicationService { return this.activatedProcessIdSubject.asObservable(); } - title$ = this.store.select(selectTitle); - constructor(private store: Store) {} - setTitle(title: string) { - this.store.dispatch(setTitle({ title })); - } - getProcesses$(section?: 'customer' | 'branch') { const processes$ = this.store.select(selectProcesses); return processes$.pipe(map((processes) => processes.filter((process) => (section ? process.section === section : true)))); @@ -52,6 +46,14 @@ export class ApplicationService { return this.store.select(selectSection); } + getTitle$() { + return this.getSection$().pipe( + map((section) => { + return section === 'customer' ? 'Kundenbereich' : 'Filialbereich'; + }) + ); + } + /** @deprecated */ getActivatedProcessId$() { return this.store.select(selectActivatedProcess).pipe(map((process) => process?.id)); diff --git a/apps/isa-app/src/config/config.json b/apps/isa-app/src/config/config.json index 8b1781c04..0fc00cf30 100644 --- a/apps/isa-app/src/config/config.json +++ b/apps/isa-app/src/config/config.json @@ -287,6 +287,11 @@ "name": "assignment-return", "data": "m479-333 43-43-74-74h182v-60H448l74-74-43-43-147 147 147 147ZM180-120q-24.75 0-42.375-17.625T120-180v-600q0-24.75 17.625-42.375T180-840h205q5-35 32-57.5t63-22.5q36 0 63 22.5t32 57.5h205q24.75 0 42.375 17.625T840-780v600q0 24.75-17.625 42.375T780-120H180Zm0-60h600v-600H180v600Zm300-617q14 0 24.5-10.5T515-832q0-14-10.5-24.5T480-867q-14 0-24.5 10.5T445-832q0 14 10.5 24.5T480-797ZM180-180v-600 600Z", "viewBox": "0 -960 960 960" + }, + { + "name": "dashboard", + "data": "M510-570v-270h330v270H510ZM120-450v-390h330v390H120Zm390 330v-390h330v390H510Zm-390 0v-270h330v270H120Zm60-390h210v-270H180v270Zm390 330h210v-270H570v270Zm0-450h210v-150H570v150ZM180-180h210v-150H180v150Zm210-330Zm180-120Zm0 180ZM390-330Z", + "viewBox": "0 -960 960 960" } ], diff --git a/apps/page/assortment/src/lib/assortment.component.ts b/apps/page/assortment/src/lib/assortment.component.ts index acc31439b..9d46fa174 100644 --- a/apps/page/assortment/src/lib/assortment.component.ts +++ b/apps/page/assortment/src/lib/assortment.component.ts @@ -1,5 +1,4 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { ApplicationService } from '@core/application'; import { Breadcrumb, BreadcrumbService } from '@core/breadcrumb'; import { Config } from '@core/config'; @@ -14,11 +13,10 @@ export class AssortmentComponent implements OnInit { return this._config.get('process.ids.assortment'); } - constructor(private _config: Config, private _breadcrumb: BreadcrumbService, private _app: ApplicationService) {} + constructor(private _config: Config, private _breadcrumb: BreadcrumbService) {} ngOnInit() { this.createBreadcrumbIfNotExists(); - this._app.setTitle('Sortiment'); } async createBreadcrumbIfNotExists(): Promise { diff --git a/apps/page/catalog/src/lib/page-catalog.component.ts b/apps/page/catalog/src/lib/page-catalog.component.ts index 55ec3507f..9a35e3a03 100644 --- a/apps/page/catalog/src/lib/page-catalog.component.ts +++ b/apps/page/catalog/src/lib/page-catalog.component.ts @@ -67,8 +67,6 @@ export class PageCatalogComponent implements OnInit, AfterViewInit, OnDestroy { this.activatedProcessId$ = this.application.activatedProcessId$.pipe(map((processId) => String(processId))); this.selectedBranch$ = this.activatedProcessId$.pipe(switchMap((processId) => this.application.getSelectedBranch$(Number(processId)))); - - this.application.setTitle('Artikelsuche'); } ngAfterViewInit(): void { diff --git a/apps/page/checkout/src/lib/page-checkout.component.ts b/apps/page/checkout/src/lib/page-checkout.component.ts index 4f38257f8..98779d0c6 100644 --- a/apps/page/checkout/src/lib/page-checkout.component.ts +++ b/apps/page/checkout/src/lib/page-checkout.component.ts @@ -13,7 +13,5 @@ export class PageCheckoutComponent implements OnInit { constructor(private applicationService: ApplicationService) {} - ngOnInit() { - this.applicationService.setTitle('Warenkorb'); - } + ngOnInit() {} } diff --git a/apps/page/customer-order/src/lib/customer-order.component.ts b/apps/page/customer-order/src/lib/customer-order.component.ts index 025136783..aa85fbb4c 100644 --- a/apps/page/customer-order/src/lib/customer-order.component.ts +++ b/apps/page/customer-order/src/lib/customer-order.component.ts @@ -46,8 +46,6 @@ export class CustomerOrderComponent implements OnInit { this.selectedBranch$ = this.application.activatedProcessId$.pipe( switchMap((processId) => this.application.getSelectedBranch$(Number(processId))) ); - - this.application.setTitle('Kundenbestellung'); } async patchProcessData(selectedBranch: BranchDTO) { diff --git a/apps/page/customer/src/lib/page-customer.component.ts b/apps/page/customer/src/lib/page-customer.component.ts index e0e3a284d..581e7d834 100644 --- a/apps/page/customer/src/lib/page-customer.component.ts +++ b/apps/page/customer/src/lib/page-customer.component.ts @@ -14,7 +14,5 @@ export class PageCustomerComponent implements OnInit { constructor(public application: ApplicationService) {} - ngOnInit() { - this.application.setTitle('Kundensuche'); - } + ngOnInit() {} } diff --git a/apps/page/dashboard/src/lib/dashboard.component.ts b/apps/page/dashboard/src/lib/dashboard.component.ts index 5ae7a70ae..7a667ee59 100644 --- a/apps/page/dashboard/src/lib/dashboard.component.ts +++ b/apps/page/dashboard/src/lib/dashboard.component.ts @@ -20,7 +20,5 @@ export class DashboardComponent implements OnInit { ngOnInit(): void { this._app.setSection('customer'); this._app.activateProcess(undefined); - - this._app.setTitle('Dashboard'); } } diff --git a/apps/page/goods-in/src/lib/goods-in.component.ts b/apps/page/goods-in/src/lib/goods-in.component.ts index fd3f6bf26..12f5b6998 100644 --- a/apps/page/goods-in/src/lib/goods-in.component.ts +++ b/apps/page/goods-in/src/lib/goods-in.component.ts @@ -1,5 +1,4 @@ import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; -import { ApplicationService } from '@core/application'; import { Config } from '@core/config'; @Component({ @@ -11,9 +10,7 @@ import { Config } from '@core/config'; export class GoodsInComponent implements OnInit { goodsInKey = this._config.get('process.ids.goodsIn'); - constructor(private readonly _config: Config, private _app: ApplicationService) {} + constructor(private readonly _config: Config) {} - ngOnInit() { - this._app.setTitle('Abholfach'); - } + ngOnInit() {} } diff --git a/apps/page/goods-out/src/lib/goods-out.component.ts b/apps/page/goods-out/src/lib/goods-out.component.ts index 7da19d286..8e563a3cc 100644 --- a/apps/page/goods-out/src/lib/goods-out.component.ts +++ b/apps/page/goods-out/src/lib/goods-out.component.ts @@ -1,6 +1,5 @@ import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { ApplicationService } from '@core/application'; import { map } from 'rxjs/operators'; @Component({ @@ -12,9 +11,7 @@ import { map } from 'rxjs/operators'; export class GoodsOutComponent implements OnInit { processId$ = this._activatedRoute.data.pipe(map((data) => String(data.processId))); - constructor(private _activatedRoute: ActivatedRoute, private _app: ApplicationService) {} + constructor(private _activatedRoute: ActivatedRoute) {} - ngOnInit() { - this._app.setTitle('Warenausgabe'); - } + ngOnInit() {} } diff --git a/apps/page/package-inspection/src/lib/package-inspection.component.ts b/apps/page/package-inspection/src/lib/package-inspection.component.ts index 1064bb669..5ecfa3f5a 100644 --- a/apps/page/package-inspection/src/lib/package-inspection.component.ts +++ b/apps/page/package-inspection/src/lib/package-inspection.component.ts @@ -14,12 +14,10 @@ export class PackageInspectionComponent implements OnInit { return this._config.get('process.ids.packageInspection'); } - constructor(private _config: Config, private _breadcrumb: BreadcrumbService, private _app: ApplicationService) {} + constructor(private _config: Config, private _breadcrumb: BreadcrumbService) {} ngOnInit(): void { this.createBreadcrumbIfNotExists(); - - this._app.setTitle('Packstück Prüfung'); } async createBreadcrumbIfNotExists(): Promise { diff --git a/apps/page/remission/src/lib/remission.component.ts b/apps/page/remission/src/lib/remission.component.ts index ae782c925..04b5376a2 100644 --- a/apps/page/remission/src/lib/remission.component.ts +++ b/apps/page/remission/src/lib/remission.component.ts @@ -45,8 +45,6 @@ export class RemissionComponent implements OnInit, OnDestroy { }); this.updateProcess(); - - this._applicationService.setTitle('Remission'); } ngOnDestroy(): void { diff --git a/apps/page/task-calendar/src/lib/page-task-calendar.component.ts b/apps/page/task-calendar/src/lib/page-task-calendar.component.ts index 480438034..1b9ba1e86 100644 --- a/apps/page/task-calendar/src/lib/page-task-calendar.component.ts +++ b/apps/page/task-calendar/src/lib/page-task-calendar.component.ts @@ -38,12 +38,7 @@ export class PageTaskCalendarComponent implements OnInit, OnDestroy { @ViewChild(TaskSearchbarComponent) searchbar: TaskSearchbarComponent; - constructor( - private taskCalendarStore: TaskCalendarStore, - private _activatedRoute: ActivatedRoute, - private readonly _config: Config, - private _app: ApplicationService - ) { + constructor(private taskCalendarStore: TaskCalendarStore, private _activatedRoute: ActivatedRoute, private readonly _config: Config) { this.taskCalendarStore.loadFilter(); } @@ -61,8 +56,6 @@ export class PageTaskCalendarComponent implements OnInit, OnDestroy { }); this.taskCalendarStore.loadItems(); - - this._app.setTitle('Tätigkeitenkalender'); } ngOnDestroy(): void { diff --git a/apps/shared/shell/src/lib/process-bar/process-bar.component.ts b/apps/shared/shell/src/lib/process-bar/process-bar.component.ts index 49e54c155..99ce45959 100644 --- a/apps/shared/shell/src/lib/process-bar/process-bar.component.ts +++ b/apps/shared/shell/src/lib/process-bar/process-bar.component.ts @@ -2,7 +2,7 @@ import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { ApplicationProcess, ApplicationService } from '@core/application'; import { ProductCatalogNavigationService } from '@shared/services'; -import { NEVER, Observable } from 'rxjs'; +import { NEVER, Observable, of } from 'rxjs'; import { first, map, switchMap } from 'rxjs/operators'; @Component({ @@ -33,7 +33,8 @@ export class ShellProcessBarComponent implements OnInit { } initSection$() { - this.section$ = this._app.getSection$(); + // this.section$ = this._app.getSection$(); + this.section$ = of('customer'); } initProcesses$() { diff --git a/apps/shared/shell/src/lib/shell.component.html b/apps/shared/shell/src/lib/shell.component.html index 9326b6893..b1f3636e0 100644 --- a/apps/shared/shell/src/lib/shell.component.html +++ b/apps/shared/shell/src/lib/shell.component.html @@ -3,7 +3,7 @@ diff --git a/apps/shared/shell/src/lib/top-bar/top-bar.component.html b/apps/shared/shell/src/lib/top-bar/top-bar.component.html index 7779ea5cd..536bd16e8 100644 --- a/apps/shared/shell/src/lib/top-bar/top-bar.component.html +++ b/apps/shared/shell/src/lib/top-bar/top-bar.component.html @@ -6,14 +6,20 @@ {{ title }}
+ + Dashboard + + + +
+ - diff --git a/apps/shared/shell/src/lib/top-bar/top-bar.component.ts b/apps/shared/shell/src/lib/top-bar/top-bar.component.ts index d48daedd4..94c9901e6 100644 --- a/apps/shared/shell/src/lib/top-bar/top-bar.component.ts +++ b/apps/shared/shell/src/lib/top-bar/top-bar.component.ts @@ -1,5 +1,5 @@ import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; -import { first, map, take } from 'rxjs/operators'; +import { first, map, retry, take } from 'rxjs/operators'; import { ShellService } from '../shell.service'; import { BehaviorSubject } from 'rxjs'; import { NotificationsHub } from '@hub/notifications'; @@ -8,6 +8,8 @@ import { ModalNotificationsComponent } from '@modal/notifications'; import { ApplicationService } from '@core/application'; import { BreadcrumbService } from '@core/breadcrumb'; import { Router } from '@angular/router'; +import { StockService } from '@swagger/wws'; +import { AuthService } from '@core/auth'; @Component({ selector: 'shell-top-bar', @@ -16,7 +18,7 @@ import { Router } from '@angular/router'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class ShellTopBarComponent implements OnInit { - title$ = this._app.title$; + title$ = this._app.getTitle$(); menuIcon$ = this._shellService.sideMenuOpen$.pipe(map((open) => (open ? 'close' : 'menu'))); @@ -26,8 +28,15 @@ export class ShellTopBarComponent implements OnInit { notificationCount$ = this.notifications$.pipe(map((message) => message?.data?.length)); + branchKey$ = this._stockService.StockCurrentBranch().pipe( + retry(3), + map((x) => x.result.key) + ); + constructor( private _shellService: ShellService, + private _stockService: StockService, + private _authService: AuthService, private readonly _notificationsHub: NotificationsHub, private _modal: UiModalService, private _app: ApplicationService, @@ -73,4 +82,8 @@ export class ShellTopBarComponent implements OnInit { }, }); } + + async logout() { + await this._authService.logout(); + } } diff --git a/apps/shared/shell/src/lib/top-bar/top-bar.module.ts b/apps/shared/shell/src/lib/top-bar/top-bar.module.ts index df6d3daab..0031d2960 100644 --- a/apps/shared/shell/src/lib/top-bar/top-bar.module.ts +++ b/apps/shared/shell/src/lib/top-bar/top-bar.module.ts @@ -4,9 +4,10 @@ import { CommonModule } from '@angular/common'; import { ShellTopBarComponent } from './top-bar.component'; import { UiIconModule } from '@ui/icon'; import { AuthModule } from '@core/auth'; +import { RouterModule } from '@angular/router'; @NgModule({ - imports: [CommonModule, UiIconModule, AuthModule], + imports: [CommonModule, UiIconModule, AuthModule, RouterModule], exports: [ShellTopBarComponent], declarations: [ShellTopBarComponent], }) diff --git a/tailwind-plugins/button.plugin.js b/tailwind-plugins/button.plugin.js index ca9a671a3..ad3f44001 100644 --- a/tailwind-plugins/button.plugin.js +++ b/tailwind-plugins/button.plugin.js @@ -8,7 +8,7 @@ module.exports = plugin(function ({ addComponents, theme, addBase, addUtilities '--btn-min-width': theme('spacing.12'), '--btn-background-color': theme('colors.components.button.DEFAULT'), '--btn-color': theme('colors.components.button.content'), - '--btn-border-radius': theme('borderRadius.button'), + '--btn-border-radius': theme('borderRadius.DEFAULT'), '--btn-hover-background-color': theme('colors.components.button.hover.DEFAULT'), '--btn-hover-color': theme('colors.components.button.hover.content'), '--btn-active-background-color': theme('colors.components.button.active.DEFAULT'), @@ -23,6 +23,14 @@ module.exports = plugin(function ({ addComponents, theme, addBase, addUtilities '--btn-background-color': theme('colors.button.light.DEFAULT'), '--btn-color': theme('colors.button.light.content'), }, + '.btn-white': { + '--btn-background-color': theme('colors.white'), + '--btn-color': theme('colors.black'), + '--btn-hover-background-color': theme('colors.white'), + '--btn-hover-color': theme('colors.black'), + '--btn-active-background-color': theme('colors.white'), + '--btn-active-color': theme('colors.black'), + }, }); for (const key in theme('colors.accent')) {