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';
|
2026-04-13 13:22:40 +03:30
|
|
|
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-04-25 15:19:19 +03:30
|
|
|
import { PosInfoStore, PosProfileStore } from '../store';
|
2026-04-13 13:22:40 +03:30
|
|
|
import { PosChooseCardsComponent } from './choose-pos.component';
|
2026-03-18 13:35:57 +03:30
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'pos-layout',
|
|
|
|
|
templateUrl: './layout.component.html',
|
2026-04-13 13:22:40 +03:30
|
|
|
imports: [
|
|
|
|
|
PageLoadingComponent,
|
|
|
|
|
RouterOutlet,
|
|
|
|
|
JalaliDateDirective,
|
|
|
|
|
Menu,
|
|
|
|
|
ButtonDirective,
|
|
|
|
|
Card,
|
|
|
|
|
PosChooseCardsComponent,
|
|
|
|
|
],
|
2026-03-18 13:35:57 +03:30
|
|
|
})
|
|
|
|
|
export class PosLayoutComponent {
|
|
|
|
|
constructor() {}
|
|
|
|
|
|
2026-04-23 01:22:44 +03:30
|
|
|
private readonly posProfileStore = inject(PosProfileStore);
|
2026-04-25 15:19:19 +03:30
|
|
|
private readonly posInfoStore = inject(PosInfoStore);
|
2026-03-29 18:07:10 +03:30
|
|
|
private readonly authService = inject(AuthService);
|
2026-03-18 13:35:57 +03:30
|
|
|
|
2026-04-23 01:22:44 +03:30
|
|
|
readonly posProfileLoading = computed(() => this.posProfileStore.loading());
|
|
|
|
|
readonly posProfile = computed(() => this.posProfileStore.entity());
|
|
|
|
|
readonly posProfileError = computed(() => this.posProfileStore.error());
|
|
|
|
|
|
2026-04-25 15:19:19 +03:30
|
|
|
readonly posInfoLoading = computed(() => this.posInfoStore.loading());
|
|
|
|
|
readonly posInfo = computed(() => this.posInfoStore.entity());
|
|
|
|
|
readonly posInfoError = computed(() => this.posInfoStore.error());
|
|
|
|
|
|
|
|
|
|
readonly loading = computed(() => this.posProfileLoading());
|
|
|
|
|
readonly error = computed(() => this.posProfileError());
|
2026-03-29 18:07:10 +03:30
|
|
|
|
2026-04-13 13:22:40 +03:30
|
|
|
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-25 15:19:19 +03:30
|
|
|
this.posProfileStore.getData().subscribe({
|
|
|
|
|
next: () => {
|
|
|
|
|
this.posInfoStore.getData().subscribe();
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-03-18 13:35:57 +03:30
|
|
|
}
|
|
|
|
|
|
2026-04-13 13:22:40 +03:30
|
|
|
onChoosePos() {
|
|
|
|
|
this.getData();
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-18 13:35:57 +03:30
|
|
|
ngOnInit() {
|
|
|
|
|
this.getData();
|
|
|
|
|
}
|
|
|
|
|
}
|