Compare commits

..

39 Commits

Author SHA1 Message Date
ahasani 93ebc80da3 feat: enhance sale invoice component with dynamic invoice ID handling and navigation improvements
Production CI / validate-and-build (push) Failing after 1m6s
2026-06-17 14:57:44 +03:30
ahasani 4e4cc08224 feat: enhance invoice handling with success messages and payment data integration
Production CI / validate-and-build (push) Failing after 1m7s
2026-06-17 10:03:06 +03:30
ahasani e5f53c2265 set loading in correction and return form 2026-06-17 09:21:20 +03:30
ahasani b57d6b4e4b set sepas favicon and update many things in correction and shared sale invoice
Production CI / validate-and-build (push) Failing after 1m2s
2026-06-17 08:48:34 +03:30
ahasani ea458c7b72 refactor: update terminology from "مشتری" to "مودی" and "ارایه‌دهنده" to "PSP" across the application
Production CI / validate-and-build (push) Failing after 1m6s
- Updated column headers and labels in various components and constants to reflect the new terminology.
- Changed the titles and placeholders in forms and dialogs to use "مودی" and "PSP".
- Adjusted routing titles and menu items to align with the new naming conventions.
- Refactored related constants and configurations to ensure consistency throughout the application.
2026-06-16 15:47:23 +03:30
ahasani 151eff2f7c set novin tenant
Production CI / validate-and-build (push) Failing after 1m1s
2026-06-16 00:03:02 +03:30
ahasani 1a0c40ecde feat: update apiBaseUrl for TIS tenant environment configuration
Production CI / validate-and-build (push) Failing after 1m1s
2026-06-15 21:43:55 +03:30
ahasani d1dd67aee7 feat: update branding and localization for various components and configurations
Production CI / validate-and-build (push) Failing after 1m15s
2026-06-15 21:36:09 +03:30
ahasani f7f8a91a85 Add branding configuration and assets for Sepehr tenant
Production CI / validate-and-build (push) Failing after 1m2s
- Created branding.config.ts to define branding settings including app title, support contact information, and working hours.
- Added brandingAssets.ts to import and export logo and login images for the Sepehr tenant.
- Introduced config.ts to specify application type as POS for the Sepehr tenant.
2026-06-15 20:36:56 +03:30
ahasani 2c90f8091e feat: replace national_id with economic_code in customer forms and models
Production CI / validate-and-build (push) Failing after 1m1s
2026-06-15 19:34:23 +03:30
ahasani d6aa165592 feat(payment): update payment bridge and form components
- Refactor PosPaymentBridgeAbstract to enforce PosPaymentResult type for emitPaymentResultForTest method.
- Simplify PosPaymentBridgeService by removing commented-out code and improving error handling.
- Replace PosPaymentFormDialogComponent with SharedInvoicePaymentFormDialog in root.component.html for better payment handling.
- Enhance root.component.ts to manage payment form visibility and submission logic.
- Update light-bottomsheet.component.html for improved styling.
- Add new return form features including item removal and total price calculation in returnForm components.
- Introduce new payment form dialog for handling invoice payments with detailed structure and validation.
- Implement payment handling logic in sale-invoice-single-view component to support correction payments.
- Ensure proper integration of payment components in the shared components index.
2026-06-15 17:15:28 +03:30
ahasani 5ee03cf761 feat: update invoice components and add correction payment dialog
Production CI / validate-and-build (push) Failing after 1m1s
- Updated return form instructions for clarity.
- Refined labels in sale invoice info card for consistency.
- Enhanced sale invoice view with a correction payment dialog for increased user interaction.
- Improved invoice print preparation utility for better data handling.
- Adjusted paginator component for first and last page navigation.
- Modified layout styles for better responsiveness and user experience.
- Updated environment configurations for different setups.
2026-06-14 16:33:51 +03:30
ahasani 72954fb5d1 feat: add current password field to change password form and update service payload structure 2026-06-11 17:53:06 +03:30
ahasani b4cd4c05f2 feat: enhance inner pages header with back button functionality and emit event on back click
fix: update total price info handling in correction form and ensure accurate calculations

refactor: streamline sale invoice single view component by extracting info card into a separate component

style: adjust button sizes in payment forms for better UI consistency

feat: implement season picker navigation controls to prevent out-of-bounds selection

fix: improve price formatting utility to handle undefined values gracefully

chore: update environment configuration for API base URL

