feat: add sale invoice card component with functionality for sending and retrieving invoice status

- Implemented sale invoice card component with HTML and TypeScript files.
- Added API routes for sale invoices including sending, retrying, and checking status.
- Created models for sale invoice fiscal actions and filters.
- Developed service for handling sale invoice operations.
- Introduced store for managing sale invoice state.
- Created views for listing and displaying single sale invoices.
- Added support for managing stock keeping units with forms and services.
- Implemented reusable select components for measure units and SKUs.
- Enhanced shared components for input fields including fiscal ID, SKU type, and VAT.
This commit is contained in:
2026-05-01 19:45:30 +03:30
parent 8104f1b7a7
commit 83f124b910
94 changed files with 1555 additions and 214 deletions
+10 -51
View File
@@ -1,8 +1,13 @@
import { IAuthResponse, Maybe, TRoles } from '@/core';
import { IAuthResponse, TRoles } from '@/core';
import { ToastService } from '@/core/services/toast.service';
import { PosPaymentBridgeAbstract } from '@/domains/pos/modules/landing/services/payment-bridge.abstract';
import { PosPaymentBridgeService } from '@/domains/pos/modules/landing/services/payment-bridge.service';
import { Component, EventEmitter, OnDestroy, OnInit, inject, Input, Output, signal } from '@angular/core';
import {
Component,
EventEmitter,
Input,
Output,
signal,
inject,
} from '@angular/core';
import { Router } from '@angular/router';
import { ButtonDirective } from 'primeng/button';
import images from 'src/assets/images';
@@ -14,9 +19,8 @@ type TSteps = 'login' | 'otp' | 'modifyLoginInfo' | 'signup';
selector: 'app-auth',
templateUrl: './auth.component.html',
imports: [LoginComponent, ButtonDirective],
providers: [{ provide: PosPaymentBridgeAbstract, useExisting: PosPaymentBridgeService }],
})
export class AuthComponent implements OnInit, OnDestroy {
export class AuthComponent {
@Input() redirectUrl!: string;
@Input() loginApiUrl!: string;
@Input() role?: TRoles;
@@ -26,7 +30,6 @@ export class AuthComponent implements OnInit, OnDestroy {
private readonly toastService = inject(ToastService);
private readonly router = inject(Router);
private readonly paymentBridge = inject(PosPaymentBridgeAbstract);
readonly logo = images.logo;
readonly authVector = images.login;
@@ -89,48 +92,4 @@ export class AuthComponent implements OnInit, OnDestroy {
this.router.navigateByUrl(redirectUrl);
}
text = signal<string>('waiting for paymentResult...');
private restorePaymentCallback: Maybe<() => void> = null;
private readonly injectedPaymentResultHandler = (payload: unknown) => {
this.handlePaymentResult(payload);
};
ngOnInit() {
this.restorePaymentCallback = this.paymentBridge.registerPaymentResultListener(
this.injectedPaymentResultHandler,
);
}
ngOnDestroy() {
this.restorePaymentCallback?.();
}
private handlePaymentResult(result: unknown) {
const value = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
this.text.set(value);
this.toastService.success({ text: 'Result received from Android.' });
}
async pay() {
//@ts-ignore
this.toastService.success({ text: window.AndroidPSP.pay(100000) });
//@ts-ignore
await window.AndroidPSP?.pay(100000)
.then((response: any) => {
// alert('payment')
// console.log('Payment response:', response);
this.toastService.success({ text: 'پرداخت با موفقیت انجام شد.' });
})
.catch((error: any) => {
// console.error('Payment error:', error);
this.toastService.error({ text: 'خطا در انجام پرداخت.' });
});
this.toastService.success({ text: 'پرداخت با موفقیت انجام شد.' });
// //@ts-ignore
// alert(window.AndroidPSP);
}
mockPaymentResult() {
this.paymentBridge.emitPaymentResultForTest(`test-result-${Date.now()}`);
}
}