Compare commits
18 Commits
cd09b09e3b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 93ebc80da3 | |||
| 4e4cc08224 | |||
| e5f53c2265 | |||
| b57d6b4e4b | |||
| ea458c7b72 | |||
| 151eff2f7c | |||
| 1a0c40ecde | |||
| d1dd67aee7 | |||
| f7f8a91a85 | |||
| 2c90f8091e | |||
| d6aa165592 | |||
| 5ee03cf761 | |||
| 72954fb5d1 | |||
| b4cd4c05f2 | |||
| 88f45eee38 | |||
| 5fa07c7ee8 | |||
| 788f4023f3 | |||
| 2f67801700 |
@@ -51,6 +51,54 @@
|
|||||||
"optimization": false,
|
"optimization": false,
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
|
"novin": {
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "public-novin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"maximumError": "3MB",
|
||||||
|
"maximumWarning": "2MB",
|
||||||
|
"type": "initial"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximumError": "8kB",
|
||||||
|
"maximumWarning": "4kB",
|
||||||
|
"type": "anyComponentStyle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/config.ts",
|
||||||
|
"with": "src/tenants/novin/config.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/assets/images/brandingAssets.ts",
|
||||||
|
"with": "src/tenants/novin/brandingAssets.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.novin.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/app.routes.ts",
|
||||||
|
"with": "src/tenants/novin/app.routes.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/app/branding/branding.config.ts",
|
||||||
|
"with": "src/tenants/novin/branding.config.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
"outputPath": "dist/novin",
|
||||||
|
"styles": [
|
||||||
|
"src/assets/styles.scss",
|
||||||
|
"src/assets/psp.scss"
|
||||||
|
]
|
||||||
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
@@ -81,6 +129,54 @@
|
|||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"outputPath": "dist/production"
|
"outputPath": "dist/production"
|
||||||
},
|
},
|
||||||
|
"sepehr": {
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "public-sepehr"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"maximumError": "3MB",
|
||||||
|
"maximumWarning": "2MB",
|
||||||
|
"type": "initial"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximumError": "8kB",
|
||||||
|
"maximumWarning": "4kB",
|
||||||
|
"type": "anyComponentStyle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/config.ts",
|
||||||
|
"with": "src/tenants/sepehr/config.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/assets/images/brandingAssets.ts",
|
||||||
|
"with": "src/tenants/sepehr/brandingAssets.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.sepehr.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/app.routes.ts",
|
||||||
|
"with": "src/tenants/sepehr/app.routes.ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"replace": "src/app/branding/branding.config.ts",
|
||||||
|
"with": "src/tenants/sepehr/branding.config.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
"outputPath": "dist/sepehr",
|
||||||
|
"styles": [
|
||||||
|
"src/assets/styles.scss",
|
||||||
|
"src/assets/psp.scss"
|
||||||
|
]
|
||||||
|
},
|
||||||
"staging": {
|
"staging": {
|
||||||
"extractLicenses": true,
|
"extractLicenses": true,
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
@@ -135,7 +231,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"outputPath": "dist/tis"
|
"outputPath": "dist/tis",
|
||||||
|
"styles": [
|
||||||
|
"src/assets/styles.scss",
|
||||||
|
"src/assets/psp.scss"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"tis-development": {
|
"tis-development": {
|
||||||
"assets": [
|
"assets": [
|
||||||
@@ -182,7 +282,11 @@
|
|||||||
"optimization": false,
|
"optimization": false,
|
||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"outputPath": "dist/tis",
|
"outputPath": "dist/tis",
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"styles": [
|
||||||
|
"src/assets/styles.scss",
|
||||||
|
"src/assets/psp.scss"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "production",
|
"defaultConfiguration": "production",
|
||||||
@@ -222,9 +326,15 @@
|
|||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "pos.client:build:development"
|
"buildTarget": "pos.client:build:development"
|
||||||
},
|
},
|
||||||
|
"novin": {
|
||||||
|
"buildTarget": "pos.client:build:novin"
|
||||||
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "pos.client:build:production"
|
"buildTarget": "pos.client:build:production"
|
||||||
},
|
},
|
||||||
|
"sepehr": {
|
||||||
|
"buildTarget": "pos.client:build:sepehr"
|
||||||
|
},
|
||||||
"staging": {
|
"staging": {
|
||||||
"buildTarget": "pos.client:build:staging"
|
"buildTarget": "pos.client:build:staging"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,6 +13,29 @@ services:
|
|||||||
- "8091:8090"
|
- "8091:8090"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
app_novin:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
TENANT: novin
|
||||||
|
DIST_DIR: novin
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "8093:8090"
|
||||||
|
restart: unless-stopped
|
||||||
|
# app_sepehr:
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: Dockerfile
|
||||||
|
# args:
|
||||||
|
# TENANT: sepehr
|
||||||
|
# DIST_DIR: sepehr
|
||||||
|
|
||||||
|
# ports:
|
||||||
|
# - "8092:8090"
|
||||||
|
# restart: unless-stopped
|
||||||
|
|
||||||
app_default:
|
app_default:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
|||||||
@@ -56,10 +56,14 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
|
"build:novin": "ng build --configuration novin",
|
||||||
|
"build:sepehr": "ng build --configuration sepehr",
|
||||||
"build:tis": "ng build --configuration tis",
|
"build:tis": "ng build --configuration tis",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"prestart": "node aspnetcore-https",
|
"prestart": "node aspnetcore-https",
|
||||||
"start": "run-script-os",
|
"start": "run-script-os",
|
||||||
|
"start:novin": " ng serve --configuration novin",
|
||||||
|
"start:sepehr": " ng serve --configuration sepehr",
|
||||||
"start:tis": " ng serve --configuration tis",
|
"start:tis": " ng serve --configuration tis",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"watch": "ng build --watch --configuration development"
|
"watch": "ng build --watch --configuration development"
|
||||||
|
|||||||
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 94 KiB |
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"background_color": "#ffffff",
|
||||||
|
"display": "standalone",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"purpose": "any",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"src": "/favicon/web-app-manifest-192x192.png",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"purpose": "maskable",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"src": "/favicon/web-app-manifest-192x192.png",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"purpose": "any",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"src": "/favicon/web-app-manifest-512x512.png",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"purpose": "maskable",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"src": "/favicon/web-app-manifest-512x512.png",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "/",
|
||||||
|
"name": "پرداخت نوین - مدیریت صورتحسابهای مالیاتی",
|
||||||
|
"scope": "/",
|
||||||
|
"short_name": "پرداخت نوین",
|
||||||
|
"start_url": "/",
|
||||||
|
"theme_color": "#ffffff"
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 187 KiB |
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "پرداخت الکترونیک سپهر",
|
||||||
|
"short_name": "پرداخت الکترونیک سپهر",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/web-app-manifest-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/web-app-manifest-512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"theme_color": "#ffffff",
|
||||||
|
"background_color": "#ffffff",
|
||||||
|
"display": "standalone"
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"background_color": "#ffffff",
|
||||||
|
"display": "standalone",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"purpose": "any",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"src": "/favicon/web-app-manifest-192x192.png",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"purpose": "maskable",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"src": "/favicon/web-app-manifest-192x192.png",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"purpose": "any",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"src": "/favicon/web-app-manifest-512x512.png",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"purpose": "maskable",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"src": "/favicon/web-app-manifest-512x512.png",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "/",
|
||||||
|
"name": "پرداخت الکترونیک سپهر",
|
||||||
|
"scope": "/",
|
||||||
|
"short_name": "سپهر",
|
||||||
|
"start_url": "/",
|
||||||
|
"theme_color": "#ffffff"
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 4.5 KiB |
@@ -28,9 +28,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": "/",
|
"id": "/",
|
||||||
"name": "نرم افزار صورتحسابهای مالیاتی پاژن",
|
"name": "نرم افزار صورتحسابهای مالیاتی سپاس",
|
||||||
"scope": "/",
|
"scope": "/",
|
||||||
"short_name": "پاژن",
|
"short_name": "سپاس",
|
||||||
"start_url": "/",
|
"start_url": "/",
|
||||||
"theme_color": "#ffffff"
|
"theme_color": "#ffffff"
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 19 KiB |
@@ -1,3 +1,4 @@
|
|||||||
|
import { NavigationService } from '@/core/services/navigation.service';
|
||||||
import { PwaInstallService } from '@/core/services/pwa-install.service';
|
import { PwaInstallService } from '@/core/services/pwa-install.service';
|
||||||
import { ConfirmationDialogComponent } from '@/shared/components/confirmationDialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@/shared/components/confirmationDialog/confirmation-dialog.component';
|
||||||
import { Component, HostListener } from '@angular/core';
|
import { Component, HostListener } from '@angular/core';
|
||||||
@@ -18,7 +19,10 @@ import { brandingConfig } from './app/branding/branding.config';
|
|||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
toastPosition: 'top-center' | 'bottom-right' = 'bottom-right';
|
toastPosition: 'top-center' | 'bottom-right' = 'bottom-right';
|
||||||
|
|
||||||
constructor(private readonly pwaInstallService: PwaInstallService) {
|
constructor(
|
||||||
|
private readonly pwaInstallService: PwaInstallService,
|
||||||
|
private readonly navigationService: NavigationService
|
||||||
|
) {
|
||||||
this.updateToastPosition();
|
this.updateToastPosition();
|
||||||
if (brandingConfig.enableInstallPrompt) {
|
if (brandingConfig.enableInstallPrompt) {
|
||||||
this.pwaInstallService.init();
|
this.pwaInstallService.init();
|
||||||
|
|||||||
@@ -73,14 +73,14 @@ export class NativeBridgeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pay(request: INativePayRequest): any {
|
pay(request: INativePayRequest): any {
|
||||||
if (request.amount <= 10_000) {
|
// if (request.amount <= 1_000) {
|
||||||
const errorMessage = 'برای مقادیر زیر ۱۰۰ هزار ریال، پرداخت ممکن نیست.';
|
// const errorMessage = 'برای مقادیر زیر ۱۰ هزار ریال، پرداخت ممکن نیست.';
|
||||||
this.toastService.warn({ text: errorMessage, life: 3000 });
|
// this.toastService.warn({ text: errorMessage, life: 3000 });
|
||||||
return {
|
// return {
|
||||||
success: false,
|
// success: false,
|
||||||
error: errorMessage,
|
// error: errorMessage,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
this.toastService.info({ text: 'در حال پردازش پرداخت...' });
|
this.toastService.info({ text: 'در حال پردازش پرداخت...' });
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -135,6 +135,7 @@ export class NativeBridgeService {
|
|||||||
this.toastService.info({ text: 'در حال چاپ ...' });
|
this.toastService.info({ text: 'در حال چاپ ...' });
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.NativeBridge.print(JSON.stringify(payload));
|
window.NativeBridge.print(JSON.stringify(payload));
|
||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' });
|
this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' });
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { filter } from 'rxjs/operators';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class NavigationService {
|
||||||
|
private readonly CURRENT_URL_KEY = 'currentUrl';
|
||||||
|
private readonly PREVIOUS_URL_KEY = 'previousUrl';
|
||||||
|
|
||||||
|
currentUrl: string | null;
|
||||||
|
previousUrl: string | null;
|
||||||
|
|
||||||
|
constructor(private router: Router) {
|
||||||
|
this.currentUrl = sessionStorage.getItem(this.CURRENT_URL_KEY);
|
||||||
|
this.previousUrl = sessionStorage.getItem(this.PREVIOUS_URL_KEY);
|
||||||
|
|
||||||
|
this.router.events
|
||||||
|
.pipe(filter((event): event is NavigationEnd => event instanceof NavigationEnd))
|
||||||
|
.subscribe((event) => {
|
||||||
|
const newUrl = event.urlAfterRedirects;
|
||||||
|
|
||||||
|
// Ignore duplicate events
|
||||||
|
if (newUrl === this.currentUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.previousUrl = this.currentUrl;
|
||||||
|
this.currentUrl = newUrl;
|
||||||
|
|
||||||
|
if (this.previousUrl) {
|
||||||
|
sessionStorage.setItem(this.PREVIOUS_URL_KEY, this.previousUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
sessionStorage.setItem(this.CURRENT_URL_KEY, this.currentUrl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
canGoBack(): boolean {
|
||||||
|
return !!this.previousUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
back(fallbackUrl = '/'): void {
|
||||||
|
if (this.canGoBack()) {
|
||||||
|
window.history.back();
|
||||||
|
} else {
|
||||||
|
this.router.navigateByUrl(fallbackUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import config from 'src/config';
|
||||||
import { AuthService } from '../../services/auth.service';
|
import { AuthService } from '../../services/auth.service';
|
||||||
import { BaseState, BaseStore } from '../base-store';
|
import { BaseState, BaseStore } from '../base-store';
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ export class GlobalStore extends BaseStore<GlobalState> {
|
|||||||
readonly isOnline = this.computed((state) => state.isOnline);
|
readonly isOnline = this.computed((state) => state.isOnline);
|
||||||
readonly notifications = this.computed((state) => state.notifications);
|
readonly notifications = this.computed((state) => state.notifications);
|
||||||
readonly unreadNotifications = this.computed((state) =>
|
readonly unreadNotifications = this.computed((state) =>
|
||||||
state.notifications.filter((n) => !n.read),
|
state.notifications.filter((n) => !n.read)
|
||||||
);
|
);
|
||||||
readonly breadcrumbs = this.computed((state) => state.breadcrumbs);
|
readonly breadcrumbs = this.computed((state) => state.breadcrumbs);
|
||||||
readonly preferences = this.computed((state) => state.preferences);
|
readonly preferences = this.computed((state) => state.preferences);
|
||||||
@@ -144,7 +145,11 @@ export class GlobalStore extends BaseStore<GlobalState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load theme from localStorage
|
// Load theme from localStorage
|
||||||
const savedTheme = localStorage.getItem('app_theme') as 'light' | 'dark';
|
const savedTheme = config.isPosApplication
|
||||||
|
? 'light'
|
||||||
|
: (localStorage.getItem('app_theme') as 'light' | 'dark');
|
||||||
|
console.log('savedTheme', savedTheme);
|
||||||
|
|
||||||
if (savedTheme) {
|
if (savedTheme) {
|
||||||
this.patchState({ theme: savedTheme });
|
this.patchState({ theme: savedTheme });
|
||||||
}
|
}
|
||||||
@@ -250,7 +255,7 @@ export class GlobalStore extends BaseStore<GlobalState> {
|
|||||||
*/
|
*/
|
||||||
markNotificationRead(id: string): void {
|
markNotificationRead(id: string): void {
|
||||||
const notifications = this._state().notifications.map((n) =>
|
const notifications = this._state().notifications.map((n) =>
|
||||||
n.id === id ? { ...n, read: true } : n,
|
n.id === id ? { ...n, read: true } : n
|
||||||
);
|
);
|
||||||
this.patchState({ notifications });
|
this.patchState({ notifications });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const columns: IColumn[] = [
|
|||||||
{ field: 'device', header: 'دستگاه', type: 'nested', nestedOption: { path: 'device.name' } },
|
{ field: 'device', header: 'دستگاه', type: 'nested', nestedOption: { path: 'device.name' } },
|
||||||
{
|
{
|
||||||
field: 'provider',
|
field: 'provider',
|
||||||
header: 'ارایهدهنده',
|
header: 'PSP',
|
||||||
type: 'nested',
|
type: 'nested',
|
||||||
nestedOption: { path: 'provider.name' },
|
nestedOption: { path: 'provider.name' },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ export const CONSUMER_MENU_ITEMS = [
|
|||||||
routerLink: ['/consumer/poses'],
|
routerLink: ['/consumer/poses'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'صورتحسابها',
|
label: 'صورتحساب',
|
||||||
icon: 'pi pi-fw pi-receipt',
|
icon: 'pi pi-fw pi-receipt',
|
||||||
routerLink: ['/consumer/sale_invoices'],
|
routerLink: ['/consumer/sale_invoices'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'مشتریها',
|
label: 'مشتری',
|
||||||
icon: 'pi pi-fw pi-users',
|
icon: 'pi pi-fw pi-users',
|
||||||
routerLink: ['/consumer/customers'],
|
routerLink: ['/consumer/customers'],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
<shared-dialog
|
<shared-dialog
|
||||||
header="ویرایش گذرواژه"
|
header="تغییر رمز عبور"
|
||||||
[(visible)]="visible"
|
[(visible)]="visible"
|
||||||
[modal]="true"
|
[modal]="true"
|
||||||
[style]="{ width: '500px' }"
|
[style]="{ width: '500px' }"
|
||||||
[closable]="true"
|
[closable]="true"
|
||||||
(onHide)="close()"
|
(onHide)="close()">
|
||||||
>
|
|
||||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||||
<shared-password-input
|
<shared-password-input
|
||||||
[passwordControl]="form.controls.password"
|
[passwordControl]="form.controls.password"
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword"
|
[confirmPasswordControl]="form.controls.confirmPassword" />
|
||||||
/>
|
|
||||||
|
|
||||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="مدیریت سطح دسترسی">
|
<app-card-data cardTitle="مدیریت سطح دسترسی">
|
||||||
@if (isOwner()) {
|
@if (isOwner()) {
|
||||||
<div class="py-20 flex items-center justify-center">
|
<div class="flex items-center justify-center py-20">
|
||||||
کاربر با سطح Owner به تمامی سطوح دسترسی داشته و قابل ویرایش نمیباشد
|
کاربر با سطح Owner به تمامی سطوح دسترسی داشته و قابل ویرایش نمیباشد
|
||||||
</div>
|
</div>
|
||||||
} @else if (loading()) {
|
} @else if (loading()) {
|
||||||
<div class="py-20 flex items-center justify-center">
|
<div class="flex items-center justify-center py-20">
|
||||||
<p-progressSpinner />
|
<p-progressSpinner />
|
||||||
</div>
|
</div>
|
||||||
} @else if (permissions()) {
|
} @else if (permissions()) {
|
||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<p-message severity="secondary"> پیام مفهومی برای مشخص کردن نوع دسترسی دادن</p-message>
|
<p-message severity="secondary"> پیام مفهومی برای مشخص کردن نوع دسترسی دادن</p-message>
|
||||||
@for (pos of permissions()?.poses; track $index) {
|
@for (pos of permissions()?.poses; track $index) {
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
|
|||||||
@@ -4,14 +4,13 @@
|
|||||||
[modal]="true"
|
[modal]="true"
|
||||||
[style]="{ width: '500px' }"
|
[style]="{ width: '500px' }"
|
||||||
[closable]="true"
|
[closable]="true"
|
||||||
(onHide)="close()"
|
(onHide)="close()">
|
||||||
>
|
|
||||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||||
<field-name [control]="form.controls.name" />
|
<field-name [control]="form.controls.name" />
|
||||||
|
|
||||||
<field-pos-type [control]="form.controls.pos_type" />
|
<!-- <field-pos-type [control]="form.controls.pos_type" /> -->
|
||||||
|
|
||||||
@if (form.controls.pos_type.value === "PSP") {
|
@if (form.controls.pos_type.value === 'PSP') {
|
||||||
<field-serial-number [control]="form.controls.serial_number" />
|
<field-serial-number [control]="form.controls.serial_number" />
|
||||||
<field-device-id [control]="form.controls.device_id" />
|
<field-device-id [control]="form.controls.device_id" />
|
||||||
<field-provider-id [control]="form.controls.provider_id" />
|
<field-provider-id [control]="form.controls.provider_id" />
|
||||||
@@ -22,8 +21,7 @@
|
|||||||
<field-username [control]="form.controls.username" />
|
<field-username [control]="form.controls.username" />
|
||||||
<shared-password-input
|
<shared-password-input
|
||||||
[passwordControl]="form.controls.password"
|
[passwordControl]="form.controls.password"
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword"
|
[confirmPasswordControl]="form.controls.confirmPassword" />
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { AbstractFormDialog } from '@/shared/abstractClasses';
|
|||||||
import {
|
import {
|
||||||
DeviceIdComponent,
|
DeviceIdComponent,
|
||||||
NameComponent,
|
NameComponent,
|
||||||
PosTypeComponent,
|
|
||||||
ProviderIdComponent,
|
ProviderIdComponent,
|
||||||
SerialNumberComponent,
|
SerialNumberComponent,
|
||||||
SharedPasswordInputComponent,
|
SharedPasswordInputComponent,
|
||||||
@@ -29,7 +28,6 @@ import { ConsumerPosesService } from '../../services/poses.service';
|
|||||||
FormFooterActionsComponent,
|
FormFooterActionsComponent,
|
||||||
DeviceIdComponent,
|
DeviceIdComponent,
|
||||||
ProviderIdComponent,
|
ProviderIdComponent,
|
||||||
PosTypeComponent,
|
|
||||||
SerialNumberComponent,
|
SerialNumberComponent,
|
||||||
UsernameComponent,
|
UsernameComponent,
|
||||||
Divider,
|
Divider,
|
||||||
@@ -46,7 +44,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
|||||||
initForm = () => {
|
initForm = () => {
|
||||||
const form = this.fb.group({
|
const form = this.fb.group({
|
||||||
name: fieldControl.name(this.initialValues?.name || ''),
|
name: fieldControl.name(this.initialValues?.name || ''),
|
||||||
pos_type: fieldControl.pos_type(this.initialValues?.pos_type || ''),
|
pos_type: fieldControl.pos_type(this.initialValues?.pos_type || 'PSP'),
|
||||||
serial_number: fieldControl.serial_number(this.initialValues?.serial_number || ''),
|
serial_number: fieldControl.serial_number(this.initialValues?.serial_number || ''),
|
||||||
device_id: fieldControl.device_id(this.initialValues?.device?.id || ''),
|
device_id: fieldControl.device_id(this.initialValues?.device?.id || ''),
|
||||||
provider_id: fieldControl.provider_id(this.initialValues?.provider?.id || ''),
|
provider_id: fieldControl.provider_id(this.initialValues?.provider?.id || ''),
|
||||||
@@ -96,7 +94,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
|||||||
this.fb.control<string>('', {
|
this.fb.control<string>('', {
|
||||||
nonNullable: true,
|
nonNullable: true,
|
||||||
validators: fieldControl.username('')[1],
|
validators: fieldControl.username('')[1],
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
form.addControl(
|
form.addControl(
|
||||||
@@ -104,7 +102,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
|||||||
this.fb.control<string>('', {
|
this.fb.control<string>('', {
|
||||||
nonNullable: true,
|
nonNullable: true,
|
||||||
validators: [Validators.required],
|
validators: [Validators.required],
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
form.addControl(
|
form.addControl(
|
||||||
@@ -112,7 +110,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
|||||||
this.fb.control<string>('', {
|
this.fb.control<string>('', {
|
||||||
nonNullable: true,
|
nonNullable: true,
|
||||||
validators: [Validators.required],
|
validators: [Validators.required],
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
form.addValidators([MustMatch('password', 'confirmPassword')]);
|
form.addValidators([MustMatch('password', 'confirmPassword')]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
pageTitle="لیست پایانههای فروش"
|
pageTitle="پایانههای فروش"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
[addNewCtaLabel]="'افزودن پایانه فروش'"
|
[addNewCtaLabel]="'افزودن پایانه فروش'"
|
||||||
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
|
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
|
||||||
@@ -12,8 +12,7 @@
|
|||||||
(onAdd)="openAddForm()"
|
(onAdd)="openAddForm()"
|
||||||
(onEdit)="onEditClick($event)"
|
(onEdit)="onEditClick($event)"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()">
|
||||||
>
|
|
||||||
</app-page-data-list>
|
</app-page-data-list>
|
||||||
<consumer-pos-form
|
<consumer-pos-form
|
||||||
[(visible)]="visibleForm"
|
[(visible)]="visibleForm"
|
||||||
@@ -22,5 +21,4 @@
|
|||||||
[complexId]="complexId"
|
[complexId]="complexId"
|
||||||
[posId]="selectedItemForEdit()?.id || ''"
|
[posId]="selectedItemForEdit()?.id || ''"
|
||||||
[initialValues]="selectedItemForEdit() || undefined"
|
[initialValues]="selectedItemForEdit() || undefined"
|
||||||
(onSubmit)="refresh()"
|
(onSubmit)="refresh()" />
|
||||||
/>
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
import { Component, inject, Input } from '@angular/core';
|
import { Component, inject, Input } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { consumerPosesNamedRoutes } from '../../constants/routes/poses';
|
import { consumerComplexPosesNamedRoutes } from '../../constants/routes/poses';
|
||||||
import { IPosResponse } from '../../models';
|
import { IPosResponse } from '../../models';
|
||||||
import { ConsumerPosesService } from '../../services/poses.service';
|
import { ConsumerPosesService } from '../../services/poses.service';
|
||||||
import { ConsumerPosFormComponent } from './form.component';
|
import { ConsumerPosFormComponent } from './form.component';
|
||||||
@@ -36,7 +36,7 @@ export class ConsumerPosesComponent extends AbstractList<IPosResponse> {
|
|||||||
|
|
||||||
toSinglePage(item: IPosResponse) {
|
toSinglePage(item: IPosResponse) {
|
||||||
this.router.navigateByUrl(
|
this.router.navigateByUrl(
|
||||||
consumerPosesNamedRoutes.pos.meta.pagePath!(this.businessId, this.complexId, item.id),
|
consumerComplexPosesNamedRoutes.pos.meta.pagePath!(this.businessId, this.complexId, item.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
pageTitle="لیست صورتحسابها"
|
[pageTitle]="'صورتحسابها'"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="تا به حال صورتحسابی توسط این پایانه ایجاد نشده است."
|
emptyPlaceholderTitle="صورتحسابی یافت نشد"
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
[loading]="loading()"
|
[loading]="loading()"
|
||||||
|
[showDetails]="true"
|
||||||
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()">
|
(onRefresh)="refresh()">
|
||||||
|
<ng-template #status let-item>
|
||||||
|
<catalog-tax-provider-status-tag [status]="item.status.value" [translate]="item.status.translate" />
|
||||||
|
</ng-template>
|
||||||
</app-page-data-list>
|
</app-page-data-list>
|
||||||
|
|||||||
@@ -1,47 +1,52 @@
|
|||||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||||
|
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||||
import {
|
import {
|
||||||
IColumn,
|
IColumn,
|
||||||
PageDataListComponent,
|
PageDataListComponent,
|
||||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
import { Component, inject, Input } from '@angular/core';
|
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
|
||||||
|
import { Component, inject, Input, TemplateRef, ViewChild } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { consumerSaleInvoicesNamedRoutes } from '../../../saleInvoices/constants/routes';
|
||||||
import { ISalesInvoicesResponse } from '../../models';
|
import { ISalesInvoicesResponse } from '../../models';
|
||||||
import { ConsumerSalesInvoicesService } from '../../services/invoices.service';
|
import { ConsumerSalesInvoicesService } from '../../services/invoices.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'consumer-salesInvoices-list',
|
selector: 'consumer-salesInvoices-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
imports: [PageDataListComponent],
|
imports: [PageDataListComponent, CatalogTaxProviderStatusTagComponent],
|
||||||
})
|
})
|
||||||
export class ConsumerSalesInvoicesComponent extends AbstractList<ISalesInvoicesResponse> {
|
export class ConsumerSalesInvoicesComponent extends AbstractList<ISalesInvoicesResponse> {
|
||||||
|
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
|
||||||
|
|
||||||
@Input({ required: true }) complexId!: string;
|
@Input({ required: true }) complexId!: string;
|
||||||
@Input({ required: true }) posId!: string;
|
@Input({ required: true }) posId!: string;
|
||||||
@Input() fullHeight?: boolean;
|
@Input() fullHeight?: boolean;
|
||||||
@Input() header: IColumn[] = [
|
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
|
||||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
|
||||||
{ field: 'code', header: 'کد رهگیری' },
|
|
||||||
{ field: 'total_amount', header: 'مبلغ کل', type: 'price' },
|
|
||||||
{
|
|
||||||
field: 'items_count',
|
|
||||||
header: 'تعداد کالاها',
|
|
||||||
customDataModel(item) {
|
|
||||||
return `${item.items.length} عدد`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'invoice_date',
|
|
||||||
header: 'تاریخ',
|
|
||||||
type: 'date',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
private readonly service = inject(ConsumerSalesInvoicesService);
|
private readonly service = inject(ConsumerSalesInvoicesService);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
|
||||||
override setColumns(): void {
|
override setColumns(): void {
|
||||||
this.columns = this.header;
|
this.columns = this.header
|
||||||
|
.map((header) => {
|
||||||
|
if (header.field === 'status') {
|
||||||
|
return {
|
||||||
|
...header,
|
||||||
|
customDataModel: this.status,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return header;
|
||||||
|
})
|
||||||
|
.filter((header) => header.field !== 'pos');
|
||||||
}
|
}
|
||||||
|
|
||||||
override getDataRequest() {
|
override getDataRequest() {
|
||||||
return this.service.getAll(this.complexId, this.posId);
|
return this.service.getAll(this.complexId, this.posId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toSinglePage(item: ISalesInvoicesResponse) {
|
||||||
|
this.router.navigateByUrl(consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(item.id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export type TPosesRouteNames = 'poses' | 'pos';
|
|||||||
const baseUrl = (businessId: string, complexId: string) =>
|
const baseUrl = (businessId: string, complexId: string) =>
|
||||||
`/consumer/business_activities/${businessId}/complexes/${complexId}/poses`;
|
`/consumer/business_activities/${businessId}/complexes/${complexId}/poses`;
|
||||||
|
|
||||||
export const consumerPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
|
export const consumerComplexPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
|
||||||
poses: {
|
poses: {
|
||||||
path: 'poses',
|
path: 'poses',
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
@@ -31,17 +31,17 @@ export const consumerPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CONSUMER_POSES_ROUTES: Routes = [
|
export const CONSUMER_POSES_ROUTES: Routes = [
|
||||||
consumerPosesNamedRoutes.poses,
|
consumerComplexPosesNamedRoutes.poses,
|
||||||
{
|
{
|
||||||
path: consumerPosesNamedRoutes.pos.path,
|
path: consumerComplexPosesNamedRoutes.pos.path,
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../components/poses/layout.component').then(
|
import('../../components/poses/layout.component').then(
|
||||||
(m) => m.SuperAdminConsumerPosLayoutComponent,
|
(m) => m.SuperAdminConsumerPosLayoutComponent
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
loadComponent: consumerPosesNamedRoutes.pos.loadComponent,
|
loadComponent: consumerComplexPosesNamedRoutes.pos.loadComponent,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import ISummary from '@/core/models/summary';
|
import ISummary from '@/core/models/summary';
|
||||||
import { TCustomerInfo, TPosOrderGoodPayload } from '@/domains/pos/modules/shop/models';
|
import { TCustomerInfo, TPosOrderGoodPayload } from '@/domains/pos/modules/shop/models';
|
||||||
|
import { TspProviderResponseStatus } from '@/shared/catalog';
|
||||||
|
import { IEnumTranslate } from '@/shared/models';
|
||||||
|
|
||||||
export interface ISalesInvoicesRawResponse {
|
export interface ISalesInvoicesRawResponse {
|
||||||
id: string;
|
id: string;
|
||||||
|
invoice_number: string;
|
||||||
code: string;
|
code: string;
|
||||||
invoice_date: string;
|
invoice_date: string;
|
||||||
total_amount: string;
|
total_amount: string;
|
||||||
|
status: IEnumTranslate<TspProviderResponseStatus>;
|
||||||
items: Item[];
|
items: Item[];
|
||||||
payments: Payment[];
|
payments: Payment[];
|
||||||
customer?: TCustomerInfo;
|
customer?: TCustomerInfo;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class BusinessActivityStore extends EntityStore<
|
|||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
this.setError(error);
|
this.setError(error);
|
||||||
throw error;
|
throw error;
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
.subscribe((entity) => {
|
.subscribe((entity) => {
|
||||||
this.patchState({ entity });
|
this.patchState({ entity });
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
|||||||
import { computed, inject, Injectable } from '@angular/core';
|
import { computed, inject, Injectable } from '@angular/core';
|
||||||
import { MenuItem } from 'primeng/api';
|
import { MenuItem } from 'primeng/api';
|
||||||
import { catchError, finalize } from 'rxjs';
|
import { catchError, finalize } from 'rxjs';
|
||||||
import { consumerPosesNamedRoutes } from '../constants/routes/poses';
|
import { consumerComplexPosesNamedRoutes } from '../constants/routes/poses';
|
||||||
import { IPosResponse } from '../models';
|
import { IPosResponse } from '../models';
|
||||||
import { ConsumerPosesService } from '../services/poses.service';
|
import { ConsumerPosesService } from '../services/poses.service';
|
||||||
|
|
||||||
@@ -28,12 +28,16 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
|
|||||||
this.patchState({
|
this.patchState({
|
||||||
breadcrumbItems: [
|
breadcrumbItems: [
|
||||||
{
|
{
|
||||||
...consumerPosesNamedRoutes.poses.meta,
|
...consumerComplexPosesNamedRoutes.poses.meta,
|
||||||
routerLink: consumerPosesNamedRoutes.poses.meta.pagePath!(businessId, complexId),
|
routerLink: consumerComplexPosesNamedRoutes.poses.meta.pagePath!(businessId, complexId),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.entity()?.name,
|
title: this.entity()?.name,
|
||||||
routerLink: consumerPosesNamedRoutes.pos.meta.pagePath!(businessId, complexId, posId),
|
routerLink: consumerComplexPosesNamedRoutes.pos.meta.pagePath!(
|
||||||
|
businessId,
|
||||||
|
complexId,
|
||||||
|
posId
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@@ -50,7 +54,7 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
|
|||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
this.setError(error);
|
this.setError(error);
|
||||||
throw error;
|
throw error;
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
.subscribe((entity) => {
|
.subscribe((entity) => {
|
||||||
this.patchState({ entity });
|
this.patchState({ entity });
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات شعبه" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات شعبه" [editable]="true" [(editMode)]="editMode">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
@@ -17,6 +17,5 @@
|
|||||||
[businessActivityId]="businessId()"
|
[businessActivityId]="businessId()"
|
||||||
[complexId]="complexId()"
|
[complexId]="complexId()"
|
||||||
[initialValues]="complex() || undefined"
|
[initialValues]="complex() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import pageParamsUtils from '@/utils/page-params.utils';
|
|||||||
import { Component, computed, inject, signal } from '@angular/core';
|
import { Component, computed, inject, signal } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { ConsumerPosesComponent } from '../../components/poses/list.component';
|
import { ConsumerPosesComponent } from '../../components/poses/list.component';
|
||||||
import { consumerPosesNamedRoutes } from '../../constants/routes/poses';
|
import { consumerComplexPosesNamedRoutes } from '../../constants/routes/poses';
|
||||||
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
||||||
import { ConsumerComplexStore } from '../../store/complex.store';
|
import { ConsumerComplexStore } from '../../store/complex.store';
|
||||||
|
|
||||||
@@ -32,10 +32,10 @@ export class ConsumerPosListPageComponent {
|
|||||||
...this.businessStore.breadcrumbItems(),
|
...this.businessStore.breadcrumbItems(),
|
||||||
...this.complexStore.breadcrumbItems(),
|
...this.complexStore.breadcrumbItems(),
|
||||||
{
|
{
|
||||||
title: consumerPosesNamedRoutes.poses.meta.title,
|
title: consumerComplexPosesNamedRoutes.poses.meta.title,
|
||||||
routerLink: consumerPosesNamedRoutes.poses.meta.pagePath!(
|
routerLink: consumerComplexPosesNamedRoutes.poses.meta.pagePath!(
|
||||||
this.businessId(),
|
this.businessId(),
|
||||||
this.complexId(),
|
this.complexId()
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات پایانه فروش" [backRoute]="backRoute()" [editable]="true" [(editMode)]="editMode">
|
||||||
<ng-template #moreActions>
|
<ng-template #moreActions>
|
||||||
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
|
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
|
||||||
<app-key-value label="نوع دستگاه" [value]="pos()?.device?.name" />
|
<app-key-value label="نوع دستگاه" [value]="pos()?.device?.name" />
|
||||||
<app-key-value label="مدل دستگاه" [value]="pos()?.model" />
|
<app-key-value label="مدل دستگاه" [value]="pos()?.model" />
|
||||||
<app-key-value label="ارایهدهنده" [value]="pos()?.provider?.name" />
|
<app-key-value label="PSP" [value]="pos()?.provider?.name" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</app-card-data>
|
</app-card-data>
|
||||||
@@ -24,6 +24,5 @@
|
|||||||
[complexId]="complexId()"
|
[complexId]="complexId()"
|
||||||
[posId]="posId()"
|
[posId]="posId()"
|
||||||
[initialValues]="pos() || undefined"
|
[initialValues]="pos() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Button } from 'primeng/button';
|
|||||||
import { COOKIE_KEYS } from 'src/assets/constants';
|
import { COOKIE_KEYS } from 'src/assets/constants';
|
||||||
import { ConsumerPosFormComponent } from '../../components/poses/form.component';
|
import { ConsumerPosFormComponent } from '../../components/poses/form.component';
|
||||||
import { ConsumerSalesInvoicesComponent } from '../../components/salesInvoices/list.component';
|
import { ConsumerSalesInvoicesComponent } from '../../components/salesInvoices/list.component';
|
||||||
|
import { consumerComplexPosesNamedRoutes } from '../../constants/routes/poses';
|
||||||
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
||||||
import { ConsumerComplexStore } from '../../store/complex.store';
|
import { ConsumerComplexStore } from '../../store/complex.store';
|
||||||
import { PosStore } from '../../store/pos.store';
|
import { PosStore } from '../../store/pos.store';
|
||||||
@@ -38,6 +39,11 @@ export class ConsumerComplexPosPageComponent {
|
|||||||
readonly posId = signal<string>(this.pageParams()['posId']!);
|
readonly posId = signal<string>(this.pageParams()['posId']!);
|
||||||
editMode = signal<boolean>(false);
|
editMode = signal<boolean>(false);
|
||||||
|
|
||||||
|
backRoute = computed(
|
||||||
|
() =>
|
||||||
|
`${consumerComplexPosesNamedRoutes.poses.meta.pagePath!(this.businessId(), this.complexId())}`
|
||||||
|
);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
effect(() => {
|
effect(() => {
|
||||||
if (this.pos()?.id) {
|
if (this.pos()?.id) {
|
||||||
@@ -59,7 +65,7 @@ export class ConsumerComplexPosPageComponent {
|
|||||||
sameSite: 'Lax', // or 'Strict' for same-site requests only
|
sameSite: 'Lax', // or 'Strict' for same-site requests only
|
||||||
secure: false,
|
secure: false,
|
||||||
path: '/',
|
path: '/',
|
||||||
domain: 'localhost',
|
domain: window.location.hostname,
|
||||||
});
|
});
|
||||||
window.open('/pos', '_blank');
|
window.open('/pos', '_blank');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
||||||
<ng-template #moreActions>
|
<ng-template #moreActions>
|
||||||
<a routerLink pButton [routerLink]="goodsPageRoute()" outlined size="small">مدیریت کالاها</a>
|
<a routerLink pButton [routerLink]="goodsPageRoute()" outlined size="small">مدیریت کالاها</a>
|
||||||
@@ -25,6 +25,5 @@
|
|||||||
[editMode]="true"
|
[editMode]="true"
|
||||||
[businessId]="businessId()"
|
[businessId]="businessId()"
|
||||||
[initialValues]="business() || undefined"
|
[initialValues]="business() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
[pageTitle]="'لیست مشتری'"
|
[pageTitle]="'مشتریها'"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="مشتری یافت نشد"
|
emptyPlaceholderTitle="مشتری یافت نشد"
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
@@ -8,8 +8,7 @@
|
|||||||
[showDetails]="true"
|
[showDetails]="true"
|
||||||
(onEdit)="onEditClick($event)"
|
(onEdit)="onEditClick($event)"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()" />
|
||||||
/>
|
|
||||||
|
|
||||||
@if (selectedItemForEdit()) {
|
@if (selectedItemForEdit()) {
|
||||||
<consumer-customer-form-dialog [(visible)]="visibleForm" [customer]="selectedItemForEdit()!" (onSubmit)="refresh()" />
|
<consumer-customer-form-dialog [(visible)]="visibleForm" [customer]="selectedItemForEdit()!" (onSubmit)="refresh()" />
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
[pageTitle]="'لیست صورتحساب'"
|
[pageTitle]="'صورتحسابها'"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="صورتحسابی یافت نشد"
|
emptyPlaceholderTitle="صورتحسابی یافت نشد"
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
[loading]="loading()"
|
[loading]="loading()"
|
||||||
[showDetails]="true"
|
[showDetails]="true"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()" />
|
(onRefresh)="refresh()">
|
||||||
|
<ng-template #status let-item>
|
||||||
|
<catalog-tax-provider-status-tag [status]="item.status.value" [translate]="item.status.translate" />
|
||||||
|
</ng-template>
|
||||||
|
</app-page-data-list>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||||
|
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||||
import {
|
import {
|
||||||
IColumn,
|
IColumn,
|
||||||
PageDataListComponent,
|
PageDataListComponent,
|
||||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
import { Component, inject, Input } from '@angular/core';
|
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
|
||||||
|
import { Component, inject, Input, TemplateRef, ViewChild } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { consumerCustomerSaleInvoicesNamedRoutes } from '../../constants/routes/saleInvoices';
|
import { consumerCustomerSaleInvoicesNamedRoutes } from '../../constants/routes/saleInvoices';
|
||||||
import { ICustomerSaleInvoicesResponse } from '../../models/saleInvoices.io';
|
import { ICustomerSaleInvoicesResponse } from '../../models/saleInvoices.io';
|
||||||
@@ -13,48 +15,27 @@ import { CustomerSaleInvoicesService } from '../../services/saleInvoices.service
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'consumer-customer-saleInvoice-list',
|
selector: 'consumer-customer-saleInvoice-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
imports: [PageDataListComponent],
|
imports: [PageDataListComponent, CatalogTaxProviderStatusTagComponent],
|
||||||
})
|
})
|
||||||
export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICustomerSaleInvoicesResponse> {
|
export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICustomerSaleInvoicesResponse> {
|
||||||
@Input({ required: true }) customerId!: string;
|
@Input({ required: true }) customerId!: string;
|
||||||
@Input() fullHeight?: boolean;
|
@Input() fullHeight?: boolean;
|
||||||
@Input() header: IColumn[] = [
|
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
|
||||||
{ field: 'code', header: 'کد رهگیری' },
|
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
|
||||||
{
|
|
||||||
field: 'total_amount',
|
|
||||||
header: 'قیمت نهایی',
|
|
||||||
type: 'price',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'pos',
|
|
||||||
header: 'پایانه',
|
|
||||||
customDataModel(item: ICustomerSaleInvoicesResponse) {
|
|
||||||
return `${item.pos.complex.business_activity.name}، شعبه ${item.pos.complex.name}، پایانه فروش ${item.pos.name}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'account',
|
|
||||||
header: 'ایجاد شده توسط',
|
|
||||||
type: 'nested',
|
|
||||||
nestedOption: { path: 'account.account.username' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'invoice_date',
|
|
||||||
header: 'تاریخ صورتحساب',
|
|
||||||
type: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'created_at',
|
|
||||||
header: 'تاریخ ایجاد',
|
|
||||||
type: 'date',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
private readonly service = inject(CustomerSaleInvoicesService);
|
private readonly service = inject(CustomerSaleInvoicesService);
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
|
|
||||||
override setColumns(): void {
|
override setColumns(): void {
|
||||||
this.columns = this.header;
|
this.columns = this.header.map((header) => {
|
||||||
|
if (header.field === 'status') {
|
||||||
|
return {
|
||||||
|
...header,
|
||||||
|
customDataModel: this.status,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return header;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
override getDataRequest() {
|
override getDataRequest() {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export const consumerCustomerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerCusto
|
|||||||
(m) => m.ConsumerCustomerSaleInvoicesComponent
|
(m) => m.ConsumerCustomerSaleInvoicesComponent
|
||||||
),
|
),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'صورتحسابهای صادر شده',
|
title: 'صورتحسابها',
|
||||||
pagePath: (customerId: string) => `consumer/customers/${customerId}`,
|
pagePath: (customerId: string) => `consumer/customers/${customerId}/saleInvoices`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
saleInvoice: {
|
saleInvoice: {
|
||||||
@@ -23,7 +23,7 @@ export const consumerCustomerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerCusto
|
|||||||
(m) => m.ConsumerCustomerSaleInvoiceComponent
|
(m) => m.ConsumerCustomerSaleInvoiceComponent
|
||||||
),
|
),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'صورتحساب صادر شده',
|
title: 'صورتحساب',
|
||||||
pagePath: (customerId: string, saleInvoiceId: string) =>
|
pagePath: (customerId: string, saleInvoiceId: string) =>
|
||||||
`consumer/customers/${customerId}/saleInvoices/${saleInvoiceId}`,
|
`consumer/customers/${customerId}/saleInvoices/${saleInvoiceId}`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ export class ConsumerCustomerSaleInvoiceStore extends EntityStore<
|
|||||||
consumerCustomerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(customerId),
|
consumerCustomerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(customerId),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.entity()?.code,
|
title: `صورتحساب ${this.entity()?.invoice_number}`,
|
||||||
routerLink: consumerCustomerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(
|
routerLink: consumerCustomerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(
|
||||||
customerId,
|
customerId,
|
||||||
invoiceId,
|
invoiceId
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -57,7 +57,7 @@ export class ConsumerCustomerSaleInvoiceStore extends EntityStore<
|
|||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
this.setError(error);
|
this.setError(error);
|
||||||
throw error;
|
throw error;
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
.subscribe((entity) => {
|
.subscribe((entity) => {
|
||||||
this.patchState({ entity });
|
this.patchState({ entity });
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||||
import { Component, inject, signal } from '@angular/core';
|
import { BreadcrumbService } from '@/core/services';
|
||||||
|
import pageParamsUtils from '@/utils/page-params.utils';
|
||||||
|
import { Component, computed, inject, signal } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { ConsumerCustomerSaleInvoiceListComponent } from '../../components/saleInvoices/list.component';
|
import { ConsumerCustomerSaleInvoiceListComponent } from '../../components/saleInvoices/list.component';
|
||||||
|
import { consumerCustomerSaleInvoicesNamedRoutes } from '../../constants/routes/saleInvoices';
|
||||||
|
import { ConsumerCustomerStore } from '../../store/customer.store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'consumer-customer-saleInvoices',
|
selector: 'consumer-customer-saleInvoices',
|
||||||
@@ -10,6 +14,25 @@ import { ConsumerCustomerSaleInvoiceListComponent } from '../../components/saleI
|
|||||||
})
|
})
|
||||||
export class ConsumerCustomerSaleInvoicesComponent {
|
export class ConsumerCustomerSaleInvoicesComponent {
|
||||||
private readonly route = inject(ActivatedRoute);
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||||
|
private readonly store = inject(ConsumerCustomerStore);
|
||||||
|
|
||||||
readonly customerId = signal<string>(this.route.snapshot.paramMap.get('customerId')!);
|
pageParams = computed(() => pageParamsUtils(this.route));
|
||||||
|
customerId = signal<string>(this.pageParams()['customerId']);
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.setBreadcrumb();
|
||||||
|
}
|
||||||
|
|
||||||
|
setBreadcrumb() {
|
||||||
|
this.breadcrumbService.setItems([
|
||||||
|
...this.store.breadcrumbItems(),
|
||||||
|
{
|
||||||
|
title: consumerCustomerSaleInvoicesNamedRoutes.saleInvoices.meta.title,
|
||||||
|
routerLink: consumerCustomerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(
|
||||||
|
this.customerId()
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data
|
<app-card-data
|
||||||
[cardTitle]="`اطلاعات مشتری (${customer() ? (customer()?.type === 'LEGAL' ? 'حقوقی' : 'حقیقی') : ''})`"
|
[cardTitle]="`اطلاعات مشتری (${customer() ? (customer()?.type === 'LEGAL' ? 'حقوقی' : 'حقیقی') : ''})`"
|
||||||
[editable]="true"
|
[editable]="true"
|
||||||
[(editMode)]="editMode"
|
[(editMode)]="editMode">
|
||||||
>
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
@if (customer()?.type === "LEGAL") {
|
@if (customer()?.type === 'LEGAL') {
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
<app-key-value label="عنوان" [value]="customer()?.legal?.company_name" />
|
<app-key-value label="عنوان" [value]="customer()?.legal?.company_name" />
|
||||||
<app-key-value label="کد اقتصادی" [value]="customer()?.legal?.economic_code" />
|
<app-key-value label="کد اقتصادی" [value]="customer()?.legal?.economic_code" />
|
||||||
<app-key-value label="شماره ثبت" [value]="customer()?.legal?.registration_number" />
|
<app-key-value label="شماره ثبت" [value]="customer()?.legal?.registration_number" />
|
||||||
<app-key-value label="کد پستی" [value]="customer()?.legal?.postal_code" />
|
<app-key-value label="کد پستی" [value]="customer()?.legal?.postal_code" />
|
||||||
</div>
|
</div>
|
||||||
} @else if (customer()?.type === "INDIVIDUAL") {
|
} @else if (customer()?.type === 'INDIVIDUAL') {
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
<app-key-value label="نام" [value]="customer()?.individual?.first_name" />
|
<app-key-value label="نام" [value]="customer()?.individual?.first_name" />
|
||||||
<app-key-value label="نام خانوادگی" [value]="customer()?.individual?.last_name" />
|
<app-key-value label="نام خانوادگی" [value]="customer()?.individual?.last_name" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
pageTitle="آخرین صورتحسابهای صادر شده امروز"
|
pageTitle="صورتحسابهای امروز"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="تا به این لحظه صورتحسابی صادر نشده است."
|
emptyPlaceholderTitle="تا به این لحظه صورتحسابی صادر نشده است."
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
[showDetails]="true"
|
[showDetails]="true"
|
||||||
[loading]="loading()"
|
[loading]="loading()"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { consumerSaleInvoicesNamedRoutes } from '@/domains/consumer/modules/sale
|
|||||||
import { AbstractList } from '@/shared/abstractClasses';
|
import { AbstractList } from '@/shared/abstractClasses';
|
||||||
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
|
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
|
||||||
import { Component, inject, TemplateRef, ViewChild } from '@angular/core';
|
import { Component, inject, TemplateRef, ViewChild } from '@angular/core';
|
||||||
import { Router, RouterLink } from '@angular/router';
|
import { Router, RouterLink } from '@angular/router';
|
||||||
import { ButtonDirective } from 'primeng/button';
|
import { ButtonDirective } from 'primeng/button';
|
||||||
@@ -27,29 +28,17 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<ISta
|
|||||||
readonly invoicesPageRoute = consumerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!();
|
readonly invoicesPageRoute = consumerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!();
|
||||||
|
|
||||||
override setColumns(): void {
|
override setColumns(): void {
|
||||||
this.columns = [
|
this.columns = saleInvoiceListConfig.columns
|
||||||
{ field: 'code', header: 'کد پیگیری' },
|
.filter((column) => column.field !== 'created_at')
|
||||||
{ field: 'total_amount', header: 'قیمت نهایی', type: 'price' },
|
.map((header) => {
|
||||||
{
|
if (header.field === 'status') {
|
||||||
field: 'pos',
|
return {
|
||||||
header: 'پایانه',
|
...header,
|
||||||
customDataModel(item) {
|
customDataModel: this.status,
|
||||||
return `${item.pos.name} - ${item.pos.complex.name} - ${item.pos.complex.business_activity.name}`;
|
};
|
||||||
},
|
}
|
||||||
},
|
return header;
|
||||||
{
|
});
|
||||||
field: 'consumer_account',
|
|
||||||
header: 'ایجاد شده توسط',
|
|
||||||
type: 'nested',
|
|
||||||
nestedOption: { path: 'consumer_account.account.username' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'invoice_date',
|
|
||||||
header: 'تاریخ صورتحساب',
|
|
||||||
type: 'dateTime',
|
|
||||||
},
|
|
||||||
{ field: 'status', header: 'وضعیت صدور', customDataModel: this.status },
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override getDataRequest() {
|
override getDataRequest() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
pageTitle="لیست پایانههای فروش"
|
pageTitle="پایانههای فروش"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
|
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
@@ -8,8 +8,7 @@
|
|||||||
[showEdit]="true"
|
[showEdit]="true"
|
||||||
(onEdit)="onEditClick($event)"
|
(onEdit)="onEditClick($event)"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()">
|
||||||
>
|
|
||||||
<ng-template #toPosLandingAction let-item>
|
<ng-template #toPosLandingAction let-item>
|
||||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding(item.id)"> ورود به پایانه </p-button>
|
<p-button type="button" variant="outlined" (onClick)="toPosLanding(item.id)"> ورود به پایانه </p-button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
@@ -19,5 +18,4 @@
|
|||||||
[editMode]="editMode()"
|
[editMode]="editMode()"
|
||||||
[posId]="selectedItemForEdit()?.id || ''"
|
[posId]="selectedItemForEdit()?.id || ''"
|
||||||
[initialValues]="selectedItemForEdit() || undefined"
|
[initialValues]="selectedItemForEdit() || undefined"
|
||||||
(onSubmit)="refresh()"
|
(onSubmit)="refresh()" />
|
||||||
/>
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
||||||
<ng-template #moreActions>
|
<ng-template #moreActions>
|
||||||
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
|
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
|
||||||
<app-key-value label="نوع دستگاه" [value]="pos()?.device?.name" />
|
<app-key-value label="نوع دستگاه" [value]="pos()?.device?.name" />
|
||||||
<app-key-value label="مدل دستگاه" [value]="pos()?.model" />
|
<app-key-value label="مدل دستگاه" [value]="pos()?.model" />
|
||||||
<app-key-value label="ارایهدهنده" [value]="pos()?.provider?.name" />
|
<app-key-value label="PSP" [value]="pos()?.provider?.name" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</app-card-data>
|
</app-card-data>
|
||||||
@@ -20,6 +20,5 @@
|
|||||||
[editMode]="true"
|
[editMode]="true"
|
||||||
[posId]="posId()"
|
[posId]="posId()"
|
||||||
[initialValues]="pos() || undefined"
|
[initialValues]="pos() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,12 +44,17 @@ export class ConsumerPosPageComponent {
|
|||||||
|
|
||||||
toPosLanding() {
|
toPosLanding() {
|
||||||
this.cookieService.set(COOKIE_KEYS.POS_ID, '', new Date());
|
this.cookieService.set(COOKIE_KEYS.POS_ID, '', new Date());
|
||||||
|
|
||||||
|
console.log('COOKIE_KEYS.POS_ID', COOKIE_KEYS.POS_ID);
|
||||||
|
|
||||||
this.cookieService.set(COOKIE_KEYS.POS_ID, this.posId(), {
|
this.cookieService.set(COOKIE_KEYS.POS_ID, this.posId(), {
|
||||||
sameSite: 'Lax', // or 'Strict' for same-site requests only
|
sameSite: 'Lax', // or 'Strict' for same-site requests only
|
||||||
secure: false,
|
secure: false,
|
||||||
path: '/',
|
path: '/',
|
||||||
domain: 'localhost',
|
domain: window.location.hostname,
|
||||||
});
|
});
|
||||||
|
console.log('this.posId', this.posId());
|
||||||
|
|
||||||
window.open('/pos', '_blank');
|
window.open('/pos', '_blank');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<app-card-data cardTitle="تغییر گذرواژه" [editable]="false">
|
<app-card-data cardTitle="تغییر رمز عبور" [editable]="false">
|
||||||
<form [formGroup]="form" (submit)="submit()" class="max-w-lg mx-auto">
|
<form [formGroup]="form" (submit)="submit()" class="mx-auto max-w-lg">
|
||||||
<shared-password-input
|
<shared-password-input
|
||||||
[passwordControl]="form.controls.password"
|
[passwordControl]="form.controls.password"
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword"
|
[confirmPasswordControl]="form.controls.confirmPassword" />
|
||||||
/>
|
<button type="submit" pButton [disabled]="form.invalid || loading()" class="mx-auto w-full max-w-xs">
|
||||||
<button type="submit" pButton [disabled]="form.invalid || loading()" class="w-full max-w-xs mx-auto">
|
تغییر رمز عبور
|
||||||
تغییر گذرواژه
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</app-card-data>
|
</app-card-data>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class ConsumerResetPasswordCardComponent {
|
|||||||
password: fieldControl.password(),
|
password: fieldControl.password(),
|
||||||
confirmPassword: fieldControl.confirmPassword(),
|
confirmPassword: fieldControl.confirmPassword(),
|
||||||
},
|
},
|
||||||
{ validators: [MustMatch('password', 'confirmPassword')] },
|
{ validators: [MustMatch('password', 'confirmPassword')] }
|
||||||
);
|
);
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
@@ -40,7 +40,7 @@ export class ConsumerResetPasswordCardComponent {
|
|||||||
.pipe(finalize(() => this.loading.set(false)))
|
.pipe(finalize(() => this.loading.set(false)))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.form.reset();
|
this.form.reset();
|
||||||
this.toastService.success({ text: 'گذرواژه با موفقیت بهروز شد.' });
|
this.toastService.success({ text: 'رمز عبور با موفقیت بهروز شد.' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
[pageTitle]="'لیست صورتحسابها'"
|
[pageTitle]="'صورتحسابها'"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="صورتحسابی یافت نشد"
|
emptyPlaceholderTitle="صورتحسابی یافت نشد"
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
[loading]="loading()"
|
[loading]="loading()"
|
||||||
[perPage]="responseMetaData()?.perPage"
|
[perPage]="responseMetaData()?.perPage"
|
||||||
@@ -10,4 +10,8 @@
|
|||||||
[showDetails]="true"
|
[showDetails]="true"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()"
|
||||||
(onChangePage)="changePage($event)" />
|
(onChangePage)="changePage($event)">
|
||||||
|
<ng-template #status let-item>
|
||||||
|
<catalog-tax-provider-status-tag [status]="item.status.value" [translate]="item.status.translate" />
|
||||||
|
</ng-template>
|
||||||
|
</app-page-data-list>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||||
import { Maybe } from '@/core';
|
import { Maybe } from '@/core';
|
||||||
|
import { IPaginatedQuery } from '@/core/models/service.model';
|
||||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||||
|
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||||
import {
|
import {
|
||||||
IColumn,
|
IColumn,
|
||||||
PageDataListComponent,
|
PageDataListComponent,
|
||||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
import { IPaginatedQuery } from '@/core/models/service.model';
|
|
||||||
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
|
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
|
||||||
import { Component, inject, Input } from '@angular/core';
|
import { Component, inject, Input, TemplateRef, ViewChild } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { consumerSaleInvoicesNamedRoutes } from '../constants/routes';
|
import { consumerSaleInvoicesNamedRoutes } from '../constants/routes';
|
||||||
import { IConsumerSaleInvoicesResponse } from '../models';
|
import { IConsumerSaleInvoicesResponse } from '../models';
|
||||||
@@ -16,7 +17,7 @@ import { ConsumerSaleInvoicesService } from '../services/main.service';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'consumer-saleInvoice-list',
|
selector: 'consumer-saleInvoice-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
imports: [PageDataListComponent],
|
imports: [PageDataListComponent, CatalogTaxProviderStatusTagComponent],
|
||||||
})
|
})
|
||||||
export class ConsumerSaleInvoiceListComponent extends AbstractList<
|
export class ConsumerSaleInvoiceListComponent extends AbstractList<
|
||||||
IConsumerSaleInvoicesResponse,
|
IConsumerSaleInvoicesResponse,
|
||||||
@@ -24,12 +25,21 @@ export class ConsumerSaleInvoiceListComponent extends AbstractList<
|
|||||||
> {
|
> {
|
||||||
@Input() fullHeight?: boolean;
|
@Input() fullHeight?: boolean;
|
||||||
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
|
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
|
||||||
|
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
|
||||||
|
|
||||||
private readonly service = inject(ConsumerSaleInvoicesService);
|
private readonly service = inject(ConsumerSaleInvoicesService);
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
|
|
||||||
override setColumns(): void {
|
override setColumns(): void {
|
||||||
this.columns = this.header;
|
this.columns = this.header.map((header) => {
|
||||||
|
if (header.field === 'status') {
|
||||||
|
return {
|
||||||
|
...header,
|
||||||
|
customDataModel: this.status,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return header;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
override getDataRequest(payload: Maybe<IPaginatedQuery>) {
|
override getDataRequest(payload: Maybe<IPaginatedQuery>) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const consumerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerSaleInvoicesR
|
|||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../views/list.component').then((m) => m.ConsumerSaleInvoicesComponent),
|
import('../../views/list.component').then((m) => m.ConsumerSaleInvoicesComponent),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'صورتحسابهای صادر شده',
|
title: 'صورتحسابها',
|
||||||
pagePath: () => `/consumer/sale_invoices`,
|
pagePath: () => `/consumer/sale_invoices`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -18,7 +18,7 @@ export const consumerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerSaleInvoicesR
|
|||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../views/single.component').then((m) => m.ConsumerSaleInvoiceComponent),
|
import('../../views/single.component').then((m) => m.ConsumerSaleInvoiceComponent),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'صورتحساب صادر شده',
|
title: 'صورتحساب',
|
||||||
pagePath: (saleInvoiceId: string) => `/consumer/sale_invoices/${saleInvoiceId}`,
|
pagePath: (saleInvoiceId: string) => `/consumer/sale_invoices/${saleInvoiceId}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class ConsumerSaleInvoiceStore extends EntityStore<
|
|||||||
routerLink: consumerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(),
|
routerLink: consumerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.entity()?.code,
|
title: `صورتحساب ${this.entity()?.invoice_number}`,
|
||||||
routerLink: consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoiceId),
|
routerLink: consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoiceId),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -53,7 +53,7 @@ export class ConsumerSaleInvoiceStore extends EntityStore<
|
|||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
this.setError(error);
|
this.setError(error);
|
||||||
throw error;
|
throw error;
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
.subscribe((entity) => {
|
.subscribe((entity) => {
|
||||||
this.patchState({ entity });
|
this.patchState({ entity });
|
||||||
|
|||||||
@@ -8,20 +8,21 @@ export const PARTNER_MENU_ITEMS = [
|
|||||||
routerLink: ['/partner'],
|
routerLink: ['/partner'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'حسابهای کاربری',
|
label: 'مودی',
|
||||||
icon: 'pi pi-fw pi-user',
|
|
||||||
routerLink: ['/partner/accounts'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'مشتریها',
|
|
||||||
icon: 'pi pi-fw pi-users',
|
icon: 'pi pi-fw pi-users',
|
||||||
routerLink: ['/partner/consumers'],
|
routerLink: ['/partner/consumers'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'لایسنسها',
|
label: 'لایسنس',
|
||||||
icon: 'pi pi-fw pi-key',
|
icon: 'pi pi-fw pi-key',
|
||||||
routerLink: ['/partner/licenses'],
|
routerLink: ['/partner/licenses'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: 'حسابهای کاربری',
|
||||||
|
icon: 'pi pi-fw pi-user',
|
||||||
|
routerLink: ['/partner/accounts'],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
] as MenuItem[];
|
] as MenuItem[];
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
<shared-dialog
|
<shared-dialog
|
||||||
header="ویرایش گذرواژه"
|
header="تغییر رمز عبور"
|
||||||
[(visible)]="visible"
|
[(visible)]="visible"
|
||||||
[modal]="true"
|
[modal]="true"
|
||||||
[style]="{ width: '500px' }"
|
[style]="{ width: '500px' }"
|
||||||
[closable]="true"
|
[closable]="true"
|
||||||
(onHide)="close()"
|
(onHide)="close()">
|
||||||
>
|
|
||||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||||
<shared-password-input
|
<shared-password-input
|
||||||
[passwordControl]="form.controls.password"
|
[passwordControl]="form.controls.password"
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword"
|
[confirmPasswordControl]="form.controls.confirmPassword" />
|
||||||
/>
|
|
||||||
|
|
||||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<shared-dialog
|
<shared-dialog
|
||||||
header="افزودن مشتری"
|
header="افزودن مودی"
|
||||||
[(visible)]="visible"
|
[(visible)]="visible"
|
||||||
[modal]="true"
|
[modal]="true"
|
||||||
[style]="{ width: '640px' }"
|
[style]="{ width: '640px' }"
|
||||||
[closable]="true"
|
[closable]="true"
|
||||||
(onHide)="close()"
|
(onHide)="close()">
|
||||||
>
|
|
||||||
<p-stepper [value]="activeStep()" [linear]="true">
|
<p-stepper [value]="activeStep()" [linear]="true">
|
||||||
<p-step-list>
|
<p-step-list>
|
||||||
<p-step [value]="1">اطلاعات اولیه</p-step>
|
<p-step [value]="1">اطلاعات اولیه</p-step>
|
||||||
@@ -24,16 +23,14 @@
|
|||||||
<partner-consumer-businessActivities-form-content
|
<partner-consumer-businessActivities-form-content
|
||||||
[consumerId]="consumer()?.id || ''"
|
[consumerId]="consumer()?.id || ''"
|
||||||
(onSubmit)="onBusinessActivitySubmit($event)"
|
(onSubmit)="onBusinessActivitySubmit($event)"
|
||||||
(onClose)="close()"
|
(onClose)="close()" />
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
@case (3) {
|
@case (3) {
|
||||||
<partner-consumer-complex-form-content
|
<partner-consumer-complex-form-content
|
||||||
[consumerId]="consumer()?.id || ''"
|
[consumerId]="consumer()?.id || ''"
|
||||||
[businessActivityId]="businessActivity()?.id || ''"
|
[businessActivityId]="businessActivity()?.id || ''"
|
||||||
(onSubmit)="onComplexSubmit($event)"
|
(onSubmit)="onComplexSubmit($event)"
|
||||||
(onClose)="close()"
|
(onClose)="close()" />
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
@case (4) {
|
@case (4) {
|
||||||
<partner-consumer-pos-form-content
|
<partner-consumer-pos-form-content
|
||||||
@@ -41,8 +38,7 @@
|
|||||||
[businessActivityId]="businessActivity()?.id || ''"
|
[businessActivityId]="businessActivity()?.id || ''"
|
||||||
[complexId]="complex()?.id || ''"
|
[complexId]="complex()?.id || ''"
|
||||||
(onSubmit)="onPosSubmit($event)"
|
(onSubmit)="onPosSubmit($event)"
|
||||||
(onClose)="close()"
|
(onClose)="close()" />
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class ConsumerUserFormDialogComponent extends AbstractDialog {
|
|||||||
@Input() consumerId?: string;
|
@Input() consumerId?: string;
|
||||||
|
|
||||||
get preparedTitle() {
|
get preparedTitle() {
|
||||||
return `${this.editMode ? 'ویرایش' : 'افزودن'} مشتری`;
|
return `${this.editMode ? 'ویرایش' : 'افزودن'} مودی`;
|
||||||
}
|
}
|
||||||
|
|
||||||
onFormSubmit(response: IPartnerConsumerResponse) {
|
onFormSubmit(response: IPartnerConsumerResponse) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||||
<field-name [control]="form.controls.name" />
|
<field-name [control]="form.controls.name" />
|
||||||
<field-pos-type [control]="form.controls.pos_type" />
|
<!-- <field-pos-type [control]="form.controls.pos_type" /> -->
|
||||||
|
|
||||||
@if (form.controls.pos_type.value === "PSP") {
|
@if (form.controls.pos_type.value === 'PSP') {
|
||||||
<field-serial-number [control]="form.controls.serial_number" />
|
<field-serial-number [control]="form.controls.serial_number" />
|
||||||
<field-device-id [control]="form.controls.device_id" />
|
<field-device-id [control]="form.controls.device_id" />
|
||||||
<field-provider-id [control]="form.controls.provider_id" />
|
<field-provider-id [control]="form.controls.provider_id" />
|
||||||
@@ -13,8 +13,7 @@
|
|||||||
<field-username [control]="form.controls.username" />
|
<field-username [control]="form.controls.username" />
|
||||||
<shared-password-input
|
<shared-password-input
|
||||||
[passwordControl]="form.controls.password"
|
[passwordControl]="form.controls.password"
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword"
|
[confirmPasswordControl]="form.controls.confirmPassword" />
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { AbstractForm } from '@/shared/abstractClasses';
|
|||||||
import {
|
import {
|
||||||
DeviceIdComponent,
|
DeviceIdComponent,
|
||||||
NameComponent,
|
NameComponent,
|
||||||
PosTypeComponent,
|
|
||||||
ProviderIdComponent,
|
ProviderIdComponent,
|
||||||
SerialNumberComponent,
|
SerialNumberComponent,
|
||||||
SharedPasswordInputComponent,
|
SharedPasswordInputComponent,
|
||||||
@@ -27,7 +26,6 @@ import { PartnerPosesService } from '../../services/poses.service';
|
|||||||
FormFooterActionsComponent,
|
FormFooterActionsComponent,
|
||||||
DeviceIdComponent,
|
DeviceIdComponent,
|
||||||
ProviderIdComponent,
|
ProviderIdComponent,
|
||||||
PosTypeComponent,
|
|
||||||
SerialNumberComponent,
|
SerialNumberComponent,
|
||||||
UsernameComponent,
|
UsernameComponent,
|
||||||
Divider,
|
Divider,
|
||||||
@@ -45,7 +43,7 @@ export class ConsumerPosFormContentComponent extends AbstractForm<IPosRequest, I
|
|||||||
initForm = () => {
|
initForm = () => {
|
||||||
const form = this.fb.group({
|
const form = this.fb.group({
|
||||||
name: fieldControl.name(this.initialValues?.name || ''),
|
name: fieldControl.name(this.initialValues?.name || ''),
|
||||||
pos_type: fieldControl.pos_type(this.initialValues?.pos_type || ''),
|
pos_type: fieldControl.pos_type(this.initialValues?.pos_type || 'PSP'),
|
||||||
serial_number: fieldControl.serial_number(this.initialValues?.serial_number || ''),
|
serial_number: fieldControl.serial_number(this.initialValues?.serial_number || ''),
|
||||||
device_id: fieldControl.device_id(this.initialValues?.device?.id || ''),
|
device_id: fieldControl.device_id(this.initialValues?.device?.id || ''),
|
||||||
provider_id: fieldControl.provider_id(this.initialValues?.provider?.id || ''),
|
provider_id: fieldControl.provider_id(this.initialValues?.provider?.id || ''),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const partnerConsumersNamedRoutes: NamedRoutes<TConsumersRouteNames> = {
|
|||||||
path: 'consumers',
|
path: 'consumers',
|
||||||
loadComponent: () => import('../../views/list.component').then((m) => m.ConsumersComponent),
|
loadComponent: () => import('../../views/list.component').then((m) => m.ConsumersComponent),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'مشتریها',
|
title: 'مودیان',
|
||||||
pagePath: () => '/partner/consumers',
|
pagePath: () => '/partner/consumers',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -18,7 +18,7 @@ export const partnerConsumersNamedRoutes: NamedRoutes<TConsumersRouteNames> = {
|
|||||||
path: 'consumers/:consumerId',
|
path: 'consumers/:consumerId',
|
||||||
loadComponent: () => import('../../views/single.component').then((m) => m.ConsumerComponent),
|
loadComponent: () => import('../../views/single.component').then((m) => m.ConsumerComponent),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'مشتری',
|
title: 'مودی',
|
||||||
pagePath: (guildId: string) => `/partner/consumers/${guildId}`,
|
pagePath: (guildId: string) => `/partner/consumers/${guildId}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
||||||
<ng-template #moreActions>
|
<ng-template #moreActions>
|
||||||
<button pButton outlined size="small" (click)="showAccountsChargeDialog()">شارژ کاربر</button>
|
<button pButton outlined size="small" (click)="showAccountsChargeDialog()">شارژ کاربر</button>
|
||||||
@@ -22,13 +22,11 @@
|
|||||||
[consumerId]="consumerId()"
|
[consumerId]="consumerId()"
|
||||||
[businessActivityId]="businessId()"
|
[businessActivityId]="businessId()"
|
||||||
[initialValues]="businessActivity() || undefined"
|
[initialValues]="businessActivity() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
<partner-charge-account-form-dialog
|
<partner-charge-account-form-dialog
|
||||||
[(visible)]="visibleAccountsChargeForm"
|
[(visible)]="visibleAccountsChargeForm"
|
||||||
[consumerId]="consumerId()"
|
[consumerId]="consumerId()"
|
||||||
[businessId]="businessId()"
|
[businessId]="businessId()"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()">
|
||||||
>
|
|
||||||
</partner-charge-account-form-dialog>
|
</partner-charge-account-form-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات شعبه" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات شعبه" [editable]="true" [(editMode)]="editMode">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
@@ -18,6 +18,5 @@
|
|||||||
[businessActivityId]="businessId()"
|
[businessActivityId]="businessId()"
|
||||||
[complexId]="complexId()"
|
[complexId]="complexId()"
|
||||||
[initialValues]="complex() || undefined"
|
[initialValues]="complex() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
pageTitle="لیست مشتری"
|
pageTitle="مودیان"
|
||||||
[addNewCtaLabel]="'افزودن مشتری'"
|
[addNewCtaLabel]="'افزودن مودی'"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
[showAdd]="true"
|
[showAdd]="true"
|
||||||
emptyPlaceholderTitle="مشتری یافت نشد"
|
emptyPlaceholderTitle="مودی یافت نشد"
|
||||||
emptyPlaceholderDescription="برای افزودن مشتری، روی دکمهٔ بالا کلیک کنید."
|
emptyPlaceholderDescription="برای افزودن مودی، روی دکمهٔ بالا کلیک کنید."
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
[loading]="loading()"
|
[loading]="loading()"
|
||||||
[showDetails]="true"
|
[showDetails]="true"
|
||||||
@@ -13,8 +13,7 @@
|
|||||||
(onAdd)="openAddForm()"
|
(onAdd)="openAddForm()"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onEdit)="onEditClick($event)"
|
(onEdit)="onEditClick($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()" />
|
||||||
/>
|
|
||||||
<partner-create-consumer-wrapper [(visible)]="visibleCreateForm" (onSubmit)="refresh()" />
|
<partner-create-consumer-wrapper [(visible)]="visibleCreateForm" (onSubmit)="refresh()" />
|
||||||
|
|
||||||
<partner-consumer-form
|
<partner-consumer-form
|
||||||
@@ -22,5 +21,4 @@
|
|||||||
[editMode]="true"
|
[editMode]="true"
|
||||||
[consumerId]="selectedItemForEdit()?.id"
|
[consumerId]="selectedItemForEdit()?.id"
|
||||||
[initialValues]="selectedItemForEdit() || undefined"
|
[initialValues]="selectedItemForEdit() || undefined"
|
||||||
(onSubmit)="refresh()"
|
(onSubmit)="refresh()" />
|
||||||
/>
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
@@ -15,6 +15,5 @@
|
|||||||
[complexId]="complexId()"
|
[complexId]="complexId()"
|
||||||
[posId]="posId()"
|
[posId]="posId()"
|
||||||
[initialValues]="pos() || undefined"
|
[initialValues]="pos() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات مشتری" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات مودی" [editable]="true" [(editMode)]="editMode">
|
||||||
<ng-template #moreActions> </ng-template>
|
<ng-template #moreActions> </ng-template>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
<app-key-value label="نام مشتری" [value]="consumer()?.name" />
|
<app-key-value label="نام" [value]="consumer()?.name" />
|
||||||
<app-key-value label="نوع مشتری" [value]="consumer()?.type?.translate" />
|
<app-key-value label="نوع" [value]="consumer()?.type?.translate" />
|
||||||
@if (consumer()?.type?.value === "LEGAL") {
|
@if (consumer()?.type?.value === 'LEGAL') {
|
||||||
<app-key-value label="شناسه ملی" [value]="consumer()?.legal?.registration_code" />
|
<app-key-value label="شناسه ملی" [value]="consumer()?.legal?.registration_code" />
|
||||||
} @else {
|
} @else {
|
||||||
<app-key-value label="شماره موبایل" [value]="consumer()?.individual?.mobile_number" />
|
<app-key-value label="شماره موبایل" [value]="consumer()?.individual?.mobile_number" />
|
||||||
@@ -28,6 +28,5 @@
|
|||||||
[editMode]="true"
|
[editMode]="true"
|
||||||
[consumerId]="consumerId()"
|
[consumerId]="consumerId()"
|
||||||
[initialValues]="consumer() || undefined"
|
[initialValues]="consumer() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<app-page-data-list
|
<app-page-data-list
|
||||||
[pageTitle]="'لیست مشتری'"
|
[pageTitle]="'مشتریها'"
|
||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="مشتری یافت نشد"
|
emptyPlaceholderTitle="مشتری یافت نشد"
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
@@ -8,5 +8,4 @@
|
|||||||
[showDetails]="true"
|
[showDetails]="true"
|
||||||
(onEdit)="onEditClick($event)"
|
(onEdit)="onEditClick($event)"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()" />
|
||||||
/>
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات مشتری" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات مشتری" [editable]="true" [(editMode)]="editMode">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="flex flex-col gap-4 w-full">
|
<div class="flex w-full flex-col gap-4">
|
||||||
<uikit-field label="بر اساس نام مشتری" name="search" class="w-full">
|
<uikit-field label="بر اساس نام مودی" name="search" class="w-full">
|
||||||
<p-inputgroup class="w-full">
|
<p-inputgroup class="w-full">
|
||||||
<input pInputText [(ngModel)]="search" placeholder="جستجوی نام مشتری" (ngModelChange)="onFilterChange($event)" />
|
<input pInputText [(ngModel)]="search" placeholder="جستجوی نام مودی" (ngModelChange)="onFilterChange($event)" />
|
||||||
<p-inputgroup-addon>
|
<p-inputgroup-addon>
|
||||||
<p-button icon="pi pi-times" severity="secondary" (onClick)="clearSearch()"></p-button>
|
<p-button icon="pi pi-times" severity="secondary" (onClick)="clearSearch()"></p-button>
|
||||||
</p-inputgroup-addon>
|
</p-inputgroup-addon>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class PartnerLicenseListComponent extends AbstractList<ILicenseResponse>
|
|||||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||||
{
|
{
|
||||||
field: 'business_activity',
|
field: 'business_activity',
|
||||||
header: 'عنوان مشتری',
|
header: 'مودی',
|
||||||
type: 'nested',
|
type: 'nested',
|
||||||
nestedOption: {
|
nestedOption: {
|
||||||
path: 'business_activity.consumer.name',
|
path: 'business_activity.consumer.name',
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<app-card-data cardTitle="تغییر گذرواژه" [editable]="false">
|
|
||||||
<form [formGroup]="form" (submit)="submit()" class="max-w-lg mx-auto">
|
|
||||||
<shared-password-input
|
|
||||||
[passwordControl]="form.controls.password"
|
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword"
|
|
||||||
/>
|
|
||||||
<button type="submit" pButton [disabled]="form.invalid || loading()" class="w-full max-w-xs mx-auto">
|
|
||||||
تغییر گذرواژه
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</app-card-data>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import { ToastService } from '@/core/services/toast.service';
|
|
||||||
import { MustMatch } from '@/core/validators';
|
|
||||||
import { AppCardComponent, SharedPasswordInputComponent } from '@/shared/components';
|
|
||||||
import { fieldControl } from '@/shared/constants';
|
|
||||||
import { Component, inject, signal } from '@angular/core';
|
|
||||||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
||||||
import { ButtonDirective } from 'primeng/button';
|
|
||||||
import { finalize } from 'rxjs';
|
|
||||||
import { ProfileService } from '../services/main.service';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'partner-reset-password-card',
|
|
||||||
templateUrl: './reset-password-card.component.html',
|
|
||||||
imports: [ReactiveFormsModule, AppCardComponent, SharedPasswordInputComponent, ButtonDirective],
|
|
||||||
})
|
|
||||||
export class PartnerResetPasswordCardComponent {
|
|
||||||
private readonly service = inject(ProfileService);
|
|
||||||
private readonly fb = inject(FormBuilder);
|
|
||||||
private readonly toastService = inject(ToastService);
|
|
||||||
|
|
||||||
readonly loading = signal(false);
|
|
||||||
|
|
||||||
form = this.fb.group(
|
|
||||||
{
|
|
||||||
password: fieldControl.password(),
|
|
||||||
confirmPassword: fieldControl.confirmPassword(),
|
|
||||||
},
|
|
||||||
{ validators: [MustMatch('password', 'confirmPassword')] },
|
|
||||||
);
|
|
||||||
|
|
||||||
submit() {
|
|
||||||
if (this.form.invalid) {
|
|
||||||
this.form.markAllAsTouched();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.loading.set(true);
|
|
||||||
this.service
|
|
||||||
.resetPassword({ password: this.form.value.password as string })
|
|
||||||
.pipe(finalize(() => this.loading.set(false)))
|
|
||||||
.subscribe(() => {
|
|
||||||
this.form.reset();
|
|
||||||
this.toastService.success({ text: 'گذرواژه با موفقیت بهروز شد.' });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,5 +12,6 @@ export interface IProfileRequestPayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IResetPasswordRequest {
|
export interface IResetPasswordRequest {
|
||||||
|
currentPassword: string;
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<app-card-data cardTitle="اطلاعات پروفایل" [editable]="true" [(editMode)]="editing">
|
<app-card-data cardTitle="اطلاعات پروفایل" [editable]="true" [(editMode)]="editing">
|
||||||
|
<ng-template #moreActions>
|
||||||
|
<p-button type="button" variant="outlined" size="small" (onClick)="openResetPasswordDialog()">
|
||||||
|
تغییر گذرواژه
|
||||||
|
</p-button>
|
||||||
|
</ng-template>
|
||||||
<div class="listKeyValue">
|
<div class="listKeyValue">
|
||||||
<app-key-value label="تصویر" [value]="profile()?.logo_url" type="thumbnail" />
|
<app-key-value label="تصویر" [value]="profile()?.logo_url" type="thumbnail" />
|
||||||
<app-key-value label="عنوان" [value]="profile()?.name" />
|
<app-key-value label="عنوان" [value]="profile()?.name" />
|
||||||
@@ -7,9 +12,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</app-card-data>
|
</app-card-data>
|
||||||
|
|
||||||
<partner-reset-password-card />
|
|
||||||
|
|
||||||
@if (editing()) {
|
@if (editing()) {
|
||||||
<partner-profile-form [(visible)]="editing" [initialValues]="profile()!" (onSubmit)="onEditSuccess()" />
|
<partner-profile-form [(visible)]="editing" [initialValues]="profile()!" (onSubmit)="onEditSuccess()" />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<shared-change-password-form-dialog
|
||||||
|
[(visible)]="resetPasswordDialog"
|
||||||
|
[showCurrentPasswordField]="true"
|
||||||
|
[loading]="resetPasswordLoading()"
|
||||||
|
(onSubmit)="resetPassword($event)" />
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
|
import { ToastService } from '@/core/services/toast.service';
|
||||||
import { PartnerStore } from '@/domains/partner/store/main.store';
|
import { PartnerStore } from '@/domains/partner/store/main.store';
|
||||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
import {
|
||||||
|
AppCardComponent,
|
||||||
|
ChangePasswordFormDialogComponent,
|
||||||
|
KeyValueComponent,
|
||||||
|
} from '@/shared/components';
|
||||||
import { Component, computed, inject, signal } from '@angular/core';
|
import { Component, computed, inject, signal } from '@angular/core';
|
||||||
|
import { Button } from 'primeng/button';
|
||||||
|
import { finalize } from 'rxjs';
|
||||||
import { PartnerProfileFormComponent } from '../components/form.component';
|
import { PartnerProfileFormComponent } from '../components/form.component';
|
||||||
import { PartnerResetPasswordCardComponent } from '../components/reset-password-card.component';
|
import { IResetPasswordRequest } from '../models';
|
||||||
|
import { ProfileService } from '../services/main.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'partner-profile',
|
selector: 'partner-profile',
|
||||||
@@ -10,17 +18,22 @@ import { PartnerResetPasswordCardComponent } from '../components/reset-password-
|
|||||||
imports: [
|
imports: [
|
||||||
AppCardComponent,
|
AppCardComponent,
|
||||||
KeyValueComponent,
|
KeyValueComponent,
|
||||||
PartnerResetPasswordCardComponent,
|
|
||||||
PartnerProfileFormComponent,
|
PartnerProfileFormComponent,
|
||||||
|
Button,
|
||||||
|
ChangePasswordFormDialogComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class PartnerProfileComponent {
|
export class PartnerProfileComponent {
|
||||||
private readonly store = inject(PartnerStore);
|
private readonly store = inject(PartnerStore);
|
||||||
|
private readonly service = inject(ProfileService);
|
||||||
|
private readonly toastService = inject(ToastService);
|
||||||
|
|
||||||
|
readonly resetPasswordLoading = signal(false);
|
||||||
|
editing = signal(false);
|
||||||
|
resetPasswordDialog = signal(false);
|
||||||
|
|
||||||
readonly profile = computed(() => this.store.entity());
|
readonly profile = computed(() => this.store.entity());
|
||||||
|
|
||||||
editing = signal(false);
|
|
||||||
|
|
||||||
edit() {
|
edit() {
|
||||||
this.editing.set(true);
|
this.editing.set(true);
|
||||||
}
|
}
|
||||||
@@ -28,4 +41,21 @@ export class PartnerProfileComponent {
|
|||||||
onEditSuccess() {
|
onEditSuccess() {
|
||||||
this.store.getData();
|
this.store.getData();
|
||||||
}
|
}
|
||||||
|
openResetPasswordDialog() {
|
||||||
|
this.resetPasswordDialog.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
resetPassword(payload: IResetPasswordRequest) {
|
||||||
|
this.resetPasswordLoading.set(true);
|
||||||
|
|
||||||
|
this.service
|
||||||
|
.resetPassword(payload)
|
||||||
|
.pipe(finalize(() => this.resetPasswordLoading.set(false)))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.toastService.success({
|
||||||
|
text: 'تغییر رمز عبور با موفقیت انجام شد.',
|
||||||
|
});
|
||||||
|
this.resetPasswordDialog.set(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<shared-change-password-form-dialog
|
||||||
|
[(visible)]="visible"
|
||||||
|
[showCurrentPasswordField]="true"
|
||||||
|
[loading]="submitLoading()"
|
||||||
|
(onSubmit)="submit($event)" />
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { ToastService } from '@/core/services/toast.service';
|
||||||
|
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||||
|
import {
|
||||||
|
ChangePasswordFormDialogComponent,
|
||||||
|
IChangePasswordSubmitPayload,
|
||||||
|
} from '@/shared/components';
|
||||||
|
import { Component, inject, signal } from '@angular/core';
|
||||||
|
import { finalize } from 'rxjs';
|
||||||
|
import { PosChangePasswordService } from '../services/password';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'pos-change-password',
|
||||||
|
templateUrl: 'change-password.component.html',
|
||||||
|
imports: [ChangePasswordFormDialogComponent],
|
||||||
|
})
|
||||||
|
export class PosChangePasswordComponent extends AbstractDialog {
|
||||||
|
private readonly service = inject(PosChangePasswordService);
|
||||||
|
private readonly toastService = inject(ToastService);
|
||||||
|
|
||||||
|
submitLoading = signal(false);
|
||||||
|
|
||||||
|
submit(payload: IChangePasswordSubmitPayload) {
|
||||||
|
this.submitLoading.set(true);
|
||||||
|
|
||||||
|
this.service
|
||||||
|
.changePassword(payload)
|
||||||
|
.pipe(finalize(() => this.submitLoading.set(false)))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.toastService.success({
|
||||||
|
text: 'تغییر رمز عبور با موفقیت انجام شد.',
|
||||||
|
});
|
||||||
|
this.submitLoading.set(false);
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<ng-template #topbarCenter>
|
<ng-template #topbarCenter>
|
||||||
@if (posInfo()) {
|
@if (posInfo()) {
|
||||||
<a [routerLink]="homeRouteLink" 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="h-8 w-8">
|
<div class="h-8 max-w-20">
|
||||||
<img
|
<img
|
||||||
[src]="posInfo()?.partner?.logo_url ?? placeholderLogo"
|
[src]="posInfo()?.partner?.logo_url ?? placeholderLogo"
|
||||||
alt="Logo"
|
alt="Logo"
|
||||||
@@ -25,52 +25,27 @@
|
|||||||
|
|
||||||
@if (loading()) {
|
@if (loading()) {
|
||||||
<shared-page-loading />
|
<shared-page-loading />
|
||||||
} @else {
|
} @else if (error()) {
|
||||||
<!-- <div class="w-svw h-svh bg-surface-ground flex flex-col gap-4 p-4"> -->
|
@switch (error()?.status) {
|
||||||
<!-- <div class="w-full flex items-center gap-4 shrink-0 justify-between">
|
@case (412) {
|
||||||
<div class="flex gap-2 items-center">
|
<pos-choose-cards class="h-full" (onChoose)="onChoosePos()" />
|
||||||
@if (posInfo()) {
|
}
|
||||||
<div class="w-10 h-10">
|
@default {
|
||||||
<img [src]="placeholderLogo" alt="Logo" class="w-full h-full object-cover rounded-md bg-surface-card" />
|
<div class="flex h-full w-full items-center justify-center">
|
||||||
</div>
|
<p-card class="border-surface-border border">
|
||||||
<span class="text-lg font-bold">
|
<div class="flex shrink-0 flex-col items-center justify-between gap-2">
|
||||||
{{ posInfo()?.name }} ({{ posInfo()?.complex!.name }} - {{ posInfo()?.businessActivity!.name }})
|
<i class="pi pi-exclamation-triangle text-error mb-3 text-6xl!" aria-hidden="true"></i>
|
||||||
</span>
|
<span class="text-error mb-2 block text-xl font-semibold"> عدم دسترسی </span>
|
||||||
}
|
<p class="inline-block text-base">متاسفانه امکان دسترسی برای کاربر شما فراهم نیست</p>
|
||||||
</div>
|
<button pButton outlined severity="danger" class="mt-5 w-32" (click)="logout()">خروج</button>
|
||||||
<div class="flex gap-2 items-center">
|
</div>
|
||||||
<div class="bg-surface-card px-3 rounded-md shadow-sm h-9 flex items-center">
|
</p-card>
|
||||||
<span [jalaliDate]="now" jalaliFormat="dddd YYYY/MM/DD" class="text-base"></span>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<p-menu #menu [model]="profileMenuItems" [popup]="true" />
|
|
||||||
<button pButton (click)="menu.toggle($event)" icon="pi pi-user" severity="contrast">
|
|
||||||
{{ posProfile()?.account?.username }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
@if (error()) {
|
|
||||||
@switch (error()?.status) {
|
|
||||||
@case (412) {
|
|
||||||
<pos-choose-cards class="h-full" (onChoose)="onChoosePos()" />
|
|
||||||
}
|
|
||||||
@default {
|
|
||||||
<div class="flex h-full w-full items-center justify-center">
|
|
||||||
<p-card class="border-surface-border border">
|
|
||||||
<div class="flex shrink-0 flex-col items-center justify-between gap-2">
|
|
||||||
<i class="pi pi-exclamation-triangle text-error mb-3 text-6xl!" aria-hidden="true"></i>
|
|
||||||
<span class="text-error mb-2 block text-xl font-semibold"> عدم دسترسی </span>
|
|
||||||
<p class="inline-block text-base">متاسفانه امکان دسترسی برای کاربر شما فراهم نیست</p>
|
|
||||||
<button pButton outlined severity="danger" class="mt-5 w-32" (click)="logout()">خروج</button>
|
|
||||||
</div>
|
|
||||||
</p-card>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} @else {
|
|
||||||
<pos-main-menu-sidebar [(visible)]="mainMenuVisible" />
|
|
||||||
<router-outlet></router-outlet>
|
|
||||||
}
|
}
|
||||||
<!-- </div> -->
|
} @else {
|
||||||
|
<pos-main-menu-sidebar [(visible)]="mainMenuVisible" />
|
||||||
|
<pos-change-password [(visible)]="changePasswordVisible" />
|
||||||
|
<router-outlet></router-outlet>
|
||||||
}
|
}
|
||||||
|
<!-- </div> -->
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { Menu } from 'primeng/menu';
|
|||||||
import { finalize } from 'rxjs';
|
import { finalize } from 'rxjs';
|
||||||
import images from 'src/assets/images';
|
import images from 'src/assets/images';
|
||||||
import config from 'src/config';
|
import config from 'src/config';
|
||||||
|
import { PosChangePasswordComponent } from '../../components/change-password.component';
|
||||||
import { PosInfoStore, PosProfileStore } from '../../store';
|
import { PosInfoStore, PosProfileStore } from '../../store';
|
||||||
import { DeviceInfoStore } from '../../store/device.store';
|
import { DeviceInfoStore } from '../../store/device.store';
|
||||||
import { PosMainMenuSidebarComponent } from '../mainMenuSidebar/main-menu-sidebar.component';
|
import { PosMainMenuSidebarComponent } from '../mainMenuSidebar/main-menu-sidebar.component';
|
||||||
@@ -30,6 +31,7 @@ import { PosChooseCardsComponent } from './choose-pos.component';
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
RouterLinkWithHref,
|
RouterLinkWithHref,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
|
PosChangePasswordComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class PosPagesLayoutComponent {
|
export class PosPagesLayoutComponent {
|
||||||
@@ -49,6 +51,7 @@ export class PosPagesLayoutComponent {
|
|||||||
private readonly layoutService = inject(LayoutService);
|
private readonly layoutService = inject(LayoutService);
|
||||||
|
|
||||||
mainMenuVisible = signal(false);
|
mainMenuVisible = signal(false);
|
||||||
|
changePasswordVisible = signal(false);
|
||||||
|
|
||||||
readonly posProfileLoading = computed(() => this.posProfileStore.loading());
|
readonly posProfileLoading = computed(() => this.posProfileStore.loading());
|
||||||
readonly posProfile = computed(() => this.posProfileStore.entity());
|
readonly posProfile = computed(() => this.posProfileStore.entity());
|
||||||
@@ -67,12 +70,21 @@ export class PosPagesLayoutComponent {
|
|||||||
this.authService.logout();
|
this.authService.logout();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
showChangePasswordDialog = () => {
|
||||||
|
this.changePasswordVisible.set(true);
|
||||||
|
};
|
||||||
|
|
||||||
profileMenuItems: MenuItem[] = [
|
profileMenuItems: MenuItem[] = [
|
||||||
{
|
{
|
||||||
label: 'راهنمای سامانه',
|
label: 'راهنمای سامانه',
|
||||||
icon: 'pi pi-question-circle',
|
icon: 'pi pi-question-circle',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'تغییر رمز عبور',
|
||||||
|
icon: 'pi pi-key',
|
||||||
|
command: this.showChangePasswordDialog,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'خروج',
|
label: 'خروج',
|
||||||
icon: 'pi pi-sign-out',
|
icon: 'pi pi-sign-out',
|
||||||
@@ -97,7 +109,7 @@ export class PosPagesLayoutComponent {
|
|||||||
.pipe(
|
.pipe(
|
||||||
finalize(() => {
|
finalize(() => {
|
||||||
this.layoutService.changeFullPageLoading(false);
|
this.layoutService.changeFullPageLoading(false);
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<app-card-data cardTitle="تغییر گذرواژه" class="w-full">
|
|
||||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
|
||||||
<shared-password-input
|
|
||||||
[passwordControl]="form.controls.password"
|
|
||||||
[confirmPasswordControl]="form.controls.confirmPassword" />
|
|
||||||
|
|
||||||
<div class="flex w-full justify-end">
|
|
||||||
<button pButton label="ذخیره گذرواژه" [loading]="submitLoading()" class="w-full max-w-40"></button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</app-card-data>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import { MustMatch } from '@/core/validators';
|
|
||||||
import { AbstractForm } from '@/shared/abstractClasses';
|
|
||||||
import { AppCardComponent } from '@/shared/components';
|
|
||||||
import { SharedPasswordInputComponent } from '@/shared/components/passwordInput/password-input.component';
|
|
||||||
import { fieldControl } from '@/shared/constants';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { Component, inject } from '@angular/core';
|
|
||||||
import { ReactiveFormsModule } from '@angular/forms';
|
|
||||||
import { ButtonDirective } from 'primeng/button';
|
|
||||||
import { tap } from 'rxjs';
|
|
||||||
import { IChangePasswordSubmitPayload } from './model';
|
|
||||||
import { PosChangePasswordService } from './services/main.service';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'pos-change-password-form',
|
|
||||||
templateUrl: './form.component.html',
|
|
||||||
imports: [
|
|
||||||
ReactiveFormsModule,
|
|
||||||
SharedPasswordInputComponent,
|
|
||||||
CommonModule,
|
|
||||||
ButtonDirective,
|
|
||||||
AppCardComponent,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class PosChangePasswordFormDialogComponent extends AbstractForm<
|
|
||||||
IChangePasswordSubmitPayload,
|
|
||||||
any
|
|
||||||
> {
|
|
||||||
private readonly changePasswordService = inject(PosChangePasswordService);
|
|
||||||
|
|
||||||
form = this.fb.group(
|
|
||||||
{
|
|
||||||
password: fieldControl.password(),
|
|
||||||
confirmPassword: fieldControl.confirmPassword(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
validators: [MustMatch('password', 'confirmPassword')],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
override submitForm() {
|
|
||||||
const payload = this.form.getRawValue().password!;
|
|
||||||
return this.changePasswordService.changePassword({ password: payload }).pipe(
|
|
||||||
tap({
|
|
||||||
next: (res) => {
|
|
||||||
this.form.reset();
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||