create invoice settlementStatus catalog and set to single invoice details, update single invoice detail actions

This commit is contained in:
2026-05-31 17:12:43 +03:30
parent 4ec6143068
commit c271a36f7e
15 changed files with 242 additions and 17 deletions
@@ -7,7 +7,12 @@ import {
CatalogInvoiceTypeTagComponent,
CatalogTaxProviderStatusTagComponent,
} from '@/shared/catalog';
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
import { CatalogInvoiceSettlementTypeTagComponent } from '@/shared/catalog/invoiceSettlementType';
import {
AppCardComponent,
KeyValueComponent,
SharedLightBottomsheetComponent,
} from '@/shared/components';
import { ISaleInvoiceFullResponse } from '@/shared/components/invoices/sale-invoice-full-response.model';
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
import {
@@ -34,7 +39,9 @@ import { MenuItem } from 'primeng/api';
import { Button } from 'primeng/button';
import { Divider } from 'primeng/divider';
import { Menu } from 'primeng/menu';
import { ProgressSpinner } from 'primeng/progressspinner';
import { TableModule } from 'primeng/table';
import { Observable } from 'rxjs';
import { AppConfirmationService } from '../confirmationDialog/confirmation-dialog.service';
export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos';
@@ -55,6 +62,9 @@ export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos';
CatalogInvoiceTypeTagComponent,
Menu,
Button,
CatalogInvoiceSettlementTypeTagComponent,
SharedLightBottomsheetComponent,
ProgressSpinner,
],
})
export class SharedSaleInvoiceSingleViewComponent {
@@ -69,8 +79,13 @@ export class SharedSaleInvoiceSingleViewComponent {
@Input() invoice!: Maybe<ISaleInvoiceFullResponse>;
@Input() variant: TSaleInvoiceSingleViewVariant = 'full';
@Input() backRoute?: UrlTree | string | any[];
@Input() sendToTspLoading: boolean = false;
@Input() resendToTspLoading: boolean = false;
@Input() inquiryLoading: boolean = false;
@Output() onRefresh = new EventEmitter<void>();
@Output() onSendToTsp = new EventEmitter<Observable<any>>();
@Output() onInquiry = new EventEmitter<Observable<any>>();
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
@@ -82,9 +97,21 @@ export class SharedSaleInvoiceSingleViewComponent {
this.showCorrection = this.showCorrection.bind(this);
this.showBackFromSale = this.showBackFromSale.bind(this);
this.printInvoice = this.printInvoice.bind(this);
this.send = this.send.bind(this);
this.inquiry = this.inquiry.bind(this);
}
get actionLoading() {
return this.sendToTspLoading || this.inquiryLoading || this.resendToTspLoading;
}
showErrors() {}
inquiry() {
this.onInquiry.emit();
}
send() {
this.onSendToTsp.emit();
}
showRevokeConfirmation() {
this.confirmationService.ask({
header: `ابطال صورت‌حساب‌ شماره ${this.invoice!.invoice_number}`,
@@ -112,6 +139,18 @@ export class SharedSaleInvoiceSingleViewComponent {
if (changes['invoice'] && this.invoice) {
const invoiceStatus = this.invoice.status.value;
const actions: MenuItem[] = [
{
label: 'ارسال صورت‌حساب',
icon: 'pi pi-send',
neededStatus: 'NOT_SEND',
command: this.send,
},
{
label: 'استعلام وضعیت',
icon: 'pi pi-info',
neededStatus: 'FISCAL_QUEUED',
command: this.inquiry,
},
{
label: 'دلایل خطا',
icon: 'pi pi-question',