From 274acecc9c75e32f4ca1c1bf3e7cfdb4866c3413 Mon Sep 17 00:00:00 2001 From: BrianJiang2021 Date: Wed, 3 Jan 2024 15:59:33 +0800 Subject: [PATCH] feat: quote print and download pdf add currency https://bigc-b2b.atlassian.net/browse/BUN-1826 --- apps/storefront/src/pages/quote/QuoteDetail.tsx | 11 ++++++++++- .../src/shared/service/b2b/graphql/quote.ts | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/storefront/src/pages/quote/QuoteDetail.tsx b/apps/storefront/src/pages/quote/QuoteDetail.tsx index 7b542ac3..3b9db8e7 100644 --- a/apps/storefront/src/pages/quote/QuoteDetail.tsx +++ b/apps/storefront/src/pages/quote/QuoteDetail.tsx @@ -235,13 +235,22 @@ function QuoteDetail() { const fetchPdfUrl = async (bool: boolean) => { setIsRequestLoading(true) - const { id, createdAt } = quoteDetail + const { + id, + createdAt, + currency: { currencyExchangeRate, token, decimalPlaces }, + } = quoteDetail try { const data = { quoteId: +id, createdAt, isPreview: bool, lang: 'en', + currency: { + currencyExchangeRate, + token, + decimalPlaces, + }, } const fn = +role === 99 ? exportBcQuotePdf : exportB2BQuotePdf diff --git a/apps/storefront/src/shared/service/b2b/graphql/quote.ts b/apps/storefront/src/shared/service/b2b/graphql/quote.ts index 69f3e0c8..0353bc84 100644 --- a/apps/storefront/src/shared/service/b2b/graphql/quote.ts +++ b/apps/storefront/src/shared/service/b2b/graphql/quote.ts @@ -292,13 +292,15 @@ const exportQuotePdf = (data: { createdAt: number isPreview: boolean lang: string + currency: object }) => `mutation{ quoteFrontendPdf( quoteId: ${data.quoteId}, storeHash: "${storeHash}", createdAt: ${data.createdAt}, lang: "${data.lang}", - isPreview: ${data.isPreview} + isPreview: ${data.isPreview}, + currency: ${convertObjectToGraphql(data.currency || {})}, ) { url, content, @@ -416,6 +418,7 @@ export const exportB2BQuotePdf = (data: { createdAt: number isPreview: boolean lang: string + currency: object }): CustomFieldItems => B3Request.graphqlB2B({ query: exportQuotePdf(data), @@ -426,6 +429,7 @@ export const exportBcQuotePdf = (data: { createdAt: number isPreview: boolean lang: string + currency: object }): CustomFieldItems => B3Request.graphqlB2B({ query: exportQuotePdf(data),