feat: enhance order submission flow and UI improvements
- Updated categories component to improve loading state and category display. - Modified order section to handle payment submission with event payload. - Refactored payment form dialog to emit order response on successful payment. - Adjusted order response model to enforce required fields. - Improved root component layout and added success dialog for order submission. - Enhanced sale invoice card component to use new TSP API methods. - Updated API routes for sale invoices to reflect TSP changes. - Improved user interface for business activities and partners sections. - Added card shadow styling for better visual hierarchy. - Introduced new order submitted dialog component for post-order actions. - Cleaned up console logs and improved code readability across components.
This commit is contained in:
@@ -52,7 +52,6 @@ export class SaleInvoiceCardComponent {
|
||||
if (customer) {
|
||||
const { legal, individual } = customer;
|
||||
let text = 'نوع اول - ';
|
||||
console.log(customer);
|
||||
if (legal) {
|
||||
text += `حقوقی (${legal.company_name})`;
|
||||
}
|
||||
@@ -67,7 +66,7 @@ export class SaleInvoiceCardComponent {
|
||||
sendInvoice() {
|
||||
this.sendingLoading.set(true);
|
||||
this.service
|
||||
.sendFiscal(this.saleInvoice.id)
|
||||
.sendToTsp(this.saleInvoice.id)
|
||||
.pipe(finalize(() => this.sendingLoading.set(false)))
|
||||
.subscribe(() => {
|
||||
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||
@@ -88,7 +87,7 @@ export class SaleInvoiceCardComponent {
|
||||
resendInvoice() {
|
||||
this.resendingLoading.set(true);
|
||||
this.service
|
||||
.retryFiscal(this.saleInvoice.id)
|
||||
.retrySendToTsp(this.saleInvoice.id)
|
||||
.pipe(finalize(() => this.resendingLoading.set(false)))
|
||||
.subscribe(() => {
|
||||
this.toastService.success({ text: 'ارسال مجدد فاکتور با موفقیت انجام شد.' });
|
||||
|
||||
@@ -3,12 +3,12 @@ const baseUrl = () => `/api/v1/pos/sales_invoices`;
|
||||
export const POS_SALE_INVOICES_API_ROUTES = {
|
||||
list: () => baseUrl(),
|
||||
single: (invoiceId: string) => `${baseUrl()}/${invoiceId}`,
|
||||
fiscal: {
|
||||
tsp: {
|
||||
send: (invoiceId: string) => `${baseUrl()}/${invoiceId}/send`,
|
||||
retry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/retry`,
|
||||
status: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/status`,
|
||||
getInquiry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/inquiry`,
|
||||
revoke: (invoiceId: string) => `${baseUrl()}/${invoiceId}/revoke`,
|
||||
retry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/retry`,
|
||||
status: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/status`,
|
||||
attempts: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/attempts`,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -32,43 +32,41 @@ export class PosSaleInvoicesService {
|
||||
return this.http.get<ISaleInvoiceFullRawResponse>(this.apiRoutes.single(invoiceId));
|
||||
}
|
||||
|
||||
sendFiscal(invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
|
||||
sendToTsp(invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
|
||||
return this.http.post<IPosSaleInvoiceFiscalActionResponse>(
|
||||
this.apiRoutes.fiscal.send(invoiceId),
|
||||
this.apiRoutes.tsp.send(invoiceId),
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
retryFiscal(invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
|
||||
retrySendToTsp(invoiceId: string): Observable<IPosSaleInvoiceFiscalActionResponse> {
|
||||
return this.http.post<IPosSaleInvoiceFiscalActionResponse>(
|
||||
this.apiRoutes.fiscal.retry(invoiceId),
|
||||
this.apiRoutes.tsp.retry(invoiceId),
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
getFiscalStatus(invoiceId: string): Observable<IPosSaleInvoiceFiscalStatusResponse> {
|
||||
return this.http.get<IPosSaleInvoiceFiscalStatusResponse>(
|
||||
this.apiRoutes.fiscal.status(invoiceId),
|
||||
);
|
||||
return this.http.get<IPosSaleInvoiceFiscalStatusResponse>(this.apiRoutes.tsp.status(invoiceId));
|
||||
}
|
||||
|
||||
getInquiry(invoiceId: string): Observable<IPosSaleInvoiceFiscalStatusResponse> {
|
||||
return this.http.get<IPosSaleInvoiceFiscalStatusResponse>(
|
||||
this.apiRoutes.fiscal.getInquiry(invoiceId),
|
||||
this.apiRoutes.tsp.getInquiry(invoiceId),
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
revoke(invoiceId: string): Observable<IPosSaleInvoiceFiscalStatusResponse> {
|
||||
return this.http.post<IPosSaleInvoiceFiscalStatusResponse>(
|
||||
this.apiRoutes.fiscal.revoke(invoiceId),
|
||||
this.apiRoutes.tsp.revoke(invoiceId),
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
getFiscalAttempts(invoiceId: string): Observable<IPosSaleInvoiceFiscalAttemptsResponse> {
|
||||
return this.http.get<IPosSaleInvoiceFiscalAttemptsResponse>(
|
||||
this.apiRoutes.fiscal.attempts(invoiceId),
|
||||
this.apiRoutes.tsp.attempts(invoiceId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user