-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/invoice pdf #1014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat/invoice pdf #1014
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
43a38c8
feat: invoice pdf
lissavxo 29f256b
feat: move invoices to payments page
lissavxo 5f4b327
feat: remove idor invoices
lissavxo 15ccc3f
feat: add generatePaymentFromTxWithInvoices method
lissavxo 6a12b06
refactor: copilot suggestions
lissavxo 106cc9b
refactor: use prisma type invoice
lissavxo 27a0413
refactor: fix invoiceWithTransaction type
lissavxo a8fecb1
fix: cancel buttons color
lissavxo bc547ff
fix:loading submit invoices
lissavxo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import React from 'react' | ||
| import { XEC_TX_EXPLORER_URL, BCH_TX_EXPLORER_URL, NETWORK_TICKERS_FROM_ID, XEC_NETWORK_ID } from 'constants/index' | ||
| import moment from 'moment' | ||
| import logoImageSource from 'assets/logo.png' | ||
| import Image from 'next/image' | ||
|
|
||
| const Receipt = React.forwardRef((props, ref) => { | ||
| const { data } = props | ||
| const { | ||
| invoiceNumber, | ||
| amount, | ||
| recipientName, | ||
| recipientAddress, | ||
| description, | ||
| customerName, | ||
| customerAddress, | ||
| createdAt, | ||
| transaction | ||
| } = data | ||
| const formattedDate = new Date(createdAt).toLocaleString('en-US', { | ||
| month: 'short', | ||
| day: '2-digit', | ||
| year: 'numeric', | ||
| hour: 'numeric', | ||
| minute: '2-digit', | ||
| hour12: true | ||
| }).replace(',', '') | ||
| const transactionNetworkId = transaction.networkId | ||
| const url = transactionNetworkId === XEC_NETWORK_ID ? XEC_TX_EXPLORER_URL : BCH_TX_EXPLORER_URL | ||
| return ( | ||
| <div ref={ref} style={{ padding: 24 }}> | ||
| <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'space-between' }}> | ||
| <div style={{ display: 'flex', alignSelf: 'flex-start', marginRight: '20px' }}> | ||
| <Image width={250} height={200} src={logoImageSource} alt="PayButton" /> | ||
| </div> | ||
| <div> | ||
| <h2>INVOICE</h2> | ||
| <p>#{ invoiceNumber }</p> | ||
| </div> | ||
| </div> | ||
| <p><strong>Generated at:</strong> { formattedDate }</p> | ||
| <p><strong>Transaction ID:</strong> <a href={url.concat(transaction.hash)} target="_blank" rel="noopener noreferrer">{transaction.hash}</a></p> | ||
| <p><strong>Transaction Date & Time:</strong> { moment(transaction.timestamp * 1000).tz('utc').format('lll') } </p> | ||
|
|
||
| <h4>Senders</h4> | ||
| <p>{ customerName } - { customerAddress }</p> | ||
|
|
||
| <h4>Recipients</h4> | ||
| <p>{ recipientName } - { recipientAddress }</p> | ||
|
|
||
| <hr /> | ||
|
|
||
| <p><strong>Notes:</strong> { description } </p> | ||
| <p><strong>Amount:</strong> { amount } { NETWORK_TICKERS_FROM_ID[transactionNetworkId]}</p> | ||
|
|
||
| </div> | ||
| ) | ||
| }) | ||
|
|
||
| export default Receipt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.