Skip to content

Commit

Permalink
fix: company order invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and CarlLiu2023 committed Aug 15, 2023
1 parent 2a3f942 commit 8cc078b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/storefront/src/pages/invoice/Invoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ function Invoice() {
snackbar.error('pdf url resolution error')
return
}

const { href } = window.location
if (!href.includes('invoice')) {
return
}

window.open(pdfUrl, '_blank', 'fullscreen=yes')
} catch (err) {
console.error(err)
Expand Down
6 changes: 6 additions & 0 deletions apps/storefront/src/pages/invoice/components/B3Pulldown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ function B3Pulldown({
snackbar.error('pdf url resolution error')
return
}

const { href } = window.location
if (!href.includes('invoice')) {
return
}

window.open(pdfUrl, '_blank', 'fullscreen=yes')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ function PrintTempalte({ row }: PrintTempalteProps) {
return
}

if (!container?.current) return

PDFObject.embed(invoicePDFUrl, container.current)

setLoadding(false)
}

useEffect(() => {
viewPrint()

return () => {
container.current = null
}
}, [row])

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export default function OrderAction(props: OrderActionProps) {
key: 'aboutInvoice',
name: isB2BUser ? 'viewInvoice' : 'printInvoice',
variant: 'outlined',
isCanShow: createdEmail === emailAddress,
isCanShow: +ipStatus !== 0 || createdEmail === emailAddress,
},
],
infos: {
Expand Down

0 comments on commit 8cc078b

Please sign in to comment.