Compare commits
10 Commits
c89d4027d6
...
048e292bdd
| Author | SHA1 | Date | |
|---|---|---|---|
| 048e292bdd | |||
| a138034c06 | |||
| ce40bd8c75 | |||
| b2a1eb8e5b | |||
| 54d00e19ae | |||
| d130a83bd4 | |||
| ec452bca22 | |||
| 797aecd489 | |||
| 83f124b910 | |||
| 8104f1b7a7 |
@@ -0,0 +1,2 @@
|
||||
TENANT=default
|
||||
DIST_DIR=default
|
||||
@@ -0,0 +1,117 @@
|
||||
# AGENT.md
|
||||
|
||||
## Purpose
|
||||
|
||||
- This file defines repository-specific instructions for coding agents.
|
||||
- Scope is the full repo unless a deeper `AGENT.md` overrides it.
|
||||
|
||||
## Stack Context
|
||||
|
||||
- Frontend: Angular 20 standalone app.
|
||||
- Package manager: `pnpm`.
|
||||
- Deployment: Docker / Docker Compose with tenant-specific services.
|
||||
- Current service mapping expectation:
|
||||
- `app_default` on host port `8090`
|
||||
- `app_tis` on host port `8091`
|
||||
|
||||
## Tenant Build Rules
|
||||
|
||||
- `default` tenant currently builds via `ng build` and outputs to `dist/production`.
|
||||
- `tis` tenant builds via `ng build --configuration tis` and outputs to `dist/tis`.
|
||||
- Keep Docker `DIST_DIR` aligned with actual Angular output path.
|
||||
- Do not assume `default` Angular configuration is usable unless verified (it may reference missing replacements).
|
||||
|
||||
## Input Component Rules
|
||||
|
||||
- File: `src/app/shared/components/input/input.component.ts`
|
||||
- For `type === 'number'` or `type === 'price'`:
|
||||
- Normalize Persian/Arabic digits to English digits.
|
||||
- Allow only digits and `.`.
|
||||
- Support `fixed` precision formatting when provided.
|
||||
- Keep behavior for identifier fields (`mobile`, `phone`, `postalCode`, `nationalId`) string-safe.
|
||||
|
||||
## Change Policy
|
||||
|
||||
- Keep changes minimal and scoped to user request.
|
||||
- Prefer root-cause fixes over temporary workarounds.
|
||||
- Avoid unrelated refactors.
|
||||
- Reuse existing patterns and naming conventions.
|
||||
|
||||
## Do / Don't
|
||||
|
||||
- Do follow existing field wrapper style in `src/app/shared/components/fields/*.component.ts`.
|
||||
- Do reuse `app-input` and set only required props (`type`, `label`, `name`, constraints).
|
||||
- Do register every new field in:
|
||||
- `src/app/shared/components/fields/index.ts`
|
||||
- `src/app/shared/constants/fields/index.ts`
|
||||
- Do keep control keys consistent across form group, field component `name`, and `fieldControl` key.
|
||||
- Don't add one-off field patterns when an existing field component can be reused.
|
||||
- Don't use invalid Angular file replacements for directories or empty paths.
|
||||
- Don't change tenant output directories without updating Docker `DIST_DIR`.
|
||||
|
||||
## How To Create Form Fields
|
||||
|
||||
- Create a wrapper component in `src/app/shared/components/fields`.
|
||||
- Use the same pattern as existing files like:
|
||||
- `src/app/shared/components/fields/name.component.ts`
|
||||
- `src/app/shared/components/fields/unit_price.component.ts`
|
||||
- Minimal wrapper shape:
|
||||
- `selector`: `field-<field-name>`
|
||||
- template: `<app-input ... />`
|
||||
- inputs: `control` (required), optional `name`, optional `label`
|
||||
|
||||
Example pattern:
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'field-example',
|
||||
template: `<app-input [label]="label" [control]="control" [name]="name" type="simple" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class ExampleComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'example';
|
||||
@Input() label = 'Example';
|
||||
}
|
||||
```
|
||||
|
||||
## Register New Fields
|
||||
|
||||
- Export the component from:
|
||||
- `src/app/shared/components/fields/index.ts`
|
||||
- Add its form control factory in:
|
||||
- `src/app/shared/constants/fields/index.ts`
|
||||
- `fieldControl` entry shape:
|
||||
- key must match form control name
|
||||
- return tuple: `[defaultValue, validators]`
|
||||
|
||||
Example:
|
||||
|
||||
```ts
|
||||
example: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required] : [],
|
||||
],
|
||||
```
|
||||
|
||||
## Using Fields In Forms
|
||||
|
||||
- In form group builders, use `fieldControl.<key>(initialValue, isRequired)` for consistency.
|
||||
- In templates, render matching wrapper component and pass the matching control:
|
||||
- `<field-example [control]="form.controls.example" />`
|
||||
- For numeric/price behavior, use `app-input` `type="number"` or `type="price"` and optional `[fixed]`.
|
||||
|
||||
## Validation Checklist
|
||||
|
||||
- For TypeScript-only changes, run:
|
||||
- `pnpm -s exec tsc -p tsconfig.app.json --noEmit`
|
||||
- For Docker/build changes, verify with:
|
||||
- `docker compose build app_default`
|
||||
- `docker compose build app_tis`
|
||||
- Start with targeted validation, then broader checks only if needed.
|
||||
|
||||
## Communication Expectations
|
||||
|
||||
- Report exactly which files changed and why.
|
||||
- Call out any assumptions or discovered config mismatches.
|
||||
- If validation is blocked (permissions, missing dependencies), state it clearly and provide next command.
|
||||
@@ -1,16 +1,15 @@
|
||||
# Build stage
|
||||
FROM node:20 AS builder
|
||||
# ---------- Build stage ----------
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
ARG TENANT=tis
|
||||
ARG DIST_DIR=tis
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# RUN npm config set registry "https://hub.megan.ir/npm/"
|
||||
|
||||
RUN npm install -g pnpm
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
|
||||
@@ -20,14 +19,23 @@ RUN if [ "$TENANT" = "default" ]; then \
|
||||
pnpm run build:$TENANT; \
|
||||
fi
|
||||
|
||||
|
||||
# ---------- Runtime stage ----------
|
||||
FROM nginx:alpine
|
||||
|
||||
# Remove default config
|
||||
RUN rm -rf /etc/nginx/conf.d/*
|
||||
|
||||
# Copy optimized config
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
ARG DIST_DIR=tis
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
COPY --from=builder /app/dist/${DIST_DIR}/browser /usr/share/nginx/html
|
||||
|
||||
EXPOSE 5000
|
||||
# Optional: reduce image size
|
||||
# RUN apk add --no-cache brotli
|
||||
|
||||
EXPOSE 8090
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# AI Agent Assistant Guide
|
||||
|
||||
This file provides a quick operational guide for AI assistants working on this project.
|
||||
|
||||
## Project
|
||||
- Framework: Angular
|
||||
- Package manager: pnpm
|
||||
- Root path: `/Users/ahasani/Projects/PSP/consumer/panel`
|
||||
|
||||
## Core Rules
|
||||
- Follow `AGENTS.md` instructions in this repository.
|
||||
- Avoid reverting unrelated local changes.
|
||||
- Keep edits minimal and scoped to the requested feature.
|
||||
- Prefer existing shared abstractions and services over duplicating logic.
|
||||
|
||||
## Common Commands
|
||||
```bash
|
||||
pnpm install
|
||||
pnpm start
|
||||
pnpm build
|
||||
pnpm test
|
||||
```
|
||||
|
||||
## Useful Practices
|
||||
- Search files quickly with `rg` when available.
|
||||
- For form changes, keep model/interface, form controls, and templates aligned.
|
||||
- For Android WebView integration, keep contract changes synchronized between panel and Android app.
|
||||
- For shared components, preserve desktop behavior and add mobile behavior conditionally.
|
||||
|
||||
## Delivery Checklist
|
||||
- Build passes (or document why not run).
|
||||
- No unrelated files changed.
|
||||
- New behavior documented in changed file comments only when necessary.
|
||||
- Keep final output short with file paths and key behavior changes.
|
||||
@@ -10,6 +10,43 @@
|
||||
"build": {
|
||||
"builder": "@angular/build:application",
|
||||
"configurations": {
|
||||
"default": {
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public-default"
|
||||
}
|
||||
],
|
||||
"budgets": [
|
||||
{
|
||||
"maximumError": "3MB",
|
||||
"maximumWarning": "2MB",
|
||||
"type": "initial"
|
||||
},
|
||||
{
|
||||
"maximumError": "8kB",
|
||||
"maximumWarning": "4kB",
|
||||
"type": "anyComponentStyle"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.default.ts"
|
||||
},
|
||||
{
|
||||
"replace": "src/app.routes.ts",
|
||||
"with": "src/tenants/default/app.routes.ts"
|
||||
},
|
||||
{
|
||||
"replace": "src/app/branding/branding.config.ts",
|
||||
"with": "src/tenants/default/branding.config.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"outputPath": "dist/default",
|
||||
"serviceWorker": "ngsw-config.json"
|
||||
},
|
||||
"development": {
|
||||
"extractLicenses": false,
|
||||
"optimization": false,
|
||||
@@ -32,10 +69,18 @@
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
},
|
||||
{
|
||||
"replace": "src/app.routes.ts",
|
||||
"with": "src/tenants/default/app.routes.ts"
|
||||
},
|
||||
{
|
||||
"replace": "src/app/branding/branding.config.ts",
|
||||
"with": "src/tenants/default/branding.config.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"outputPath": "dist/pos.client",
|
||||
"outputPath": "dist/production",
|
||||
"serviceWorker": "ngsw-config.json"
|
||||
},
|
||||
"staging": {
|
||||
|
||||
@@ -1,72 +1,51 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
# Production service
|
||||
app:
|
||||
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
||||
app_tis:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
TENANT: ${TENANT:-tis}
|
||||
DIST_DIR: ${DIST_DIR:-tis}
|
||||
container_name: psp_panel_prod
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5000/" ]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
networks:
|
||||
- psp_panel_network
|
||||
# Staging service
|
||||
# staging:
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: Dockerfile.staging
|
||||
# container_name: psp_panel_staging
|
||||
# ports:
|
||||
# - "5050:5000"
|
||||
# environment:
|
||||
# - NODE_ENV=staging
|
||||
# restart: unless-stopped
|
||||
# healthcheck:
|
||||
# test:
|
||||
# ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
|
||||
# interval: 30s
|
||||
# timeout: 3s
|
||||
# retries: 3
|
||||
# start_period: 5s
|
||||
# profiles:
|
||||
# - staging
|
||||
# networks:
|
||||
# - psp_panel_network
|
||||
TENANT: tis
|
||||
DIST_DIR: tis
|
||||
|
||||
# # Development service with hot reload
|
||||
# dev:
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: Dockerfile.dev
|
||||
# container_name: psp_panel-dev
|
||||
# working_dir: /app
|
||||
# volumes:
|
||||
# - .:/app
|
||||
# - /app/node_modules
|
||||
# ports:
|
||||
# - "4200:4200"
|
||||
# environment:
|
||||
# - NODE_ENV=development
|
||||
# restart: unless-stopped
|
||||
# profiles:
|
||||
# - dev
|
||||
# networks:
|
||||
# - psp_panel_network
|
||||
ports:
|
||||
- "8091:8090"
|
||||
restart: unless-stopped
|
||||
|
||||
app_default:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
TENANT: default
|
||||
DIST_DIR: production
|
||||
|
||||
ports:
|
||||
- "8090:8090"
|
||||
restart: unless-stopped
|
||||
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
|
||||
# # 🌐 Router
|
||||
# - "traefik.http.routers.psp.rule=Host(`your-domain.com`)"
|
||||
# - "traefik.http.routers.psp.entrypoints=websecure"
|
||||
# - "traefik.http.routers.psp.tls=true"
|
||||
|
||||
# # 🔐 SSL (auto with Traefik)
|
||||
# - "traefik.http.routers.psp.tls.certresolver=letsencrypt"
|
||||
|
||||
# # ⚡ Service port (IMPORTANT)
|
||||
# - "traefik.http.services.psp.loadbalancer.server.port=80"
|
||||
|
||||
# # 🚀 Compression at edge (optional)
|
||||
# - "traefik.http.middlewares.compress.compress=true"
|
||||
# - "traefik.http.routers.psp.middlewares=compress@docker"
|
||||
|
||||
networks:
|
||||
- web
|
||||
|
||||
networks:
|
||||
psp_panel_network:
|
||||
web:
|
||||
driver: bridge
|
||||
|
||||
@@ -1,80 +1,28 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
server {
|
||||
listen 8090;
|
||||
server_name _;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
client_max_body_size 20M;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 🔥 Gzip
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain text/css text/xml text/javascript
|
||||
application/json application/javascript application/xml+rss
|
||||
application/rss+xml font/truetype font/opentype
|
||||
application/vnd.ms-fontobject image/svg+xml;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
# 🔥 Brotli (better than gzip)
|
||||
# brotli on;
|
||||
# brotli_comp_level 6;
|
||||
# brotli_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||
|
||||
server {
|
||||
listen 5000;
|
||||
server_name localhost;
|
||||
charset utf-8;
|
||||
# 🔥 Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
# Cache control for static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Service worker files should be revalidated on each request
|
||||
location = /ngsw.json {
|
||||
expires -1;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
location = /ngsw-worker.js {
|
||||
expires -1;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
# Angular routing - serve index.html for all routes
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Don't cache index.html
|
||||
location = /index.html {
|
||||
expires -1;
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate";
|
||||
}
|
||||
# 🔥 Angular routing (SPA fallback)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
|
||||
"appData": {
|
||||
"appVersion": "0.0.0",
|
||||
"buildDate": "2026-04-27T06:02:22.249Z"
|
||||
"buildDate": "2026-05-04T18:58:47.135Z"
|
||||
},
|
||||
"assetGroups": [
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"build:tis": "ng build --configuration tis",
|
||||
"ng": "ng",
|
||||
"prebuild": "node scripts/update-ngsw-appdata.js",
|
||||
"prebuild:tis": "node scripts/update-ngsw-appdata.js",
|
||||
"prebuild:tis": "node scripts/tis/prepare-tis-logo.js && node scripts/tis/update-tis-ngsw-appdata.js",
|
||||
"prestart": "node aspnetcore-https",
|
||||
"start": "run-script-os",
|
||||
"start:tis": "ng serve --configuration tis",
|
||||
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 37 KiB |
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone",
|
||||
"id": "/",
|
||||
"icons": [
|
||||
{
|
||||
"purpose": "maskable",
|
||||
@@ -16,9 +15,10 @@
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"name": "PSP A - مدیریت صورتحسابهای مالیاتی",
|
||||
"short_name": "PSP A",
|
||||
"start_url": "/",
|
||||
"id": "/",
|
||||
"name": "تیس - مدیریت صورتحسابهای مالیاتی",
|
||||
"scope": "/",
|
||||
"short_name": "تیس",
|
||||
"start_url": "/",
|
||||
"theme_color": "#ffffff"
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 35 KiB |
@@ -5,20 +5,20 @@
|
||||
{
|
||||
"purpose": "maskable",
|
||||
"sizes": "192x192",
|
||||
"src": "/favicon/web-app-manifest-192x192.png",
|
||||
"src": "/web-app-manifest-192x192.png",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"purpose": "maskable",
|
||||
"sizes": "512x512",
|
||||
"src": "/favicon/web-app-manifest-512x512.png",
|
||||
"src": "/web-app-manifest-512x512.png",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"id": "/",
|
||||
"name": "مدیریت صورتحسابهای مالیاتی",
|
||||
"name": "نرم افزار صورتحسابهای مالیاتی پاژن",
|
||||
"scope": "/",
|
||||
"short_name": "مدیریت صورتحسابهای مالیاتی",
|
||||
"short_name": "پاژن",
|
||||
"start_url": "/",
|
||||
"theme_color": "#ffffff"
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 44 KiB |
@@ -0,0 +1,22 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.resolve(__dirname, '../..');
|
||||
const tenantLogo = path.join(root, 'public-tis', 'branding', 'logo.png/');
|
||||
const defaultLogo = path.join(root, 'src', 'assets', 'images', 'logo.png');
|
||||
const targetLogo = path.join(root, 'src', 'tenants', 'tis', 'assets', 'images', 'logo.png');
|
||||
|
||||
const source = fs.existsSync(tenantLogo) ? tenantLogo : defaultLogo;
|
||||
|
||||
if (!fs.existsSync(source)) {
|
||||
console.warn(
|
||||
`[prepare-tis-logo] No logo source found. Checked: ${tenantLogo} and ${defaultLogo}`,
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
fs.mkdirSync(path.dirname(targetLogo), { recursive: true });
|
||||
fs.copyFileSync(source, targetLogo);
|
||||
console.log(
|
||||
`[prepare-tis-logo] Using logo: ${path.relative(root, source)} -> ${path.relative(root, targetLogo)}`,
|
||||
);
|
||||
@@ -0,0 +1,21 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = process.cwd();
|
||||
const packageJsonPath = path.join(root, 'package.json');
|
||||
const ngswConfigPath = path.join(root, 'ngsw-config.json');
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
const ngswConfig = JSON.parse(fs.readFileSync(ngswConfigPath, 'utf8'));
|
||||
|
||||
const now = new Date();
|
||||
const buildDate = process.env.TIS_BUILD_DATE || now.toISOString();
|
||||
const appVersion = process.env.TIS_APP_VERSION || packageJson.version || '0.0.0';
|
||||
|
||||
ngswConfig.appData = {
|
||||
...(ngswConfig.appData || {}),
|
||||
appVersion,
|
||||
buildDate,
|
||||
};
|
||||
|
||||
fs.writeFileSync(ngswConfigPath, `${JSON.stringify(ngswConfig, null, 2)}\n`);
|
||||
@@ -1,7 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const root = process.cwd();
|
||||
const packageJsonPath = path.join(root, 'package.json');
|
||||
const ngswConfigPath = path.join(root, 'ngsw-config.json');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, HostListener } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ConfirmDialog } from 'primeng/confirmdialog';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
@@ -8,9 +8,25 @@ import { ToastModule } from 'primeng/toast';
|
||||
standalone: true,
|
||||
imports: [RouterModule, ToastModule, ConfirmDialog],
|
||||
template: `
|
||||
<p-toast position="bottom-right" />
|
||||
<p-toast [position]="toastPosition" />
|
||||
<p-confirmDialog />
|
||||
<router-outlet />
|
||||
`,
|
||||
})
|
||||
export class AppComponent {}
|
||||
export class AppComponent {
|
||||
toastPosition: 'top-center' | 'bottom-right' = 'bottom-right';
|
||||
|
||||
constructor() {
|
||||
this.updateToastPosition();
|
||||
}
|
||||
|
||||
@HostListener('window:resize')
|
||||
onResize() {
|
||||
this.updateToastPosition();
|
||||
}
|
||||
|
||||
private updateToastPosition() {
|
||||
this.toastPosition =
|
||||
typeof window !== 'undefined' && window.innerWidth <= 768 ? 'top-center' : 'bottom-right';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export const appConfig: ApplicationConfig = {
|
||||
emptySearchMessage: 'هیچ موردی برای نمایش وجود ندارد',
|
||||
accept: 'تایید',
|
||||
reject: 'رد کردن',
|
||||
cancel: 'لغو',
|
||||
cancel: 'انصراف',
|
||||
noFileChosenMessage: 'هیچ فایلی انتخاب نشده است',
|
||||
fileChosenMessage: 'انتخاب فایل',
|
||||
selectionMessage: '{0} مورد انتخاب شده است',
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from './pos-display';
|
||||
@@ -1,133 +0,0 @@
|
||||
# POS Display Component
|
||||
|
||||
A reusable component for displaying Point-of-Sale (POS) terminal information with configurable variants.
|
||||
|
||||
## Overview
|
||||
|
||||
The `PosDisplayComponent` displays POS entity information in a card-based layout with support for different visibility variants ('consumer', 'partner', 'full').
|
||||
|
||||
## Features
|
||||
|
||||
- **Variant Support**: Choose from 'consumer', 'partner', or 'full' display modes
|
||||
- **Conditional Field Visibility**: Fields are dynamically shown/hidden based on variant
|
||||
- **Edit Mode**: Toggle between view and edit modes
|
||||
- **Responsive Grid**: Displays up to 3 columns with gap-4 spacing
|
||||
- **More Actions**: Optional button for additional actions
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```typescript
|
||||
import { PosDisplayComponent, IPosEntity } from '@/app/components';
|
||||
|
||||
@Component({
|
||||
selector: 'app-my-component',
|
||||
template: `
|
||||
<app-pos-display
|
||||
variant="consumer"
|
||||
[pos]="posData"
|
||||
[editMode]="isEditing"
|
||||
(onMoreAction)="handleMoreAction()"
|
||||
(editModeChange)="editModeChange($event)"
|
||||
/>
|
||||
`,
|
||||
standalone: true,
|
||||
imports: [PosDisplayComponent],
|
||||
})
|
||||
export class MyComponent {
|
||||
posData = signal<IPosEntity>({
|
||||
id: '123',
|
||||
name: 'Terminal 1',
|
||||
pos_type: 'PSP',
|
||||
serial_number: 'SN123',
|
||||
model: 'Model X',
|
||||
status: 'active',
|
||||
complex: { id: 'c1', name: 'Complex 1' },
|
||||
device: { id: 'd1', name: 'Device A' },
|
||||
provider: { id: 'p1', name: 'Provider A' },
|
||||
});
|
||||
|
||||
isEditing = signal(false);
|
||||
|
||||
handleMoreAction(): void {
|
||||
console.log('More action clicked');
|
||||
}
|
||||
|
||||
editModeChange(editing: boolean): void {
|
||||
this.isEditing.set(editing);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Variants
|
||||
|
||||
### Consumer Variant
|
||||
Displays: name, pos_type, serial_number, device, model, provider (6 fields)
|
||||
|
||||
### Partner Variant
|
||||
Displays: name, pos_type, serial_number (3 fields)
|
||||
|
||||
### Full Variant
|
||||
Displays: name, pos_type, serial_number, device, model, provider (6 fields - same as consumer)
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Type | Default | Description |
|
||||
|-------|------|---------|-------------|
|
||||
| `variant` | 'consumer' \| 'partner' \| 'full' | 'full' | Display variant mode |
|
||||
| `pos` | Signal<IPosEntity \| undefined> | undefined | POS entity data |
|
||||
| `editMode` | Signal<boolean> | false | Edit mode state |
|
||||
| `cardTitle` | string | 'اطلاعات پایانهی فروش' | Card header title |
|
||||
| `showMoreActions` | boolean | true | Show more actions button |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Output | Payload | Description |
|
||||
|--------|---------|-------------|
|
||||
| `editModeChange` | boolean | Emitted when edit mode toggled |
|
||||
| `onMoreAction` | void | Emitted when more actions button clicked |
|
||||
| `onSubmit` | void | Emitted on form submission |
|
||||
|
||||
## Model (IPosEntity)
|
||||
|
||||
```typescript
|
||||
interface IPosEntity {
|
||||
id: string;
|
||||
name: string;
|
||||
serial_number: string;
|
||||
model?: string;
|
||||
status: string;
|
||||
pos_type: string;
|
||||
complex: ISummary;
|
||||
device?: ISummary;
|
||||
provider?: ISummary;
|
||||
}
|
||||
```
|
||||
|
||||
## Integration in Existing Component
|
||||
|
||||
To replace the inline display in your POS single view:
|
||||
|
||||
```typescript
|
||||
// Before: Manual field rendering
|
||||
<app-key-value label="عنوان" [value]="pos()?.name" />
|
||||
<app-key-value label="نوع پایانه" [value]="pos()?.pos_type" />
|
||||
// ... more fields
|
||||
|
||||
// After: Use the component
|
||||
<app-pos-display
|
||||
variant="full"
|
||||
[pos]="pos"
|
||||
[editMode]="editMode"
|
||||
(onMoreAction)="toPosLanding()"
|
||||
/>
|
||||
```
|
||||
|
||||
## Files
|
||||
|
||||
- `pos-display.component.ts` - Component logic
|
||||
- `pos-display.component.html` - Template
|
||||
- `pos-display.component.scss` - Styles
|
||||
- `models/posEntity.model.ts` - TypeScript interfaces and types
|
||||
- `index.ts` - Barrel export
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './models/posEntity.model';
|
||||
export * from './pos-display.component';
|
||||
@@ -1,27 +0,0 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
|
||||
export type PosVariant = 'consumer' | 'partner' | 'full';
|
||||
|
||||
export interface IPosEntity {
|
||||
id: string;
|
||||
name: string;
|
||||
serial_number: string;
|
||||
model?: string;
|
||||
status: string;
|
||||
pos_type: string;
|
||||
complex: ISummary;
|
||||
device?: ISummary;
|
||||
provider?: ISummary;
|
||||
}
|
||||
|
||||
export interface IPosDisplayConfig {
|
||||
variant: PosVariant;
|
||||
editable?: boolean;
|
||||
showMoreActions?: boolean;
|
||||
}
|
||||
|
||||
export const POS_VARIANT_FIELDS: Record<PosVariant, Array<keyof IPosEntity>> = {
|
||||
consumer: ['name', 'pos_type', 'serial_number', 'device', 'model', 'provider'],
|
||||
partner: ['name', 'pos_type', 'serial_number'],
|
||||
full: ['name', 'pos_type', 'serial_number', 'device', 'model', 'provider'],
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
<app-card-data [cardTitle]="cardTitle" [editable]="true" [editMode]="isEditing()" (editModeChange)="toggleEditMode()">
|
||||
<ng-template #moreActions>
|
||||
@if (showMoreActions) {
|
||||
<p-button type="button" variant="outlined" (onClick)="handleMoreAction()"> ورود به پایانه </p-button>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
@for (field of visibleFields(); track field) {
|
||||
@if (isFieldVisible(field)) {
|
||||
<app-key-value [label]="fieldLabels[field]" [value]="getFieldValue(field)" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</app-card-data>
|
||||
@@ -1,78 +0,0 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, effect, EventEmitter, Input, Output, signal } from '@angular/core';
|
||||
import { Button } from 'primeng/button';
|
||||
import { IPosEntity, POS_VARIANT_FIELDS, PosVariant } from './models/posEntity.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pos-entity-display',
|
||||
standalone: true,
|
||||
imports: [CommonModule, AppCardComponent, Button, KeyValueComponent],
|
||||
templateUrl: './pos-display.component.html',
|
||||
})
|
||||
export class PosDisplayComponent {
|
||||
@Input() variant: PosVariant = 'full';
|
||||
@Input() pos = signal<IPosEntity | undefined>(undefined);
|
||||
@Input() editMode = signal<boolean>(false);
|
||||
@Input() cardTitle = 'اطلاعات پایانهی فروش';
|
||||
@Input() showMoreActions = true;
|
||||
|
||||
@Output() editModeChange = new EventEmitter<boolean>();
|
||||
@Output() onMoreAction = new EventEmitter<void>();
|
||||
@Output() onSubmit = new EventEmitter<void>();
|
||||
|
||||
visibleFields = signal<Array<keyof IPosEntity>>([]);
|
||||
isEditing = signal<boolean>(false);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
this.visibleFields.set(POS_VARIANT_FIELDS[this.variant] || POS_VARIANT_FIELDS.full);
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
this.isEditing.set(this.editMode());
|
||||
});
|
||||
}
|
||||
|
||||
get fieldLabels(): Record<string, string> {
|
||||
return {
|
||||
name: 'عنوان',
|
||||
pos_type: 'نوع پایانه',
|
||||
serial_number: 'شماره سریال',
|
||||
device: 'نوع دستگاه',
|
||||
model: 'مدل دستگاه',
|
||||
provider: 'ارایهدهنده',
|
||||
};
|
||||
}
|
||||
|
||||
isFieldVisible(field: keyof IPosEntity): boolean {
|
||||
return this.visibleFields().includes(field);
|
||||
}
|
||||
|
||||
getFieldValue(field: keyof IPosEntity): any {
|
||||
const posData = this.pos();
|
||||
if (!posData) return null;
|
||||
|
||||
if (field === 'device' && posData.device) {
|
||||
return posData.device.name;
|
||||
}
|
||||
if (field === 'provider' && posData.provider) {
|
||||
return posData.provider.name;
|
||||
}
|
||||
return posData[field];
|
||||
}
|
||||
|
||||
toggleEditMode(): void {
|
||||
const newMode = !this.isEditing();
|
||||
this.isEditing.set(newMode);
|
||||
this.editModeChange.emit(newMode);
|
||||
}
|
||||
|
||||
handleMoreAction(): void {
|
||||
this.onMoreAction.emit();
|
||||
}
|
||||
|
||||
handleSubmit(): void {
|
||||
this.onSubmit.emit();
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,10 @@ export class FormErrorsService {
|
||||
if (errors['invalidMobile']) {
|
||||
out.push({ key: 'invalidMobile', message: `${label} معتبر نیست.` });
|
||||
}
|
||||
if (errors['invalidUsername']) {
|
||||
const info = errors['invalidUsername'];
|
||||
out.push({ key: 'invalidUsername', message: info.message ?? `${label} معتبر نیست.` });
|
||||
}
|
||||
// fallback: include any other error keys
|
||||
Object.keys(errors).forEach((k) => {
|
||||
if (
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Maybe } from '../models';
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
interface INativeBridgeHost {
|
||||
pay?: (payload: string) => unknown;
|
||||
print?: (payload: string) => unknown;
|
||||
pay?: (amount: number, id: Maybe<string>) => unknown;
|
||||
print?: (payload: INativePrintRequest) => unknown;
|
||||
isEnabled?: () => boolean;
|
||||
getUUID?: () => Maybe<string>;
|
||||
}
|
||||
|
||||
export interface INativePayRequest {
|
||||
amount: number;
|
||||
totalAmount: number;
|
||||
invoiceDate: string;
|
||||
id: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface INativePrintRequest {
|
||||
invoiceId?: string;
|
||||
code?: string;
|
||||
title: string;
|
||||
items: {
|
||||
label: string;
|
||||
value: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface INativeBridgeResult<T = unknown> {
|
||||
@@ -23,19 +28,40 @@ export interface INativeBridgeResult<T = unknown> {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface INativeBridgeDeviceInfo {
|
||||
deviceName: string;
|
||||
androidId: string;
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class NativeBridgeService {
|
||||
private readonly toastService = inject(ToastService);
|
||||
|
||||
private get host(): INativeBridgeHost | undefined {
|
||||
const globalWindow = window as unknown as {
|
||||
AndroidBridge?: INativeBridgeHost;
|
||||
Android?: INativeBridgeHost;
|
||||
NativeBridge?: INativeBridgeHost;
|
||||
};
|
||||
|
||||
return globalWindow.AndroidBridge || globalWindow.Android;
|
||||
return globalWindow.NativeBridge;
|
||||
}
|
||||
|
||||
isEnabled(): boolean {
|
||||
return !!environment.enableNativeBridge;
|
||||
// @ts-ignore
|
||||
return !!window.NativeBridge;
|
||||
// if (window.NativeBridge) {
|
||||
|
||||
// }
|
||||
// if (!this.host) return false;
|
||||
// const hostEnabled = this.host?.isEnabled;
|
||||
// if (typeof hostEnabled === 'function') {
|
||||
// try {
|
||||
// return !!hostEnabled();
|
||||
// } catch {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return !!environment.enableNativeBridge && !!this.host;
|
||||
}
|
||||
|
||||
canPay(): boolean {
|
||||
@@ -46,37 +72,79 @@ export class NativeBridgeService {
|
||||
return this.isEnabled() && typeof this.host?.print === 'function';
|
||||
}
|
||||
|
||||
pay(request: INativePayRequest): INativeBridgeResult {
|
||||
return this.invoke('pay', request);
|
||||
pay(request: INativePayRequest): any {
|
||||
if (request.amount <= 10_000) {
|
||||
const errorMessage = 'برای مقادیر زیر ۱۰۰ هزار ریال، پرداخت ممکن نیست.';
|
||||
this.toastService.warn({ text: errorMessage, life: 3000 });
|
||||
return {
|
||||
success: false,
|
||||
error: errorMessage,
|
||||
};
|
||||
}
|
||||
this.toastService.info({ text: 'در حال پردازش پرداخت...' });
|
||||
try {
|
||||
// @ts-ignore
|
||||
window.NativeBridge.pay(request.amount, request.id || '');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
this.toastService.info({ text: (error as Error).message });
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
// const fn = window.NativeBridge.pay(123, 'test');
|
||||
// if (typeof fn !== 'function') {
|
||||
// this.toastService.error({ text: 'متاسفانه پرداخت امکانپذیر نیست.', life: 3000 });
|
||||
// return { success: false, error: 'متاسفانه پرداخت امکانپذیر نیست.' };
|
||||
// }
|
||||
|
||||
// try {
|
||||
// fn(123, 'test');
|
||||
// // fn(request.amount, request.id || '');
|
||||
|
||||
// return { success: true };
|
||||
|
||||
// // return { success: true, data: parsed ?? raw };
|
||||
// } catch (error) {
|
||||
// this.toastService.info({ text: (error as Error).message, });
|
||||
// return { success: false, error: (error as Error).message };
|
||||
// }
|
||||
}
|
||||
|
||||
print(request: INativePrintRequest): INativeBridgeResult {
|
||||
return this.invoke('print', request);
|
||||
return this.invokePrint(request);
|
||||
}
|
||||
|
||||
private invoke(method: 'pay' | 'print', payload: object): INativeBridgeResult {
|
||||
async getDeviceInfo(): Promise<INativeBridgeResult<INativeBridgeDeviceInfo>> {
|
||||
if (!this.isEnabled()) {
|
||||
return { success: false, error: 'Native bridge is disabled for this tenant.' };
|
||||
return { success: false, error: 'متاسفانه ارتباط با دستگاه برقرار نیست.' };
|
||||
}
|
||||
|
||||
const fn = this.host?.[method];
|
||||
if (typeof fn !== 'function') {
|
||||
return { success: false, error: `Native method "${method}" is not available.` };
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = fn(JSON.stringify(payload));
|
||||
const parsed = this.tryParse(raw);
|
||||
if (parsed && typeof parsed === 'object' && 'success' in parsed) {
|
||||
return parsed as INativeBridgeResult;
|
||||
}
|
||||
|
||||
return { success: true, data: parsed ?? raw };
|
||||
// @ts-ignore
|
||||
const deviceInfo = await window.NativeBridge.deviceInfo();
|
||||
return { success: true, data: JSON.parse(deviceInfo) };
|
||||
} catch (error) {
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
}
|
||||
|
||||
private invokePrint(payload: INativePrintRequest): INativeBridgeResult {
|
||||
if (!this.isEnabled() || !this.canPrint()) {
|
||||
this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' });
|
||||
return { success: false, error: 'متاسفانه ارتباط با چاپگر برقرار نیست.' };
|
||||
}
|
||||
try {
|
||||
// @ts-ignore
|
||||
window.NativeBridge.print(JSON.stringify([payload]));
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' });
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
}
|
||||
|
||||
getNativeDeviceId(): Maybe<string> {
|
||||
return typeof this.host?.getUUID === 'function' ? this.host.getUUID!() : null;
|
||||
}
|
||||
|
||||
private tryParse(value: unknown): unknown {
|
||||
if (typeof value !== 'string') return value;
|
||||
try {
|
||||
|
||||
@@ -5,6 +5,7 @@ export function fiscalCodeValidator(): ValidatorFn {
|
||||
if (control.value === null || control.value === undefined || control.value === '') {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
return control.value.length === 11 && /^[0-9]{11}$/.test(control.value)
|
||||
? null
|
||||
: { fiscalCode: 'معتبر نیست' };
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
||||
|
||||
/**
|
||||
* Strictly checks numeric value is greater than `minValue` (not equal).
|
||||
* Empty values are treated as valid; combine with `Validators.required` when needed.
|
||||
*/
|
||||
export function greaterThanValidator(minValue: number): ValidatorFn {
|
||||
return (control: AbstractControl): ValidationErrors | null => {
|
||||
const v = control.value;
|
||||
if (v === null || v === undefined || v === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const numericValue = typeof v === 'number' ? v : Number(v);
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return { greaterThan: 'مقدار باید عددی باشد' };
|
||||
}
|
||||
|
||||
return numericValue > minValue
|
||||
? null
|
||||
: {
|
||||
greaterThan: `مقدار باید بیشتر از ${minValue} باشد`,
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
export * from './fiscal-code.validator';
|
||||
export * from './greater.validator';
|
||||
export * from './iban.validator';
|
||||
export * from './mobile.validator';
|
||||
export * from './must-match.validator';
|
||||
export * from './password.validator';
|
||||
export * from './postal-code.validator';
|
||||
export * from './username.validator';
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { ValidatorFn } from '@angular/forms';
|
||||
|
||||
export function usernameValidator(): ValidatorFn {
|
||||
return (control) => {
|
||||
if (control.value === null || control.value === undefined || control.value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (control.value.length < 6) {
|
||||
return {
|
||||
minlength: {
|
||||
requiredLength: 6,
|
||||
actualLength: control.value.length,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const pattern = /^[a-zA-Z0-9_-]*$/;
|
||||
|
||||
if (!pattern.test(control.value)) {
|
||||
return {
|
||||
invalidUsername: {
|
||||
value: control.value,
|
||||
message:
|
||||
'نام کاربری فقط میتواند شامل حروف انگلیسی، اعداد، خط تیره (-) و زیرخط (_) باشد',
|
||||
},
|
||||
};
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
@@ -4,24 +4,32 @@
|
||||
<uikit-empty-state> </uikit-empty-state>
|
||||
} @else {
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false" [backRoute]="backRoute">
|
||||
<ng-template #moreActions>
|
||||
<button pButton type="button" label="چاپ" icon="pi pi-print" outlined (click)="printInvoice()"></button>
|
||||
<button
|
||||
pButton
|
||||
type="button"
|
||||
label="چاپ"
|
||||
icon="pi pi-print"
|
||||
outlined
|
||||
size="small"
|
||||
(click)="printInvoice()"
|
||||
></button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="کد رهگیری" [value]="invoice.code" />
|
||||
<app-key-value label="تاریخ فاکتور" [value]="invoice.invoice_date" type="dateTime" />
|
||||
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice.created_at" type="dateTime" />
|
||||
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
||||
<p-badge value="ارسال نشده" severity="danger" />
|
||||
<catalog-tax-provider-status-tag [status]="invoice.status.value" [translate]="invoice.status.translate" />
|
||||
</app-key-value>
|
||||
<div class="col-span-3">
|
||||
<div class="col-span-full">
|
||||
<app-key-value label="توضیحات" [value]="invoice.notes" />
|
||||
</div>
|
||||
</div>
|
||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="grid md:grid-cols-3 sm:grid-cols-2 sm:gap-4 gap-3 items-center">
|
||||
<app-key-value label="مجموع قابل پرداخت" [value]="invoice.total_amount" type="price" />
|
||||
@for (payment of invoice.payments; track $index) {
|
||||
<app-key-value
|
||||
@@ -33,17 +41,17 @@
|
||||
</div>
|
||||
|
||||
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="کسب و کار" [value]="invoice.pos!.complex.business_activity.name" />
|
||||
<app-key-value label="مجموعه" [value]="invoice.pos!.complex.name" />
|
||||
<app-key-value label="پایانهی فروش" [value]="invoice.pos!.name" />
|
||||
<app-key-value label="پایانه فروش" [value]="invoice.pos!.name" />
|
||||
<app-key-value label="ایجاد کننده" [value]="invoice.consumer_account.account.username" />
|
||||
</div>
|
||||
|
||||
@if (variant !== "customer") {
|
||||
<p-divider align="center"> اطلاعات مشتری </p-divider>
|
||||
@if (invoice.customer) {
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
@if (invoice.customer.type === "INDIVIDUAL") {
|
||||
<app-key-value label="نوع مشتری" value="حقیقی" />
|
||||
<app-key-value label="نام" [value]="invoice.customer.individual?.first_name" />
|
||||
@@ -60,7 +68,7 @@
|
||||
}
|
||||
</div>
|
||||
} @else if (invoice.unknown_customer) {
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="نوع مشتری" value="نوع دوم" />
|
||||
<app-key-value label="عنوان" [value]="invoice.unknown_customer.name" />
|
||||
<app-key-value label="کد ثبتی" [value]="invoice.unknown_customer.national_code" />
|
||||
@@ -83,7 +91,6 @@
|
||||
[showRefresh]="false"
|
||||
>
|
||||
<ng-template #totalAmount let-item>
|
||||
aaa
|
||||
@if (!item.discount_amount) {
|
||||
<span [appPriceMask]="item.total_amount"></span>
|
||||
} @else {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { PosInfoStore } from '@/domains/pos/store';
|
||||
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
import {
|
||||
@@ -8,9 +10,18 @@ import {
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { UikitEmptyStateComponent } from '@/uikit';
|
||||
import { getGoodUnitTypeProperties } from '@/utils';
|
||||
import { Component, EventEmitter, inject, Input, Output, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { formatJalali, getGoodUnitTypeProperties } from '@/utils';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
EventEmitter,
|
||||
inject,
|
||||
Input,
|
||||
Output,
|
||||
TemplateRef,
|
||||
ViewChild,
|
||||
} from '@angular/core';
|
||||
import { UrlTree } from '@angular/router';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { Divider } from 'primeng/divider';
|
||||
import { TableModule } from 'primeng/table';
|
||||
@@ -24,7 +35,6 @@ export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||
imports: [
|
||||
AppCardComponent,
|
||||
KeyValueComponent,
|
||||
Badge,
|
||||
Divider,
|
||||
ButtonDirective,
|
||||
PageDataListComponent,
|
||||
@@ -32,37 +42,47 @@ export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||
PageLoadingComponent,
|
||||
UikitEmptyStateComponent,
|
||||
PriceMaskDirective,
|
||||
CatalogTaxProviderStatusTagComponent,
|
||||
],
|
||||
})
|
||||
export class ConsumerSaleInvoiceSharedComponent {
|
||||
private readonly nativeBridge = inject(NativeBridgeService);
|
||||
|
||||
@Input({ required: true }) loading!: boolean;
|
||||
@Input() invoice?: Maybe<ISaleInvoiceFullResponse>;
|
||||
@Input() invoice!: Maybe<ISaleInvoiceFullResponse>;
|
||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||
@Input() backRoute?: UrlTree | string | any[];
|
||||
|
||||
@Output() onRefresh = new EventEmitter<void>();
|
||||
|
||||
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
|
||||
readonly posName = computed(() => {
|
||||
if (this.posInfoStore.entity()) {
|
||||
const { name, businessActivity, complex } = this.posInfoStore.entity()!;
|
||||
return `${name} (${businessActivity.name} - ${complex.name})`;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
printInvoice = () => {
|
||||
if (this.nativeBridge.isEnabled()) {
|
||||
const result = this.nativeBridge.print({
|
||||
invoiceId: this.invoice?.id,
|
||||
code: this.invoice?.code,
|
||||
if (this.invoice) {
|
||||
const printResult = this.nativeBridge.print({
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice?.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
});
|
||||
if (result.success) return;
|
||||
}
|
||||
|
||||
window.print();
|
||||
};
|
||||
|
||||
columns: IColumn[] = [
|
||||
{
|
||||
field: '',
|
||||
header: '',
|
||||
type: 'index',
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
header: 'عنوان',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { FormBuilder, Validators } from '@angular/forms';
|
||||
import { IPosInitialValues } from './pos.model';
|
||||
|
||||
export const columns: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
// // { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'serial_number', header: 'شماره سریال' },
|
||||
{ field: 'pos_type', header: 'نوع دستگاه' },
|
||||
|
||||
@@ -8,7 +8,7 @@ export const CONSUMER_MENU_ITEMS = [
|
||||
routerLink: ['/consumer'],
|
||||
},
|
||||
{
|
||||
label: 'فعالیتهای اقتصادی',
|
||||
label: 'فعالیت اقتصادی',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
routerLink: ['/consumer/business_activities'],
|
||||
},
|
||||
@@ -18,12 +18,12 @@ export const CONSUMER_MENU_ITEMS = [
|
||||
routerLink: ['/consumer/poses'],
|
||||
},
|
||||
{
|
||||
label: 'لیست فاکتورها',
|
||||
label: 'فاکتورها',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
routerLink: ['/consumer/sale_invoices'],
|
||||
},
|
||||
{
|
||||
label: 'مشتریان',
|
||||
label: 'مشتریها',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
routerLink: ['/consumer/customers'],
|
||||
},
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
import { TspProviderResponseStatus } from '@/shared/catalog';
|
||||
import { IEnumTranslate } from '@/shared/models/enum_translate.type';
|
||||
|
||||
export interface ISaleInvoiceFullRawResponse {
|
||||
id: string;
|
||||
@@ -13,6 +15,7 @@ export interface ISaleInvoiceFullRawResponse {
|
||||
notes?: string;
|
||||
customer?: Customer;
|
||||
unknown_customer?: UnknownCustomer;
|
||||
status: IEnumTranslate<TspProviderResponseStatus>;
|
||||
}
|
||||
|
||||
export interface ISaleInvoiceFullResponse extends ISaleInvoiceFullRawResponse {}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class ConsumerAccountsComponent extends AbstractList<IAccountResponse> {
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'username',
|
||||
header: 'نام کاربری',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="نام کاربری" [value]="account()?.account?.username" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
// import { CatalogRolesComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||
import {
|
||||
NameComponent,
|
||||
AddressComponent,
|
||||
BranchCodeComponent,
|
||||
} from '@/shared/components';
|
||||
import { fieldControl } from '@/shared/constants/fields';
|
||||
import { AddressComponent, BranchCodeComponent, NameComponent } from '@/shared/components';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { fieldControl } from '@/shared/constants/fields';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { IComplexRequest, IComplexResponse } from '../../models';
|
||||
import { ConsumerComplexesService } from '../../services/complexes.service';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-complex-form',
|
||||
@@ -45,7 +41,7 @@ export class ConsumerComplexFormComponent extends AbstractFormDialog<
|
||||
form = this.initForm();
|
||||
|
||||
get preparedTitle() {
|
||||
return `${this.editMode ? 'ویرایش' : 'ایجاد'} شعبه`;
|
||||
return `${this.editMode ? 'ویرایش' : 'افزودن'} شعبه`;
|
||||
}
|
||||
|
||||
override ngOnChanges(): void {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<app-page-data-list
|
||||
pageTitle="مدیریت شعب"
|
||||
[addNewCtaLabel]="'افزودن شعبه جدید'"
|
||||
[addNewCtaLabel]="'افزودن شعبه'"
|
||||
[showAdd]="true"
|
||||
[columns]="columns"
|
||||
[showAdd]="true"
|
||||
emptyPlaceholderTitle="شعبهای یافت نشد."
|
||||
emptyPlaceholderDescription="برای افزودن شعبه جدید، روی دکمهٔ بالا کلیک کنید."
|
||||
emptyPlaceholderDescription="برای افزودن شعبه، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="true"
|
||||
|
||||
@@ -20,7 +20,7 @@ export class ConsumerComplexListComponent extends AbstractList<IComplexResponse>
|
||||
@Input({ required: true }) businessId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'branch_code', header: 'کد شعبه' },
|
||||
{
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||
<field-name [control]="form.controls.name" />
|
||||
<field-economic-code [control]="form.controls.economic_code" />
|
||||
<field-fiscal-code [control]="form.controls.fiscal_code" />
|
||||
<field-fiscal-code [control]="form.controls.fiscal_id" />
|
||||
<field-partner-token [control]="form.controls.partner_token" />
|
||||
<field-invoice-number-sequence [control]="form.controls.invoice_number_sequence" [min]="1" />
|
||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||
</form>
|
||||
</shared-dialog>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||
import {
|
||||
EconomicCodeComponent,
|
||||
FiscalCodeComponent,
|
||||
FiscalIdComponent,
|
||||
NameComponent,
|
||||
PartnerTokenComponent,
|
||||
} from '@/shared/components';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { InvoiceNumberSequenceComponent } from '@/shared/components/fields/invoice_number_sequence.component';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { fieldControl } from '@/shared/constants/fields';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { IBusinessActivityRequest, IBusinessActivityResponse } from '../models';
|
||||
import { BusinessActivitiesService } from '../services/main.service';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-businessActivity-form',
|
||||
@@ -22,8 +23,9 @@ import { SharedDialogComponent } from '@/shared/components/dialog/dialog.compone
|
||||
FormFooterActionsComponent,
|
||||
NameComponent,
|
||||
EconomicCodeComponent,
|
||||
FiscalCodeComponent,
|
||||
PartnerTokenComponent,
|
||||
InvoiceNumberSequenceComponent,
|
||||
FiscalIdComponent,
|
||||
],
|
||||
})
|
||||
export class ConsumerBusinessActivityFormComponent extends AbstractFormDialog<
|
||||
@@ -36,11 +38,17 @@ export class ConsumerBusinessActivityFormComponent extends AbstractFormDialog<
|
||||
form = this.fb.group({
|
||||
name: fieldControl.name(this.initialValues?.name || ''),
|
||||
economic_code: fieldControl.economic_code(this.initialValues?.economic_code || ''),
|
||||
fiscal_code: fieldControl.fiscal_code(this.initialValues?.fiscal_code || ''),
|
||||
fiscal_id: fieldControl.fiscal_id(this.initialValues?.fiscal_id || ''),
|
||||
partner_token: fieldControl.partner_token(this.initialValues?.partner_token || ''),
|
||||
invoice_number_sequence: fieldControl.invoice_number_sequence(
|
||||
this.initialValues?.invoice_number_sequence || 1,
|
||||
),
|
||||
});
|
||||
|
||||
override submitForm(payload: IBusinessActivityRequest) {
|
||||
return this.service.update(this.businessId, payload);
|
||||
return this.service.update(this.businessId, {
|
||||
...payload,
|
||||
economic_code: payload.economic_code.toString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
<shared-dialog [header]="preparedTitle" [(visible)]="visible" [modal]="true" [style]="{ width: '500px' }" [closable]="true">
|
||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||
<app-input label="عنوان" [control]="form.controls.name" name="name" />
|
||||
<app-input label="شناسه عمومی" [control]="form.controls.sku" name="sku" />
|
||||
<catalog-guild-goodCategories-select
|
||||
[guildId]="guildId"
|
||||
label="دستهبندی"
|
||||
[control]="form.controls.category_id"
|
||||
name="category_id"
|
||||
/>
|
||||
<app-enum-select type="unitType" [control]="form.controls.unit_type" />
|
||||
<app-enum-select type="goodPricingModel" [control]="form.controls.pricing_model" />
|
||||
<app-input label="توضیحات" [control]="form.controls.description" name="description" />
|
||||
|
||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||
</form>
|
||||
</shared-dialog>
|
||||
<shared-good-form
|
||||
[guildId]="guildId"
|
||||
[visible]="visible"
|
||||
(visibleChange)="visibleChange.emit($event)"
|
||||
[initialValues]="initialValues"
|
||||
[editMode]="editMode"
|
||||
[createFn]="create"
|
||||
[updateFn]="update"
|
||||
(onSubmit)="onSubmit.emit($event)"
|
||||
(onClose)="onClose.emit()"
|
||||
/>
|
||||
|
||||
@@ -1,57 +1,31 @@
|
||||
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||
import { InputComponent } from '@/shared/components';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
||||
|
||||
import { EnumSelectComponent } from '@/shared/apiEnum/select.component';
|
||||
import { CatalogGuildGoodCategoriesSelectComponent } from '@/shared/catalog/guildGoodCategories';
|
||||
import {
|
||||
IConsumerBusinessActivityGoodRequest,
|
||||
IConsumerBusinessActivityGoodResponse,
|
||||
} from '../../models/goods_io';
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { IGoodResponse, SharedGoodFormComponent } from '@/shared/components/good';
|
||||
import { IConsumerBusinessActivityGoodResponse } from '../../models/goods_io';
|
||||
import { BusinessActivityGoodsService } from '../../services/goods.service';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-businessActivity-good-form',
|
||||
templateUrl: './form.component.html',
|
||||
imports: [
|
||||
ReactiveFormsModule,
|
||||
SharedDialogComponent,
|
||||
InputComponent,
|
||||
FormFooterActionsComponent,
|
||||
EnumSelectComponent,
|
||||
CatalogGuildGoodCategoriesSelectComponent,
|
||||
],
|
||||
imports: [SharedGoodFormComponent],
|
||||
})
|
||||
export class ConsumerBusinessActivityGoodFormComponent extends AbstractFormDialog<
|
||||
IConsumerBusinessActivityGoodRequest,
|
||||
IConsumerBusinessActivityGoodResponse
|
||||
> {
|
||||
export class ConsumerBusinessActivityGoodFormComponent extends AbstractDialog {
|
||||
@Input({ required: true }) businessId!: string;
|
||||
@Input({ required: true }) guildId!: string;
|
||||
@Input() categoryId?: string;
|
||||
@Input() initialValues?: IConsumerBusinessActivityGoodResponse;
|
||||
@Input() editMode?: boolean;
|
||||
|
||||
@Output() onSubmit = new EventEmitter<IGoodResponse>();
|
||||
|
||||
private service = inject(BusinessActivityGoodsService);
|
||||
|
||||
form = this.fb.group({
|
||||
name: [this.initialValues?.name || '', [Validators.required]],
|
||||
sku: [this.initialValues?.sku || '', [Validators.required]],
|
||||
unit_type: [this.initialValues?.unit_type || '', [Validators.required]],
|
||||
pricing_model: [this.initialValues?.pricing_model || '', [Validators.required]],
|
||||
category_id: [this.initialValues?.category.id || '', [Validators.required]],
|
||||
description: [this.initialValues?.description || ''],
|
||||
});
|
||||
|
||||
get preparedTitle() {
|
||||
return `${this.editMode ? 'ویرایش' : 'ایجاد'} کالا`;
|
||||
}
|
||||
|
||||
override submitForm(payload: IConsumerBusinessActivityGoodRequest) {
|
||||
if (this.editMode) {
|
||||
return this.service.update(this.businessId, this.categoryId!, payload);
|
||||
}
|
||||
create = (payload: FormData) => {
|
||||
return this.service.create(this.businessId, payload);
|
||||
}
|
||||
};
|
||||
|
||||
update = (payload: FormData) => {
|
||||
return this.service.update(this.businessId, this.categoryId!, payload);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<app-page-data-list
|
||||
pageTitle="مدیریت کالاها"
|
||||
[addNewCtaLabel]="'افزودن کالای جدید'"
|
||||
[addNewCtaLabel]="'افزودن کالای'"
|
||||
[columns]="columns"
|
||||
[showAdd]="true"
|
||||
emptyPlaceholderTitle="کالایی یافت نشد"
|
||||
emptyPlaceholderDescription="برای افزودن کالای جدید، روی دکمهٔ بالا کلیک کنید."
|
||||
emptyPlaceholderDescription="برای افزودن کالای، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showAdd]="true"
|
||||
|
||||
@@ -19,9 +19,9 @@ export class ConsumerBusinessActivityGoodsListComponent extends AbstractList<ICo
|
||||
@Input({ required: true }) guildId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'sku', header: 'شناسهی عمومی' },
|
||||
{ field: 'sku', header: 'شناسه عمومی' },
|
||||
{
|
||||
field: 'category',
|
||||
header: 'دستهبندی',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-data-list
|
||||
pageTitle="لیست فعالیتهای اقتصادی"
|
||||
pageTitle="لیست فعالیت اقتصادی"
|
||||
[columns]="columns"
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
@@ -10,10 +10,13 @@
|
||||
(onRefresh)="refresh()"
|
||||
>
|
||||
</app-page-data-list>
|
||||
<consumer-businessActivity-form
|
||||
[(visible)]="visibleForm"
|
||||
[editMode]="editMode()"
|
||||
[businessId]="selectedItemForEdit()?.id || ''"
|
||||
[initialValues]="selectedItemForEdit() || undefined"
|
||||
(onSubmit)="refresh()"
|
||||
/>
|
||||
|
||||
@if (visibleForm()) {
|
||||
<consumer-businessActivity-form
|
||||
[(visible)]="visibleForm"
|
||||
[editMode]="editMode()"
|
||||
[businessId]="selectedItemForEdit()?.id || ''"
|
||||
[initialValues]="selectedItemForEdit() || undefined"
|
||||
(onSubmit)="refresh()"
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ConsumerBusinessActivityListComponent extends AbstractList<IBusines
|
||||
},
|
||||
{
|
||||
field: 'license_info',
|
||||
header: 'انقضای مجوز',
|
||||
header: 'انقضا مجوز',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'license_info.expires_at', type: 'date' },
|
||||
},
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
import { MustMatch } from '@/core/validators';
|
||||
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||
import {
|
||||
NameComponent,
|
||||
SharedPasswordInputComponent,
|
||||
DeviceIdComponent,
|
||||
NameComponent,
|
||||
PosTypeComponent,
|
||||
ProviderIdComponent,
|
||||
SerialNumberComponent,
|
||||
PosTypeComponent,
|
||||
SharedPasswordInputComponent,
|
||||
UsernameComponent,
|
||||
} from '@/shared/components';
|
||||
import { fieldControl } from '@/shared/constants/fields';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { fieldControl } from '@/shared/constants/fields';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { Divider } from 'primeng/divider';
|
||||
import { IPosRequest, IPosResponse } from '../../models';
|
||||
import { ConsumerPosesService } from '../../services/poses.service';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-pos-form',
|
||||
@@ -123,7 +123,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
||||
form = this.initForm();
|
||||
|
||||
get preparedTitle() {
|
||||
return `${this.editMode ? 'ویرایش' : 'ایجاد'} پایانه فروش`;
|
||||
return `${this.editMode ? 'ویرایش' : 'افزودن'} پایانه فروش`;
|
||||
}
|
||||
|
||||
override ngOnChanges(): void {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<app-page-data-list
|
||||
pageTitle="لیست پایانههای فروش"
|
||||
[columns]="columns"
|
||||
[addNewCtaLabel]="'افزودن پایانهی فروش جدید'"
|
||||
emptyPlaceholderTitle="پایانهی فروشی یافت نشد."
|
||||
emptyPlaceholderDescription="برای افزودن پایانهی فروش جدید، روی دکمهٔ بالا کلیک کنید."
|
||||
[addNewCtaLabel]="'افزودن پایانه فروش'"
|
||||
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
|
||||
emptyPlaceholderDescription="برای افزودن پایانه فروش، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="true"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-data-list
|
||||
pageTitle="لیست فاکتورهای صادر شده"
|
||||
pageTitle="لیست فاکتورها"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="تا به حال فاکتور فروشی توسط این پایانه ایجاد نشده است."
|
||||
[items]="items()"
|
||||
|
||||
@@ -18,7 +18,7 @@ export class ConsumerSalesInvoicesComponent extends AbstractList<ISalesInvoicesR
|
||||
@Input({ required: true }) posId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'code', header: 'کد رهگیری' },
|
||||
{ field: 'total_amount', header: 'مبلغ کل', type: 'price' },
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ export const consumerBusinessActivityGoodsNamedRoutes: NamedRoutes<TGoodsRouteNa
|
||||
// import('../../views/goods/single.component').then((m) => m.SuperAdminUserPosComponent),
|
||||
// // @ts-ignore
|
||||
// meta: {
|
||||
// title: 'پایانهی فروش',
|
||||
// title: 'پایانه فروش',
|
||||
// pagePath: (businessId: string, complexId: string, goodId: string) =>
|
||||
// `${baseUrl(businessId)}/${goodId}`,
|
||||
// },
|
||||
|
||||
@@ -23,7 +23,7 @@ export const consumerPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
|
||||
import('../../views/poses/single.component').then((m) => m.ConsumerComplexPosPageComponent),
|
||||
// @ts-ignore
|
||||
meta: {
|
||||
title: 'پایانهی فروش',
|
||||
title: 'پایانه فروش',
|
||||
pagePath: (businessId: string, complexId: string, posId: string) =>
|
||||
`${baseUrl(businessId, complexId)}/${posId}`,
|
||||
},
|
||||
|
||||
@@ -3,9 +3,10 @@ import ISummary from '@/core/models';
|
||||
export interface IConsumerBusinessActivityGoodRawResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
sku: string;
|
||||
image_url: string;
|
||||
sku: ISummary;
|
||||
category: ISummary;
|
||||
unit_type: string;
|
||||
measure_unit: ISummary;
|
||||
pricing_model: string;
|
||||
description?: string;
|
||||
created_at: string;
|
||||
@@ -15,9 +16,9 @@ export interface IConsumerBusinessActivityGoodResponse extends IConsumerBusiness
|
||||
|
||||
export interface IConsumerBusinessActivityGoodRequest {
|
||||
name: string;
|
||||
sku: string;
|
||||
sku_id: string;
|
||||
category_id: string;
|
||||
unit_type: string;
|
||||
measure_unit_id: string;
|
||||
pricing_model: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
@@ -4,19 +4,21 @@ export interface IBusinessActivityRawResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
economic_code: string;
|
||||
fiscal_code: string;
|
||||
fiscal_id: string;
|
||||
partner_token: string;
|
||||
guild: ISummary;
|
||||
created_at: string;
|
||||
invoice_number_sequence: number;
|
||||
license_info: LicenseInfo;
|
||||
}
|
||||
export interface IBusinessActivityResponse extends IBusinessActivityRawResponse {}
|
||||
|
||||
export interface IBusinessActivityRequest {
|
||||
economic_code: string;
|
||||
fiscal_code: string;
|
||||
fiscal_id: string;
|
||||
partner_token: string;
|
||||
name: string;
|
||||
invoice_number_sequence: number;
|
||||
}
|
||||
|
||||
interface LicenseInfo {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Observable } from 'rxjs';
|
||||
import { CONSUMER_BUSINESS_ACTIVITY_GOODS_API_ROUTES } from '../constants/apiRoutes/businessActivityGoods';
|
||||
import {
|
||||
IConsumerBusinessActivityGoodRawResponse,
|
||||
IConsumerBusinessActivityGoodRequest,
|
||||
IConsumerBusinessActivityGoodResponse,
|
||||
} from '../models/goods_io';
|
||||
|
||||
@@ -28,10 +27,7 @@ export class BusinessActivityGoodsService {
|
||||
);
|
||||
}
|
||||
|
||||
create(
|
||||
businessId: string,
|
||||
data: IConsumerBusinessActivityGoodRequest,
|
||||
): Observable<IConsumerBusinessActivityGoodResponse> {
|
||||
create(businessId: string, data: FormData): Observable<IConsumerBusinessActivityGoodResponse> {
|
||||
return this.http.post<IConsumerBusinessActivityGoodResponse>(
|
||||
this.apiRoutes.list(businessId),
|
||||
data,
|
||||
@@ -41,7 +37,7 @@ export class BusinessActivityGoodsService {
|
||||
update(
|
||||
businessId: string,
|
||||
id: string,
|
||||
data: IConsumerBusinessActivityGoodRequest,
|
||||
data: FormData,
|
||||
): Observable<IConsumerBusinessActivityGoodResponse> {
|
||||
return this.http.patch<IConsumerBusinessActivityGoodResponse>(
|
||||
this.apiRoutes.single(businessId, id),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات شعبه" [editable]="true" [(editMode)]="editMode">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="عنوان" [value]="complex()?.name" />
|
||||
<app-key-value label="کد شعبه" [value]="complex()?.branch_code" />
|
||||
<app-key-value label="آدرس" [value]="complex()?.address" />
|
||||
|
||||
@@ -15,7 +15,7 @@ export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessA
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{
|
||||
field: 'created_at',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات پایانهی فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreActions>
|
||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="عنوان" [value]="pos()?.name" />
|
||||
<app-key-value label="نوع پایانه" [value]="pos()?.pos_type" />
|
||||
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreActions>
|
||||
<a routerLink pButton [routerLink]="goodsPageRoute()" outlined>مدیریت کالاها</a>
|
||||
<a routerLink pButton [routerLink]="goodsPageRoute()" outlined size="small">مدیریت کالاها</a>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="عنوان" [value]="business()?.name" />
|
||||
<app-key-value label="کد اقتصادی" [value]="business()?.economic_code" />
|
||||
<app-key-value label="صنف" [value]="business()?.guild?.name" />
|
||||
</div>
|
||||
<p-divider align="center">اطلاعات لایسنس</p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="تاریخ پایان لایسنس" [value]="business()?.license_info?.expires_at" type="date" />
|
||||
<app-key-value label="محدودیت کاربر" [value]="business()?.license_info?.accounts_limit" />
|
||||
<app-key-value label="تعداد کاربران ایجاد شده" [value]="business()?.license_info?.allocated_account_count" />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { ICustomerResponse } from '../models';
|
||||
import { ConsumerCustomerIndividualFormComponent } from './form-individual.component';
|
||||
import { ConsumerCustomerLegalFormComponent } from './form-legal.component';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-customer-form-dialog',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'لیست مشتریان'"
|
||||
[pageTitle]="'لیست مشتری'"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="مشتریای یافت نشد"
|
||||
emptyPlaceholderTitle="مشتری یافت نشد"
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showEdit]="true"
|
||||
|
||||
@@ -19,7 +19,7 @@ import { CustomersService } from '../services/main.service';
|
||||
export class ConsumerCustomerListComponent extends AbstractList<ICustomerResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'type',
|
||||
header: 'نوع مشتری',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'لیست فاکتورهای ایجاد شده'"
|
||||
[pageTitle]="'لیست فاکتورها'"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="فاکتوری یافت نشد"
|
||||
[items]="items()"
|
||||
|
||||
@@ -29,7 +29,7 @@ export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICust
|
||||
field: 'pos',
|
||||
header: 'پایانه',
|
||||
customDataModel(item: ICustomerSaleInvoicesResponse) {
|
||||
return `${item.pos.complex.business_activity.name}، شعبه ${item.pos.complex.name}، پایانهی فروش ${item.pos.name}`;
|
||||
return `${item.pos.complex.business_activity.name}، شعبه ${item.pos.complex.name}، پایانه فروش ${item.pos.name}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ export const consumerCustomersNamedRoutes: NamedRoutes<TConsumerCustomersRouteNa
|
||||
loadComponent: () =>
|
||||
import('../../views/list.component').then((m) => m.ConsumerCustomersComponent),
|
||||
meta: {
|
||||
title: 'مشتریان',
|
||||
title: 'مشتریها',
|
||||
pagePath: () => 'consumer/customers',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
>
|
||||
<div class="flex flex-col gap-4">
|
||||
@if (customer()?.type === "LEGAL") {
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<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?.registration_number" />
|
||||
<app-key-value label="کد پستی" [value]="customer()?.legal?.postal_code" />
|
||||
</div>
|
||||
} @else if (customer()?.type === "INDIVIDUAL") {
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<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?.national_id" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-data-list
|
||||
pageTitle="آخرین فاکتورهای صادر شدهی امروز"
|
||||
pageTitle="آخرین فاکتورهای صادر شده امروز"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="تا به این لحظه فاکتوری صادر نشده است."
|
||||
[items]="items()"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<app-page-data-list
|
||||
pageTitle="لیست پایانههای فروش"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="پایانهی فروشی یافت نشد."
|
||||
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="true"
|
||||
|
||||
@@ -22,7 +22,7 @@ export const ConsumerPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
|
||||
import('../../views/single.component').then((m) => m.ConsumerPosPageComponent),
|
||||
// @ts-ignore
|
||||
meta: {
|
||||
title: 'پایانهی فروش',
|
||||
title: 'پایانه فروش',
|
||||
pagePath: (posId: string) => `${baseUrl}/${posId}`,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import { EntityState, EntityStore } from '@/core/state';
|
||||
import { computed, inject, Injectable } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
import { consumerPosesNamedRoutes } from '../../businessActivities/constants/routes/poses';
|
||||
import { ConsumerPosesNamedRoutes } from '../constants/routes/index';
|
||||
import { IPosResponse } from '../models';
|
||||
import { ConsumerPosesService } from '../services/main.service';
|
||||
|
||||
@@ -32,12 +32,12 @@ export class ConsumerPosStore extends EntityStore<IPosResponse, ConsumerPosState
|
||||
this.patchState({
|
||||
breadcrumbItems: [
|
||||
{
|
||||
...consumerPosesNamedRoutes.poses.meta,
|
||||
routerLink: consumerPosesNamedRoutes.poses.meta.pagePath!(),
|
||||
...ConsumerPosesNamedRoutes.poses.meta,
|
||||
routerLink: ConsumerPosesNamedRoutes.poses.meta.pagePath!(),
|
||||
},
|
||||
{
|
||||
title: this.entity()?.name,
|
||||
routerLink: consumerPosesNamedRoutes.pos.meta.pagePath!(posId),
|
||||
routerLink: ConsumerPosesNamedRoutes.pos.meta.pagePath!(posId),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات پایانهی فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<app-card-data cardTitle="اطلاعات پایانه فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreActions>
|
||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="عنوان" [value]="pos()?.name" />
|
||||
<app-key-value label="نوع پایانه" [value]="pos()?.pos_type" />
|
||||
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'لیست فاکتورهای ایجاد شده'"
|
||||
[pageTitle]="'لیست فاکتورها'"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="فاکتوری یافت نشد"
|
||||
[items]="items()"
|
||||
|
||||
@@ -13,7 +13,7 @@ export const PARTNER_MENU_ITEMS = [
|
||||
routerLink: ['/partner/accounts'],
|
||||
},
|
||||
{
|
||||
label: 'مشتریان',
|
||||
label: 'مشتریها',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
routerLink: ['/partner/consumers'],
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@ export class PartnerAccountsComponent extends AbstractList<IAccountResponse> {
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'username',
|
||||
header: 'نام کاربری',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="نام کاربری" [value]="account()?.account?.username" />
|
||||
<app-key-value label="نقش" [value]="account()?.role" />
|
||||
<app-key-value label="وضعیت" [value]="account()?.account?.status" />
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="حساب کاربریای یافت نشد."
|
||||
[items]="items()"
|
||||
[showIndex]="false"
|
||||
[loading]="loading()"
|
||||
(onRefresh)="refresh()"
|
||||
>
|
||||
|
||||
@@ -18,17 +18,16 @@ export class ConsumerAccountListComponent extends AbstractList<IConsumerAccountR
|
||||
@Input({ required: true }) consumerId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'account',
|
||||
header: 'نام کاربری',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
{ field: 'role', header: 'نوع حساب' },
|
||||
{ field: 'role', header: 'نوع حساب', type: 'nested', nestedOption: { path: 'role.translate' } },
|
||||
{
|
||||
field: 'pos',
|
||||
header: 'پایانهی مرتبط',
|
||||
header: 'پایانه',
|
||||
customDataModel(item: IConsumerAccountResponse) {
|
||||
if (item.pos) {
|
||||
return `${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`;
|
||||
@@ -40,7 +39,8 @@ export class ConsumerAccountListComponent extends AbstractList<IConsumerAccountR
|
||||
field: 'status',
|
||||
header: 'وضعیت',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.status' },
|
||||
nestedOption: { path: 'account.status.translate' },
|
||||
variant: 'tag',
|
||||
},
|
||||
// {
|
||||
// field: 'created_at',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<shared-dialog
|
||||
header="ایجاد فعالیت اقتصادی"
|
||||
header="افزودن فعالیت اقتصادی"
|
||||
[(visible)]="visible"
|
||||
[modal]="true"
|
||||
[style]="{ width: '520px' }"
|
||||
@@ -9,8 +9,8 @@
|
||||
<p-stepper [value]="activeStep()" [linear]="true">
|
||||
<p-step-list>
|
||||
<p-step [value]="1">فعالیت اقتصادی</p-step>
|
||||
<p-step [value]="2" [disabled]="!businessActivity()">فروشگاه</p-step>
|
||||
<p-step [value]="3" [disabled]="!complex()">پایانهی فروشگاهی</p-step>
|
||||
<p-step [value]="2" [disabled]="!businessActivity()">شعبه</p-step>
|
||||
<p-step [value]="3" [disabled]="!complex()">پایانه فروشگاهی</p-step>
|
||||
</p-step-list>
|
||||
</p-stepper>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { IBusinessActivityResponse } from '../../models';
|
||||
import { ConsumerBusinessActivitiesFormComponent } from './form.component';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'partner-consumer-businessActivities-form',
|
||||
@@ -18,7 +18,7 @@ export class ConsumerBusinessActivitiesFormDialogComponent extends AbstractDialo
|
||||
@Input() businessActivityId!: string;
|
||||
|
||||
get preparedTitle() {
|
||||
return `${this.editMode ? 'ویرایش' : 'ایجاد'} فعالیت اقتصادی`;
|
||||
return `${this.editMode ? 'ویرایش' : 'افزودن'} فعالیت اقتصادی`;
|
||||
}
|
||||
|
||||
onFormSubmit(response: IBusinessActivityResponse) {
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||
<field-name [control]="$any(form).controls.name" />
|
||||
<field-economic-code [control]="$any(form).controls.economic_code" />
|
||||
<field-fiscal-code [control]="$any(form).controls.fiscal_code" />
|
||||
<field-partner-token [control]="$any(form).controls.partner_token" />
|
||||
<field-guild-id [control]="$any(form).controls.guild_id" />
|
||||
<field-name [control]="form.controls.name" />
|
||||
<field-economic-code [control]="form.controls.economic_code" />
|
||||
<field-fiscal-code [control]="form.controls.fiscal_id" />
|
||||
<field-partner-token [control]="form.controls.partner_token" />
|
||||
<field-guild-id [control]="form.controls.guild_id" />
|
||||
|
||||
@if (!editMode) {
|
||||
<p-divider align="center"> اطلاعات لایسنس </p-divider>
|
||||
<field-license-starts-at
|
||||
[control]="$any(form).controls.license_starts_at"
|
||||
/>
|
||||
<field-license-starts-at [control]="form.controls.license_starts_at" />
|
||||
}
|
||||
|
||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AbstractForm } from '@/shared/abstractClasses';
|
||||
import {
|
||||
EconomicCodeComponent,
|
||||
FiscalCodeComponent,
|
||||
FiscalIdComponent,
|
||||
GuildIdComponent,
|
||||
LicenseStartsAtComponent,
|
||||
NameComponent,
|
||||
@@ -22,7 +22,7 @@ import { PartnerConsumerBusinessActivitiesService } from '../../services/busines
|
||||
ReactiveFormsModule,
|
||||
NameComponent,
|
||||
EconomicCodeComponent,
|
||||
FiscalCodeComponent,
|
||||
FiscalIdComponent,
|
||||
PartnerTokenComponent,
|
||||
GuildIdComponent,
|
||||
LicenseStartsAtComponent,
|
||||
@@ -43,7 +43,7 @@ export class ConsumerBusinessActivitiesFormComponent extends AbstractForm<
|
||||
const form = this.fb.group({
|
||||
name: fieldControl.name(this.initialValues?.name || ''),
|
||||
economic_code: fieldControl.economic_code(this.initialValues?.economic_code || ''),
|
||||
fiscal_code: fieldControl.fiscal_code(this.initialValues?.fiscal_code || ''),
|
||||
fiscal_id: fieldControl.fiscal_id(this.initialValues?.fiscal_id || ''),
|
||||
partner_token: fieldControl.partner_token(this.initialValues?.partner_token || ''),
|
||||
guild_id: fieldControl.guild_id(this.initialValues?.guild?.id || ''),
|
||||
license_starts_at: [''],
|
||||
@@ -73,6 +73,7 @@ export class ConsumerBusinessActivitiesFormComponent extends AbstractForm<
|
||||
|
||||
submitForm() {
|
||||
const formValue = this.form.value as IBusinessActivityRequest;
|
||||
formValue.economic_code = String(formValue.economic_code);
|
||||
if (this.editMode) {
|
||||
return this.service.update(this.consumerId, this.businessActivityId, formValue);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<app-page-data-list
|
||||
pageTitle="مدیریت فعالیتهای اقتصادی"
|
||||
[addNewCtaLabel]="'افزودن فعالیت اقتصادی جدید'"
|
||||
pageTitle="مدیریت فعالیت اقتصادی"
|
||||
[addNewCtaLabel]="'افزودن فعالیت اقتصادی'"
|
||||
[columns]="columns"
|
||||
[showAdd]="true"
|
||||
emptyPlaceholderTitle="فعالیت اقتصادیای یافت نشد."
|
||||
emptyPlaceholderDescription="برای افزودن فعالیت اقتصادی جدید، روی دکمهٔ بالا کلیک کنید."
|
||||
emptyPlaceholderDescription="برای افزودن فعالیت اقتصادی، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="true"
|
||||
|
||||
@@ -25,7 +25,6 @@ export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessA
|
||||
@Input({ required: true }) consumerId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
||||
{ field: 'economic_code', header: 'کد اقتصادی' },
|
||||
@@ -42,15 +41,10 @@ export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessA
|
||||
},
|
||||
{
|
||||
field: 'license_info',
|
||||
header: 'انقضای مجوز',
|
||||
header: 'انقضا مجوز',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'license_info.expires_at', type: 'date' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
|
||||
private readonly service = inject(PartnerConsumerBusinessActivitiesService);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<shared-dialog
|
||||
header="ایجاد فروشگاه"
|
||||
header="افزودن شعبه"
|
||||
[(visible)]="visible"
|
||||
[modal]="true"
|
||||
[style]="{ width: '400px' }"
|
||||
@@ -8,8 +8,8 @@
|
||||
>
|
||||
<p-stepper [value]="activeStep()" [linear]="true">
|
||||
<p-step-list>
|
||||
<p-step [value]="1">فروشگاه</p-step>
|
||||
<p-step [value]="2" [disabled]="!complex()">پایانهی روشگاهی</p-step>
|
||||
<p-step [value]="1">شعبه</p-step>
|
||||
<p-step [value]="2" [disabled]="!complex()">پایانه فروشگاهی</p-step>
|
||||
</p-step-list>
|
||||
</p-stepper>
|
||||
|
||||
|
||||