feat: add correction and return from sale functionalities to sale invoices

- Added new API routes for correction and return from sale in POS_SALE_INVOICES_API_ROUTES.
- Implemented correction and return from sale methods in PosSaleInvoicesService.
- Updated PosSaleInvoiceStore to include actions for correction and return from sale.
- Enhanced single.component to handle correction and return from sale events.
- Created correction and return from sale forms with appropriate validation and submission logic.
- Updated sale-invoice-single-view component to manage correction and return from sale actions.
- Added models for correction and return from sale requests.
- Improved user interface messages and form handling for better user experience.
This commit is contained in:
2026-06-06 19:52:58 +03:30
parent 560b3516e1
commit eb39f42b8c
26 changed files with 472 additions and 42 deletions
@@ -21,11 +21,11 @@ export class PosSaleInvoicesService {
private apiRoutes = POS_SALE_INVOICES_API_ROUTES;
getAll(
query: IPosSaleInvoicesFilterDto = {},
query: IPosSaleInvoicesFilterDto = {}
): Observable<IPaginatedResponse<IPosSaleInvoicesSummaryResponse>> {
return this.http.get<IPaginatedResponse<IPosSaleInvoicesSummaryRawResponse>>(
this.apiRoutes.list(),
{ params: query as Record<string, string | number | boolean> },
{ params: query as Record<string, string | number | boolean> }
);
}
@@ -36,14 +36,14 @@ export class PosSaleInvoicesService {
sendToTsp(invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
return this.http.post<IPosSaleInvoiceFiscalActionResponse>(
this.apiRoutes.tsp.send(invoiceId),
{},
{}
);
}
retrySendToTsp(invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
return this.http.post<IPosSaleInvoiceFiscalActionResponse>(
this.apiRoutes.tsp.retry(invoiceId),
{},
{}
);
}
@@ -54,20 +54,34 @@ export class PosSaleInvoicesService {
getInquiry(invoiceId: string): Observable<IPosSaleInvoiceFiscalStatusResponse> {
return this.http.get<IPosSaleInvoiceFiscalStatusResponse>(
this.apiRoutes.tsp.getInquiry(invoiceId),
{},
{}
);
}
correction(data: any, invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
return this.http.post<IPosSaleInvoiceFiscalActionResponse>(
this.apiRoutes.tsp.correction(invoiceId),
data
);
}
returnFromSale(data: any, invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
return this.http.post<IPosSaleInvoiceFiscalActionResponse>(
this.apiRoutes.tsp.returnFromSale(invoiceId),
data
);
}
revoke(invoiceId: string): Observable<IPosSaleInvoiceFiscalStatusResponse> {
return this.http.post<IPosSaleInvoiceFiscalStatusResponse>(
this.apiRoutes.tsp.revoke(invoiceId),
{},
{}
);
}
getFiscalAttempts(invoiceId: string): Observable<IPosSaleInvoiceFiscalAttemptsResponse> {
return this.http.get<IPosSaleInvoiceFiscalAttemptsResponse>(
this.apiRoutes.tsp.attempts(invoiceId),
this.apiRoutes.tsp.attempts(invoiceId)
);
}
}