diff --git a/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.html b/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.html index a445c77..6964ff4 100644 --- a/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.html +++ b/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.html @@ -1,5 +1,5 @@ - -
+ +
{{ saleInvoice.invoice_number }} - {{ saleInvoice.code }}
@@ -9,48 +9,46 @@ {{ preparedInvoiceType() }} + + + -

- @if (["success", "failure"].includes(saleInvoice.status.value.toLowerCase())) { + @if (['success', 'failure'].includes(saleInvoice.status.value.toLowerCase())) { + [disabled]="onAction()"> } - @if (saleInvoice.status.value.toLowerCase() === "not_send") { + @if (saleInvoice.status.value.toLowerCase() === 'not_send') { + [disabled]="onAction()"> } - @if (saleInvoice.status.value.toLowerCase() === "queued") { + @if (saleInvoice.status.value.toLowerCase() === 'queued') { + [disabled]="onAction()"> } - @if (saleInvoice.status.value.toLowerCase() === "failure") { + @if (saleInvoice.status.value.toLowerCase() === 'failure') { + [disabled]="onAction()"> } مشاهده جزییات
diff --git a/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts b/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts index 4ab118e..f234223 100644 --- a/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts +++ b/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts @@ -1,4 +1,5 @@ import { ToastService } from '@/core/services/toast.service'; +import { CatalogInvoiceTypeTagComponent } from '@/shared/catalog'; import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog/taxProviderStatus'; import { KeyValueComponent } from '@/shared/components'; import { Component, computed, EventEmitter, inject, Input, Output, signal } from '@angular/core'; @@ -20,6 +21,7 @@ import { PosSaleInvoicesService } from '../services/main.service'; RouterLink, ButtonDirective, CatalogTaxProviderStatusTagComponent, + CatalogInvoiceTypeTagComponent, ], }) export class SaleInvoiceCardComponent { @@ -39,11 +41,11 @@ export class SaleInvoiceCardComponent { this.sendingLoading() || this.gettingStatusLoading() || this.resendingLoading() || - this.revokingInvoiceLoading(), + this.revokingInvoiceLoading() ); singlePageRoute = computed(() => - posSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.saleInvoice?.id), + posSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.saleInvoice?.id) ); preparedInvoiceType = computed(() => { if (!this.saleInvoice) return ''; @@ -76,7 +78,7 @@ export class SaleInvoiceCardComponent { } else { this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' }); } - this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' }); + // this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' }); this.refreshRequested.emit(); }); } diff --git a/src/app/domains/pos/modules/saleInvoices/models/io.d.ts b/src/app/domains/pos/modules/saleInvoices/models/io.d.ts index e7007d1..b20d1c4 100644 --- a/src/app/domains/pos/modules/saleInvoices/models/io.d.ts +++ b/src/app/domains/pos/modules/saleInvoices/models/io.d.ts @@ -1,22 +1,8 @@ +import { Maybe } from '@/core'; import ISummary from '@/core/models/summary'; -import { TspProviderResponseStatus } from '@/shared/catalog'; +import { InvoiceTypes, TspProviderResponseStatus } from '@/shared/catalog'; import { IEnumTranslate } from '@/shared/models/enum_translate.type'; -export interface IPosSaleInvoicesRawResponse { - id: string; - code: string; - invoice_date: string; - notes?: string; - total_amount: string; - pos: Pos; - consumer_account: ConsumerAccount; - created_at: string; - items_count: number; - payments: Payments[]; -} - -export interface IPosSaleInvoicesResponse extends IPosSaleInvoicesRawResponse {} - export interface IPosSaleInvoicesSummaryRawResponse { id: string; code: string; @@ -24,12 +10,26 @@ export interface IPosSaleInvoicesSummaryRawResponse { invoice_date: string; created_at: string; total_amount: string; - customer: Customer; - fiscal: null; + customer: Maybe; status: IEnumTranslate; + type: IEnumTranslate; + main_id: Maybe; + tax_id: Maybe; + reference_invoice: Maybe; + notes: Maybe; } + export interface IPosSaleInvoicesSummaryResponse extends IPosSaleInvoicesSummaryRawResponse {} +export interface IPosSaleInvoicesRawResponse extends IPosSaleInvoicesSummaryRawResponse { + pos: Pos; + consumer_account: ConsumerAccount; + items_count: number; + payments: Payments[]; +} + +export interface IPosSaleInvoicesResponse extends IPosSaleInvoicesRawResponse {} + interface ConsumerAccount { role: string; account: Account; diff --git a/src/app/domains/pos/modules/shop/components/order/order-section.component.ts b/src/app/domains/pos/modules/shop/components/order/order-section.component.ts index e6a0c06..95790be 100644 --- a/src/app/domains/pos/modules/shop/components/order/order-section.component.ts +++ b/src/app/domains/pos/modules/shop/components/order/order-section.component.ts @@ -49,17 +49,17 @@ export class PosOrderSectionComponent { customerNameToShow = computed(() => { const type = this.store.customer().type; const info = this.store.customer().info; - let customerNameToShow = 'نامشخص'; + let customerNameToShow = 'رهگذر'; switch (type) { case 'UNKNOWN': - customerNameToShow = `${info?.customer_unknown?.name || 'نامشخص'} (نوع دوم)`; + customerNameToShow = `${info?.customer_unknown?.name || 'رهگذر'} (نوع دوم)`; break; case 'INDIVIDUAL': - customerNameToShow = `${info?.customer_individual ? info?.customer_individual.first_name + ' ' + info?.customer_individual.last_name : 'نامشخص'} (نوع اول)`; + customerNameToShow = `${info?.customer_individual ? info?.customer_individual.first_name + ' ' + info?.customer_individual.last_name : '-----'} (نوع اول)`; break; case 'LEGAL': - customerNameToShow = `${info?.customer_legal?.company_name || 'نامشخص'} (نوع اول)`; + customerNameToShow = `${info?.customer_legal?.company_name || '-----'} (نوع اول)`; break; } diff --git a/src/app/domains/pos/modules/shop/components/payment/form-dialog.component.html b/src/app/domains/pos/modules/shop/components/payment/form-dialog.component.html index e83aabd..46ab0c1 100644 --- a/src/app/domains/pos/modules/shop/components/payment/form-dialog.component.html +++ b/src/app/domains/pos/modules/shop/components/payment/form-dialog.component.html @@ -13,15 +13,18 @@
-
- نوع تسویه‌حساب - -
+ @if (!isUnknownCustomer()) { +
+ نوع تسویه‌حساب + +
+ } + v this.store.submitOrderLoading()); readonly isGoldGuild = computed(() => this.posInfo.entity()?.guild.code.toLowerCase() === 'gold'); + readonly isUnknownCustomer = computed(() => this.store.customer().type === 'UNKNOWN'); payByTerminalSteps = signal( Array.from({ length: 10 }, (_, i) => ({ diff --git a/src/app/domains/pos/modules/statistics/components/invoice-type-card.component.ts b/src/app/domains/pos/modules/statistics/components/invoice-type-card.component.ts index 5a5cfee..aea996b 100644 --- a/src/app/domains/pos/modules/statistics/components/invoice-type-card.component.ts +++ b/src/app/domains/pos/modules/statistics/components/invoice-type-card.component.ts @@ -8,7 +8,7 @@ import { Component, computed, EventEmitter, Input, Output } from '@angular/core' imports: [CommonModule], }) export class PosStatisticsInvoiceTypeCardComponent { - @Input() type: 'all' | 'success' | 'failure' | 'notSended' | 'pending' | 'credit' = 'all'; + @Input() type: 'all' | 'success' | 'failure' | 'not_sended' | 'pending' | 'not_original' = 'all'; @Input() count?: number = 0; @Input() totalAmount?: number = 0; @Input() totalTaxAmount?: number = 0; @@ -36,18 +36,18 @@ export class PosStatisticsInvoiceTypeCardComponent { case 'success': return { title: 'تایید شده', - icon: 'check', + icon: 'check-circle', bgColor: '#22C55E1A', borderColor: '#22C55E', }; case 'failure': return { title: 'خطادار', - icon: 'times', + icon: 'ban', bgColor: '#EF44441A', borderColor: '#EF4444', }; - case 'notSended': + case 'not_sended': return { title: 'ارسال نشده', icon: 'clock', @@ -61,9 +61,9 @@ export class PosStatisticsInvoiceTypeCardComponent { bgColor: '#3B82F61A', borderColor: '#3B82F6', }; - case 'credit': + case 'not_original': return { - title: 'اعتبار', + title: 'ارجاعی', icon: 'credit-card', bgColor: '#8B5CF61A', borderColor: '#8B5CF6', diff --git a/src/app/domains/pos/modules/statistics/models/io.d.ts b/src/app/domains/pos/modules/statistics/models/io.d.ts index c7ba6e1..72fdd2c 100644 --- a/src/app/domains/pos/modules/statistics/models/io.d.ts +++ b/src/app/domains/pos/modules/statistics/models/io.d.ts @@ -3,8 +3,8 @@ export interface IPosStatisticsRawResponse { success: IPosStatisticsItem; failure: IPosStatisticsItem; pending: IPosStatisticsItem; - notSended: IPosStatisticsItem; - credit: IPosStatisticsItem; + not_sended: IPosStatisticsItem; + not_original: IPosStatisticsItem; } export interface IPosStatisticsResponse extends IPosStatisticsRawResponse {} diff --git a/src/app/domains/pos/modules/statistics/views/root.component.html b/src/app/domains/pos/modules/statistics/views/root.component.html index d1b6228..149122f 100644 --- a/src/app/domains/pos/modules/statistics/views/root.component.html +++ b/src/app/domains/pos/modules/statistics/views/root.component.html @@ -30,12 +30,12 @@ [count]="item()?.failure?.count" (onClick)="toInvoicesPage('failure')" /> + [totalAmount]="item()?.not_sended?.total_amount" + [totalTaxAmount]="item()?.not_sended?.total_tax" + [count]="item()?.not_sended?.count" + (onClick)="toInvoicesPage('not_sended')" /> + [totalAmount]="item()?.not_original?.total_amount" + [totalTaxAmount]="item()?.not_original?.total_tax" + [count]="item()?.not_original?.count" /> }
diff --git a/src/app/shared/catalog/index.ts b/src/app/shared/catalog/index.ts index 52c36fc..f5acbfd 100644 --- a/src/app/shared/catalog/index.ts +++ b/src/app/shared/catalog/index.ts @@ -1,4 +1,5 @@ export * from './devices'; export * from './guild'; +export * from './invoiceTypes'; export * from './providers'; export * from './taxProviderStatus'; diff --git a/src/app/shared/catalog/invoiceTypes/index.ts b/src/app/shared/catalog/invoiceTypes/index.ts new file mode 100644 index 0000000..6a7eadc --- /dev/null +++ b/src/app/shared/catalog/invoiceTypes/index.ts @@ -0,0 +1,2 @@ +export * from './invoice-type-tag.component'; +export * from './type'; diff --git a/src/app/shared/catalog/invoiceTypes/invoice-type-tag.component.html b/src/app/shared/catalog/invoiceTypes/invoice-type-tag.component.html new file mode 100644 index 0000000..23b4831 --- /dev/null +++ b/src/app/shared/catalog/invoiceTypes/invoice-type-tag.component.html @@ -0,0 +1 @@ + diff --git a/src/app/shared/catalog/invoiceTypes/invoice-type-tag.component.ts b/src/app/shared/catalog/invoiceTypes/invoice-type-tag.component.ts new file mode 100644 index 0000000..8715e79 --- /dev/null +++ b/src/app/shared/catalog/invoiceTypes/invoice-type-tag.component.ts @@ -0,0 +1,35 @@ +import { Component, Input } from '@angular/core'; +import { Tag } from 'primeng/tag'; +import { InvoiceTypes } from './type'; + +@Component({ + selector: 'catalog-invoice-type-tag', + templateUrl: './invoice-type-tag.component.html', + imports: [Tag], +}) +export class CatalogInvoiceTypeTagComponent { + @Input({ required: true }) status!: InvoiceTypes; + @Input() translate!: string; + + get severity() { + switch (this.status) { + case 'ORIGINAL': + return 'success'; + case 'CORRECTION': + return 'warn'; + case 'REVOKE': + return 'danger'; + } + } + + get label() { + switch (this.status) { + case 'ORIGINAL': + return 'اصلی'; + case 'CORRECTION': + return 'اصلاحی'; + case 'REVOKE': + return 'ابطالی'; + } + } +} diff --git a/src/app/shared/catalog/invoiceTypes/type.ts b/src/app/shared/catalog/invoiceTypes/type.ts new file mode 100644 index 0000000..801b332 --- /dev/null +++ b/src/app/shared/catalog/invoiceTypes/type.ts @@ -0,0 +1,7 @@ +export const InvoiceTypes = { + ORIGINAL: 'ORIGINAL', + CORRECTION: 'CORRECTION', + REVOKE: 'REVOKE', +} as const; + +export type InvoiceTypes = (typeof InvoiceTypes)[keyof typeof InvoiceTypes]; diff --git a/src/app/shared/components/formFooterActions/form-footer-actions.component.html b/src/app/shared/components/formFooterActions/form-footer-actions.component.html index 7fa083c..35f487a 100644 --- a/src/app/shared/components/formFooterActions/form-footer-actions.component.html +++ b/src/app/shared/components/formFooterActions/form-footer-actions.component.html @@ -1,4 +1,11 @@
- - + +
diff --git a/src/app/shared/components/formFooterActions/form-footer-actions.component.ts b/src/app/shared/components/formFooterActions/form-footer-actions.component.ts index b041bd9..8049e1e 100644 --- a/src/app/shared/components/formFooterActions/form-footer-actions.component.ts +++ b/src/app/shared/components/formFooterActions/form-footer-actions.component.ts @@ -1,10 +1,10 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; -import { Button } from 'primeng/button'; +import { ButtonDirective } from 'primeng/button'; @Component({ selector: 'app-form-footer-actions', templateUrl: './form-footer-actions.component.html', - imports: [Button], + imports: [ButtonDirective], }) export class FormFooterActionsComponent { @Input() submitLabel = 'تایید'; diff --git a/src/app/shared/components/invoices/sale-invoice-full-response.model.ts b/src/app/shared/components/invoices/sale-invoice-full-response.model.ts index 691595e..b233319 100644 --- a/src/app/shared/components/invoices/sale-invoice-full-response.model.ts +++ b/src/app/shared/components/invoices/sale-invoice-full-response.model.ts @@ -1,5 +1,6 @@ +import { Maybe } from '@/core'; import ISummary from '@/core/models/summary'; -import { TspProviderResponseStatus } from '@/shared/catalog'; +import { InvoiceTypes, TspProviderResponseStatus } from '@/shared/catalog'; import { IEnumTranslate } from '@/shared/models/enum_translate.type'; export interface ISaleInvoiceFullRawResponse { @@ -11,11 +12,16 @@ export interface ISaleInvoiceFullRawResponse { pos: Pos; payments: Payment[]; items: Item[]; + invoice_number: number; + type: IEnumTranslate; created_at: string; - notes?: string; customer?: Customer; unknown_customer?: UnknownCustomer; status: IEnumTranslate; + main_id: Maybe; + tax_id: Maybe; + reference_invoice: Maybe; + notes: Maybe; } export interface ISaleInvoiceFullResponse extends ISaleInvoiceFullRawResponse {} diff --git a/src/app/shared/components/invoices/sale-invoice-single-view.component.html b/src/app/shared/components/invoices/sale-invoice-single-view.component.html index 93a9116..8109cd4 100644 --- a/src/app/shared/components/invoices/sale-invoice-single-view.component.html +++ b/src/app/shared/components/invoices/sale-invoice-single-view.component.html @@ -17,14 +17,17 @@
- + + + +
- +
اطلاعات پرداخت diff --git a/src/app/shared/components/invoices/sale-invoice-single-view.component.ts b/src/app/shared/components/invoices/sale-invoice-single-view.component.ts index 257bc4d..83b4f9d 100644 --- a/src/app/shared/components/invoices/sale-invoice-single-view.component.ts +++ b/src/app/shared/components/invoices/sale-invoice-single-view.component.ts @@ -3,7 +3,10 @@ import { NativeBridgeService } from '@/core/services'; import { ToastService } from '@/core/services/toast.service'; import { PosConfigPrintService } from '@/domains/pos/modules/configs/components/print/services/main.service'; import { PosInfoStore } from '@/domains/pos/store'; -import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog'; +import { + CatalogInvoiceTypeTagComponent, + CatalogTaxProviderStatusTagComponent, +} from '@/shared/catalog'; import { AppCardComponent, KeyValueComponent } from '@/shared/components'; import { ISaleInvoiceFullResponse } from '@/shared/components/invoices/sale-invoice-full-response.model'; import { PageLoadingComponent } from '@/shared/components/page-loading.component'; @@ -45,6 +48,7 @@ export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos'; UikitEmptyStateComponent, PriceMaskDirective, CatalogTaxProviderStatusTagComponent, + CatalogInvoiceTypeTagComponent, ], }) export class SharedSaleInvoiceSingleViewComponent { diff --git a/src/app/shared/components/key-value.component/key-value.component.ts b/src/app/shared/components/key-value.component/key-value.component.ts index 62a6cf3..7a4cdfc 100644 --- a/src/app/shared/components/key-value.component/key-value.component.ts +++ b/src/app/shared/components/key-value.component/key-value.component.ts @@ -88,12 +88,12 @@ export class KeyValueComponent { } switch (this.type) { case 'simple': - return this.value || '-'; + return this.value || '-----'; } return value; } valueType = computed(() => - this.variant || ['boolean', 'has', 'active'].includes(this.type) ? 'tag' : 'text', + this.variant || ['boolean', 'has', 'active'].includes(this.type) ? 'tag' : 'text' ); }