Skip to content

Commit

Permalink
feat: quote print and download pdf add currency
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and libruce committed Jan 9, 2024
1 parent 436a6d5 commit 274acec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion apps/storefront/src/pages/quote/QuoteDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion apps/storefront/src/shared/service/b2b/graphql/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -416,6 +418,7 @@ export const exportB2BQuotePdf = (data: {
createdAt: number
isPreview: boolean
lang: string
currency: object
}): CustomFieldItems =>
B3Request.graphqlB2B({
query: exportQuotePdf(data),
Expand All @@ -426,6 +429,7 @@ export const exportBcQuotePdf = (data: {
createdAt: number
isPreview: boolean
lang: string
currency: object
}): CustomFieldItems =>
B3Request.graphqlB2B({
query: exportQuotePdf(data),
Expand Down

0 comments on commit 274acec

Please sign in to comment.