Files
psp_panel/src/app/domains/pos/layouts/layout.component.ts
T

71 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-03-29 18:07:10 +03:30
import { AuthService } from '@/core';
2026-03-18 13:35:57 +03:30
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
2026-03-29 18:07:10 +03:30
import { JalaliDateDirective } from '@/shared/directives';
2026-03-18 13:35:57 +03:30
import { Component, computed, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { MenuItem } from 'primeng/api';
import { ButtonDirective } from 'primeng/button';
import { Card } from 'primeng/card';
import { Menu } from 'primeng/menu';
2026-03-29 18:07:10 +03:30
import images from 'src/assets/images';
2026-03-18 13:35:57 +03:30
import { PosStore } from '../pos.store';
import { PosChooseCardsComponent } from './choose-pos.component';
2026-03-18 13:35:57 +03:30
@Component({
selector: 'pos-layout',
templateUrl: './layout.component.html',
imports: [
PageLoadingComponent,
RouterOutlet,
JalaliDateDirective,
Menu,
ButtonDirective,
Card,
PosChooseCardsComponent,
],
2026-03-18 13:35:57 +03:30
})
export class PosLayoutComponent {
constructor() {}
private readonly store = inject(PosStore);
2026-03-29 18:07:10 +03:30
private readonly authService = inject(AuthService);
2026-03-18 13:35:57 +03:30
readonly loading = computed(() => this.store.loading());
readonly posInfo = computed(() => this.store.entity());
readonly error = computed(() => this.store.error());
2026-03-29 18:07:10 +03:30
readonly userInfo = computed(() => this.authService.currentAccount());
logout = () => {
this.authService.logout();
};
profileMenuItems: MenuItem[] = [
{
label: 'راهنمای سامانه',
icon: 'pi pi-question-circle',
disabled: true,
},
{
label: 'خروج',
icon: 'pi pi-sign-out',
command: this.logout,
},
];
2026-03-29 18:07:10 +03:30
placeholderLogo = images.placeholders.logo;
now = new Date();
2026-03-18 13:35:57 +03:30
getData() {
2026-04-11 14:46:52 +03:30
this.store.getData().subscribe();
2026-03-18 13:35:57 +03:30
}
onChoosePos() {
this.getData();
}
2026-03-18 13:35:57 +03:30
ngOnInit() {
this.getData();
}
}