feat(layout): enhance topbar with customizable templates and full-page support
- Updated app.layout.component.html to include start, center, and end templates for the topbar. - Modified app.layout.component.ts to manage new template references and added isFullPage getter. - Refactored app.topbar.component.html to utilize new templates and improved layout structure. - Enhanced app.topbar.component.ts to accept new input properties for templates. - Updated layout.service.ts to manage full-page state and new topbar slots. - Added new payment bridge services for POS functionality. - Introduced greater validator for form validation. - Improved dialog component to support mobile drawer and responsive design. - Updated styles for better mobile support and layout adjustments. - Added new main menu sidebar for POS with dynamic content.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import { SwUpdate, VersionReadyEvent } from '@angular/service-worker';
|
||||
import { Button } from 'primeng/button';
|
||||
import { Drawer } from 'primeng/drawer';
|
||||
import { Ripple } from 'primeng/ripple';
|
||||
import { filter } from 'rxjs';
|
||||
import { PosInfoStore } from '../../store';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-main-menu-sidebar',
|
||||
templateUrl: './main-menu-sidebar.component.html',
|
||||
imports: [Drawer, Button, Ripple],
|
||||
})
|
||||
export class PosMainMenuSidebarComponent extends AbstractDialog {
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
private readonly swUpdate = inject(SwUpdate);
|
||||
|
||||
readonly posInfo = computed(() => this.posInfoStore.entity());
|
||||
appVersion = '0.0.0';
|
||||
isPwaBuild = false;
|
||||
|
||||
readonly posName = computed(() => {
|
||||
if (this.posInfo()) {
|
||||
const { name, businessActivity, complex } = this.posInfo()!;
|
||||
return `${name} (${businessActivity.name} - ${complex.name})`;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
ngOnInit() {
|
||||
this.isPwaBuild = this.swUpdate.isEnabled;
|
||||
if (!this.isPwaBuild) return;
|
||||
|
||||
fetch('/ngsw.json')
|
||||
.then((res) => res.json())
|
||||
.then((data: { appData?: { appVersion?: string } }) => {
|
||||
this.appVersion = data?.appData?.appVersion || this.appVersion;
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
this.swUpdate.versionUpdates
|
||||
.pipe(filter((event): event is VersionReadyEvent => event.type === 'VERSION_READY'))
|
||||
.subscribe((event) => {
|
||||
const appData = event.latestVersion.appData as { appVersion?: string } | undefined;
|
||||
this.appVersion = appData?.appVersion || this.appVersion;
|
||||
});
|
||||
|
||||
this.swUpdate.checkForUpdate().catch(() => {});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user