This commit is contained in:
2026-05-12 20:35:04 +03:30
parent cee708209e
commit ebd2aa46dc
2 changed files with 85 additions and 77 deletions
@@ -9,7 +9,7 @@
<button <button
pButton pButton
type="button" type="button"
label="چاپ" label="چاپ کن"
icon="pi pi-print" icon="pi pi-print"
outlined outlined
size="small" size="small"
@@ -1,5 +1,6 @@
import { Maybe } from '@/core'; import { Maybe } from '@/core';
import { NativeBridgeService } from '@/core/services'; import { NativeBridgeService } from '@/core/services';
import { ToastService } from '@/core/services/toast.service';
import { PosInfoStore } from '@/domains/pos/store'; import { PosInfoStore } from '@/domains/pos/store';
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog'; import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
import { AppCardComponent, KeyValueComponent } from '@/shared/components'; import { AppCardComponent, KeyValueComponent } from '@/shared/components';
@@ -47,6 +48,7 @@ export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos';
export class SharedSaleInvoiceSingleViewComponent { export class SharedSaleInvoiceSingleViewComponent {
private readonly nativeBridge = inject(NativeBridgeService); private readonly nativeBridge = inject(NativeBridgeService);
private readonly posInfoStore = inject(PosInfoStore); private readonly posInfoStore = inject(PosInfoStore);
private readonly toastService = inject(ToastService);
@Input({ required: true }) loading!: boolean; @Input({ required: true }) loading!: boolean;
@Input() invoice!: Maybe<ISaleInvoiceFullResponse>; @Input() invoice!: Maybe<ISaleInvoiceFullResponse>;
@@ -66,6 +68,7 @@ export class SharedSaleInvoiceSingleViewComponent {
}); });
printInvoice = () => { printInvoice = () => {
try {
if (this.invoice) { if (this.invoice) {
this.nativeBridge.print([ this.nativeBridge.print([
{ {
@@ -143,6 +146,11 @@ export class SharedSaleInvoiceSingleViewComponent {
}, },
]); ]);
} }
} catch (error) {
return this.toastService.error({
text: 'چاپ صورت‌حساب با خطا مواجه شد. لطفا دوباره تلاش کنید.',
});
}
}; };
columns: IColumn[] = [ columns: IColumn[] = [