refactor: replace economic code fields with individual and legal variants, add equal length validation

This commit is contained in:
2026-06-03 17:48:54 +03:30
parent 8d6fa8860b
commit 694b2ec946
23 changed files with 272 additions and 101 deletions
@@ -6,6 +6,7 @@ import { PosInfoStore } from '@/domains/pos/store';
import {
CatalogInvoiceTypeTagComponent,
CatalogTaxProviderStatusTagComponent,
TspProviderResponseStatus,
} from '@/shared/catalog';
import { CatalogInvoiceSettlementTypeTagComponent } from '@/shared/catalog/invoiceSettlementType';
import {
@@ -87,6 +88,7 @@ export class SharedSaleInvoiceSingleViewComponent {
@Output() onRefresh = new EventEmitter<void>();
@Output() onSendToTsp = new EventEmitter<Observable<any>>();
@Output() onResendToTsp = new EventEmitter<Observable<any>>();
@Output() onInquiry = new EventEmitter<Observable<any>>();
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
@@ -102,6 +104,7 @@ export class SharedSaleInvoiceSingleViewComponent {
this.showBackFromSale = this.showBackFromSale.bind(this);
this.printInvoice = this.printInvoice.bind(this);
this.send = this.send.bind(this);
this.resend = this.resend.bind(this);
this.inquiry = this.inquiry.bind(this);
}
@@ -116,6 +119,9 @@ export class SharedSaleInvoiceSingleViewComponent {
send() {
this.onSendToTsp.emit();
}
resend() {
this.onResendToTsp.emit();
}
async showRevokeConfirmation() {
await this.confirmationService.ask({
header: `ابطال صورت‌حساب‌ شماره ${this.invoice!.invoice_number}`,
@@ -146,40 +152,46 @@ export class SharedSaleInvoiceSingleViewComponent {
if (changes['invoice'] && this.invoice) {
const invoiceStatus = this.invoice.status.value;
const actions: MenuItem[] = [
{
label: 'ارسال مجدد صورت‌حساب',
icon: 'pi pi-send',
neededStatus: TspProviderResponseStatus.SEND_FAILURE,
command: this.resend,
},
{
label: 'ارسال صورت‌حساب',
icon: 'pi pi-send',
neededStatus: 'NOT_SEND',
neededStatus: TspProviderResponseStatus.NOT_SEND,
command: this.send,
},
{
label: 'استعلام وضعیت',
icon: 'pi pi-info',
neededStatus: 'FISCAL_QUEUED',
neededStatus: TspProviderResponseStatus.FISCAL_QUEUED,
command: this.inquiry,
},
{
label: 'دلایل خطا',
icon: 'pi pi-question',
neededStatus: 'FAILURE',
neededStatus: TspProviderResponseStatus.FAILURE,
command: this.showErrors,
},
{
label: 'ابطال',
icon: 'pi pi-eraser',
neededStatus: 'SUCCESS',
neededStatus: TspProviderResponseStatus.SUCCESS,
command: this.showRevokeConfirmation,
},
{
label: 'اصلاح',
icon: 'pi pi-file-edit',
neededStatus: 'SUCCESS',
neededStatus: TspProviderResponseStatus.SUCCESS,
command: this.showCorrection,
},
{
label: 'برگشت از فروش',
icon: 'pi pi-cart-minus',
neededStatus: 'SUCCESS',
neededStatus: TspProviderResponseStatus.SUCCESS,
command: this.showBackFromSale,
},
{