feat: add navigation service to manage routing history and back navigation
2026-06-11 16:13:48 +03:30
ahasani 88f45eee38 refactor: update labels and translations in various components
Production CI / validate-and-build (push) Failing after 1m2s
- Changed 'تغییر گذرواژه' to 'تغییر رمز عبور' in layout.component.ts
- Updated HTML structure in list.component.html and saleInvoices components for consistency and improved styling.
- Modified sale-invoice-card.component.html to enhance the display of invoice details.
- Adjusted sale-invoice-card.component.ts to handle customer types more effectively.
- Enhanced the handling of invoice statuses in saleInvoices components.
- Improved layout and styling in shop components for better user experience.
- Refactored key-value component for better readability and maintainability.
- Updated upload file component to streamline file selection process.
- Added new styles in customize.scss and psp.scss for consistent UI.
- Adjusted environment configuration for better API endpoint management.
2026-06-09 13:31:48 +03:30
ahasani 5fa07c7ee8 feat: enhance invoice correction form with item editing and price info display 2026-06-08 13:35:58 +03:30
ahasani 788f4023f3 refactor: remove change password form and related service, update root component to use tabs 2026-06-07 14:33:11 +03:30
ahasani 2f67801700 feat: implement change password functionality with dialog and service integration 2026-06-07 13:56:36 +03:30
ahasani cd09b09e3b set ci/cd
Production CI / validate-and-build (push) Failing after 1m5s
2026-06-07 12:45:46 +03:30
ahasani eb39f42b8c feat: add correction and return from sale functionalities to sale invoices
- Added new API routes for correction and return from sale in POS_SALE_INVOICES_API_ROUTES.
- Implemented correction and return from sale methods in PosSaleInvoicesService.
- Updated PosSaleInvoiceStore to include actions for correction and return from sale.
- Enhanced single.component to handle correction and return from sale events.
- Created correction and return from sale forms with appropriate validation and submission logic.
- Updated sale-invoice-single-view component to manage correction and return from sale actions.
- Added models for correction and return from sale requests.
- Improved user interface messages and form handling for better user experience.
2026-06-06 19:52:58 +03:30
ahasani 560b3516e1 feat: add customer selection component for individual and legal customers, update forms to utilize new component 2026-06-05 01:33:37 +03:30
ahasani 694b2ec946 refactor: replace economic code fields with individual and legal variants, add equal length validation 2026-06-03 17:48:54 +03:30
ahasani 8d6fa8860b update input 2026-06-02 13:45:57 +03:30
ahasani 1f9166bed3 some ui fix and debug input field, separate price field 2026-06-02 12:22:32 +03:30
ahasani ae963a60ce update invoice filter and paginator 2026-06-01 16:22:20 +03:30
ahasani d44004d555 update saleinvoice single and create return from sale form, update agent.md file, 2026-06-01 13:53:42 +03:30
ahasani c271a36f7e create invoice settlementStatus catalog and set to single invoice details, update single invoice detail actions 2026-05-31 17:12:43 +03:30
ahasani 4ec6143068 set own datepicker and change فاکتور to صورت‌حساب 2026-05-31 13:54:34 +03:30
ahasani f50219a094 transform pos payload forms to shared 2026-05-31 10:34:43 +03:30
ahasani f2a496134b update tis env 2026-05-30 19:09:08 +03:30
ahasani 90c51edad4 some ui fix 2026-05-30 19:05:23 +03:30
ahasani d678b6c699 debug 2026-05-28 18:27:38 +03:30
ahasani 550db47b88 update sale invoice and payload forms of pos 2026-05-28 16:37:58 +03:30
ahasani 9fdd5e451c update sale invoices models and some ui fix 2026-05-26 12:06:43 +03:30
ahasani eb671d5949 feat: enhance form components with validation and dynamic properties; update payment handling and UI interactions 2026-05-24 19:40:02 +03:30
ahasani cdd2bd6bee refactor: restructure order and payload components for improved functionality
- Updated `PosOrderSectionComponent` to emit `onSubmit` instead of `onSuccess` and removed payment form visibility logic.
- Deleted unused `payload-form.component.html` and `payload-form.component.ts`.
- Introduced `PayloadFormDialogComponent` to handle payload form logic and rapid invoice creation.
- Enhanced `PosGoldPayloadFormComponent` and `PosStandardPayloadFormComponent` to support rapid invoice submissions.
- Added `PosGoodCategoriesComponent` for better category management in the goods view.
- Implemented `FavoriteCTAComponent` for managing favorite goods with loading states.
- Created `PosGoodsGridViewComponent` and `PosGoodsListViewComponent` for displaying goods in grid and list formats respectively.
- Improved UI elements across various components for consistency and better user experience.
2026-05-24 12:42:21 +03:30
ahasani f18d7a1f04 feat: implement change password and send to fiscal activation modules with forms and services 2026-05-24 10:44:35 +03:30
ahasani 12752f37d5 feat: add rapid invoice configuration module with form, service, and integration 2026-05-23 20:25:35 +03:30
ahasani 7f07bf53c2 feat: update environment configurations and add gold price management module with related components and services 2026-05-23 19:57:28 +03:30
400 changed files with 6494 additions and 16355 deletions
+7
View File
@@ -1,2 +1,9 @@
TENANT=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
+7
View File
@@ -3,3 +3,10 @@ DIST_DIR=tis
# TIS_BUILD_DATE=
# TIS_APP_VERSION=
# 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
+34
View File
@@ -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
+44
View File
@@ -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
+2 -2
View File
@@ -42,5 +42,5 @@ testem.log
.DS_Store
Thumbs.db
/false
.env.*
.env
+187 -465
View File
@@ -1,532 +1,254 @@
# AGENT.md
## Purpose
## Scope
- This file defines repository-specific instructions for coding agents.
- Scope is the full repo unless a deeper `AGENT.md` overrides it.
- Use RTK to reduce token usage, avoid repeated context transfer, and preserve repository knowledge across sessions.
Applies to the full repository unless overridden by a deeper `AGENT.md`.
Stack:
- Angular 20
- Standalone components
- pnpm
- Docker
- RTK
---
# ✅ RTK-FIRST RULES (STRICT)
Always prefer RTK commands for repository inspection, navigation, and code understanding.
# RTK RULES (MANDATORY)
## Command Rewrite Rules
Always prefer RTK commands.
Prefer:
Use:
```bash
git status -> rtk git status
git diff -> rtk git diff
git log -> rtk git log
ls -> rtk ls
tree -> rtk ls
cat <file> -> rtk read <file>
grep <pattern> -> rtk grep <pattern>
rg <pattern> -> rtk grep <pattern>
find -> rtk find
```
Avoid raw commands for repository inspection when RTK equivalents exist.
Do not:
- use raw `cat` for large files
- use raw `grep`/`rg` across the repository
- use recursive `find` blindly
- inspect large diffs with raw `git diff`
- scan directories manually before searching
Raw commands are allowed only when:
- RTK cannot perform the operation
- executing builds/tests/runtime commands
- debugging environment/runtime issues
- working outside indexed repository scope
---
# 📂 CODE NAVIGATION WORKFLOW (MANDATORY)
Follow this order when working in the repository.
## 1. Discover Structure
```bash
rtk ls
```
## 2. Search Before Opening Files
```bash
rtk grep <symbol | class | function | DTO | service>
```
Examples:
```bash
rtk grep "InputComponent"
rtk grep "fieldControl"
rtk grep "breadcrumbItems"
```
## 3. Read Only Necessary Files
```bash
rtk read <file>
```
## 4. Large File Strategy
For files larger than ~300 lines:
```bash
rtk read <file> -l aggressive
```
## 5. Fast Context Understanding
```bash
rtk smart <file>
```
Never:
- open many files blindly
- read entire modules without searching first
- inspect unrelated folders
- load generated directories into context
---
# 🧠 DIFF INSPECTION RULES
For repository changes use:
```bash
rtk git diff
```
For large diffs:
```bash
rtk git diff -l aggressive
```
- `rtk ls`
- `rtk grep`
- `rtk smart`
- `rtk read`
- `rtk git diff`
- `rtk git status`
Avoid raw:
- `cat`
- `grep`
- `rg`
- `tree`
- `git diff`
- recursive `find`
```bash
git diff
```
unless RTK diff is unavailable.
Use raw shell only for:
- builds
- runtime/debugging
- Docker
- pnpm
- commands RTK cannot perform
---
# 🚫 LOW-VALUE PATHS
# FILE READING POLICY
Avoid loading:
Preferred order:
```txt
dist/
.angular/
coverage/
node_modules/
.git/
.cache/
.tmp/
```
1. `rtk grep`
2. `rtk smart`
3. `rtk read`
unless explicitly required.
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`
---
# RTK Usage Rules
# ANGULAR WORKFLOW
## Required RTK Usage
For components:
- Always use RTK for:
- repository indexing
- semantic code search
- symbol lookup
- dependency tracing
- architectural context
- change impact analysis
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
- Prefer RTK context retrieval over:
- reading large files entirely
- repeatedly scanning unchanged directories
- re-sending full file contents
- broad grep operations
- Retrieve only the minimal relevant context before making changes.
## Recommended RTK Workflow
1. Index repository
2. Search related symbols/files/components
3. Retrieve minimal context
4. Apply scoped changes
5. Validate impacted areas only
Example workflow:
```bash
rtk index
rtk search "InputComponent number normalization"
rtk search "fieldControl"
rtk refs "goodListConfig"
```
## Token Reduction Rules
- Never load entire large files unless required.
- Never inspect generated folders (`dist`, `.angular`, coverage, etc.).
- Prefer symbol-level retrieval over file-level retrieval.
- Reuse previously retrieved RTK context whenever possible.
- Avoid duplicate searches for the same symbols within one task.
- Use targeted searches:
- component name
- selector
- signal/store name
- config constant
- Angular route
- injected service
- form control key
## Suggested RTK Queries
### Angular Components
```bash
rtk search "selector: 'field-"
rtk search "standalone: true"
rtk search "InputComponent"
```
### Forms & Controls
```bash
rtk search "fieldControl."
rtk search "ControlConfig"
rtk search "Validators.required"
```
### Stores & Signals
```bash
rtk search "breadcrumbItems"
rtk search "computed("
rtk search "signal("
```
### Tenant / Docker
```bash
rtk search "DIST_DIR"
rtk search "configuration tis"
rtk search "prebuild:tis"
```
### List Configs
```bash
rtk search "IListConfig"
rtk search "columns:"
rtk search "goodListConfig"
```
Avoid broad module inspection.
---
## Stack Context
# TOKEN RULES
- Frontend: Angular 20 standalone app.
- Package manager: `pnpm`.
- Deployment: Docker / Docker Compose with tenant-specific services.
- AI-assisted repository navigation: RTK.
Do not:
- dump large files
- scan unrelated folders
- inspect generated directories
- perform repeated searches
- over-explain edits
### Current service mapping expectation
- `app_default` on host port `8090`
- `app_tis` on host port `8091`
Avoid:
- `dist/`
- `.angular/`
- `coverage/`
- `node_modules/`
- `.git/`
---
## Tenant Build Rules
# CHANGE POLICY
- `default` tenant currently builds via `ng build` and outputs to `dist/production`.
- `tis` tenant builds via `ng build --configuration tis` and outputs to `dist/tis`.
- `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.
- Keep changes minimal and scoped.
- Reuse existing patterns.
- Avoid unrelated refactors.
- Preserve tenant separation.
- Prefer root-cause fixes.
---
## Tenant PWA Rules
# PROJECT RULES
- Keep tenant manifest files under tenant public assets (e.g. `public-tis/favicon/site.webmanifest`).
- 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.
## Tenant Builds
- `default``dist/production`
- `tis``dist/tis`
Keep Docker `DIST_DIR` aligned with Angular output.
Do not use Angular `fileReplacements` for static assets.
---
## Input Component Rules
## Input Component
File:
- `src/app/shared/components/input/input.component.ts`
For:
- `type === 'number'`
- `type === 'price'`
- `type="number"`
- `type="price"`
Requirements:
- Normalize Persian/Arabic digits to English digits.
- Allow only digits and `.`.
- Support `fixed` precision formatting when provided.
Additional rule:
- Keep behavior for identifier fields (`mobile`, `phone`, `postalCode`, `nationalId`) string-safe.
- normalize Persian/Arabic digits
- allow only digits and `.`
- support fixed precision
- keep identifier fields string-safe
---
## Change Policy
## Shared Field Rules
- Keep changes minimal and scoped to user request.
- Prefer root-cause fixes over temporary workarounds.
- Avoid unrelated refactors.
- Reuse existing patterns and naming conventions.
- Use RTK to understand existing patterns before introducing new ones.
When creating fields:
- use shared field wrappers
- reuse `app-input`
- register exports in shared indexes
- keep control names consistent
---
## Do / Don't
# VALIDATION
### Do
TypeScript:
- `pnpm -s exec tsc -p tsconfig.app.json --noEmit`
- Follow existing field wrapper style in:
- `src/app/shared/components/fields/*.component.ts`
- Reuse `app-input` and set only required props:
- `type`
- `label`
- `name`
- constraints
- Register every new field in:
- `src/app/shared/components/fields/index.ts`
- `src/app/shared/constants/fields/index.ts`
- Keep control keys consistent across:
- form group
- field component `name`
- `fieldControl` key
- Use RTK searches before creating new abstractions.
Docker:
- `docker compose build app_default`
- `docker compose build app_tis`
### Don't
- 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`.
- Don't scan unrelated folders/files when RTK can retrieve exact symbols.
- Don't load full files if RTK symbol extraction is sufficient.
Validate only impacted areas when possible.
---
## How To Create Form Fields
# FINAL RESPONSE RULES
- Create a wrapper component in:
- `src/app/shared/components/fields`
- Use the same pattern as existing files like:
- `src/app/shared/components/fields/name.component.ts`
- `src/app/shared/components/fields/unit_price.component.ts`
Minimal wrapper shape:
```ts
@Component({
selector: 'field-example',
template: `<app-input [label]="label" [control]="control" [name]="name" type="simple" />`,
imports: [ReactiveFormsModule, InputComponent],
})
export class ExampleComponent {
@Input({ required: true }) control = new FormControl<string>('');
@Input() name = 'example';
@Input() label = 'Example';
}
```
---
## Register New Fields
Export the component from:
- `src/app/shared/components/fields/index.ts`
Add its form control factory in:
- `src/app/shared/constants/fields/index.ts`
`fieldControl` entry shape:
- key must match form control name
- return tuple: `[defaultValue, validators]`
Example:
```ts
example: (value = '', isRequired = true): ControlConfig => [
value,
isRequired ? [Validators.required] : [],
],
```
---
## Using Fields In Forms
- In form group builders, use:
- `fieldControl.<key>(initialValue, isRequired)`
- In templates, render matching wrapper component and pass matching control:
- `<field-example [control]="form.controls.example" />`
- For numeric/price behavior:
- use `app-input`
- use `type="number"` or `type="price"`
- optional `[fixed]`
---
## List Component Configs
Centralized list metadata is stored in:
- `src/app/shared/constants/list-configs/`
Never store configs inside domain modules.
### Structure
Structure by data type, not domain:
- `good-list.const.ts`
- `sku-list.const.ts`
- `category-list.const.ts`
### Requirements
Each config implements `IListConfig`:
- `pageTitle`
- `addNewCtaLabel`
- `emptyPlaceholderTitle`
- `emptyPlaceholderDescription`
- `columns`
### Usage
```ts
@Input() header: IColumn[] = goodListConfig.columns;
listConfig = goodListConfig;
```
### Rules
- Any domain needing a list config imports from:
- `@/shared/constants/list-configs`
- No cross-domain dependencies.
- Do not duplicate configs.
---
## Breadcrumb Usage in Stores & Views
- Entity stores expose `breadcrumbItems` as a computed signal.
- 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-only changes
```bash
pnpm -s exec tsc -p tsconfig.app.json --noEmit
```
### Docker/build changes
```bash
docker compose build app_default
docker compose build app_tis
```
### Validation Strategy
- Start with targeted validation.
- Run broader checks only if needed.
- Validate only impacted tenants/features when possible.
---
## Communication Expectations
- Report exactly which files changed and why.
- Call out assumptions and discovered config mismatches.
- If validation is blocked:
- explain why
- provide next command
- Mention RTK searches/symbols used when relevant to implementation decisions.
---
## Preferred Investigation Order
Before editing code:
1. RTK symbol search
2. Existing implementation discovery
3. Shared abstraction verification
4. Minimal scoped change
5. Targeted validation
Avoid:
- broad exploratory reads
- repeated file dumping
- unnecessary context expansion
---
## Angular Architecture Preferences
- Prefer standalone components.
- Prefer signals/computed over legacy observable-only state when consistent with current architecture.
- Keep forms typed.
- Keep reusable UI in `shared`.
- Keep domain logic outside presentation components.
- Preserve existing tenant separation model.
---
## Performance & AI Efficiency
- Optimize for:
- minimal token usage
- minimal file reads
- scoped context retrieval
- reusable architectural understanding
Keep final responses under 10 lines unless:
- validation failed
- architecture changed
- user requested explanation
Prefer:
- RTK symbol search
- targeted reads
- incremental inspection
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:
- dumping full files
- repeated repository scans
- repeated searches for the same symbols
- unnecessary architectural exploration
- opening 400+ line files for small edits
- RTK should be the primary repository understanding tool.
# 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.
+113 -8
View File
@@ -51,6 +51,54 @@
"optimization": false,
"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": {
"budgets": [
{
@@ -81,6 +129,54 @@
"outputHashing": "all",
"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": {
"extractLicenses": true,
"fileReplacements": [
@@ -135,7 +231,11 @@
}
],
"outputHashing": "all",
"outputPath": "dist/tis"
"outputPath": "dist/tis",
"styles": [
"src/assets/styles.scss",
"src/assets/psp.scss"
]
},
"tis-development": {
"assets": [
@@ -182,7 +282,11 @@
"optimization": false,
"outputHashing": "all",
"outputPath": "dist/tis",
"sourceMap": true
"sourceMap": true,
"styles": [
"src/assets/styles.scss",
"src/assets/psp.scss"
]
}
},
"defaultConfiguration": "production",
@@ -190,8 +294,7 @@
"allowedCommonJsDependencies": [
"dayjs",
"dayjs/locale/fa",
"dayjs/plugin/relativeTime",
"flatpickr-wrap/dist/l10n/fa.js"
"dayjs/plugin/relativeTime"
],
"assets": [
{
@@ -209,8 +312,6 @@
".webp": "file"
},
"styles": [
"node_modules/flatpickr-wrap/dist/flatpickr.css",
"node_modules/flatpickr-wrap/dist/themes/confetti.css",
"src/assets/styles.scss"
],
"tsConfig": "tsconfig.app.json"
@@ -225,9 +326,15 @@
"development": {
"buildTarget": "pos.client:build:development"
},
"novin": {
"buildTarget": "pos.client:build:novin"
},
"production": {
"buildTarget": "pos.client:build:production"
},
"sepehr": {
"buildTarget": "pos.client:build:sepehr"
},
"staging": {
"buildTarget": "pos.client:build:staging"
},
@@ -252,8 +359,6 @@
"inlineStyleLanguage": "scss",
"karmaConfig": "karma.conf.js",
"styles": [
"node_modules/flatpickr-wrap/dist/flatpickr.css",
"node_modules/flatpickr-wrap/dist/themes/confetti.css",
"src/assets/styles.scss"
],
"tsConfig": "tsconfig.spec.json"
-12993
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -13,6 +13,29 @@ services:
- "8091:8090"
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:
build:
context: .
+4 -3
View File
@@ -12,12 +12,9 @@
"@primeng/themes": "^20.4.0",
"@primeuix/themes": "^1.2.5",
"@tailwindcss/postcss": "^4.2.3",
"@zoomit/dayjs-jalali-plugin": "^0.1.11",
"angularx-qrcode": "20.0.0",
"chart.js": "4.4.2",
"dayjs": "^1.11.20",
"flatpickr": "^4.6.13",
"flatpickr-wrap": "^1.0.0",
"jalaliday": "^3.1.1",
"jest-editor-support": "32.0.0-beta.1",
"ngx-cookie-service": "^21.3.1",
@@ -59,10 +56,14 @@
"private": true,
"scripts": {
"build": "ng build",
"build:novin": "ng build --configuration novin",
"build:sepehr": "ng build --configuration sepehr",
"build:tis": "ng build --configuration tis",
"ng": "ng",
"prestart": "node aspnetcore-https",
"start": "run-script-os",
"start:novin": " ng serve --configuration novin",
"start:sepehr": " ng serve --configuration sepehr",
"start:tis": " ng serve --configuration tis",
"test": "ng test",
"watch": "ng build --watch --configuration development"
+1 -32
View File
@@ -44,9 +44,6 @@ importers:
'@tailwindcss/postcss':
specifier: ^4.2.3
version: 4.2.3
'@zoomit/dayjs-jalali-plugin':
specifier: ^0.1.11
version: 0.1.11
angularx-qrcode:
specifier: 20.0.0
version: 20.0.0(@angular/core@20.3.19(@angular/compiler@20.3.19)(rxjs@7.8.2))
@@ -56,12 +53,6 @@ importers:
dayjs:
specifier: ^1.11.20
version: 1.11.20
flatpickr:
specifier: ^4.6.13
version: 4.6.13
flatpickr-wrap:
specifier: ^1.0.0
version: 1.0.0
jalaliday:
specifier: ^3.1.1
version: 3.1.1(dayjs@1.11.20)
@@ -2817,9 +2808,6 @@ packages:
'@yarnpkg/lockfile@1.1.0':
resolution: {integrity: sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==}
'@zoomit/dayjs-jalali-plugin@0.1.11':
resolution: {integrity: sha512-xqbrBPRoBhbaAWeLbqq9QERZwj+h2KuJMehpOQrlT4y980oA+rdiF/YzXlzVaIvc845UYDrsTp8IDwttWyV/xg==}
abbrev@4.0.0:
resolution: {integrity: sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA==}
engines: {node: ^20.17.0 || >=22.9.0}
@@ -3956,12 +3944,6 @@ packages:
resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==}
hasBin: true
flatpickr-wrap@1.0.0:
resolution: {integrity: sha512-ctthNBZyDJe1P2fpLF7N7ivwDQGkWAAr7R5BLZ2BSlz9O+w4NEc68M7FNvK/UPUPNj3FQ2pGV8UNZV/9WBU9/Q==}
flatpickr@4.6.13:
resolution: {integrity: sha512-97PMG/aywoYpB4IvbvUJi0RQi8vearvU0oov1WW3k0WZPBMrTQVqekSX5CjSG/M4Q3i6A/0FKXC7RyAoAUUSPw==}
flatted@3.4.2:
resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==}
@@ -4229,7 +4211,7 @@ packages:
engines: {node: '>=0.10.0'}
iconv-lite@0.7.2:
resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==}
resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==, tarball: https://hub.megan.ir/repository/npm/iconv-lite/-/iconv-lite-0.7.2.tgz}
engines: {node: '>=0.10.0'}
icss-utils@5.1.0:
@@ -5085,9 +5067,6 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
native-date-adapter@1.0.3:
resolution: {integrity: sha512-WXA6496dHy79BS35CWbeBha1A1QV5LjezaTA5bFWV3LXrwiRT9YXE5LJc+SSEgbN7QHz++xJnjhMHZAXMKIqAg==}
natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
@@ -9450,8 +9429,6 @@ snapshots:
'@yarnpkg/lockfile@1.1.0': {}
'@zoomit/dayjs-jalali-plugin@0.1.11': {}
abbrev@4.0.0: {}
abort-controller@3.0.0:
@@ -10884,12 +10861,6 @@ snapshots:
flat@5.0.2: {}
flatpickr-wrap@1.0.0:
dependencies:
native-date-adapter: 1.0.3
flatpickr@4.6.13: {}
flatted@3.4.2: {}
follow-redirects@1.16.0(debug@4.4.3):
@@ -12106,8 +12077,6 @@ snapshots:
nanoid@3.3.11: {}
native-date-adapter@1.0.3: {}
natural-compare@1.4.0: {}
needle@3.5.0:
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 94 KiB

+36
View File
@@ -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"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

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"
}
+36
View File
@@ -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"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

+2 -2
View File
@@ -28,9 +28,9 @@
}
],
"id": "/",
"name": "نرم افزار صورت‌حساب‌های مالیاتی پاژن",
"name": "نرم افزار صورت‌حساب‌های مالیاتی سپاس",
"scope": "/",
"short_name": "پاژن",
"short_name": "سپاس",
"start_url": "/",
"theme_color": "#ffffff"
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+8 -4
View File
@@ -1,24 +1,28 @@
import { NavigationService } from '@/core/services/navigation.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 { RouterModule } from '@angular/router';
import { ConfirmDialog } from 'primeng/confirmdialog';
import { ToastModule } from 'primeng/toast';
import { brandingConfig } from './app/branding/branding.config';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterModule, ToastModule, ConfirmDialog],
imports: [RouterModule, ToastModule, ConfirmationDialogComponent],
template: `
<p-toast [position]="toastPosition" [baseZIndex]="3000" />
<p-confirmDialog />
<app-shared-confirmation-dialog />
<router-outlet />
`,
})
export class AppComponent {
toastPosition: 'top-center' | 'bottom-right' = 'bottom-right';
constructor(private readonly pwaInstallService: PwaInstallService) {
constructor(
private readonly pwaInstallService: PwaInstallService,
private readonly navigationService: NavigationService
) {
this.updateToastPosition();
if (brandingConfig.enableInstallPrompt) {
this.pwaInstallService.init();
+9 -3
View File
@@ -12,7 +12,7 @@ import {
withInterceptors,
withInterceptorsFromDi,
} 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 {
provideRouter,
@@ -34,7 +34,7 @@ export const appConfig: ApplicationConfig = {
anchorScrolling: 'enabled',
scrollPositionRestoration: 'enabled',
}),
withEnabledBlockingInitialNavigation(),
withEnabledBlockingInitialNavigation()
),
provideZonelessChangeDetection(),
// configure HttpClient once: enable fetch and register both functional
@@ -42,6 +42,12 @@ export const appConfig: ApplicationConfig = {
provideAnimationsAsync(),
// ensure PrimeNG uses our preset (applies css variables at app initialization)
providePrimeNG({
zIndex: {
tooltip: 2100,
menu: 2000,
overlay: 2000,
modal: 1100,
},
theme: {
preset: MyPreset,
options: { darkModeSelector: '.app-dark' },
@@ -72,7 +78,7 @@ export const appConfig: ApplicationConfig = {
provideHttpClient(
withFetch(),
withInterceptors([loggingInterceptor, authInterceptor, errorInterceptor, dedupInterceptor]),
withInterceptorsFromDi(),
withInterceptorsFromDi()
),
// provideServiceWorker('ngsw-worker.js', {
// enabled: !isDevMode(),
@@ -68,6 +68,13 @@ export class FormErrorsService {
const info = errors['invalidUsername'];
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'];
+10 -9
View File
@@ -73,21 +73,21 @@ export class NativeBridgeService {
}
pay(request: INativePayRequest): any {
if (request.amount <= 10_000) {
const errorMessage = 'برای مقادیر زیر ۱۰۰ هزار ریال، پرداخت ممکن نیست.';
this.toastService.warn({ text: errorMessage, life: 3000 });
return {
success: false,
error: errorMessage,
};
}
// if (request.amount <= 1_000) {
// const errorMessage = 'برای مقادیر زیر ۱۰ هزار ریال، پرداخت ممکن نیست.';
// this.toastService.warn({ text: errorMessage, life: 3000 });
// return {
// success: false,
// error: errorMessage,
// };
// }
this.toastService.info({ text: 'در حال پردازش پرداخت...' });
try {
// @ts-ignore
window.NativeBridge.pay(request.amount, request.id || '');
return { success: true };
} catch (error) {
this.toastService.info({ text: (error as Error).message });
// this.toastService.info({ text: (error as Error).message });
return { success: false, error: (error as Error).message };
}
// const fn = window.NativeBridge.pay(123, 'test');
@@ -135,6 +135,7 @@ export class NativeBridgeService {
this.toastService.info({ text: 'در حال چاپ ...' });
// @ts-ignore
window.NativeBridge.print(JSON.stringify(payload));
return { success: true };
} catch (error) {
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);
}
}
}
+8
View File
@@ -10,10 +10,18 @@ interface IToast extends Pick<ToastMessageOptions, 'sticky' | 'life'> {
providedIn: 'root',
})
export class ToastService {
private readonly dedupeWindowMs = 2000;
private readonly recentMessages = new Map<string, number>();
constructor(private messageService: MessageService) {}
add(message: ToastMessageOptions) {
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);
}
+8 -3
View File
@@ -1,5 +1,6 @@
import { inject, Injectable } from '@angular/core';
import { Router } from '@angular/router';
import config from 'src/config';
import { AuthService } from '../../services/auth.service';
import { BaseState, BaseStore } from '../base-store';
@@ -123,7 +124,7 @@ export class GlobalStore extends BaseStore<GlobalState> {
readonly isOnline = this.computed((state) => state.isOnline);
readonly notifications = this.computed((state) => state.notifications);
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 preferences = this.computed((state) => state.preferences);
@@ -144,7 +145,11 @@ export class GlobalStore extends BaseStore<GlobalState> {
}
// 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) {
this.patchState({ theme: savedTheme });
}
@@ -250,7 +255,7 @@ export class GlobalStore extends BaseStore<GlobalState> {
*/
markNotificationRead(id: string): void {
const notifications = this._state().notifications.map((n) =>
n.id === id ? { ...n, read: true } : n,
n.id === id ? { ...n, read: true } : n
);
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
View File
@@ -1,3 +1,4 @@
export * from './equalLength.validator';
export * from './fiscal-id.validator';
export * from './greater.validator';
export * from './iban.validator';
@@ -10,7 +10,7 @@ export const columns: IColumn[] = [
{ field: 'device', header: 'دستگاه', type: 'nested', nestedOption: { path: 'device.name' } },
{
field: 'provider',
header: 'ارایه‌دهنده',
header: 'PSP',
type: 'nested',
nestedOption: { path: 'provider.name' },
},
@@ -18,12 +18,12 @@ export const CONSUMER_MENU_ITEMS = [
routerLink: ['/consumer/poses'],
},
{
label: 'فاکتورها',
label: 'صورت‌حساب‌',
icon: 'pi pi-fw pi-receipt',
routerLink: ['/consumer/sale_invoices'],
},
{
label: 'مشتری‌ها',
label: 'مشتری',
icon: 'pi pi-fw pi-users',
routerLink: ['/consumer/customers'],
},
@@ -1,16 +1,14 @@
<shared-dialog
header="ویرایش گذرواژه"
header="تغییر رمز عبور"
[(visible)]="visible"
[modal]="true"
[style]="{ width: '500px' }"
[closable]="true"
(onHide)="close()"
>
(onHide)="close()">
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<shared-password-input
[passwordControl]="form.controls.password"
[confirmPasswordControl]="form.controls.confirmPassword"
/>
[confirmPasswordControl]="form.controls.confirmPassword" />
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
</form>
@@ -1,15 +1,15 @@
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="مدیریت سطح دسترسی">
@if (isOwner()) {
<div class="py-20 flex items-center justify-center">
<div class="flex items-center justify-center py-20">
کاربر با سطح Owner به تمامی سطوح دسترسی داشته و قابل ویرایش نمی‌باشد
</div>
} @else if (loading()) {
<div class="py-20 flex items-center justify-center">
<div class="flex items-center justify-center py-20">
<p-progressSpinner />
</div>
} @else if (permissions()) {
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<p-message severity="secondary"> پیام مفهومی برای مشخص کردن نوع دسترسی دادن</p-message>
@for (pos of permissions()?.poses; track $index) {
<div class="flex items-center gap-4">
@@ -1,4 +1,4 @@
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
<div class="flex flex-col gap-4">
<div class="listKeyValue">
@@ -4,11 +4,10 @@
[modal]="true"
[style]="{ width: '500px' }"
[closable]="true"
(onHide)="close()"
>
(onHide)="close()">
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<field-name [control]="form.controls.name" />
<field-economic-code [control]="form.controls.economic_code" />
<field-individual-economic-code [control]="form.controls.economic_code" />
<field-fiscal-id [control]="form.controls.fiscal_id" />
<field-partner-token [control]="form.controls.partner_token" />
<field-invoice-number-sequence [control]="form.controls.invoice_number_sequence" [min]="1" />
@@ -1,7 +1,7 @@
import { AbstractFormDialog } from '@/shared/abstractClasses';
import {
EconomicCodeComponent,
FiscalIdComponent,
IndividualEconomicCodeComponent,
NameComponent,
PartnerTokenComponent,
} from '@/shared/components';
@@ -22,7 +22,7 @@ import { BusinessActivitiesService } from '../services/main.service';
SharedDialogComponent,
FormFooterActionsComponent,
NameComponent,
EconomicCodeComponent,
IndividualEconomicCodeComponent,
PartnerTokenComponent,
InvoiceNumberSequenceComponent,
FiscalIdComponent,
@@ -37,11 +37,11 @@ export class ConsumerBusinessActivityFormComponent extends AbstractFormDialog<
form = this.fb.group({
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 || ''),
partner_token: fieldControl.partner_token(this.initialValues?.partner_token || ''),
invoice_number_sequence: fieldControl.invoice_number_sequence(
this.initialValues?.invoice_number_sequence || 1,
this.initialValues?.invoice_number_sequence || 1
),
});
@@ -4,14 +4,13 @@
[modal]="true"
[style]="{ width: '500px' }"
[closable]="true"
(onHide)="close()"
>
(onHide)="close()">
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<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-device-id [control]="form.controls.device_id" />
<field-provider-id [control]="form.controls.provider_id" />
@@ -22,8 +21,7 @@
<field-username [control]="form.controls.username" />
<shared-password-input
[passwordControl]="form.controls.password"
[confirmPasswordControl]="form.controls.confirmPassword"
/>
[confirmPasswordControl]="form.controls.confirmPassword" />
}
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
@@ -4,7 +4,6 @@ import { AbstractFormDialog } from '@/shared/abstractClasses';
import {
DeviceIdComponent,
NameComponent,
PosTypeComponent,
ProviderIdComponent,
SerialNumberComponent,
SharedPasswordInputComponent,
@@ -29,7 +28,6 @@ import { ConsumerPosesService } from '../../services/poses.service';
FormFooterActionsComponent,
DeviceIdComponent,
ProviderIdComponent,
PosTypeComponent,
SerialNumberComponent,
UsernameComponent,
Divider,
@@ -46,7 +44,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
initForm = () => {
const form = this.fb.group({
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 || ''),
device_id: fieldControl.device_id(this.initialValues?.device?.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>('', {
nonNullable: true,
validators: fieldControl.username('')[1],
}),
})
);
// @ts-ignore
form.addControl(
@@ -104,7 +102,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
this.fb.control<string>('', {
nonNullable: true,
validators: [Validators.required],
}),
})
);
// @ts-ignore
form.addControl(
@@ -112,7 +110,7 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
this.fb.control<string>('', {
nonNullable: true,
validators: [Validators.required],
}),
})
);
form.addValidators([MustMatch('password', 'confirmPassword')]);
}
@@ -1,5 +1,5 @@
<app-page-data-list
pageTitle="لیست پایانه‌های فروش"
pageTitle="پایانه‌های فروش"
[columns]="columns"
[addNewCtaLabel]="'افزودن پایانه فروش'"
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
@@ -12,8 +12,7 @@
(onAdd)="openAddForm()"
(onEdit)="onEditClick($event)"
(onDetails)="toSinglePage($event)"
(onRefresh)="refresh()"
>
(onRefresh)="refresh()">
</app-page-data-list>
<consumer-pos-form
[(visible)]="visibleForm"
@@ -22,5 +21,4 @@
[complexId]="complexId"
[posId]="selectedItemForEdit()?.id || ''"
[initialValues]="selectedItemForEdit() || undefined"
(onSubmit)="refresh()"
/>
(onSubmit)="refresh()" />
@@ -7,7 +7,7 @@ import {
} from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { consumerPosesNamedRoutes } from '../../constants/routes/poses';
import { consumerComplexPosesNamedRoutes } from '../../constants/routes/poses';
import { IPosResponse } from '../../models';
import { ConsumerPosesService } from '../../services/poses.service';
import { ConsumerPosFormComponent } from './form.component';
@@ -36,7 +36,7 @@ export class ConsumerPosesComponent extends AbstractList<IPosResponse> {
toSinglePage(item: IPosResponse) {
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
pageTitle="لیست فاکتور‌ها"
[pageTitle]="'صورت‌حساب‌ها'"
[columns]="columns"
emptyPlaceholderTitle="تا به حال فاکتور فروشی توسط این پایانه ایجاد نشده است."
emptyPlaceholderTitle="صورت‌حسابی یافت نشد"
[items]="items()"
[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>
@@ -1,47 +1,52 @@
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
import {
IColumn,
PageDataListComponent,
} 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 { ConsumerSalesInvoicesService } from '../../services/invoices.service';
@Component({
selector: 'consumer-salesInvoices-list',
templateUrl: './list.component.html',
imports: [PageDataListComponent],
imports: [PageDataListComponent, CatalogTaxProviderStatusTagComponent],
})
export class ConsumerSalesInvoicesComponent extends AbstractList<ISalesInvoicesResponse> {
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
@Input({ required: true }) complexId!: string;
@Input({ required: true }) posId!: string;
@Input() fullHeight?: boolean;
@Input() header: IColumn[] = [
// { 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',
},
];
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
private readonly service = inject(ConsumerSalesInvoicesService);
private readonly router = inject(Router);
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() {
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) =>
`/consumer/business_activities/${businessId}/complexes/${complexId}/poses`;
export const consumerPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
export const consumerComplexPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
poses: {
path: 'poses',
loadComponent: () =>
@@ -31,17 +31,17 @@ export const consumerPosesNamedRoutes: NamedRoutes<TPosesRouteNames> = {
};
export const CONSUMER_POSES_ROUTES: Routes = [
consumerPosesNamedRoutes.poses,
consumerComplexPosesNamedRoutes.poses,
{
path: consumerPosesNamedRoutes.pos.path,
path: consumerComplexPosesNamedRoutes.pos.path,
loadComponent: () =>
import('../../components/poses/layout.component').then(
(m) => m.SuperAdminConsumerPosLayoutComponent,
(m) => m.SuperAdminConsumerPosLayoutComponent
),
children: [
{
path: '',
loadComponent: consumerPosesNamedRoutes.pos.loadComponent,
loadComponent: consumerComplexPosesNamedRoutes.pos.loadComponent,
},
],
},
@@ -1,11 +1,15 @@
import ISummary from '@/core/models/summary';
import { TCustomerInfo, TPosOrderGoodPayload } from '@/domains/pos/modules/shop/models';
import { TspProviderResponseStatus } from '@/shared/catalog';
import { IEnumTranslate } from '@/shared/models';
export interface ISalesInvoicesRawResponse {
id: string;
invoice_number: string;
code: string;
invoice_date: string;
total_amount: string;
status: IEnumTranslate<TspProviderResponseStatus>;
items: Item[];
payments: Payment[];
customer?: TCustomerInfo;
@@ -54,7 +54,7 @@ export class BusinessActivityStore extends EntityStore<
catchError((error) => {
this.setError(error);
throw error;
}),
})
)
.subscribe((entity) => {
this.patchState({ entity });
@@ -2,7 +2,7 @@ import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
import { computed, inject, Injectable } from '@angular/core';
import { MenuItem } from 'primeng/api';
import { catchError, finalize } from 'rxjs';
import { consumerPosesNamedRoutes } from '../constants/routes/poses';
import { consumerComplexPosesNamedRoutes } from '../constants/routes/poses';
import { IPosResponse } from '../models';
import { ConsumerPosesService } from '../services/poses.service';
@@ -28,12 +28,16 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
this.patchState({
breadcrumbItems: [
{
...consumerPosesNamedRoutes.poses.meta,
routerLink: consumerPosesNamedRoutes.poses.meta.pagePath!(businessId, complexId),
...consumerComplexPosesNamedRoutes.poses.meta,
routerLink: consumerComplexPosesNamedRoutes.poses.meta.pagePath!(businessId, complexId),
},
{
title: this.entity()?.name,
routerLink: consumerPosesNamedRoutes.pos.meta.pagePath!(businessId, complexId, posId),
routerLink: consumerComplexPosesNamedRoutes.pos.meta.pagePath!(
businessId,
complexId,
posId
),
},
],
});
@@ -50,7 +54,7 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
catchError((error) => {
this.setError(error);
throw error;
}),
})
)
.subscribe((entity) => {
this.patchState({ entity });
@@ -1,4 +1,4 @@
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="اطلاعات شعبه" [editable]="true" [(editMode)]="editMode">
<div class="flex flex-col gap-4">
<div class="listKeyValue">
@@ -17,6 +17,5 @@
[businessActivityId]="businessId()"
[complexId]="complexId()"
[initialValues]="complex() || undefined"
(onSubmit)="getData()"
/>
(onSubmit)="getData()" />
</div>
@@ -4,7 +4,7 @@ import pageParamsUtils from '@/utils/page-params.utils';
import { Component, computed, inject, signal } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
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 { ConsumerComplexStore } from '../../store/complex.store';
@@ -32,10 +32,10 @@ export class ConsumerPosListPageComponent {
...this.businessStore.breadcrumbItems(),
...this.complexStore.breadcrumbItems(),
{
title: consumerPosesNamedRoutes.poses.meta.title,
routerLink: consumerPosesNamedRoutes.poses.meta.pagePath!(
title: consumerComplexPosesNamedRoutes.poses.meta.title,
routerLink: consumerComplexPosesNamedRoutes.poses.meta.pagePath!(
this.businessId(),
this.complexId(),
this.complexId()
),
},
]);
@@ -1,5 +1,5 @@
<div class="flex flex-col gap-6">
<app-card-data cardTitle="اطلاعات پایانه‌ فروش" [editable]="true" [(editMode)]="editMode">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="اطلاعات پایانه‌ فروش" [backRoute]="backRoute()" [editable]="true" [(editMode)]="editMode">
<ng-template #moreActions>
<p-button type="button" variant="outlined" size="small" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
</ng-template>
@@ -10,7 +10,7 @@
<app-key-value label="شماره سریال" [value]="pos()?.serial_number" />
<app-key-value label="نوع دستگاه" [value]="pos()?.device?.name" />
<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>
</app-card-data>
@@ -24,6 +24,5 @@
[complexId]="complexId()"
[posId]="posId()"
[initialValues]="pos() || undefined"
(onSubmit)="getData()"
/>
(onSubmit)="getData()" />
</div>
@@ -8,6 +8,7 @@ import { Button } from 'primeng/button';
import { COOKIE_KEYS } from 'src/assets/constants';
import { ConsumerPosFormComponent } from '../../components/poses/form.component';
import { ConsumerSalesInvoicesComponent } from '../../components/salesInvoices/list.component';
import { consumerComplexPosesNamedRoutes } from '../../constants/routes/poses';
import { BusinessActivityStore } from '../../store/businessActivity.store';
import { ConsumerComplexStore } from '../../store/complex.store';
import { PosStore } from '../../store/pos.store';
@@ -38,6 +39,11 @@ export class ConsumerComplexPosPageComponent {
readonly posId = signal<string>(this.pageParams()['posId']!);
editMode = signal<boolean>(false);
backRoute = computed(
() =>
`${consumerComplexPosesNamedRoutes.poses.meta.pagePath!(this.businessId(), this.complexId())}`
);
constructor() {
effect(() => {
if (this.pos()?.id) {
@@ -59,7 +65,7 @@ export class ConsumerComplexPosPageComponent {
sameSite: 'Lax', // or 'Strict' for same-site requests only
secure: false,
path: '/',
domain: 'localhost',
domain: window.location.hostname,
});
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">
<ng-template #moreActions>
<a routerLink pButton [routerLink]="goodsPageRoute()" outlined size="small">مدیریت کالاها</a>
@@ -25,6 +25,5 @@
[editMode]="true"
[businessId]="businessId()"
[initialValues]="business() || undefined"
(onSubmit)="getData()"
/>
(onSubmit)="getData()" />
</div>
@@ -1,5 +1,5 @@
<app-page-data-list
[pageTitle]="'لیست مشتری'"
[pageTitle]="'مشتری‌ها'"
[columns]="columns"
emptyPlaceholderTitle="مشتری یافت نشد"
[items]="items()"
@@ -8,8 +8,7 @@
[showDetails]="true"
(onEdit)="onEditClick($event)"
(onDetails)="toSinglePage($event)"
(onRefresh)="refresh()"
/>
(onRefresh)="refresh()" />
@if (selectedItemForEdit()) {
<consumer-customer-form-dialog [(visible)]="visibleForm" [customer]="selectedItemForEdit()!" (onSubmit)="refresh()" />
@@ -1,10 +1,13 @@
<app-page-data-list
[pageTitle]="'لیست فاکتورها'"
[pageTitle]="'صورت‌حساب‌ها'"
[columns]="columns"
emptyPlaceholderTitle="فاکتوری یافت نشد"
emptyPlaceholderTitle="صورت‌حسابی یافت نشد"
[items]="items()"
[loading]="loading()"
[showDetails]="true"
(onDetails)="toSinglePage($event)"
(onRefresh)="refresh()"
/>
(onRefresh)="refresh()">
<ng-template #status let-item>
<catalog-tax-provider-status-tag [status]="item.status.value" [translate]="item.status.translate" />
</ng-template>
</app-page-data-list>
@@ -1,10 +1,12 @@
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
import {
IColumn,
PageDataListComponent,
} 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 { consumerCustomerSaleInvoicesNamedRoutes } from '../../constants/routes/saleInvoices';
import { ICustomerSaleInvoicesResponse } from '../../models/saleInvoices.io';
@@ -13,48 +15,27 @@ import { CustomerSaleInvoicesService } from '../../services/saleInvoices.service
@Component({
selector: 'consumer-customer-saleInvoice-list',
templateUrl: './list.component.html',
imports: [PageDataListComponent],
imports: [PageDataListComponent, CatalogTaxProviderStatusTagComponent],
})
export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICustomerSaleInvoicesResponse> {
@Input({ required: true }) customerId!: string;
@Input() fullHeight?: boolean;
@Input() header: IColumn[] = [
{ field: 'code', header: 'کد رهگیری' },
{
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',
},
];
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
private readonly service = inject(CustomerSaleInvoicesService);
private readonly router = inject(Router);
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() {
@@ -63,7 +44,7 @@ export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICust
toSinglePage(item: ICustomerSaleInvoicesResponse) {
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',
loadComponent: () =>
import('../../views/saleInvoices/list.component').then(
(m) => m.ConsumerCustomerSaleInvoicesComponent,
(m) => m.ConsumerCustomerSaleInvoicesComponent
),
meta: {
title: 'فاکتورهای صادر شده',
pagePath: (customerId: string) => `consumer/customers/${customerId}`,
title: 'صورت‌حساب‌ها',
pagePath: (customerId: string) => `consumer/customers/${customerId}/saleInvoices`,
},
},
saleInvoice: {
path: 'saleInvoices/:invoiceId',
loadComponent: () =>
import('../../views/saleInvoices/single.component').then(
(m) => m.ConsumerCustomerSaleInvoiceComponent,
(m) => m.ConsumerCustomerSaleInvoiceComponent
),
meta: {
title: 'فاکتور صادر شده',
title: 'صورت‌حساب‌',
pagePath: (customerId: string, saleInvoiceId: string) =>
`consumer/customers/${customerId}/saleInvoices/${saleInvoiceId}`,
},
@@ -36,10 +36,10 @@ export class ConsumerCustomerSaleInvoiceStore extends EntityStore<
consumerCustomerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(customerId),
},
{
title: this.entity()?.code,
title: `صورت‌حساب ${this.entity()?.invoice_number}`,
routerLink: consumerCustomerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(
customerId,
invoiceId,
invoiceId
),
},
],
@@ -57,7 +57,7 @@ export class ConsumerCustomerSaleInvoiceStore extends EntityStore<
catchError((error) => {
this.setError(error);
throw error;
}),
})
)
.subscribe((entity) => {
this.patchState({ entity });
@@ -1,7 +1,11 @@
// 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 { ConsumerCustomerSaleInvoiceListComponent } from '../../components/saleInvoices/list.component';
import { consumerCustomerSaleInvoicesNamedRoutes } from '../../constants/routes/saleInvoices';
import { ConsumerCustomerStore } from '../../store/customer.store';
@Component({
selector: 'consumer-customer-saleInvoices',
@@ -10,6 +14,25 @@ import { ConsumerCustomerSaleInvoiceListComponent } from '../../components/saleI
})
export class ConsumerCustomerSaleInvoicesComponent {
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
[cardTitle]="`اطلاعات مشتری (${customer() ? (customer()?.type === 'LEGAL' ? 'حقوقی' : 'حقیقی') : ''})`"
[editable]="true"
[(editMode)]="editMode"
>
[(editMode)]="editMode">
<div class="flex flex-col gap-4">
@if (customer()?.type === "LEGAL") {
@if (customer()?.type === 'LEGAL') {
<div class="listKeyValue">
<app-key-value label="عنوان" [value]="customer()?.legal?.company_name" />
<app-key-value label="کد اقتصادی" [value]="customer()?.legal?.economic_code" />
<app-key-value label="شماره ثبت" [value]="customer()?.legal?.registration_number" />
<app-key-value label="کد پستی" [value]="customer()?.legal?.postal_code" />
</div>
} @else if (customer()?.type === "INDIVIDUAL") {
} @else if (customer()?.type === 'INDIVIDUAL') {
<div class="listKeyValue">
<app-key-value label="نام" [value]="customer()?.individual?.first_name" />
<app-key-value label="نام خانوادگی" [value]="customer()?.individual?.last_name" />
@@ -1,15 +1,14 @@
<app-page-data-list
pageTitle="آخرین فاکتورهای صادر شده امروز"
pageTitle="صورت‌حساب‌های امروز"
[columns]="columns"
emptyPlaceholderTitle="تا به این لحظه فاکتوری صادر نشده است."
emptyPlaceholderTitle="تا به این لحظه صورت‌حسابی صادر نشده است."
[items]="items()"
[showDetails]="true"
[loading]="loading()"
(onDetails)="toSinglePage($event)"
(onRefresh)="refresh()"
>
(onRefresh)="refresh()">
<ng-template #moreActions>
<a routerLink pButton [routerLink]="invoicesPageRoute" outlined>تمامی فاکتورها</a>
<a routerLink pButton [routerLink]="invoicesPageRoute" outlined>تمامی صورت‌حساب‌ها</a>
</ng-template>
<ng-template #status let-item>
@@ -2,6 +2,7 @@ import { consumerSaleInvoicesNamedRoutes } from '@/domains/consumer/modules/sale
import { AbstractList } from '@/shared/abstractClasses';
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
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 { Router, RouterLink } from '@angular/router';
import { ButtonDirective } from 'primeng/button';
@@ -27,29 +28,17 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<ISta
readonly invoicesPageRoute = consumerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!();
override setColumns(): void {
this.columns = [
{ field: 'code', header: 'کد پیگیری' },
{ field: 'total_amount', header: 'قیمت نهایی', type: 'price' },
{
field: 'pos',
header: 'پایانه',
customDataModel(item) {
return `${item.pos.name} - ${item.pos.complex.name} - ${item.pos.complex.business_activity.name}`;
},
},
{
field: 'consumer_account',
header: 'ایجاد شده توسط',
type: 'nested',
nestedOption: { path: 'consumer_account.account.username' },
},
{
field: 'invoice_date',
header: 'تاریخ فاکتور',
type: 'dateTime',
},
{ field: 'status', header: 'وضعیت صدور', customDataModel: this.status },
];
this.columns = saleInvoiceListConfig.columns
.filter((column) => column.field !== 'created_at')
.map((header) => {
if (header.field === 'status') {
return {
...header,
customDataModel: this.status,
};
}
return header;
});
}
override getDataRequest() {
@@ -58,7 +47,7 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<ISta
toSinglePage(invoice: IStatisticsSaleInvoicesResponse) {
this.router.navigateByUrl(
consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoice.id),
consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoice.id)
);
}
}
@@ -1,5 +1,5 @@
<app-page-data-list
pageTitle="لیست پایانه‌های فروش"
pageTitle="پایانه‌های فروش"
[columns]="columns"
emptyPlaceholderTitle="پایانه فروشی یافت نشد."
[items]="items()"
@@ -8,8 +8,7 @@
[showEdit]="true"
(onEdit)="onEditClick($event)"
(onDetails)="toSinglePage($event)"
(onRefresh)="refresh()"
>
(onRefresh)="refresh()">
<ng-template #toPosLandingAction let-item>
<p-button type="button" variant="outlined" (onClick)="toPosLanding(item.id)"> ورود به پایانه </p-button>
</ng-template>
@@ -19,5 +18,4 @@
[editMode]="editMode()"
[posId]="selectedItemForEdit()?.id || ''"
[initialValues]="selectedItemForEdit() || undefined"
(onSubmit)="refresh()"
/>
(onSubmit)="refresh()" />
@@ -1,4 +1,4 @@
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="اطلاعات پایانه‌ فروش" [editable]="true" [(editMode)]="editMode">
<ng-template #moreActions>
<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()?.device?.name" />
<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>
</app-card-data>
@@ -20,6 +20,5 @@
[editMode]="true"
[posId]="posId()"
[initialValues]="pos() || undefined"
(onSubmit)="getData()"
/>
(onSubmit)="getData()" />
</div>
@@ -44,12 +44,17 @@ export class ConsumerPosPageComponent {
toPosLanding() {
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(), {
sameSite: 'Lax', // or 'Strict' for same-site requests only
secure: false,
path: '/',
domain: 'localhost',
domain: window.location.hostname,
});
console.log('this.posId', this.posId());
window.open('/pos', '_blank');
}
}
@@ -1,11 +1,10 @@
<app-card-data cardTitle="تغییر گذرواژه" [editable]="false">
<form [formGroup]="form" (submit)="submit()" class="max-w-lg mx-auto">
<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="w-full max-w-xs mx-auto">
تغییر گذرواژه
[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>
@@ -25,7 +25,7 @@ export class ConsumerResetPasswordCardComponent {
password: fieldControl.password(),
confirmPassword: fieldControl.confirmPassword(),
},
{ validators: [MustMatch('password', 'confirmPassword')] },
{ validators: [MustMatch('password', 'confirmPassword')] }
);
submit() {
@@ -40,7 +40,7 @@ export class ConsumerResetPasswordCardComponent {
.pipe(finalize(() => this.loading.set(false)))
.subscribe(() => {
this.form.reset();
this.toastService.success({ text: 'گذرواژه با موفقیت به‌روز شد.' });
this.toastService.success({ text: 'رمز عبور با موفقیت به‌روز شد.' });
});
}
}
@@ -1,14 +1,17 @@
<app-page-data-list
[pageTitle]="'لیست فاکتورها'"
[pageTitle]="'صورت‌حساب‌ها'"
[columns]="columns"
emptyPlaceholderTitle="فاکتوری یافت نشد"
emptyPlaceholderTitle="صورت‌حسابی یافت نشد"
[items]="items()"
[loading]="loading()"
[perPage]="responseMetaData()?.perPage"
[currentPage]="responseMetaData()?.page"
[totalRecords]="responseMetaData()?.totalRecords || items().length"
[totalPages]="responseMetaData()?.totalPages || 1"
[showDetails]="true"
(onDetails)="toSinglePage($event)"
(onRefresh)="refresh()"
(onChangePage)="changePage($event)"
/>
(onChangePage)="changePage($event)">
<ng-template #status let-item>
<catalog-tax-provider-status-tag [status]="item.status.value" [translate]="item.status.translate" />
</ng-template>
</app-page-data-list>
@@ -1,13 +1,14 @@
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { Maybe } from '@/core';
import { IPaginatedQuery } from '@/core/models/service.model';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
import {
IColumn,
PageDataListComponent,
} from '@/shared/components/pageDataList/page-data-list.component';
import { IPaginatedQuery } from '@/core/models/service.model';
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
import { Component, inject, Input } from '@angular/core';
import { Component, inject, Input, TemplateRef, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { consumerSaleInvoicesNamedRoutes } from '../constants/routes';
import { IConsumerSaleInvoicesResponse } from '../models';
@@ -16,7 +17,7 @@ import { ConsumerSaleInvoicesService } from '../services/main.service';
@Component({
selector: 'consumer-saleInvoice-list',
templateUrl: './list.component.html',
imports: [PageDataListComponent],
imports: [PageDataListComponent, CatalogTaxProviderStatusTagComponent],
})
export class ConsumerSaleInvoiceListComponent extends AbstractList<
IConsumerSaleInvoicesResponse,
@@ -24,12 +25,21 @@ export class ConsumerSaleInvoiceListComponent extends AbstractList<
> {
@Input() fullHeight?: boolean;
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
private readonly service = inject(ConsumerSaleInvoicesService);
private readonly router = inject(Router);
override setColumns(): void {
this.columns = this.header;
this.columns = this.header.map((header) => {
if (header.field === 'status') {
return {
...header,
customDataModel: this.status,
};
}
return header;
});
}
override getDataRequest(payload: Maybe<IPaginatedQuery>) {
@@ -9,7 +9,7 @@ export const consumerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerSaleInvoicesR
loadComponent: () =>
import('../../views/list.component').then((m) => m.ConsumerSaleInvoicesComponent),
meta: {
title: 'فاکتورهای صادر شده',
title: 'صورت‌حساب‌ها',
pagePath: () => `/consumer/sale_invoices`,
},
},
@@ -18,7 +18,7 @@ export const consumerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerSaleInvoicesR
loadComponent: () =>
import('../../views/single.component').then((m) => m.ConsumerSaleInvoiceComponent),
meta: {
title: 'فاکتور صادر شده',
title: 'صورت‌حساب‌',
pagePath: (saleInvoiceId: string) => `/consumer/sale_invoices/${saleInvoiceId}`,
},
},
@@ -35,7 +35,7 @@ export class ConsumerSaleInvoiceStore extends EntityStore<
routerLink: consumerSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(),
},
{
title: this.entity()?.code,
title: `صورت‌حساب ${this.entity()?.invoice_number}`,
routerLink: consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(invoiceId),
},
],
@@ -53,7 +53,7 @@ export class ConsumerSaleInvoiceStore extends EntityStore<
catchError((error) => {
this.setError(error);
throw error;
}),
})
)
.subscribe((entity) => {
this.patchState({ entity });
@@ -8,20 +8,21 @@ export const PARTNER_MENU_ITEMS = [
routerLink: ['/partner'],
},
{
label: 'حساب‌های کاربری',
icon: 'pi pi-fw pi-user',
routerLink: ['/partner/accounts'],
},
{
label: 'مشتری‌ها',
label: 'مودی',
icon: 'pi pi-fw pi-users',
routerLink: ['/partner/consumers'],
},
{
label: 'لایسنس‌ها',
label: 'لایسنس',
icon: 'pi pi-fw pi-key',
routerLink: ['/partner/licenses'],
},
{
label: 'حساب‌های کاربری',
icon: 'pi pi-fw pi-user',
routerLink: ['/partner/accounts'],
},
],
},
] as MenuItem[];
@@ -1,16 +1,14 @@
<shared-dialog
header="ویرایش گذرواژه"
header="تغییر رمز عبور"
[(visible)]="visible"
[modal]="true"
[style]="{ width: '500px' }"
[closable]="true"
(onHide)="close()"
>
(onHide)="close()">
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<shared-password-input
[passwordControl]="form.controls.password"
[confirmPasswordControl]="form.controls.confirmPassword"
/>
[confirmPasswordControl]="form.controls.confirmPassword" />
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
</form>
@@ -1,4 +1,4 @@
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="اطلاعات کاربری" [editable]="false" [(editMode)]="editMode">
<div class="flex flex-col gap-4">
<div class="listKeyValue">
@@ -1,6 +1,6 @@
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<field-name [control]="form.controls.name" />
<field-economic-code [control]="form.controls.economic_code" />
<field-individual-economic-code [control]="form.controls.economic_code" />
<field-fiscal-id [control]="form.controls.fiscal_id" />
<field-invoice-number-sequence [control]="form.controls.invoice_number_sequence" />
<field-partner-token [control]="form.controls.partner_token" />
@@ -1,8 +1,8 @@
import { AbstractForm } from '@/shared/abstractClasses';
import {
EconomicCodeComponent,
FiscalIdComponent,
GuildIdComponent,
IndividualEconomicCodeComponent,
LicenseStartsAtComponent,
NameComponent,
PartnerTokenComponent,
@@ -22,7 +22,7 @@ import { PartnerConsumerBusinessActivitiesService } from '../../services/busines
imports: [
ReactiveFormsModule,
NameComponent,
EconomicCodeComponent,
IndividualEconomicCodeComponent,
FiscalIdComponent,
PartnerTokenComponent,
GuildIdComponent,
@@ -44,10 +44,10 @@ export class ConsumerBusinessActivitiesFormComponent extends AbstractForm<
initForm = () => {
const form = this.fb.group({
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 || ''),
invoice_number_sequence: fieldControl.invoice_number_sequence(
parseInt(this.initialValues?.invoice_number_sequence || '1'),
parseInt(this.initialValues?.invoice_number_sequence || '1')
),
partner_token: fieldControl.partner_token(this.initialValues?.partner_token || ''),
guild_id: fieldControl.guild_id(this.initialValues?.guild?.id || ''),
@@ -63,7 +63,7 @@ export class ConsumerBusinessActivitiesFormComponent extends AbstractForm<
this.fb.control<string>('', {
nonNullable: true,
validators: fieldControl.license_starts_at('')[1],
}),
})
);
}
@@ -1,11 +1,10 @@
<shared-dialog
header="افزودن مشتری"
header="افزودن مودی"
[(visible)]="visible"
[modal]="true"
[style]="{ width: '640px' }"
[closable]="true"
(onHide)="close()"
>
(onHide)="close()">
<p-stepper [value]="activeStep()" [linear]="true">
<p-step-list>
<p-step [value]="1">اطلاعات اولیه</p-step>
@@ -24,16 +23,14 @@
<partner-consumer-businessActivities-form-content
[consumerId]="consumer()?.id || ''"
(onSubmit)="onBusinessActivitySubmit($event)"
(onClose)="close()"
/>
(onClose)="close()" />
}
@case (3) {
<partner-consumer-complex-form-content
[consumerId]="consumer()?.id || ''"
[businessActivityId]="businessActivity()?.id || ''"
(onSubmit)="onComplexSubmit($event)"
(onClose)="close()"
/>
(onClose)="close()" />
}
@case (4) {
<partner-consumer-pos-form-content
@@ -41,8 +38,7 @@
[businessActivityId]="businessActivity()?.id || ''"
[complexId]="complex()?.id || ''"
(onSubmit)="onPosSubmit($event)"
(onClose)="close()"
/>
(onClose)="close()" />
}
}
</div>
@@ -17,7 +17,7 @@ export class ConsumerUserFormDialogComponent extends AbstractDialog {
@Input() consumerId?: string;
get preparedTitle() {
return `${this.editMode ? 'ویرایش' : 'افزودن'} مشتری`;
return `${this.editMode ? 'ویرایش' : 'افزودن'} مودی`;
}
onFormSubmit(response: IPartnerConsumerResponse) {
@@ -4,15 +4,14 @@
[modal]="true"
[style]="{ width: '500px' }"
[closable]="true"
(onHide)="close()"
>
(onHide)="close()">
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<uikit-datepicker
<!-- <uikit-datepicker
label="تاریخ شروع لایسنس"
[control]="form.controls.starts_at"
name="starts_at"
hint="مدت زمان لایسنس‌ها ۱ ساله هستند."
/>
/> -->
<!-- <uikit-datepicker label="تاریخ انقضا لایسنس" [control]="form.controls.expires_at" name="expires_at" /> -->
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
</form>
@@ -1,7 +1,7 @@
import { AbstractFormDialog } from '@/shared/abstractClasses';
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
import { UikitFlatpickrJalaliComponent } from '@/uikit';
// import { UikitFlatpickrJalaliComponent } from '@/uikit';
import { Component, computed, inject, Input } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { ILicenseRequest, ILicenseResponse } from '../../models';
@@ -10,12 +10,7 @@ import { LicensesService } from '../../services/licenses.service';
@Component({
selector: 'partner-consumer-license-form',
templateUrl: './form.component.html',
imports: [
ReactiveFormsModule,
SharedDialogComponent,
FormFooterActionsComponent,
UikitFlatpickrJalaliComponent,
],
imports: [ReactiveFormsModule, SharedDialogComponent, FormFooterActionsComponent],
})
export class ConsumerLicenseFormComponent extends AbstractFormDialog<
ILicenseRequest,
@@ -1,8 +1,8 @@
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
<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-device-id [control]="form.controls.device_id" />
<field-provider-id [control]="form.controls.provider_id" />
@@ -13,8 +13,7 @@
<field-username [control]="form.controls.username" />
<shared-password-input
[passwordControl]="form.controls.password"
[confirmPasswordControl]="form.controls.confirmPassword"
/>
[confirmPasswordControl]="form.controls.confirmPassword" />
}
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
@@ -4,7 +4,6 @@ import { AbstractForm } from '@/shared/abstractClasses';
import {
DeviceIdComponent,
NameComponent,
PosTypeComponent,
ProviderIdComponent,
SerialNumberComponent,
SharedPasswordInputComponent,
@@ -27,7 +26,6 @@ import { PartnerPosesService } from '../../services/poses.service';
FormFooterActionsComponent,
DeviceIdComponent,
ProviderIdComponent,
PosTypeComponent,
SerialNumberComponent,
UsernameComponent,
Divider,
@@ -45,7 +43,7 @@ export class ConsumerPosFormContentComponent extends AbstractForm<IPosRequest, I
initForm = () => {
const form = this.fb.group({
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 || ''),
device_id: fieldControl.device_id(this.initialValues?.device?.id || ''),
provider_id: fieldControl.provider_id(this.initialValues?.provider?.id || ''),
@@ -10,7 +10,7 @@ export const partnerConsumersNamedRoutes: NamedRoutes<TConsumersRouteNames> = {
path: 'consumers',
loadComponent: () => import('../../views/list.component').then((m) => m.ConsumersComponent),
meta: {
title: شتری‌ها',
title: ودیان',
pagePath: () => '/partner/consumers',
},
},
@@ -18,7 +18,7 @@ export const partnerConsumersNamedRoutes: NamedRoutes<TConsumersRouteNames> = {
path: 'consumers/:consumerId',
loadComponent: () => import('../../views/single.component').then((m) => m.ConsumerComponent),
meta: {
title: شتری',
title: ودی',
pagePath: (guildId: string) => `/partner/consumers/${guildId}`,
},
},
@@ -1,4 +1,4 @@
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-4">
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
<ng-template #moreActions>
<button pButton outlined size="small" (click)="showAccountsChargeDialog()">شارژ کاربر</button>
@@ -22,13 +22,11 @@
[consumerId]="consumerId()"
[businessActivityId]="businessId()"
[initialValues]="businessActivity() || undefined"
(onSubmit)="getData()"
/>
(onSubmit)="getData()" />
<partner-charge-account-form-dialog
[(visible)]="visibleAccountsChargeForm"
[consumerId]="consumerId()"
[businessId]="businessId()"
(onSubmit)="getData()"
>
(onSubmit)="getData()">
</partner-charge-account-form-dialog>
</div>

Some files were not shown because too many files have changed in this diff Show More