update
This commit is contained in:
@@ -18,3 +18,4 @@ LICENSE.md
|
||||
karma.conf.js
|
||||
tsconfig.spec.json
|
||||
src/**/*.spec.ts
|
||||
false/
|
||||
|
||||
@@ -41,3 +41,6 @@ testem.log
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
|
||||
/false
|
||||
|
||||
@@ -35,13 +35,13 @@ docker-compose --profile dev up dev
|
||||
### Build the Docker Image
|
||||
|
||||
```bash
|
||||
docker build -t sakai-ng:latest .
|
||||
docker build -t psp_panel:latest .
|
||||
```
|
||||
|
||||
### Run the Container
|
||||
|
||||
```bash
|
||||
docker run -d -p 80:80 --name sakai-ng sakai-ng:latest
|
||||
docker run -d -p 80:80 --name psp_panel psp_panel:latest
|
||||
```
|
||||
|
||||
The application will be available at `http://localhost`
|
||||
@@ -57,13 +57,13 @@ docker-compose up -d app
|
||||
### Build for Staging
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.staging -t sakai-ng:staging .
|
||||
docker build -f Dockerfile.staging -t psp_panel:staging .
|
||||
```
|
||||
|
||||
### Run Staging Container
|
||||
|
||||
```bash
|
||||
docker run -d -p 8080:80 --name sakai-ng-staging sakai-ng:staging
|
||||
docker run -d -p 8080:80 --name psp_panel-staging psp_panel:staging
|
||||
```
|
||||
|
||||
### Run with Docker Compose
|
||||
@@ -89,8 +89,8 @@ The application will be available at `http://localhost:4200`
|
||||
### Building Development Image Directly
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.dev -t sakai-ng:dev .
|
||||
docker run -it -v $(pwd):/app -p 4200:4200 sakai-ng:dev
|
||||
docker build -f Dockerfile.dev -t psp_panel:dev .
|
||||
docker run -it -v $(pwd):/app -p 4200:4200 psp_panel:dev
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
@@ -102,7 +102,7 @@ To use specific environment configurations, you can build with different targets
|
||||
Create a separate `Dockerfile.staging` if needed, or manually use:
|
||||
|
||||
```bash
|
||||
docker run -e NODE_ENV=staging sakai-ng:latest
|
||||
docker run -e NODE_ENV=staging psp_panel:latest
|
||||
```
|
||||
|
||||
## Common Commands
|
||||
@@ -140,27 +140,27 @@ docker-compose build --no-cache
|
||||
# View Logs
|
||||
|
||||
# Production
|
||||
docker logs sakai-ng
|
||||
docker logs psp_panel
|
||||
|
||||
# Staging
|
||||
docker logs sakai-ng-staging
|
||||
docker logs psp_panel-staging
|
||||
|
||||
# Development
|
||||
docker logs sakai-ng-dev
|
||||
docker logs psp_panel-dev
|
||||
|
||||
# Stop Container
|
||||
|
||||
# Production
|
||||
docker stop sakai-ng
|
||||
docker rm sakai-ng
|
||||
docker stop psp_panel
|
||||
docker rm psp_panel
|
||||
|
||||
# Staging
|
||||
docker stop sakai-ng-staging
|
||||
docker rm sakai-ng-staging
|
||||
docker stop psp_panel-staging
|
||||
docker rm psp_panel-staging
|
||||
|
||||
# Development
|
||||
docker stop sakai-ng-dev
|
||||
docker rm sakai-ng-dev
|
||||
docker stop psp_panel-dev
|
||||
docker rm psp_panel-dev
|
||||
|
||||
# List running containers
|
||||
docker ps
|
||||
@@ -206,7 +206,7 @@ The `nginx.conf` file includes:
|
||||
To use different ports:
|
||||
|
||||
```bash
|
||||
docker run -d -p 8080:80 sakai-ng:latest
|
||||
docker run -d -p 8080:80 psp_panel:latest
|
||||
# App available at http://localhost:8080
|
||||
```
|
||||
|
||||
@@ -217,8 +217,8 @@ This project includes specialized Dockerfiles for different environments:
|
||||
### Production
|
||||
|
||||
```bash
|
||||
docker build -t sakai-ng:prod .
|
||||
docker run -d -p 80:80 sakai-ng:prod
|
||||
docker build -t psp_panel:prod .
|
||||
docker run -d -p 80:80 psp_panel:prod
|
||||
```
|
||||
|
||||
**Dockerfile**: `Dockerfile`
|
||||
@@ -228,8 +228,8 @@ docker run -d -p 80:80 sakai-ng:prod
|
||||
### Staging
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.staging -t sakai-ng:staging .
|
||||
docker run -d -p 8080:80 sakai-ng:staging
|
||||
docker build -f Dockerfile.staging -t psp_panel:staging .
|
||||
docker run -d -p 8080:80 psp_panel:staging
|
||||
```
|
||||
|
||||
**Dockerfile**: `Dockerfile.staging`
|
||||
@@ -240,8 +240,8 @@ docker run -d -p 8080:80 sakai-ng:staging
|
||||
### Development
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.dev -t sakai-ng:dev .
|
||||
docker run -it -v $(pwd):/app -p 4200:4200 sakai-ng:dev
|
||||
docker build -f Dockerfile.dev -t psp_panel:dev .
|
||||
docker run -it -v $(pwd):/app -p 4200:4200 psp_panel:dev
|
||||
```
|
||||
|
||||
**Dockerfile**: `Dockerfile.dev`
|
||||
@@ -263,14 +263,14 @@ docker run -it -v $(pwd):/app -p 4200:4200 sakai-ng:dev
|
||||
|
||||
Check logs for errors:
|
||||
```bash
|
||||
docker logs sakai-ng
|
||||
docker logs psp_panel
|
||||
```
|
||||
|
||||
### Port already in use
|
||||
|
||||
Use a different port:
|
||||
```bash
|
||||
docker run -d -p 8080:80 sakai-ng:latest
|
||||
docker run -d -p 8080:80 psp_panel:latest
|
||||
```
|
||||
|
||||
### Build fails on pnpm install
|
||||
@@ -300,15 +300,15 @@ jobs:
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
if [ "${{ github.ref }}" = "refs/heads/staging" ]; then
|
||||
docker build -f Dockerfile.staging -t sakai-ng:staging .
|
||||
docker build -f Dockerfile.staging -t psp_panel:staging .
|
||||
else
|
||||
docker build -t sakai-ng:latest .
|
||||
docker build -t psp_panel:latest .
|
||||
fi
|
||||
|
||||
- name: Push to registry
|
||||
run: |
|
||||
docker tag sakai-ng:latest your-registry/sakai-ng:latest
|
||||
docker push your-registry/sakai-ng:latest
|
||||
docker tag psp_panel:latest your-registry/psp_panel:latest
|
||||
docker push your-registry/psp_panel:latest
|
||||
```
|
||||
|
||||
### Generic CI/CD
|
||||
@@ -319,17 +319,17 @@ BUILD_ID=${CI_COMMIT_SHA:0:8}
|
||||
REGISTRY=${DOCKER_REGISTRY:-docker.io}
|
||||
|
||||
# Build
|
||||
docker build -t $REGISTRY/sakai-ng:$BUILD_ID .
|
||||
docker build -t $REGISTRY/psp_panel:$BUILD_ID .
|
||||
|
||||
# Test (optional)
|
||||
docker run --rm $REGISTRY/sakai-ng:$BUILD_ID wget --spider http://localhost
|
||||
docker run --rm $REGISTRY/psp_panel:$BUILD_ID wget --spider http://localhost
|
||||
|
||||
# Push
|
||||
docker push $REGISTRY/sakai-ng:$BUILD_ID
|
||||
docker push $REGISTRY/psp_panel:$BUILD_ID
|
||||
|
||||
# Tag as latest
|
||||
docker tag $REGISTRY/sakai-ng:$BUILD_ID $REGISTRY/sakai-ng:latest
|
||||
docker push $REGISTRY/sakai-ng:latest
|
||||
docker tag $REGISTRY/psp_panel:$BUILD_ID $REGISTRY/psp_panel:latest
|
||||
docker push $REGISTRY/psp_panel:latest
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ FROM node:20 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN npm config set registry "https://hub.megan.ir/npm/"
|
||||
# RUN npm config set registry "https://hub.megan.ir/npm/"
|
||||
|
||||
RUN npm install -g pnpm
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
Generated
+12993
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -3,6 +3,7 @@ version: "3.8"
|
||||
services:
|
||||
# Production service
|
||||
app:
|
||||
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
@@ -13,15 +14,13 @@ services:
|
||||
- NODE_ENV=production
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test:
|
||||
["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
|
||||
test: [ "CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/" ]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
networks:
|
||||
- psp_panel_network
|
||||
|
||||
# Staging service
|
||||
# staging:
|
||||
# build:
|
||||
|
||||
+27
-27
@@ -1,55 +1,55 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@angular/animations": "^20",
|
||||
"@angular/common": "^20",
|
||||
"@angular/compiler": "^20",
|
||||
"@angular/core": "^20",
|
||||
"@angular/forms": "^20",
|
||||
"@angular/platform-browser": "^20",
|
||||
"@angular/platform-browser-dynamic": "^20",
|
||||
"@angular/router": "^20",
|
||||
"@primeng/themes": "^20.2.0",
|
||||
"@primeuix/themes": "^1.2.1",
|
||||
"@tailwindcss/postcss": "^4.1.11",
|
||||
"@angular/animations": "^20.3.19",
|
||||
"@angular/common": "^20.3.19",
|
||||
"@angular/compiler": "^20.3.19",
|
||||
"@angular/core": "^20.3.19",
|
||||
"@angular/forms": "^20.3.19",
|
||||
"@angular/platform-browser": "^20.3.19",
|
||||
"@angular/platform-browser-dynamic": "^20.3.19",
|
||||
"@angular/router": "^20.3.19",
|
||||
"@primeng/themes": "^20.4.0",
|
||||
"@primeuix/themes": "^1.2.5",
|
||||
"@tailwindcss/postcss": "^4.2.3",
|
||||
"@zoomit/dayjs-jalali-plugin": "^0.1.11",
|
||||
"chart.js": "4.4.2",
|
||||
"dayjs": "^1.11.19",
|
||||
"dayjs": "^1.11.20",
|
||||
"flatpickr": "^4.6.13",
|
||||
"flatpickr-wrap": "^1.0.0",
|
||||
"jalaliday": "^3.1.1",
|
||||
"jest-editor-support": "*",
|
||||
"jest-editor-support": "32.0.0-beta.1",
|
||||
"ngx-cookie-service": "^21.3.1",
|
||||
"primeclt": "^0.1.5",
|
||||
"primeicons": "^7.0.0",
|
||||
"primeng": "^20",
|
||||
"run-script-os": "*",
|
||||
"primeng": "^20.4.0",
|
||||
"run-script-os": "^1.1.6",
|
||||
"rxjs": "~7.8.2",
|
||||
"tailwindcss-primeui": "^0.6.1",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^20",
|
||||
"@angular/build": "^20.1.4",
|
||||
"@angular/cli": "^20",
|
||||
"@angular/compiler-cli": "^20",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint": "^9.30.1",
|
||||
"eslint-config-prettier": "^10.1.5",
|
||||
"@angular-devkit/build-angular": "^20.3.24",
|
||||
"@angular/build": "^20.3.24",
|
||||
"@angular/cli": "^20.3.24",
|
||||
"@angular/compiler-cli": "^20.3.19",
|
||||
"@types/jasmine": "~5.1.15",
|
||||
"autoprefixer": "^10.5.0",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||
"eslint-plugin-prettier": "^5.5.1",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"jasmine-core": "~5.8.0",
|
||||
"karma": "~6.4.4",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.1",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"postcss": "^8.5.6",
|
||||
"prettier": "^3.6.2",
|
||||
"postcss": "^8.5.10",
|
||||
"prettier": "^3.8.3",
|
||||
"prettier-plugin-organize-imports": "^4.3.0",
|
||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"tailwindcss": "^4.2.3",
|
||||
"typescript": "~5.8.3"
|
||||
},
|
||||
"name": "psp_panel",
|
||||
|
||||
Generated
+2777
-2679
File diff suppressed because it is too large
Load Diff
+15
-1
@@ -1,5 +1,8 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false" [(editMode)]="editMode">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false">
|
||||
<ng-template #moreActions>
|
||||
<button pButton type="button" label="چاپ" icon="pi pi-print" outlined (click)="printInvoice()"></button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="کد رهگیری" [value]="invoice()?.code" />
|
||||
@@ -46,4 +49,15 @@
|
||||
}
|
||||
</div>
|
||||
</app-card-data>
|
||||
<app-card-data cardTitle="کالاهای خریداری شده" [editable]="false">
|
||||
<app-page-data-list
|
||||
[columns]="columns"
|
||||
[expandColumns]="expandableColumns"
|
||||
[expandable]="true"
|
||||
expandableItemKey="payload"
|
||||
[items]="invoice()?.items"
|
||||
[loading]="loading"
|
||||
pageTitle=""
|
||||
/>
|
||||
</app-card-data>
|
||||
</div>
|
||||
@@ -0,0 +1,87 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { getGoodUnitTypeProperties } from '@/utils';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { Divider } from 'primeng/divider';
|
||||
import { TableModule } from 'primeng/table';
|
||||
|
||||
export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-saleInvoice-shared',
|
||||
templateUrl: './shared-saleInvoice.component.html',
|
||||
imports: [
|
||||
AppCardComponent,
|
||||
KeyValueComponent,
|
||||
Badge,
|
||||
Divider,
|
||||
ButtonDirective,
|
||||
PageDataListComponent,
|
||||
TableModule,
|
||||
],
|
||||
})
|
||||
export class ConsumerSaleInvoiceSharedComponent {
|
||||
@Input({ required: true }) loading!: boolean;
|
||||
@Input({ required: true }) invoice!: any;
|
||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||
|
||||
printInvoice = () => {
|
||||
window.print();
|
||||
};
|
||||
|
||||
columns: IColumn[] = [
|
||||
{
|
||||
field: '',
|
||||
header: '',
|
||||
type: 'index',
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
header: 'عنوان',
|
||||
type: 'nested',
|
||||
nestedPath: 'good.name',
|
||||
},
|
||||
{
|
||||
field: 'unit_price',
|
||||
header: 'قیمت واحد',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
header: 'مقدار',
|
||||
customDataModel(item) {
|
||||
return `${item.quantity} ${getGoodUnitTypeProperties(item.good.unit_type).quantitySymbolText}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'total_amount',
|
||||
header: 'قیمت نهایی',
|
||||
type: 'price',
|
||||
},
|
||||
];
|
||||
|
||||
expandableColumns: IColumn[] = [
|
||||
{
|
||||
field: 'commission',
|
||||
header: 'کارمزد',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'profit',
|
||||
header: 'سود',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'wages',
|
||||
header: 'اجرت',
|
||||
type: 'price',
|
||||
},
|
||||
];
|
||||
|
||||
expandedRows: { [key: string]: boolean } = {};
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { Component, Input, signal } from '@angular/core';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { Divider } from 'primeng/divider';
|
||||
|
||||
export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-saleInvoice-shared',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [AppCardComponent, KeyValueComponent, Badge, Divider],
|
||||
})
|
||||
export class ConsumerSaleInvoiceSharedComponent {
|
||||
@Input({ required: true }) loading!: boolean;
|
||||
@Input({ required: true }) invoice!: any;
|
||||
@Input() editable = false;
|
||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||
|
||||
editMode = signal<boolean>(false);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export class ConsumerBusinessActivityListComponent extends AbstractList<IBusines
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedPath: 'name' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedPath: 'guild.name' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات پایانهی فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction>
|
||||
<ng-template #moreActions>
|
||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction> </ng-template>
|
||||
<ng-template #moreActions> </ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="عنوان" [value]="business()?.name" />
|
||||
|
||||
+1
-38
@@ -1,38 +1 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false" [(editMode)]="editMode">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="کد رهگیری" [value]="invoice()?.code" />
|
||||
<app-key-value label="تاریخ فاکتور" [value]="invoice()?.invoice_date" type="dateTime" />
|
||||
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice()?.created_at" type="dateTime" />
|
||||
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
||||
<p-badge value="ارسال نشده" severity="danger" />
|
||||
</app-key-value>
|
||||
<div class="col-span-3">
|
||||
<app-key-value label="توضیحات" [value]="invoice()?.notes" />
|
||||
</div>
|
||||
</div>
|
||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="مجموع قابل پرداخت" [value]="invoice()?.total_amount" type="price" />
|
||||
@for (payment of invoice()?.payments; track $index) {
|
||||
<app-key-value
|
||||
[label]="
|
||||
`${payment.payment_method === 'SET_OF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پایانه' : 'نقدی'}`
|
||||
"
|
||||
[value]="payment.amount"
|
||||
type="price"
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="کسب و کار" [value]="invoice()?.pos!.complex.business_activity.name" />
|
||||
<app-key-value label="مجموعه" [value]="invoice()?.pos!.complex.name" />
|
||||
<app-key-value label="پایانهی فروش" [value]="invoice()?.pos!.name" />
|
||||
<app-key-value label="ایجاد کننده" [value]="invoice()?.consumer_account?.account?.username" />
|
||||
</div>
|
||||
</div>
|
||||
</app-card-data>
|
||||
</div>
|
||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice" variant="customer" />
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { Divider } from 'primeng/divider';
|
||||
import { ConsumerCustomerStore } from '../../store/customer.store';
|
||||
import { ConsumerCustomerSaleInvoiceStore } from '../../store/saleInvoice.store';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-customer-saleInvoice',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [AppCardComponent, KeyValueComponent, Divider, Badge],
|
||||
imports: [ConsumerSaleInvoiceSharedComponent],
|
||||
})
|
||||
export class ConsumerCustomerSaleInvoiceComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
@@ -25,6 +23,7 @@ export class ConsumerCustomerSaleInvoiceComponent {
|
||||
editMode = signal<boolean>(false);
|
||||
|
||||
readonly invoice = computed(() => this.store.entity());
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات پایانهی فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction>
|
||||
<ng-template #moreActions>
|
||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/single.component';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="">
|
||||
<p-menu #menu [model]="profileMenuItems" [popup]="true" />
|
||||
<button pButton (click)="menu.toggle($event)" icon="pi pi-user" severity="contrast">
|
||||
{{ userInfo()?.username }}
|
||||
{{ posProfile()?.account?.username }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,8 @@ import { ButtonDirective } from 'primeng/button';
|
||||
import { Card } from 'primeng/card';
|
||||
import { Menu } from 'primeng/menu';
|
||||
import images from 'src/assets/images';
|
||||
import { PosStore } from '../pos.store';
|
||||
import { PosProfileStore } from '../store';
|
||||
import { PosStore } from '../store/pos.store';
|
||||
import { PosChooseCardsComponent } from './choose-pos.component';
|
||||
|
||||
@Component({
|
||||
@@ -27,13 +28,19 @@ import { PosChooseCardsComponent } from './choose-pos.component';
|
||||
export class PosLayoutComponent {
|
||||
constructor() {}
|
||||
|
||||
private readonly store = inject(PosStore);
|
||||
private readonly posInfoStore = inject(PosStore);
|
||||
private readonly posProfileStore = inject(PosProfileStore);
|
||||
private readonly authService = inject(AuthService);
|
||||
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
readonly posInfo = computed(() => this.store.entity());
|
||||
readonly error = computed(() => this.store.error());
|
||||
readonly userInfo = computed(() => this.authService.currentAccount());
|
||||
readonly posInfoLoading = computed(() => this.posInfoStore.loading());
|
||||
readonly posInfo = computed(() => this.posInfoStore.entity());
|
||||
readonly posInfoError = computed(() => this.posInfoStore.error());
|
||||
readonly posProfileLoading = computed(() => this.posProfileStore.loading());
|
||||
readonly posProfile = computed(() => this.posProfileStore.entity());
|
||||
readonly posProfileError = computed(() => this.posProfileStore.error());
|
||||
|
||||
readonly loading = computed(() => this.posInfoLoading() || this.posProfileLoading());
|
||||
readonly error = computed(() => this.posInfoError() || this.posProfileError());
|
||||
|
||||
logout = () => {
|
||||
this.authService.logout();
|
||||
@@ -57,7 +64,8 @@ export class PosLayoutComponent {
|
||||
now = new Date();
|
||||
|
||||
getData() {
|
||||
this.store.getData().subscribe();
|
||||
this.posProfileStore.getData().subscribe();
|
||||
this.posInfoStore.getData().subscribe();
|
||||
}
|
||||
|
||||
onChoosePos() {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './good.io';
|
||||
export * from './pos.io';
|
||||
export * from './profile.io';
|
||||
@@ -1,7 +1,7 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
|
||||
export interface IPosInfoRawResponse {
|
||||
name: true;
|
||||
name: string;
|
||||
complex: {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
|
||||
export interface IPosProfileRawResponse {
|
||||
id: string;
|
||||
role: string;
|
||||
account: { username: string };
|
||||
consumer: {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IPosProfileResponse extends IPosProfileRawResponse {}
|
||||
|
||||
interface Complex extends ISummary {
|
||||
business_activity: ISummary;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
const baseUrl = '/api/v1/pos';
|
||||
|
||||
export const POS_API_ROUTES = {
|
||||
profile: () => `${baseUrl}/me`,
|
||||
info: () => `${baseUrl}`,
|
||||
accessible: () => `${baseUrl}/accessible`,
|
||||
goods: () => `${baseUrl}/goods`,
|
||||
|
||||
@@ -5,9 +5,6 @@ export interface IGoldPayload {
|
||||
wages: number;
|
||||
profit: number;
|
||||
commission: number;
|
||||
// wages_amount: number;
|
||||
// profit_amount: number;
|
||||
// commission_amount: number;
|
||||
}
|
||||
|
||||
export interface IStandardPayload {}
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
IPosInfoRawResponse,
|
||||
IPosInfoResponse,
|
||||
} from '@/domains/pos/models/pos.io';
|
||||
import { IPosProfileRawResponse, IPosProfileResponse } from '@/domains/pos/models/profile.io';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -23,6 +24,10 @@ export class PosService {
|
||||
|
||||
private apiRoutes = POS_API_ROUTES;
|
||||
|
||||
getProfile(): Observable<IPosProfileResponse> {
|
||||
return this.http.get<IPosProfileRawResponse>(this.apiRoutes.profile());
|
||||
}
|
||||
|
||||
getInfo(): Observable<IPosInfoResponse> {
|
||||
return this.http.get<IPosInfoRawResponse>(this.apiRoutes.info());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { PosStore } from '@/domains/pos/pos.store';
|
||||
import { PosStore } from '@/domains/pos/store/pos.store';
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import { PosGoodsComponent } from '../components/goods.component';
|
||||
import { PosOrderSectionComponent } from '../components/order/order-section.component';
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './me.store';
|
||||
export * from './pos.store';
|
||||
@@ -0,0 +1,49 @@
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { catchError, finalize, map } from 'rxjs';
|
||||
import { IPosProfileResponse } from '../models';
|
||||
import { PosService } from '../modules/landing/services/main.service';
|
||||
|
||||
interface PosProfileState extends EntityState<IPosProfileResponse> {}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PosProfileStore extends EntityStore<IPosProfileResponse, PosProfileState> {
|
||||
private readonly service = inject(PosService);
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
...defaultBaseStateData,
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
this.patchState({ loading: true });
|
||||
return this.service.getProfile().pipe(
|
||||
finalize(() => {
|
||||
this.patchState({ loading: false });
|
||||
}),
|
||||
|
||||
catchError((err: HttpErrorResponse) => {
|
||||
this.setError(err);
|
||||
// if (err.status === 403) debugger;
|
||||
throw err;
|
||||
}),
|
||||
|
||||
map((entity: IPosProfileResponse) => {
|
||||
if (entity) {
|
||||
this.setEntity(entity);
|
||||
}
|
||||
return entity;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
...defaultBaseStateData,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import { computed, inject, Injectable } from '@angular/core';
|
||||
import { CookieService } from 'ngx-cookie-service';
|
||||
import { catchError, finalize, map } from 'rxjs';
|
||||
import { COOKIE_KEYS } from 'src/assets/constants';
|
||||
import { IPosInfoResponse } from './models/pos.io';
|
||||
import { PosService } from './modules/landing/services/main.service';
|
||||
import { IPosInfoResponse } from '../models/pos.io';
|
||||
import { PosService } from '../modules/landing/services/main.service';
|
||||
|
||||
interface PosState extends EntityState<IPosInfoResponse> {
|
||||
posId: string;
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات مشتری" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction> </ng-template>
|
||||
<ng-template #moreActions> </ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="نام مشتری" [value]="consumer()?.fullname" />
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
</div>
|
||||
</app-card-data>
|
||||
|
||||
<div class="max-h-[500px] flex">
|
||||
<div class="max-h-125 flex">
|
||||
<admin-guild-good-categories-list [guildId]="guildId()" class="w-full" />
|
||||
</div>
|
||||
<div class="max-h-[500px] flex">
|
||||
<div class="max-h-125 flex">
|
||||
<admin-guild-goods-list [guildId]="guildId()" class="w-full" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export class LicenseFormComponent extends AbstractFormDialog<ILicenseRequest, IL
|
||||
private service = inject(LicensesService);
|
||||
|
||||
form = this.fb.group({
|
||||
name: [this.initialValues?.name || '', [Validators.required]],
|
||||
name: ['', [Validators.required]],
|
||||
});
|
||||
|
||||
override submitForm(payload: ILicenseRequest) {
|
||||
|
||||
+19
-1
@@ -1,9 +1,27 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
|
||||
export interface ILicenseRawResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
starts_at: string;
|
||||
expires_at: string;
|
||||
consumer: Consumer;
|
||||
license: License;
|
||||
}
|
||||
export interface ILicenseResponse extends ILicenseRawResponse {}
|
||||
|
||||
export interface ILicenseRequest {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface License {
|
||||
id: string;
|
||||
charged_license_transaction: {
|
||||
partner: ISummary;
|
||||
};
|
||||
}
|
||||
interface Consumer {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
mobile_number: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ILicenseResponse } from '../models';
|
||||
import { ILicenseRawResponse, ILicenseResponse } from '../models';
|
||||
import { LicensesService } from '../services/main.service';
|
||||
|
||||
@Component({
|
||||
@@ -23,14 +23,15 @@ export class LicensesComponent extends AbstractList<ILicenseResponse> {
|
||||
return `${item.consumer.first_name} ${item.consumer.last_name}`;
|
||||
},
|
||||
},
|
||||
{ field: 'expires_at', header: 'تاریخ انقضا', type: 'date' },
|
||||
{
|
||||
field: 'partner',
|
||||
header: 'ارایه شده توسط',
|
||||
customDataModel(item) {
|
||||
return item.partner?.name || 'برند نرمافزار';
|
||||
customDataModel(item: ILicenseRawResponse) {
|
||||
return item.license.charged_license_transaction.partner.name || 'برند نرمافزار';
|
||||
},
|
||||
},
|
||||
{ field: 'expires_at', header: 'تاریخ انقضا', type: 'date' },
|
||||
{ field: 'created_at', header: 'تاریخ ایجاد', type: 'date' },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -17,9 +17,13 @@ export class AdminPartnerChargeLicenseTransactionListComponent extends AbstractL
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'charged_license_count', header: 'تعداد لایسنس خریداری شده' },
|
||||
{ field: 'remained_license_count', header: 'تعداد لایسنس فروخته نشده' },
|
||||
{ field: 'tracking_code', header: 'کد پیگیری' },
|
||||
{ field: 'charged_license_count', header: 'لایسنسهای خریداری شده' },
|
||||
{ field: 'remained_license_count', header: 'لایسنسهای باقیمانده' },
|
||||
{
|
||||
field: 'activated_license_count',
|
||||
header: 'لایسنسهای فروخته شده',
|
||||
},
|
||||
{
|
||||
field: 'activation_expires_at',
|
||||
header: 'تاریخ انقضا',
|
||||
|
||||
+2
@@ -1,8 +1,10 @@
|
||||
export interface IPartnerChargeLicenseTransactionRawResponse {
|
||||
id: string;
|
||||
created_at: string;
|
||||
tracking_code: string;
|
||||
activation_expires_at: string;
|
||||
charged_license_count: number;
|
||||
activated_license_count: number;
|
||||
remained_license_count: number;
|
||||
}
|
||||
export interface IPartnerChargeLicenseTransactionResponse extends IPartnerChargeLicenseTransactionRawResponse {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات شریک تجاری" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction>
|
||||
<ng-template #moreActions>
|
||||
<p-button outlined size="small" (onClick)="openChargeDialog()"> شارژ لایسنس </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
@@ -22,15 +22,15 @@
|
||||
</div>
|
||||
</app-card-data>
|
||||
|
||||
<div class="max-h-[500px] flex">
|
||||
<div class="max-h-125 flex">
|
||||
<admin-partner-licenses [partnerId]="partnerId()" class="w-full" />
|
||||
</div>
|
||||
|
||||
<div class="max-h-[500px] flex">
|
||||
<div class="max-h-125 flex">
|
||||
<admin-partner-chargeLicenseTransaction-list [partnerId]="partnerId()" class="w-full" />
|
||||
</div>
|
||||
|
||||
<div class="max-h-[500px] flex">
|
||||
<div class="max-h-125 flex">
|
||||
<superAdmin-partner-account-list [partnerId]="partnerId()" class="w-full" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="flex items-center gap-10 justify-between">
|
||||
<h5 class="font-bold">{{ cardTitle }}</h5>
|
||||
<div class="flex items-center gap-2 shrink-0">
|
||||
<ng-container [ngTemplateOutlet]="moreAction"></ng-container>
|
||||
<ng-container [ngTemplateOutlet]="moreActions"></ng-container>
|
||||
@if (editable) {
|
||||
<button
|
||||
pButton
|
||||
|
||||
@@ -34,7 +34,7 @@ export class AppCardComponent {
|
||||
@Output() editModeChange = new EventEmitter<boolean>();
|
||||
|
||||
@ContentChild('header', { static: true }) header?: Maybe<TemplateRef<any>>;
|
||||
@ContentChild('moreAction', { static: true }) moreAction?: Maybe<TemplateRef<any>>;
|
||||
@ContentChild('moreActions', { static: true }) moreActions?: Maybe<TemplateRef<any>>;
|
||||
|
||||
// constructor() {
|
||||
// if (this.editable) {
|
||||
|
||||
@@ -25,7 +25,12 @@ export class KeyValueComponent {
|
||||
| 'date'
|
||||
| 'dateTime'
|
||||
| 'duration'
|
||||
| 'id'
|
||||
| 'thumbnail'
|
||||
| 'nested'
|
||||
| 'index'
|
||||
| 'simple' = 'simple';
|
||||
|
||||
@Input() trueValueToShow?: string;
|
||||
@Input() falseValueToShow?: string;
|
||||
@Input() variant?: 'badge' | 'text';
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
columnResizeMode="fit"
|
||||
stripedRows
|
||||
[showFirstLastIcon]="false"
|
||||
[expandedRowKeys]="expandedRows"
|
||||
[dataKey]="dataKey"
|
||||
class="grow flex! flex-col overflow-hidden"
|
||||
[tableStyleClass]="!items.length && !loading ? 'h-full' : ''"
|
||||
>
|
||||
@@ -55,10 +57,13 @@
|
||||
@if (actionsCount()) {
|
||||
<th type="th" [style]="{ width: `${actionsCount() * 2 + (actionsCount() - 1) * 0.25}rem` }"></th>
|
||||
}
|
||||
@if (expandable) {
|
||||
<th style="width: 3rem"></th>
|
||||
}
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #body let-item let-i="rowIndex">
|
||||
<ng-template #body let-item let-i="rowIndex" let-expanded="expanded">
|
||||
<tr>
|
||||
@for (col of columns; track col.field) {
|
||||
<td>
|
||||
@@ -99,9 +104,121 @@
|
||||
(details)="details(item)"
|
||||
></td>
|
||||
}
|
||||
|
||||
@if (expandable) {
|
||||
<td>
|
||||
<p-button
|
||||
type="button"
|
||||
pRipple
|
||||
[pRowToggler]="item"
|
||||
[text]="true"
|
||||
[rounded]="true"
|
||||
[plain]="true"
|
||||
[icon]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'"
|
||||
/>
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
@if (expandable && expandColumns && expandableItemKey) {
|
||||
<ng-template #expandedrow let-item>
|
||||
<tr>
|
||||
<td [attr.colspan]="columns.length + 1">
|
||||
<div class="px-4">
|
||||
@if (item[expandableItemKey]?.length) {
|
||||
<p-table
|
||||
[columns]="expandColumns || []"
|
||||
[scrollable]="true"
|
||||
[value]="item[expandableItemKey]"
|
||||
[loading]="loading"
|
||||
columnResizeMode="fit"
|
||||
stripedRows
|
||||
[showFirstLastIcon]="false"
|
||||
[expandedRowKeys]="expandedRows"
|
||||
class="grow flex! flex-col overflow-hidden"
|
||||
[tableStyleClass]="!item.items?.length && !loading ? 'h-full' : ''"
|
||||
>
|
||||
<ng-template #header let-columns>
|
||||
<tr>
|
||||
@for (col of expandColumns; track col.header) {
|
||||
<th
|
||||
[style]="
|
||||
col.type === 'index'
|
||||
? { width: '3rem', minWidth: '3rem' }
|
||||
: { width: col.width, minWidth: col.minWidth }
|
||||
"
|
||||
>
|
||||
{{ col.header }}
|
||||
</th>
|
||||
}
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #body let-item let-i="rowIndex">
|
||||
<tr>
|
||||
@for (col of expandColumns; track col.field) {
|
||||
<td>
|
||||
{{ item.name }}
|
||||
@if (col.type === "index") {
|
||||
{{ i * (currentPage || 1) + 1 }}
|
||||
} @else if (col.type === "thumbnail") {
|
||||
<div
|
||||
class="w-20 h-20 rounded-2xl overflow-hidden bg-surface-50 cursor-pointer"
|
||||
(click)="openThumbnailModal(item)"
|
||||
>
|
||||
@if (item[col.field]) {
|
||||
<img [src]="item[col.field]" class="w-full h-full object-cover" />
|
||||
}
|
||||
</div>
|
||||
} @else if (getTemplate(col)) {
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="getTemplate(col)"
|
||||
[ngTemplateOutletContext]="{ $implicit: item }"
|
||||
></ng-container>
|
||||
} @else if (col.canCopy) {
|
||||
<uikit-copy [text]="getCell(item, col)"></uikit-copy>
|
||||
} @else {
|
||||
<span [class]="getPreviewClasses(item, col)">
|
||||
{{ getCell(item, col) }}
|
||||
</span>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #emptymessage>
|
||||
<tr class="">
|
||||
<td [colSpan]="(expandColumns.length + 1).toString()" class="w-full">
|
||||
<uikit-empty-state
|
||||
[title]="emptyPlaceholderTitle"
|
||||
[description]="emptyPlaceholderDescription"
|
||||
[ctaLabel]="emptyPlaceholderCtaLabel || addNewCtaLabel"
|
||||
[showCTA]="showAdd"
|
||||
(ctaClick)="openAddForm()"
|
||||
></uikit-empty-state>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
} @else {
|
||||
<div class="grid grid-cols-3 gap-4 py-2">
|
||||
@for (col of expandColumns; track $index) {
|
||||
<app-key-value
|
||||
[label]="col.header"
|
||||
[value]="item[expandableItemKey][col.field]"
|
||||
[type]="col.type || 'simple'"
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
}
|
||||
|
||||
<ng-template #emptymessage>
|
||||
<tr class="">
|
||||
<td [colSpan]="(columns.length + 1).toString()" class="w-full">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { PaginatorComponent, UikitCopyComponent, UikitEmptyStateComponent } from '@/uikit';
|
||||
import { formatJalali, formatWithCurrency, jalaliDiff } from '@/utils';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -18,6 +19,7 @@ import { DrawerModule } from 'primeng/drawer';
|
||||
import { PaginatorModule } from 'primeng/paginator';
|
||||
import { SkeletonModule } from 'primeng/skeleton';
|
||||
import { TableModule } from 'primeng/table';
|
||||
import { KeyValueComponent } from '../key-value.component/key-value.component';
|
||||
import { TableActionRowComponent } from '../table-action-row.component';
|
||||
|
||||
export interface IColumn<T = any> {
|
||||
@@ -26,7 +28,7 @@ export interface IColumn<T = any> {
|
||||
width?: string;
|
||||
minWidth?: string;
|
||||
canCopy?: boolean;
|
||||
type?: 'text' | 'price' | 'boolean' | 'date' | 'nested' | 'index' | 'id' | 'thumbnail';
|
||||
type?: 'simple' | 'price' | 'boolean' | 'date' | 'nested' | 'index' | 'id' | 'thumbnail';
|
||||
nestedPath?: string;
|
||||
thumbnailOptions?: {
|
||||
editable: boolean;
|
||||
@@ -58,6 +60,7 @@ export interface IColumn<T = any> {
|
||||
DrawerModule,
|
||||
PaginatorComponent,
|
||||
UikitCopyComponent,
|
||||
KeyValueComponent,
|
||||
],
|
||||
})
|
||||
export class PageDataListComponent<I> {
|
||||
@@ -84,10 +87,15 @@ export class PageDataListComponent<I> {
|
||||
@Input() isFiltered: boolean = false;
|
||||
@Input() fullHeight?: boolean = false;
|
||||
@Input() height: string = '';
|
||||
@Input() expandable?: boolean = false;
|
||||
@Input() expandableItemKey?: string = '';
|
||||
@Input() expandColumns?: Maybe<IColumn[]> = null;
|
||||
@Input() dataKey?: string = 'items';
|
||||
|
||||
@ContentChild('filter', { static: true }) filter!: TemplateRef<any> | null;
|
||||
@ContentChild('caption', { static: true }) caption!: TemplateRef<any> | null;
|
||||
@ContentChild('moreActions', { static: true }) moreActions!: TemplateRef<any> | null;
|
||||
@ContentChild('expandableTemp', { static: false }) expandableTemp!: TemplateRef<any> | null;
|
||||
|
||||
@Output() onEdit = new EventEmitter<I>();
|
||||
@Output() onDelete = new EventEmitter<I>();
|
||||
@@ -97,6 +105,7 @@ export class PageDataListComponent<I> {
|
||||
@Output() onThumbnailClick = new EventEmitter<I>();
|
||||
|
||||
filterDrawerVisible = signal<boolean>(false);
|
||||
expandedRows: { [key: string]: boolean } = {};
|
||||
|
||||
ngOnInit() {
|
||||
if (this.height)
|
||||
|
||||
Reference in New Issue
Block a user