update for build

This commit is contained in:
2026-05-11 15:41:58 +03:30
parent 8e1a021eec
commit 7b3a27110a
12 changed files with 78 additions and 86 deletions
@@ -1,7 +1,9 @@
import { NamedRoutes } from '@/core';
import { Routes } from '@angular/router';
import config from 'src/config';
export type TPosAboutRouteNames = 'about';
const baseRoute = `${config.isPosApplication ? '' : '/pos'}/about`;
export const posAboutNamedRoutes: NamedRoutes<TPosAboutRouteNames> = {
about: {
@@ -9,7 +11,7 @@ export const posAboutNamedRoutes: NamedRoutes<TPosAboutRouteNames> = {
loadComponent: () => import('../../views/root.component').then((m) => m.PosAboutPageComponent),
meta: {
title: 'درباره سیستم',
pagePath: () => '/pos/about',
pagePath: () => baseRoute,
},
},
};
@@ -1,23 +1,28 @@
import { NamedRoutes } from '@/core';
import { Routes } from '@angular/router';
import config from 'src/config';
export type TPosSaleInvoicesRouteNames = 'saleInvoices' | 'saleInvoice';
const baseRoute = `${config.isPosApplication ? '' : '/pos'}/sale_invoices`;
export const posSaleInvoicesNamedRoutes: NamedRoutes<TPosSaleInvoicesRouteNames> = {
saleInvoices: {
path: 'sale_invoices',
loadComponent: () => import('../../views/list.component').then((m) => m.PosSaleInvoicesComponent),
loadComponent: () =>
import('../../views/list.component').then((m) => m.PosSaleInvoicesComponent),
meta: {
title: 'فاکتورها',
pagePath: () => `/pos/sale_invoices`,
pagePath: () => baseRoute,
},
},
saleInvoice: {
path: 'sale_invoices/:invoiceId',
loadComponent: () => import('../../views/single.component').then((m) => m.PosSaleInvoiceComponent),
loadComponent: () =>
import('../../views/single.component').then((m) => m.PosSaleInvoiceComponent),
meta: {
title: 'جزئیات فاکتور',
pagePath: (invoiceId: string) => `/pos/sale_invoices/${invoiceId}`,
pagePath: (invoiceId: string) => `${baseRoute}/${invoiceId}`,
},
},
};
@@ -1,7 +1,9 @@
import { NamedRoutes } from '@/core';
import { Routes } from '@angular/router';
import config from 'src/config';
export type TPosSupportRouteNames = 'support';
const baseRoute = `${config.isPosApplication ? '' : '/pos'}/support`;
export const posSupportNamedRoutes: NamedRoutes<TPosSupportRouteNames> = {
support: {
@@ -10,7 +12,7 @@ export const posSupportNamedRoutes: NamedRoutes<TPosSupportRouteNames> = {
import('../../views/root.component').then((m) => m.PosSupportPageComponent),
meta: {
title: 'پشتیبانی',
pagePath: () => '/pos/support',
pagePath: () => baseRoute,
},
},
};
+28 -23
View File
@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
import { Component, computed, ContentChild, inject, Renderer2, TemplateRef } from '@angular/core';
import { NavigationEnd, Router, RouterModule } from '@angular/router';
import { filter, Subscription } from 'rxjs';
import config from 'src/config';
import { LayoutService } from '../service/layout.service';
import { AppFooter } from './app.footer.component';
import { AppSidebar } from './app.sidebar.component';
@@ -137,29 +138,33 @@ export class AppLayout {
this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl));
this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl));
// if (window.location.pathname === '/') {
// if (!this.authService.currentAccount()) {
// this.router.navigateByUrl('auth');
// }
// switch (this.authService.currentAccount()?.type) {
// case 'ADMIN':
// this.router.navigateByUrl('super_admin');
// break;
// case 'CONSUMER':
// if (this.authService.currentAccount()?.role === 'OWNER')
// this.router.navigateByUrl('consumer');
// // else {
// // this.router.navigateByUrl('pos');
// // }
// break;
// case 'PARTNER':
// this.router.navigateByUrl('partner');
// break;
// case 'PROVIDER':
// this.router.navigateByUrl('provider');
// break;
// }
// }
if (window.location.pathname === '/') {
if (!this.authService.currentAccount()) {
this.router.navigateByUrl('auth');
}
let redirectUrl = '';
switch (this.authService.currentAccount()?.type) {
case 'ADMIN':
redirectUrl = '/super_admin';
break;
case 'PROVIDER':
redirectUrl = '/provider';
break;
case 'PARTNER':
redirectUrl = '/partner';
break;
case 'CONSUMER':
if (this.authService.currentAccount()?.role === 'OWNER') {
redirectUrl = '/consumer';
} else {
redirectUrl = config.isPosApplication ? '/' : '/pos';
}
break;
}
this.router.navigateByUrl(redirectUrl);
}
}
ngOnDestroy() {
+2 -1
View File
@@ -3,6 +3,7 @@ import { ToastService } from '@/core/services/toast.service';
import { Component, EventEmitter, inject, Input, Output, signal } from '@angular/core';
import { Router } from '@angular/router';
import images from 'src/assets/images';
import config from 'src/config';
import { LoginComponent } from './login/login.component';
type TSteps = 'login' | 'otp' | 'modifyLoginInfo' | 'signup';
@@ -74,7 +75,7 @@ export class AuthComponent {
break;
case 'CONSUMER':
if (this.accountRole() === 'OPERATOR') {
redirectUrl = '/pos';
redirectUrl = config.isPosApplication ? '/' : '/pos';
} else {
redirectUrl = '/consumer';
}
@@ -1,4 +1,4 @@
<form [formGroup]="loginForm" class="w-full flex flex-col gap-4" (ngSubmit)="submit()">
<form [formGroup]="loginForm" (submit)="submit()">
<uikit-field name="username" pSize="large" [control]="loginForm.controls.username" label="نام کاربری">
<input
pInputText
@@ -36,59 +36,8 @@
/>
</uikit-field>
<!-- <div class="flex items-center justify-between mt-2 mb-8 gap-8">
<div class="flex items-center">
<p-checkbox formControlName="rememberMe" id="rememberMe" binary class="me-2"></p-checkbox>
<uikit-label name="rememberMe" pSize="small">مرا به خاطر بسپار</uikit-label>
</div>
<span class="text-sm font-medium no-underline ms-2 text-right cursor-pointer text-primary">
رمز را فراموش کردید؟
</span>
</div> -->
<div class="mb-6 flex flex-col items-center gap-4 w-[16rem] mx-auto">
<!-- <div
class="relative bg-surface-ground rounded-xl overflow-hidden shadow shrink-0 border border-(--p-inputtext-border-color) w-full aspect-[2]"
>
<img p-image id="captchaImage" [src]="captchaImageSrc()" class="w-full object-contain" />
@if (isCaptchaLoading()) {
<div class="absolute! inset-0 bg-surface-hover/50 flex items-center justify-center">
<p-progress-spinner
strokeWidth="4"
fill="transparent"
animationDuration="1s"
[style]="{ width: '48px', height: '48px' }"
/>
</div>
} @else if (isCaptchaExpired()) {
<div
class="absolute! inset-0 bg-surface-hover/70 flex items-center justify-center text-center p-2 text-sm font-medium cursor-pointer"
(click)="onRefreshCaptcha()"
>
<i class="pi pi-refresh text-3xl! text-gray-500"></i>
</div>
}
</div> -->
<!-- <p-inputgroup>
<input
pInputText
id="captcha"
type="text"
placeholder="کد کپچا را وارد کنید"
class="w-full"
formControlName="captcha"
/>
<p-inputgroup-addon>
<p-button icon="pi pi-refresh" severity="secondary" variant="text" (click)="onRefreshCaptchaImage()" />
</p-inputgroup-addon>
</p-inputgroup> -->
</div>
<div class="mb-6 flex flex-col items-center gap-4 w-[16rem] mx-auto"></div>
<div class="grid grid-cols-1 gap-3">
<!-- @if (loginForm.controls.role.value === "TEACHER") {
<span class="w-full text-center text-sm select-none">
برای ثبت نام در سامانه <a class="text-primary cursor-pointer" (click)="toSignup()">اینجا</a> کلیک کنید.
</span>
} -->
<p-button label="ورود" styleClass="w-full" size="large" [loading]="isLoading()" type="submit"></p-button>
</div>
</form>
+3
View File
@@ -0,0 +1,3 @@
export default {
isPosApplication: false,
};
+3
View File
@@ -0,0 +1,3 @@
export default {
isPosApplication: true,
};