Compare commits
46 Commits
78501b907b
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 93ebc80da3 | |||
| 4e4cc08224 | |||
| e5f53c2265 | |||
| b57d6b4e4b | |||
| ea458c7b72 | |||
| 151eff2f7c | |||
| 1a0c40ecde | |||
| d1dd67aee7 | |||
| f7f8a91a85 | |||
| 2c90f8091e | |||
| d6aa165592 | |||
| 5ee03cf761 | |||
| 72954fb5d1 | |||
| b4cd4c05f2 | |||
| 88f45eee38 | |||
| 5fa07c7ee8 | |||
| 788f4023f3 | |||
| 2f67801700 | |||
| cd09b09e3b | |||
| eb39f42b8c | |||
| 560b3516e1 | |||
| 694b2ec946 | |||
| 8d6fa8860b | |||
| 1f9166bed3 | |||
| ae963a60ce | |||
| d44004d555 | |||
| c271a36f7e | |||
| 4ec6143068 | |||
| f50219a094 | |||
| f2a496134b | |||
| 90c51edad4 | |||
| d678b6c699 | |||
| 550db47b88 | |||
| 9fdd5e451c | |||
| eb671d5949 | |||
| cdd2bd6bee | |||
| f18d7a1f04 | |||
| 12752f37d5 | |||
| 7f07bf53c2 | |||
| 6ad1a73c16 | |||
| 8c07dc7c3f | |||
| 1b4ac0789c | |||
| c5e1fab09b | |||
| 2e1ad77946 | |||
| c135e1a85f | |||
| 79c00e0149 |
@@ -1,2 +1,9 @@
|
|||||||
TENANT=default
|
TENANT=default
|
||||||
DIST_DIR=default
|
DIST_DIR=default
|
||||||
|
PRODUCTION=false
|
||||||
|
API_BASE_URL=https://psp-api.shift-am.ir
|
||||||
|
HOST=localhost
|
||||||
|
PORT=5001
|
||||||
|
ENABLE_LOGGING=false
|
||||||
|
ENABLE_DEBUG=false
|
||||||
|
ENABLE_NATIVE_BRIDGE=false
|
||||||
|
|||||||
@@ -3,3 +3,10 @@ DIST_DIR=tis
|
|||||||
# TIS_BUILD_DATE=
|
# TIS_BUILD_DATE=
|
||||||
# TIS_APP_VERSION=
|
# TIS_APP_VERSION=
|
||||||
# TIS_BUILD_NUMBER=
|
# TIS_BUILD_NUMBER=
|
||||||
|
PRODUCTION=true
|
||||||
|
API_BASE_URL=http://192.168.128.73:5002
|
||||||
|
HOST=localhost
|
||||||
|
PORT=5000
|
||||||
|
ENABLE_LOGGING=false
|
||||||
|
ENABLE_DEBUG=false
|
||||||
|
ENABLE_NATIVE_BRIDGE=true
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
name: Manual Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: "Target service"
|
||||||
|
required: true
|
||||||
|
default: "app_default"
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- app_default
|
||||||
|
- app_tis
|
||||||
|
- both
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Deploy locally (manual trigger only)
|
||||||
|
run: |
|
||||||
|
if [ "${{ inputs.target }}" = "app_default" ]; then
|
||||||
|
docker compose build app_default
|
||||||
|
docker compose up -d app_default
|
||||||
|
elif [ "${{ inputs.target }}" = "app_tis" ]; then
|
||||||
|
docker compose build app_tis
|
||||||
|
docker compose up -d app_tis
|
||||||
|
else
|
||||||
|
docker compose build app_default app_tis
|
||||||
|
docker compose up -d app_default app_tis
|
||||||
|
fi
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
name: Production CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-and-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: TypeScript check
|
||||||
|
run: pnpm -s exec tsc -p tsconfig.app.json --noEmit
|
||||||
|
|
||||||
|
- name: Build default tenant
|
||||||
|
run: pnpm build
|
||||||
|
|
||||||
|
- name: Build tis tenant
|
||||||
|
run: pnpm build:tis
|
||||||
|
|
||||||
|
- name: Docker build default
|
||||||
|
run: docker compose build app_default
|
||||||
|
|
||||||
|
- name: Docker build tis
|
||||||
|
run: docker compose build app_tis
|
||||||
@@ -42,5 +42,5 @@ testem.log
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
.env.*
|
||||||
/false
|
.env
|
||||||
|
|||||||
@@ -5,28 +5,28 @@
|
|||||||
"endOfLine": "lf",
|
"endOfLine": "lf",
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": "*.html",
|
"files": "**/*.html",
|
||||||
"options": {
|
"options": {
|
||||||
"bracketSameLine": true,
|
"bracketSameLine": true,
|
||||||
"printWidth": 120
|
"printWidth": 120
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": "*.scss",
|
"files": "**/*.scss",
|
||||||
"options": {
|
"options": {
|
||||||
"printWidth": 120,
|
"printWidth": 120,
|
||||||
"singleQuote": false
|
"singleQuote": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": "*.less",
|
"files": "**/*.less",
|
||||||
"options": {
|
"options": {
|
||||||
"printWidth": 120,
|
"printWidth": 120,
|
||||||
"singleQuote": false
|
"singleQuote": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": "*.json",
|
"files": "**/*.json",
|
||||||
"options": {
|
"options": {
|
||||||
"printWidth": 100
|
"printWidth": 100
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,10 @@
|
|||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
|
"tailwindAttributes": [
|
||||||
|
"class",
|
||||||
|
"ngClass"
|
||||||
|
],
|
||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"useTabs": false
|
"useTabs": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,158 +1,254 @@
|
|||||||
# AGENT.md
|
# AGENT.md
|
||||||
|
|
||||||
## Purpose
|
## Scope
|
||||||
|
|
||||||
- This file defines repository-specific instructions for coding agents.
|
Applies to the full repository unless overridden by a deeper `AGENT.md`.
|
||||||
- Scope is the full repo unless a deeper `AGENT.md` overrides it.
|
|
||||||
|
|
||||||
## Stack Context
|
Stack:
|
||||||
|
- Angular 20
|
||||||
|
- Standalone components
|
||||||
|
- pnpm
|
||||||
|
- Docker
|
||||||
|
- RTK
|
||||||
|
|
||||||
- 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`.
|
# RTK RULES (MANDATORY)
|
||||||
- `tis` tenant builds via `ng build --configuration tis` and outputs to `dist/tis`.
|
|
||||||
- `prebuild:tis` is tenant-scoped and should keep using scripts under `scripts/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).
|
|
||||||
- Do not use Angular `fileReplacements` for static assets (`.png`, `.jpg`, etc.); use tenant public assets or prebuild copy scripts.
|
|
||||||
|
|
||||||
## Tenant PWA Rules
|
Always prefer RTK commands.
|
||||||
|
|
||||||
- Keep tenant manifest files under tenant public assets (e.g. `public-tis/favicon/site.webmanifest`).
|
Use:
|
||||||
- Ensure `manifest` `id`, `start_url`, and `scope` match actual deployment path:
|
|
||||||
- root deploy: `/`
|
|
||||||
- subpath deploy example: `/tis/`
|
|
||||||
- Keep `<link rel="manifest">` path and branding config `manifestPath` aligned.
|
|
||||||
|
|
||||||
## Input Component Rules
|
- `rtk ls`
|
||||||
|
- `rtk grep`
|
||||||
|
- `rtk smart`
|
||||||
|
- `rtk read`
|
||||||
|
- `rtk git diff`
|
||||||
|
- `rtk git status`
|
||||||
|
|
||||||
- File: `src/app/shared/components/input/input.component.ts`
|
Avoid raw:
|
||||||
- For `type === 'number'` or `type === 'price'`:
|
- `cat`
|
||||||
- Normalize Persian/Arabic digits to English digits.
|
- `grep`
|
||||||
- Allow only digits and `.`.
|
- `rg`
|
||||||
- Support `fixed` precision formatting when provided.
|
- `tree`
|
||||||
- Keep behavior for identifier fields (`mobile`, `phone`, `postalCode`, `nationalId`) string-safe.
|
- `git diff`
|
||||||
|
- recursive `find`
|
||||||
|
|
||||||
## Change Policy
|
Use raw shell only for:
|
||||||
|
- builds
|
||||||
|
- runtime/debugging
|
||||||
|
- Docker
|
||||||
|
- pnpm
|
||||||
|
- commands RTK cannot perform
|
||||||
|
|
||||||
- Keep changes minimal and scoped to user request.
|
---
|
||||||
- Prefer root-cause fixes over temporary workarounds.
|
|
||||||
|
# FILE READING POLICY
|
||||||
|
|
||||||
|
Preferred order:
|
||||||
|
|
||||||
|
1. `rtk grep`
|
||||||
|
2. `rtk smart`
|
||||||
|
3. `rtk read`
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Search before reading.
|
||||||
|
- Read only required files.
|
||||||
|
- Do not read TS/HTML/SCSS together unless required.
|
||||||
|
- Stop exploring once edit location is clear.
|
||||||
|
- Avoid rereading unchanged files.
|
||||||
|
|
||||||
|
Large files:
|
||||||
|
- `rtk read <file> -l aggressive`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# ANGULAR WORKFLOW
|
||||||
|
|
||||||
|
For components:
|
||||||
|
|
||||||
|
1. `rtk grep "<component-name>"`
|
||||||
|
2. `rtk smart component.ts`
|
||||||
|
3. Read template only if UI changes are required
|
||||||
|
4. Read styles only if styling changes are required
|
||||||
|
|
||||||
|
Avoid broad module inspection.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# TOKEN RULES
|
||||||
|
|
||||||
|
Do not:
|
||||||
|
- dump large files
|
||||||
|
- scan unrelated folders
|
||||||
|
- inspect generated directories
|
||||||
|
- perform repeated searches
|
||||||
|
- over-explain edits
|
||||||
|
|
||||||
|
Avoid:
|
||||||
|
- `dist/`
|
||||||
|
- `.angular/`
|
||||||
|
- `coverage/`
|
||||||
|
- `node_modules/`
|
||||||
|
- `.git/`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# CHANGE POLICY
|
||||||
|
|
||||||
|
- Keep changes minimal and scoped.
|
||||||
|
- Reuse existing patterns.
|
||||||
- Avoid unrelated refactors.
|
- Avoid unrelated refactors.
|
||||||
- Reuse existing patterns and naming conventions.
|
- Preserve tenant separation.
|
||||||
|
- Prefer root-cause fixes.
|
||||||
|
|
||||||
## Do / Don't
|
---
|
||||||
|
|
||||||
- Do follow existing field wrapper style in `src/app/shared/components/fields/*.component.ts`.
|
# PROJECT RULES
|
||||||
- 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
|
## Tenant Builds
|
||||||
|
|
||||||
- Create a wrapper component in `src/app/shared/components/fields`.
|
- `default` → `dist/production`
|
||||||
- Use the same pattern as existing files like:
|
- `tis` → `dist/tis`
|
||||||
- `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:
|
Keep Docker `DIST_DIR` aligned with Angular output.
|
||||||
|
|
||||||
```ts
|
Do not use Angular `fileReplacements` for static assets.
|
||||||
@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:
|
## Input Component
|
||||||
- `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:
|
File:
|
||||||
|
- `src/app/shared/components/input/input.component.ts`
|
||||||
|
|
||||||
```ts
|
For:
|
||||||
example: (value = '', isRequired = true): ControlConfig => [
|
- `type="number"`
|
||||||
value,
|
- `type="price"`
|
||||||
isRequired ? [Validators.required] : [],
|
|
||||||
],
|
|
||||||
```
|
|
||||||
|
|
||||||
## Using Fields In Forms
|
Requirements:
|
||||||
|
- normalize Persian/Arabic digits
|
||||||
|
- allow only digits and `.`
|
||||||
|
- support fixed precision
|
||||||
|
- keep identifier fields string-safe
|
||||||
|
|
||||||
- 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]`.
|
|
||||||
|
|
||||||
## List Component Configs
|
## Shared Field Rules
|
||||||
|
|
||||||
- Centralized list metadata is stored in `src/app/shared/constants/list-configs/` — **never** in domain modules.
|
When creating fields:
|
||||||
- Structure by data type, not domain (e.g. `good-list.const.ts`, `sku-list.const.ts`, `category-list.const.ts`).
|
- use shared field wrappers
|
||||||
- Each config implements `IListConfig` (defined in `list-config.model.ts`):
|
- reuse `app-input`
|
||||||
- `pageTitle`: display title for the list page
|
- register exports in shared indexes
|
||||||
- `addNewCtaLabel`: call-to-action button label
|
- keep control names consistent
|
||||||
- `emptyPlaceholderTitle` and `emptyPlaceholderDescription`: empty state messaging
|
|
||||||
- `columns`: array of `IColumn[]` definitions
|
|
||||||
- Usage in list components:
|
|
||||||
```ts
|
|
||||||
@Input() header: IColumn[] = goodListConfig.columns;
|
|
||||||
listConfig = goodListConfig;
|
|
||||||
```
|
|
||||||
- Any domain needing a list config imports from `@/shared/constants/list-configs` — no cross-domain dependencies.
|
|
||||||
- **Do not** define configs inside domains or duplicate them across modules.
|
|
||||||
|
|
||||||
## Breadcrumb Usage in Stores & Views
|
---
|
||||||
|
|
||||||
- Entity stores expose `breadcrumbItems` as a computed signal.
|
# VALIDATION
|
||||||
- Call `store.breadcrumbItems()` in view components and extend with current page:
|
|
||||||
```ts
|
|
||||||
setBreadcrumb() {
|
|
||||||
this.breadcrumbService.setItems([
|
|
||||||
...this.store.breadcrumbItems(),
|
|
||||||
{ title: 'Current Page' },
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
- Root page breadcrumbs are set in the store's `getData()` method once entity is loaded.
|
|
||||||
|
|
||||||
## Validation Checklist
|
TypeScript:
|
||||||
|
|
||||||
- For TypeScript-only changes, run:
|
|
||||||
- `pnpm -s exec tsc -p tsconfig.app.json --noEmit`
|
- `pnpm -s exec tsc -p tsconfig.app.json --noEmit`
|
||||||
- For Docker/build changes, verify with:
|
|
||||||
|
Docker:
|
||||||
- `docker compose build app_default`
|
- `docker compose build app_default`
|
||||||
- `docker compose build app_tis`
|
- `docker compose build app_tis`
|
||||||
- Start with targeted validation, then broader checks only if needed.
|
|
||||||
|
|
||||||
## Communication Expectations
|
Validate only impacted areas when possible.
|
||||||
|
|
||||||
- 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.
|
# FINAL RESPONSE RULES
|
||||||
|
|
||||||
|
Keep final responses under 10 lines unless:
|
||||||
|
- validation failed
|
||||||
|
- architecture changed
|
||||||
|
- user requested explanation
|
||||||
|
|
||||||
|
Prefer:
|
||||||
|
|
||||||
|
Updated:
|
||||||
|
- file1
|
||||||
|
- file2
|
||||||
|
|
||||||
|
Validation:
|
||||||
|
- tsc passed
|
||||||
|
|
||||||
|
|
||||||
|
# TARGETED READ RULES
|
||||||
|
|
||||||
|
Do not read files larger than 300 lines unless required.
|
||||||
|
|
||||||
|
For changes at a known location:
|
||||||
|
|
||||||
|
- read the surrounding symbol only
|
||||||
|
- avoid full-file reads
|
||||||
|
|
||||||
|
Prefer:
|
||||||
|
- rtk grep
|
||||||
|
- rtk smart
|
||||||
|
- targeted read
|
||||||
|
|
||||||
|
Avoid:
|
||||||
|
- opening 400+ line files for small edits
|
||||||
|
|
||||||
|
# REASONING OUTPUT RULES
|
||||||
|
|
||||||
|
Do not expose internal reasoning.
|
||||||
|
|
||||||
|
Never output:
|
||||||
|
- "I think..."
|
||||||
|
- "I'm considering..."
|
||||||
|
- "I wonder..."
|
||||||
|
- "Maybe..."
|
||||||
|
- implementation deliberation
|
||||||
|
- "It sounds..."
|
||||||
|
|
||||||
|
Never explain alternative approaches unless requested.
|
||||||
|
|
||||||
|
Use:
|
||||||
|
|
||||||
|
Inspecting confirmation dialog.
|
||||||
|
|
||||||
|
Updating async accept support.
|
||||||
|
|
||||||
|
Validation passed.
|
||||||
|
|
||||||
|
|
||||||
|
# INVESTIGATION LIMITS
|
||||||
|
|
||||||
|
For localized fixes:
|
||||||
|
|
||||||
|
- maximum 3 file reads before first edit
|
||||||
|
- maximum 1 related-file read unless required
|
||||||
|
|
||||||
|
Stop searching once the edit target is identified.
|
||||||
|
|
||||||
|
# REVIEW MODE
|
||||||
|
|
||||||
|
During reviews:
|
||||||
|
|
||||||
|
- inspect changed files only
|
||||||
|
- avoid loading unrelated dependencies
|
||||||
|
- avoid architecture exploration
|
||||||
|
- avoid repository-wide searches
|
||||||
|
|
||||||
|
Review only code directly affected by the diff.
|
||||||
|
|
||||||
|
|
||||||
|
# HARD TOKEN LIMITS
|
||||||
|
|
||||||
|
For localized fixes:
|
||||||
|
|
||||||
|
- Never read files larger than 300 lines unless the target symbol cannot be isolated.
|
||||||
|
- Never read an entire file when a symbol-level read is possible.
|
||||||
|
- Never read more than 5 total files before the first edit.
|
||||||
|
- Never open a file already summarized by `rtk smart` unless implementation details are required.
|
||||||
|
|
||||||
|
When a file exceeds 300 lines:
|
||||||
|
|
||||||
|
1. rtk grep
|
||||||
|
2. rtk smart
|
||||||
|
3. read only the relevant symbol/section
|
||||||
|
|
||||||
|
Avoid full-file reads.
|
||||||
|
|||||||
@@ -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",
|
||||||
@@ -190,8 +294,7 @@
|
|||||||
"allowedCommonJsDependencies": [
|
"allowedCommonJsDependencies": [
|
||||||
"dayjs",
|
"dayjs",
|
||||||
"dayjs/locale/fa",
|
"dayjs/locale/fa",
|
||||||
"dayjs/plugin/relativeTime",
|
"dayjs/plugin/relativeTime"
|
||||||
"flatpickr-wrap/dist/l10n/fa.js"
|
|
||||||
],
|
],
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
@@ -223,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: .
|
||||||
|
|||||||
@@ -12,11 +12,9 @@
|
|||||||
"@primeng/themes": "^20.4.0",
|
"@primeng/themes": "^20.4.0",
|
||||||
"@primeuix/themes": "^1.2.5",
|
"@primeuix/themes": "^1.2.5",
|
||||||
"@tailwindcss/postcss": "^4.2.3",
|
"@tailwindcss/postcss": "^4.2.3",
|
||||||
"@zoomit/dayjs-jalali-plugin": "^0.1.11",
|
"angularx-qrcode": "20.0.0",
|
||||||
"chart.js": "4.4.2",
|
"chart.js": "4.4.2",
|
||||||
"dayjs": "^1.11.20",
|
"dayjs": "^1.11.20",
|
||||||
"flatpickr": "^4.6.13",
|
|
||||||
"flatpickr-wrap": "^1.0.0",
|
|
||||||
"jalaliday": "^3.1.1",
|
"jalaliday": "^3.1.1",
|
||||||
"jest-editor-support": "32.0.0-beta.1",
|
"jest-editor-support": "32.0.0-beta.1",
|
||||||
"ngx-cookie-service": "^21.3.1",
|
"ngx-cookie-service": "^21.3.1",
|
||||||
@@ -55,23 +53,17 @@
|
|||||||
"typescript": "~5.8.3"
|
"typescript": "~5.8.3"
|
||||||
},
|
},
|
||||||
"name": "psp_panel",
|
"name": "psp_panel",
|
||||||
"prettier": {
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": "*.html",
|
|
||||||
"options": {
|
|
||||||
"parser": "angular"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"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,24 +1,28 @@
|
|||||||
|
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 { Component, HostListener } from '@angular/core';
|
import { Component, HostListener } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { ConfirmDialog } from 'primeng/confirmdialog';
|
|
||||||
import { ToastModule } from 'primeng/toast';
|
import { ToastModule } from 'primeng/toast';
|
||||||
import { brandingConfig } from './app/branding/branding.config';
|
import { brandingConfig } from './app/branding/branding.config';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [RouterModule, ToastModule, ConfirmDialog],
|
imports: [RouterModule, ToastModule, ConfirmationDialogComponent],
|
||||||
template: `
|
template: `
|
||||||
<p-toast [position]="toastPosition" [baseZIndex]="3000" />
|
<p-toast [position]="toastPosition" [baseZIndex]="3000" />
|
||||||
<p-confirmDialog />
|
<app-shared-confirmation-dialog />
|
||||||
<router-outlet />
|
<router-outlet />
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
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();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
withInterceptors,
|
withInterceptors,
|
||||||
withInterceptorsFromDi,
|
withInterceptorsFromDi,
|
||||||
} from '@angular/common/http';
|
} from '@angular/common/http';
|
||||||
import { ApplicationConfig, isDevMode, provideZonelessChangeDetection } from '@angular/core';
|
import { ApplicationConfig, provideZonelessChangeDetection } from '@angular/core';
|
||||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||||
import {
|
import {
|
||||||
provideRouter,
|
provideRouter,
|
||||||
@@ -34,7 +34,7 @@ export const appConfig: ApplicationConfig = {
|
|||||||
anchorScrolling: 'enabled',
|
anchorScrolling: 'enabled',
|
||||||
scrollPositionRestoration: 'enabled',
|
scrollPositionRestoration: 'enabled',
|
||||||
}),
|
}),
|
||||||
withEnabledBlockingInitialNavigation(),
|
withEnabledBlockingInitialNavigation()
|
||||||
),
|
),
|
||||||
provideZonelessChangeDetection(),
|
provideZonelessChangeDetection(),
|
||||||
// configure HttpClient once: enable fetch and register both functional
|
// configure HttpClient once: enable fetch and register both functional
|
||||||
@@ -42,6 +42,12 @@ export const appConfig: ApplicationConfig = {
|
|||||||
provideAnimationsAsync(),
|
provideAnimationsAsync(),
|
||||||
// ensure PrimeNG uses our preset (applies css variables at app initialization)
|
// ensure PrimeNG uses our preset (applies css variables at app initialization)
|
||||||
providePrimeNG({
|
providePrimeNG({
|
||||||
|
zIndex: {
|
||||||
|
tooltip: 2100,
|
||||||
|
menu: 2000,
|
||||||
|
overlay: 2000,
|
||||||
|
modal: 1100,
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
preset: MyPreset,
|
preset: MyPreset,
|
||||||
options: { darkModeSelector: '.app-dark' },
|
options: { darkModeSelector: '.app-dark' },
|
||||||
@@ -72,7 +78,7 @@ export const appConfig: ApplicationConfig = {
|
|||||||
provideHttpClient(
|
provideHttpClient(
|
||||||
withFetch(),
|
withFetch(),
|
||||||
withInterceptors([loggingInterceptor, authInterceptor, errorInterceptor, dedupInterceptor]),
|
withInterceptors([loggingInterceptor, authInterceptor, errorInterceptor, dedupInterceptor]),
|
||||||
withInterceptorsFromDi(),
|
withInterceptorsFromDi()
|
||||||
),
|
),
|
||||||
// provideServiceWorker('ngsw-worker.js', {
|
// provideServiceWorker('ngsw-worker.js', {
|
||||||
// enabled: !isDevMode(),
|
// enabled: !isDevMode(),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { PARTNER_ROUTES } from '@/domains/partner/routes';
|
|||||||
import { POS_ROUTES } from '@/domains/pos/routes';
|
import { POS_ROUTES } from '@/domains/pos/routes';
|
||||||
import { PROVIDER_ROUTES } from '@/domains/provider/routes';
|
import { PROVIDER_ROUTES } from '@/domains/provider/routes';
|
||||||
import { SUPER_ADMIN_ROUTES } from '@/domains/superAdmin/routes';
|
import { SUPER_ADMIN_ROUTES } from '@/domains/superAdmin/routes';
|
||||||
|
import { PUBLIC_SALE_INVOICES_ROUTES } from '@/modules/saleInvoices/constants';
|
||||||
import { Notfound } from '@/pages/notfound/notfound.component';
|
import { Notfound } from '@/pages/notfound/notfound.component';
|
||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
@@ -23,6 +24,6 @@ export const appRoutes: Routes = [
|
|||||||
path: 'auth',
|
path: 'auth',
|
||||||
loadComponent: () => import('@/modules/auth/pages/auth.component').then((m) => m.AuthComponent),
|
loadComponent: () => import('@/modules/auth/pages/auth.component').then((m) => m.AuthComponent),
|
||||||
},
|
},
|
||||||
{ path: 'notfound', component: Notfound },
|
...PUBLIC_SALE_INVOICES_ROUTES,
|
||||||
{ path: '**', redirectTo: '/notfound' },
|
{ path: '**', component: Notfound },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -68,6 +68,18 @@ export class FormErrorsService {
|
|||||||
const info = errors['invalidUsername'];
|
const info = errors['invalidUsername'];
|
||||||
out.push({ key: 'invalidUsername', message: info.message ?? `${label} معتبر نیست.` });
|
out.push({ key: 'invalidUsername', message: info.message ?? `${label} معتبر نیست.` });
|
||||||
}
|
}
|
||||||
|
if (errors['equalLength']) {
|
||||||
|
const info = errors['equalLength'];
|
||||||
|
out.push({
|
||||||
|
key: 'equalLength',
|
||||||
|
message: `تعداد کاراکترهای ${label} باید برابر با ${info.length} باشد.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors['invalidFiscalId']) {
|
||||||
|
const info = errors['invalidFiscalId'];
|
||||||
|
out.push({ key: 'invalidFiscalId', message: info.message ?? `${label} معتبر نیست.` });
|
||||||
|
}
|
||||||
// fallback: include any other error keys
|
// fallback: include any other error keys
|
||||||
Object.keys(errors).forEach((k) => {
|
Object.keys(errors).forEach((k) => {
|
||||||
if (
|
if (
|
||||||
@@ -80,6 +92,7 @@ export class FormErrorsService {
|
|||||||
'max',
|
'max',
|
||||||
'email',
|
'email',
|
||||||
'pattern',
|
'pattern',
|
||||||
|
'invalidFiscalId',
|
||||||
].indexOf(k) === -1
|
].indexOf(k) === -1
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -73,21 +73,21 @@ 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
|
||||||
window.NativeBridge.pay(request.amount, request.id || '');
|
window.NativeBridge.pay(request.amount, request.id || '');
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.toastService.info({ text: (error as Error).message });
|
// this.toastService.info({ text: (error as Error).message });
|
||||||
return { success: false, error: (error as Error).message };
|
return { success: false, error: (error as Error).message };
|
||||||
}
|
}
|
||||||
// const fn = window.NativeBridge.pay(123, 'test');
|
// const fn = window.NativeBridge.pay(123, 'test');
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,10 +10,18 @@ interface IToast extends Pick<ToastMessageOptions, 'sticky' | 'life'> {
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ToastService {
|
export class ToastService {
|
||||||
|
private readonly dedupeWindowMs = 2000;
|
||||||
|
private readonly recentMessages = new Map<string, number>();
|
||||||
|
|
||||||
constructor(private messageService: MessageService) {}
|
constructor(private messageService: MessageService) {}
|
||||||
|
|
||||||
add(message: ToastMessageOptions) {
|
add(message: ToastMessageOptions) {
|
||||||
if (!message.detail) return;
|
if (!message.detail) return;
|
||||||
|
const dedupeKey = `${message.severity ?? ''}|${message.summary ?? ''}|${message.detail}`;
|
||||||
|
const now = Date.now();
|
||||||
|
const lastShownAt = this.recentMessages.get(dedupeKey);
|
||||||
|
if (lastShownAt && now - lastShownAt < this.dedupeWindowMs) return;
|
||||||
|
this.recentMessages.set(dedupeKey, now);
|
||||||
this.messageService.add(message);
|
this.messageService.add(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,11 +197,7 @@ export abstract class EntityStore<
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// @TODO: check to familiar with ts
|
// @TODO: check to familiar with ts
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
||||||
|
|
||||||
|
export function equalLengthValidator(length: number): ValidatorFn {
|
||||||
|
return (control: AbstractControl): ValidationErrors | null => {
|
||||||
|
const v = control.value;
|
||||||
|
if (v === null || v === undefined || v === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const normalized = String(v);
|
||||||
|
|
||||||
|
return normalized.length !== length
|
||||||
|
? {
|
||||||
|
equalLength: {
|
||||||
|
length,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { ValidatorFn } from '@angular/forms';
|
|
||||||
|
|
||||||
export function fiscalCodeValidator(): ValidatorFn {
|
|
||||||
return (control) => {
|
|
||||||
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,30 @@
|
|||||||
|
import { ValidatorFn } from '@angular/forms';
|
||||||
|
|
||||||
|
export function fiscalIdValidator(): 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 {
|
||||||
|
invalidFiscalId: {
|
||||||
|
value: control.value,
|
||||||
|
message: 'شناسه مالی فقط میتواند شامل حروف انگلیسی و اعداد باشد',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './fiscal-code.validator';
|
export * from './equalLength.validator';
|
||||||
|
export * from './fiscal-id.validator';
|
||||||
export * from './greater.validator';
|
export * from './greater.validator';
|
||||||
export * from './iban.validator';
|
export * from './iban.validator';
|
||||||
export * from './mobile.validator';
|
export * from './mobile.validator';
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
import { ValidatorFn } from '@angular/forms';
|
import { ValidatorFn } from '@angular/forms';
|
||||||
|
|
||||||
// Password must be minimum 8 characters, include at least one uppercase,
|
// const PASSWORD_PATTERN = /^[a-zA-Z0-9_-]*$/;
|
||||||
// one lowercase, one number and one special character
|
|
||||||
// export const PASSWORD_PATTERN = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,}$/;
|
|
||||||
export const PASSWORD_PATTERN = /^[0-9]{6,}$/;
|
|
||||||
|
|
||||||
// Validator factory named `password` as requested. Returns `null` for empty
|
|
||||||
// values so `Validators.required` can be used alongside it when needed.
|
|
||||||
export function password(): ValidatorFn {
|
export function password(): ValidatorFn {
|
||||||
return (control) => {
|
return (control) => {
|
||||||
const value = control?.value;
|
const value = control?.value;
|
||||||
if (value === null || value === undefined || String(value).length === 0) return null;
|
if (value === null || value === undefined || String(value).length === 0) return null;
|
||||||
return PASSWORD_PATTERN.test(String(value)) ? null : { password: 'معتبر نیست' };
|
|
||||||
|
if (value.length < 6) {
|
||||||
|
return {
|
||||||
|
minlength: {
|
||||||
|
requiredLength: 6,
|
||||||
|
actualLength: value.length,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
// return PASSWORD_PATTERN.test(String(value)) ? null : { password: 'معتبر نیست' };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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' },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,28 +9,28 @@ export const CONSUMER_MENU_ITEMS = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'فعالیت اقتصادی',
|
label: 'فعالیت اقتصادی',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-shop',
|
||||||
routerLink: ['/consumer/business_activities'],
|
routerLink: ['/consumer/business_activities'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'پایانههای فروش',
|
label: 'پایانهی فروش',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-tablet',
|
||||||
routerLink: ['/consumer/poses'],
|
routerLink: ['/consumer/poses'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'فاکتورها',
|
label: 'صورتحساب',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-receipt',
|
||||||
routerLink: ['/consumer/sale_invoices'],
|
routerLink: ['/consumer/sale_invoices'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'مشتریها',
|
label: 'مشتری',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-users',
|
||||||
routerLink: ['/consumer/customers'],
|
routerLink: ['/consumer/customers'],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: 'حسابهای کاربری',
|
label: 'حسابهای کاربری',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-user',
|
||||||
routerLink: ['/consumer/accounts'],
|
routerLink: ['/consumer/accounts'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,9 +1,31 @@
|
|||||||
|
import { IEnumTranslate } from '@/shared/models/enum_translate.type';
|
||||||
|
|
||||||
export interface IConsumerInfoRawResponse {
|
export interface IConsumerInfoRawResponse {
|
||||||
id: string;
|
id: string;
|
||||||
|
partner: Partner;
|
||||||
|
type: IEnumTranslate<'INDIVIDUAL' | 'LEGAL'>;
|
||||||
|
status: IEnumTranslate<'ACTIVE' | 'INACTIVE'>;
|
||||||
|
legal?: Legal;
|
||||||
|
individual?: Individual;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
export interface IConsumerInfoResponse extends IConsumerInfoRawResponse {}
|
||||||
|
|
||||||
|
interface Individual {
|
||||||
first_name: string;
|
first_name: string;
|
||||||
last_name: string;
|
last_name: string;
|
||||||
mobile_number: string;
|
mobile_number: string;
|
||||||
status: string;
|
national_code: string;
|
||||||
fullname: string;
|
fullname: string;
|
||||||
}
|
}
|
||||||
export interface IConsumerInfoResponse extends IConsumerInfoRawResponse {}
|
|
||||||
|
interface Legal {
|
||||||
|
company_name: string;
|
||||||
|
registration_number: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Partner {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
code: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
@@ -17,11 +17,7 @@ export class AccountStore extends EntityStore<IAccountResponse, AccountState> {
|
|||||||
private readonly service = inject(AccountsService);
|
private readonly service = inject(AccountsService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,11 +60,7 @@ export class AccountStore extends EntityStore<IAccountResponse, AccountState> {
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,12 +4,11 @@
|
|||||||
[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-economic-code [control]="form.controls.economic_code" />
|
<field-individual-economic-code [control]="form.controls.economic_code" />
|
||||||
<field-fiscal-code [control]="form.controls.fiscal_id" />
|
<field-fiscal-id [control]="form.controls.fiscal_id" />
|
||||||
<field-partner-token [control]="form.controls.partner_token" />
|
<field-partner-token [control]="form.controls.partner_token" />
|
||||||
<field-invoice-number-sequence [control]="form.controls.invoice_number_sequence" [min]="1" />
|
<field-invoice-number-sequence [control]="form.controls.invoice_number_sequence" [min]="1" />
|
||||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||||
import {
|
import {
|
||||||
EconomicCodeComponent,
|
|
||||||
FiscalIdComponent,
|
FiscalIdComponent,
|
||||||
|
IndividualEconomicCodeComponent,
|
||||||
NameComponent,
|
NameComponent,
|
||||||
PartnerTokenComponent,
|
PartnerTokenComponent,
|
||||||
} from '@/shared/components';
|
} from '@/shared/components';
|
||||||
@@ -22,7 +22,7 @@ import { BusinessActivitiesService } from '../services/main.service';
|
|||||||
SharedDialogComponent,
|
SharedDialogComponent,
|
||||||
FormFooterActionsComponent,
|
FormFooterActionsComponent,
|
||||||
NameComponent,
|
NameComponent,
|
||||||
EconomicCodeComponent,
|
IndividualEconomicCodeComponent,
|
||||||
PartnerTokenComponent,
|
PartnerTokenComponent,
|
||||||
InvoiceNumberSequenceComponent,
|
InvoiceNumberSequenceComponent,
|
||||||
FiscalIdComponent,
|
FiscalIdComponent,
|
||||||
@@ -37,11 +37,11 @@ export class ConsumerBusinessActivityFormComponent extends AbstractFormDialog<
|
|||||||
|
|
||||||
form = this.fb.group({
|
form = this.fb.group({
|
||||||
name: fieldControl.name(this.initialValues?.name || ''),
|
name: fieldControl.name(this.initialValues?.name || ''),
|
||||||
economic_code: fieldControl.economic_code(this.initialValues?.economic_code || ''),
|
economic_code: fieldControl.individual_economic_code(this.initialValues?.economic_code || ''),
|
||||||
fiscal_id: fieldControl.fiscal_id(this.initialValues?.fiscal_id || ''),
|
fiscal_id: fieldControl.fiscal_id(this.initialValues?.fiscal_id || ''),
|
||||||
partner_token: fieldControl.partner_token(this.initialValues?.partner_token || ''),
|
partner_token: fieldControl.partner_token(this.initialValues?.partner_token || ''),
|
||||||
invoice_number_sequence: fieldControl.invoice_number_sequence(
|
invoice_number_sequence: fieldControl.invoice_number_sequence(
|
||||||
this.initialValues?.invoice_number_sequence || 1,
|
this.initialValues?.invoice_number_sequence || 1
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<shared-good-form
|
<shared-good-form-dialog
|
||||||
[guildId]="guildId"
|
[guildId]="guildId"
|
||||||
[visible]="visible"
|
[visible]="visible"
|
||||||
(visibleChange)="visibleChange.emit($event)"
|
(visibleChange)="visibleChange.emit($event)"
|
||||||
@@ -7,5 +7,4 @@
|
|||||||
[createFn]="create"
|
[createFn]="create"
|
||||||
[updateFn]="update"
|
[updateFn]="update"
|
||||||
(onSubmit)="onSubmit.emit($event)"
|
(onSubmit)="onSubmit.emit($event)"
|
||||||
(onClose)="onClose.emit()"
|
(onClose)="onClose.emit()" />
|
||||||
/>
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
||||||
|
|
||||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||||
import { IGoodResponse, SharedGoodFormComponent } from '@/shared/components/good';
|
import { IGoodResponse } from '@/shared/components/good';
|
||||||
|
import { ConsumerUserFormDialogComponent } from '@/shared/components/good/form-dialog.component';
|
||||||
import { IConsumerBusinessActivityGoodResponse } from '../../models/goods_io';
|
import { IConsumerBusinessActivityGoodResponse } from '../../models/goods_io';
|
||||||
import { BusinessActivityGoodsService } from '../../services/goods.service';
|
import { BusinessActivityGoodsService } from '../../services/goods.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'consumer-businessActivity-good-form',
|
selector: 'consumer-businessActivity-good-form',
|
||||||
templateUrl: './form.component.html',
|
templateUrl: './form.component.html',
|
||||||
imports: [SharedGoodFormComponent],
|
imports: [ConsumerUserFormDialogComponent],
|
||||||
})
|
})
|
||||||
export class ConsumerBusinessActivityGoodFormComponent extends AbstractDialog {
|
export class ConsumerBusinessActivityGoodFormComponent extends AbstractDialog {
|
||||||
@Input({ required: true }) businessId!: string;
|
@Input({ required: true }) businessId!: string;
|
||||||
|
|||||||
@@ -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,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()"
|
||||||
(onRefresh)="refresh()"
|
[showDetails]="true"
|
||||||
>
|
(onDetails)="toSinglePage($event)"
|
||||||
|
(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/landing/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;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
@@ -20,11 +20,7 @@ export class BusinessActivityStore extends EntityStore<
|
|||||||
private readonly service = inject(BusinessActivitiesService);
|
private readonly service = inject(BusinessActivitiesService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -58,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 });
|
||||||
@@ -68,11 +64,7 @@ export class BusinessActivityStore extends EntityStore<
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
@@ -17,11 +17,7 @@ export class ConsumerComplexStore extends EntityStore<IComplexResponse, ComplexS
|
|||||||
private readonly service = inject(ConsumerComplexesService);
|
private readonly service = inject(ConsumerComplexesService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -63,11 +59,7 @@ export class ConsumerComplexStore extends EntityStore<IComplexResponse, ComplexS
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
|
|
||||||
@@ -17,11 +17,7 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
|
|||||||
private readonly service = inject(ConsumerPosesService);
|
private readonly service = inject(ConsumerPosesService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -32,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
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@@ -54,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 });
|
||||||
@@ -64,11 +64,7 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,10 +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() {
|
||||||
@@ -63,7 +44,7 @@ export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICust
|
|||||||
|
|
||||||
toSinglePage(item: ICustomerSaleInvoicesResponse) {
|
toSinglePage(item: ICustomerSaleInvoicesResponse) {
|
||||||
this.router.navigateByUrl(
|
this.router.navigateByUrl(
|
||||||
consumerCustomerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.customerId, item.id),
|
consumerCustomerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.customerId, item.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,21 +9,21 @@ export const consumerCustomerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerCusto
|
|||||||
path: 'saleInvoices',
|
path: 'saleInvoices',
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../views/saleInvoices/list.component').then(
|
import('../../views/saleInvoices/list.component').then(
|
||||||
(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: {
|
||||||
path: 'saleInvoices/:invoiceId',
|
path: 'saleInvoices/:invoiceId',
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../views/saleInvoices/single.component').then(
|
import('../../views/saleInvoices/single.component').then(
|
||||||
(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}`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
@@ -17,11 +17,7 @@ export class ConsumerCustomerStore extends EntityStore<ICustomerResponse, Consum
|
|||||||
private readonly service = inject(CustomersService);
|
private readonly service = inject(CustomersService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -67,11 +63,7 @@ export class ConsumerCustomerStore extends EntityStore<ICustomerResponse, Consum
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
@@ -20,11 +20,7 @@ export class ConsumerCustomerSaleInvoiceStore extends EntityStore<
|
|||||||
private readonly service = inject(CustomerSaleInvoicesService);
|
private readonly service = inject(CustomerSaleInvoicesService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -40,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
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -61,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 });
|
||||||
@@ -71,11 +67,7 @@ export class ConsumerCustomerSaleInvoiceStore extends EntityStore<
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,15 +1,14 @@
|
|||||||
<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()"
|
||||||
(onDetails)="toSinglePage($event)"
|
(onDetails)="toSinglePage($event)"
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()">
|
||||||
>
|
|
||||||
<ng-template #moreActions>
|
<ng-template #moreActions>
|
||||||
<a routerLink pButton [routerLink]="invoicesPageRoute" outlined>تمامی فاکتورها</a>
|
<a routerLink pButton [routerLink]="invoicesPageRoute" outlined>تمامی صورتحسابها</a>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #status let-item>
|
<ng-template #status let-item>
|
||||||
|
|||||||
@@ -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() {
|
||||||
@@ -58,7 +47,7 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<ISta
|
|||||||
|
|
||||||
toSinglePage(invoice: IStatisticsSaleInvoicesResponse) {
|
toSinglePage(invoice: IStatisticsSaleInvoicesResponse) {
|
||||||
this.router.navigateByUrl(
|
this.router.navigateByUrl(
|
||||||
consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoice.id),
|
consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoice.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 @@
|
|||||||
import { EntityState, EntityStore } from '@/core/state';
|
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';
|
||||||
@@ -17,11 +17,7 @@ export class ConsumerPosStore extends EntityStore<IPosResponse, ConsumerPosState
|
|||||||
private readonly service = inject(ConsumerPosesService);
|
private readonly service = inject(ConsumerPosesService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,11 +60,7 @@ export class ConsumerPosStore extends EntityStore<IPosResponse, ConsumerPosState
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<shared-dialog
|
||||||
|
header="ویرایش اطلاعات پروفایل"
|
||||||
|
[(visible)]="visible"
|
||||||
|
[modal]="true"
|
||||||
|
[style]="{ width: '500px' }"
|
||||||
|
[closable]="true"
|
||||||
|
(onHide)="close()"
|
||||||
|
>
|
||||||
|
<form [formGroup]="form" (submit)="submit()">
|
||||||
|
@if (profileType === "LEGAL") {
|
||||||
|
<field-company-name [control]="form.controls.company_name" />
|
||||||
|
<field-registration-number [control]="form.controls.registration_number" />
|
||||||
|
} @else {
|
||||||
|
<field-first-name [control]="form.controls.first_name" />
|
||||||
|
<field-last-name [control]="form.controls.last_name" />
|
||||||
|
<field-mobile-number [control]="form.controls.mobile_number" />
|
||||||
|
<field-national-code [control]="form.controls.national_code" />
|
||||||
|
}
|
||||||
|
<app-form-footer-actions [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
|
</form>
|
||||||
|
</shared-dialog>
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||||
|
import {
|
||||||
|
CompanyNameComponent,
|
||||||
|
FirstNameComponent,
|
||||||
|
LastNameComponent,
|
||||||
|
MobileNumberComponent,
|
||||||
|
NationalCodeComponent,
|
||||||
|
RegistrationNumberComponent,
|
||||||
|
SharedDialogComponent,
|
||||||
|
} from '@/shared/components';
|
||||||
|
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||||
|
import { fieldControl } from '@/shared/constants';
|
||||||
|
import { Component, inject, Input } from '@angular/core';
|
||||||
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { IProfileRequestPayload, IProfileResponse } from '../models';
|
||||||
|
import { ProfileService } from '../services/main.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'consumer-profile-form',
|
||||||
|
templateUrl: 'form.component.html',
|
||||||
|
imports: [
|
||||||
|
ReactiveFormsModule,
|
||||||
|
FormFooterActionsComponent,
|
||||||
|
FirstNameComponent,
|
||||||
|
LastNameComponent,
|
||||||
|
NationalCodeComponent,
|
||||||
|
MobileNumberComponent,
|
||||||
|
CompanyNameComponent,
|
||||||
|
RegistrationNumberComponent,
|
||||||
|
SharedDialogComponent,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class ConsumerProfileFormComponent extends AbstractFormDialog<
|
||||||
|
IProfileRequestPayload,
|
||||||
|
IProfileResponse,
|
||||||
|
IProfileRequestPayload
|
||||||
|
> {
|
||||||
|
@Input({ required: true }) profileType!: 'INDIVIDUAL' | 'LEGAL';
|
||||||
|
|
||||||
|
private readonly service = inject(ProfileService);
|
||||||
|
|
||||||
|
initForm = () => {
|
||||||
|
const form = this.fb.group({
|
||||||
|
first_name: fieldControl.first_name(this.initialValues?.first_name),
|
||||||
|
last_name: fieldControl.last_name(this.initialValues?.last_name),
|
||||||
|
mobile_number: fieldControl.mobile_number(this.initialValues?.mobile_number),
|
||||||
|
national_code: fieldControl.national_code(this.initialValues?.national_code),
|
||||||
|
company_name: fieldControl.company_name(this.initialValues?.company_name),
|
||||||
|
registration_number: fieldControl.registration_number(
|
||||||
|
this.initialValues?.registration_number,
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.profileType === 'LEGAL') {
|
||||||
|
// @ts-ignore
|
||||||
|
form.removeControl('first_name');
|
||||||
|
// @ts-ignore
|
||||||
|
form.removeControl('last_name');
|
||||||
|
// @ts-ignore
|
||||||
|
form.removeControl('mobile_number');
|
||||||
|
// @ts-ignore
|
||||||
|
form.removeControl('national_code');
|
||||||
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
|
form.removeControl('company_name');
|
||||||
|
// @ts-ignore
|
||||||
|
form.removeControl('registration_number');
|
||||||
|
}
|
||||||
|
return form;
|
||||||
|
};
|
||||||
|
override form = this.initForm();
|
||||||
|
|
||||||
|
override submitForm(payload: IProfileRequestPayload) {
|
||||||
|
return this.service.updateProfile(payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<app-card-data cardTitle="تغییر رمز عبور" [editable]="false">
|
||||||
|
<form [formGroup]="form" (submit)="submit()" class="mx-auto max-w-lg">
|
||||||
|
<shared-password-input
|
||||||
|
[passwordControl]="form.controls.password"
|
||||||
|
[confirmPasswordControl]="form.controls.confirmPassword" />
|
||||||
|
<button type="submit" pButton [disabled]="form.invalid || loading()" class="mx-auto w-full max-w-xs">
|
||||||
|
تغییر رمز عبور
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</app-card-data>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
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: 'consumer-reset-password-card',
|
||||||
|
templateUrl: './reset-password-card.component.html',
|
||||||
|
imports: [ReactiveFormsModule, AppCardComponent, SharedPasswordInputComponent, ButtonDirective],
|
||||||
|
})
|
||||||
|
export class ConsumerResetPasswordCardComponent {
|
||||||
|
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: 'رمز عبور با موفقیت بهروز شد.' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const baseUrl = '/api/v1/consumer';
|
||||||
|
|
||||||
|
export const CONSUMER_PROFILE_API_ROUTES = {
|
||||||
|
info: () => `${baseUrl}`,
|
||||||
|
updateInfo: () => `${baseUrl}`,
|
||||||
|
resetPassword: () => `${baseUrl}/update-password`,
|
||||||
|
};
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from './apiRoutes';
|
||||||
|
export * from './routes';
|
||||||