feat: add public sale invoices module with routing and service integration

- Introduced PUBLIC_SALE_INVOICES_ROUTES for handling sale invoice routes.
- Created PublicSaleInvoicesService to fetch single invoice data from the API.
- Implemented PublicSaleInvoiceStore for managing invoice state.
- Added PublicSaleInvoiceComponent to display invoice details.
- Updated app routes to include public sale invoices.
- Removed pre-invoice dialog component and its associated files.
- Enhanced order submitted dialog with QR code for invoice sharing.
- Updated sale invoice single view to reflect new data structure.
- Refactored page data list component for improved layout and functionality.
This commit is contained in:
2026-05-21 21:35:34 +03:30
parent 1b4ac0789c
commit 8c07dc7c3f
25 changed files with 1036 additions and 349 deletions
@@ -13,8 +13,7 @@
icon="pi pi-print"
outlined
size="small"
(click)="printInvoice()"
></button>
(click)="printInvoice()"></button>
</ng-template>
<div class="flex flex-col gap-4">
<div class="listKeyValue">
@@ -29,14 +28,13 @@
</div>
</div>
<p-divider align="center"> اطلاعات پرداخت </p-divider>
<div class="grid md:grid-cols-3 sm:grid-cols-2 sm:gap-4 gap-3 items-center">
<div class="grid items-center gap-3 sm:grid-cols-2 sm:gap-4 md:grid-cols-3">
<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_OFF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پوز' : 'نقدی/ کارت‌خوان دیگر/ کارت به کارت'}`"
[value]="payment.amount"
type="price"
/>
type="price" />
}
</div>
@@ -45,14 +43,16 @@
<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" />
@if (invoice.consumer_account?.account?.username) {
<app-key-value label="ایجاد کننده" [value]="invoice.consumer_account.account.username" />
}
</div>
@if (variant !== "customer") {
@if (variant !== 'customer') {
<p-divider align="center"> اطلاعات مشتری </p-divider>
@if (invoice.customer) {
<div class="listKeyValue">
@if (invoice.customer.type === "INDIVIDUAL") {
@if (invoice.customer.type === 'INDIVIDUAL') {
<app-key-value label="نوع مشتری" value="حقیقی" />
<app-key-value label="نام" [value]="invoice.customer.individual?.first_name" />
<app-key-value label="نام خانوادگی" [value]="invoice.customer.individual?.last_name" />
@@ -74,7 +74,7 @@
<app-key-value label="کد ثبتی" [value]="invoice.unknown_customer.national_code" />
</div>
} @else {
<p class="text-center text-text-color pt-3 pb-5">اطلاعات مشتری ثبت نشده است.</p>
<p class="text-text-color pt-3 pb-5 text-center">اطلاعات مشتری ثبت نشده است.</p>
}
}
</div>
@@ -88,16 +88,10 @@
[items]="invoice.items"
[loading]="loading"
pageTitle=""
[showRefresh]="false"
>
[showRefresh]="false">
<ng-template #totalAmount let-item>
@if (!item.discount_amount) {
<span [appPriceMask]="item.total_amount"></span>
} @else {
<!-- <div class="flex flex-col items-end">
<span class="line-through text-muted-color text-xs" [appPriceMask]="item.total_amount"></span>
<span [appPriceMask]="item.total_amount - item.discount_amount"></span>
</div> -->
}
</ng-template>
</app-page-data-list>
@@ -250,7 +250,7 @@ export class SharedSaleInvoiceSingleViewComponent {
header: 'عنوان',
type: 'nested',
nestedOption: {
path: 'good.name',
path: 'good_snapshot.name',
},
},
{