remove unused codes and update
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
<ng-template #topbarCenter>
|
||||
@if (posInfo()) {
|
||||
<div class="flex flex-col items-center justify-center gap-2">
|
||||
<a [routerLink]="homeRouteLink" class="flex flex-col items-center justify-center gap-2">
|
||||
<div class="w-8 h-8">
|
||||
<img
|
||||
[src]="posInfo()?.partner?.logo_url ?? placeholderLogo"
|
||||
@@ -13,14 +13,14 @@
|
||||
/>
|
||||
</div>
|
||||
<span class="text-base font-semibold">{{ posInfo()?.partner?.name }}</span>
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #topbarEnd>
|
||||
<div class="">
|
||||
<p-menu #menu [model]="profileMenuItems" [popup]="true" />
|
||||
<p-button (click)="menu.toggle($event)" icon="pi pi-user" text outlined size="large" />
|
||||
<p-button (click)="menu.toggle($event)" icon="pi pi-user" outlined size="large" />
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
>
|
||||
@if (pullDistance() >= 0) {
|
||||
<div
|
||||
class="w-full flex justify-center items-center py-2 min-h-10 text-xs text-surface-500 overflow-hidden fixed top-0 inset-x-0 z-1000 translate-y--20px"
|
||||
class="w-full flex justify-center items-center py-2 min-h-10 text-xs text-surface-500 overflow-hidden fixed top-0 inset-x-0 z-1000 translate-y-[-20px]"
|
||||
[ngStyle]="{ height: pullDistance() + 'px' }"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { AuthService } from '@/core';
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { LayoutService } from '@/layout/service/layout.service';
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -13,13 +11,15 @@ import {
|
||||
inject,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { RouterLinkWithHref, RouterOutlet } from '@angular/router';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { Button, ButtonDirective } from 'primeng/button';
|
||||
import { Card } from 'primeng/card';
|
||||
import { Menu } from 'primeng/menu';
|
||||
import { finalize } from 'rxjs';
|
||||
import images from 'src/assets/images';
|
||||
import { PosInfoStore, PosProfileStore } from '../store';
|
||||
import { DeviceInfoStore } from '../store/device.store';
|
||||
import { PosChooseCardsComponent } from './choose-pos.component';
|
||||
import { PosMainMenuSidebarComponent } from './mainMenuSidebar/main-menu-sidebar.component';
|
||||
|
||||
@@ -36,13 +36,14 @@ import { PosMainMenuSidebarComponent } from './mainMenuSidebar/main-menu-sidebar
|
||||
PosMainMenuSidebarComponent,
|
||||
Menu,
|
||||
CommonModule,
|
||||
RouterLinkWithHref,
|
||||
],
|
||||
})
|
||||
export class PosLayoutComponent implements AfterViewInit {
|
||||
constructor() {}
|
||||
|
||||
private readonly nativeBridgeService = inject(NativeBridgeService);
|
||||
private readonly toastService = inject(ToastService);
|
||||
// private readonly nativeBridgeService = inject(NativeBridgeService);
|
||||
// private readonly toastService = inject(ToastService);
|
||||
|
||||
@ViewChild('topbarStart', { static: true }) topbarStart!: TemplateRef<any>;
|
||||
@ViewChild('topbarCenter', { static: true }) topbarCenter!: TemplateRef<any>;
|
||||
@@ -50,6 +51,7 @@ export class PosLayoutComponent implements AfterViewInit {
|
||||
|
||||
private readonly posProfileStore = inject(PosProfileStore);
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
private readonly deviceInfoStore = inject(DeviceInfoStore);
|
||||
private readonly authService = inject(AuthService);
|
||||
private readonly layoutService = inject(LayoutService);
|
||||
|
||||
@@ -66,6 +68,8 @@ export class PosLayoutComponent implements AfterViewInit {
|
||||
readonly loading = computed(() => this.posProfileLoading());
|
||||
readonly error = computed(() => this.posProfileError());
|
||||
|
||||
readonly deviceInfo = computed(() => this.deviceInfoStore.entity());
|
||||
|
||||
logout = () => {
|
||||
this.authService.logout();
|
||||
};
|
||||
@@ -91,10 +95,21 @@ export class PosLayoutComponent implements AfterViewInit {
|
||||
pullDistance = signal(0);
|
||||
readonly pullThreshold = 80;
|
||||
|
||||
getData() {
|
||||
this.posProfileStore.getData().subscribe({
|
||||
homeRouteLink = '/pos';
|
||||
|
||||
async getData() {
|
||||
await this.layoutService.changeFullPageLoading(true);
|
||||
await this.deviceInfoStore.getData();
|
||||
await this.posProfileStore.getData().subscribe({
|
||||
next: () => {
|
||||
this.posInfoStore.getData().subscribe();
|
||||
this.posInfoStore
|
||||
.getData()
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
this.layoutService.changeFullPageLoading(false);
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,8 +37,11 @@ export class PosMainMenuSidebarComponent extends AbstractDialog {
|
||||
.then((res) => res.json())
|
||||
.then((data: { appData?: { appVersion?: string } }) => {
|
||||
this.appVersion = data?.appData?.appVersion || this.appVersion;
|
||||
console.log('appVersion:', data?.appData);
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch((err) => {
|
||||
console.log('err', err);
|
||||
});
|
||||
|
||||
this.swUpdate.versionUpdates
|
||||
.pipe(filter((event): event is VersionReadyEvent => event.type === 'VERSION_READY'))
|
||||
|
||||
Reference in New Issue
Block a user