@powerhousedao/contributor-billing 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +22 -0
- package/dist/document-models/index.d.ts +2 -0
- package/dist/document-models/index.d.ts.map +1 -0
- package/dist/document-models/index.js +1 -0
- package/dist/document-models/invoice/gen/actions.d.ts +8 -0
- package/dist/document-models/invoice/gen/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/actions.js +3 -0
- package/dist/document-models/invoice/gen/creators.d.ts +4 -0
- package/dist/document-models/invoice/gen/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/creators.js +3 -0
- package/dist/document-models/invoice/gen/document-model.d.ts +3 -0
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/document-model.js +227 -0
- package/dist/document-models/invoice/gen/general/actions.d.ts +10 -0
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/actions.js +1 -0
- package/dist/document-models/invoice/gen/general/creators.d.ts +9 -0
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/creators.js +8 -0
- package/dist/document-models/invoice/gen/general/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/general/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/error.js +1 -0
- package/dist/document-models/invoice/gen/general/object.d.ts +12 -0
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/object.js +22 -0
- package/dist/document-models/invoice/gen/general/operations.d.ts +12 -0
- package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/operations.js +1 -0
- package/dist/document-models/invoice/gen/index.d.ts +6 -0
- package/dist/document-models/invoice/gen/index.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/index.js +5 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts +8 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/actions.js +1 -0
- package/dist/document-models/invoice/gen/items/creators.d.ts +7 -0
- package/dist/document-models/invoice/gen/items/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/creators.js +6 -0
- package/dist/document-models/invoice/gen/items/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/items/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/error.js +1 -0
- package/dist/document-models/invoice/gen/items/object.d.ts +10 -0
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/object.js +16 -0
- package/dist/document-models/invoice/gen/items/operations.d.ts +10 -0
- package/dist/document-models/invoice/gen/items/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/operations.js +1 -0
- package/dist/document-models/invoice/gen/object.d.ts +20 -0
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/object.js +29 -0
- package/dist/document-models/invoice/gen/parties/actions.d.ts +10 -0
- package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/actions.js +1 -0
- package/dist/document-models/invoice/gen/parties/creators.d.ts +9 -0
- package/dist/document-models/invoice/gen/parties/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/creators.js +8 -0
- package/dist/document-models/invoice/gen/parties/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/parties/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/error.js +1 -0
- package/dist/document-models/invoice/gen/parties/object.d.ts +12 -0
- package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/object.js +22 -0
- package/dist/document-models/invoice/gen/parties/operations.d.ts +12 -0
- package/dist/document-models/invoice/gen/parties/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/operations.js +1 -0
- package/dist/document-models/invoice/gen/reducer.d.ts +3 -0
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/reducer.js +79 -0
- package/dist/document-models/invoice/gen/schema/index.d.ts +3 -0
- package/dist/document-models/invoice/gen/schema/index.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/schema/index.js +2 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts +390 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/schema/types.js +1 -0
- package/dist/document-models/invoice/gen/schema/zod.d.ts +56 -0
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/schema/zod.js +362 -0
- package/dist/document-models/invoice/gen/types.d.ts +10 -0
- package/dist/document-models/invoice/gen/types.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/types.js +1 -0
- package/dist/document-models/invoice/gen/utils.d.ts +7 -0
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/utils.js +166 -0
- package/dist/document-models/invoice/index.d.ts +41 -0
- package/dist/document-models/invoice/index.d.ts.map +1 -0
- package/dist/document-models/invoice/index.js +21 -0
- package/dist/document-models/invoice/src/reducers/general.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/general.js +79 -0
- package/dist/document-models/invoice/src/reducers/items.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/items.js +108 -0
- package/dist/document-models/invoice/src/reducers/parties.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/parties.js +266 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/document-model.test.js +17 -0
- package/dist/document-models/invoice/src/tests/general.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/general.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/general.test.js +75 -0
- package/dist/document-models/invoice/src/tests/items.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/items.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/items.test.js +45 -0
- package/dist/document-models/invoice/src/tests/parties.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/parties.test.js +75 -0
- package/dist/document-models/invoice/src/utils.d.ts +2 -0
- package/dist/document-models/invoice/src/utils.d.ts.map +1 -0
- package/dist/document-models/invoice/src/utils.js +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +8 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.js +14 -0
- package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts +12 -0
- package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DocumentDispatch.js +20 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +17 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.js +112 -0
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts +14 -0
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/EditorContainer.js +28 -0
- package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts +12 -0
- package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FileItemsGrid.js +7 -0
- package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts +17 -0
- package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderItemsGrid.js +14 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +9 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderTree.js +31 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +16 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +16 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +21 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +45 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +12 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +12 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +7 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +7 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts +8 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
- package/dist/editors/contributor-billing/editor.d.ts +6 -0
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -0
- package/dist/editors/contributor-billing/editor.js +48 -0
- package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts +9 -0
- package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useDispatchMap.js +21 -0
- package/dist/editors/contributor-billing/hooks/useDrop.d.ts +22 -0
- package/dist/editors/contributor-billing/hooks/useDrop.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useDrop.js +57 -0
- package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts +8 -0
- package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.js +19 -0
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +4 -0
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.js +32 -0
- package/dist/editors/contributor-billing/index.d.ts +5 -0
- package/dist/editors/contributor-billing/index.d.ts.map +1 -0
- package/dist/editors/contributor-billing/index.js +12 -0
- package/dist/editors/index.d.ts +3 -0
- package/dist/editors/index.d.ts.map +1 -0
- package/dist/editors/index.js +2 -0
- package/dist/editors/invoice/InvoicePDF.d.ts +8 -0
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -0
- package/dist/editors/invoice/InvoicePDF.js +359 -0
- package/dist/editors/invoice/assets/custom.d.ts +4 -0
- package/dist/editors/invoice/assets/powerhouseLogo.png +0 -0
- package/dist/editors/invoice/components/countryForm.d.ts +12 -0
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -0
- package/dist/editors/invoice/components/countryForm.js +28 -0
- package/dist/editors/invoice/components/currencyForm.d.ts +13 -0
- package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -0
- package/dist/editors/invoice/components/currencyForm.js +26 -0
- package/dist/editors/invoice/components/datePicker.d.ts +11 -0
- package/dist/editors/invoice/components/datePicker.d.ts.map +1 -0
- package/dist/editors/invoice/components/datePicker.js +8 -0
- package/dist/editors/invoice/components/inputField.d.ts +14 -0
- package/dist/editors/invoice/components/inputField.d.ts.map +1 -0
- package/dist/editors/invoice/components/inputField.js +25 -0
- package/dist/editors/invoice/components/numberForm.d.ts +11 -0
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -0
- package/dist/editors/invoice/components/numberForm.js +7 -0
- package/dist/editors/invoice/components/selectField.d.ts +8 -0
- package/dist/editors/invoice/components/selectField.d.ts.map +1 -0
- package/dist/editors/invoice/components/selectField.js +323 -0
- package/dist/editors/invoice/editor.d.ts +5 -0
- package/dist/editors/invoice/editor.d.ts.map +1 -0
- package/dist/editors/invoice/editor.js +377 -0
- package/dist/editors/invoice/exportUBL.d.ts +85 -0
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -0
- package/dist/editors/invoice/exportUBL.js +382 -0
- package/dist/editors/invoice/index.d.ts +5 -0
- package/dist/editors/invoice/index.d.ts.map +1 -0
- package/dist/editors/invoice/index.js +12 -0
- package/dist/editors/invoice/ingestPDF.d.ts +12 -0
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -0
- package/dist/editors/invoice/ingestPDF.js +193 -0
- package/dist/editors/invoice/ingestUBL.d.ts +21 -0
- package/dist/editors/invoice/ingestUBL.d.ts.map +1 -0
- package/dist/editors/invoice/ingestUBL.js +169 -0
- package/dist/editors/invoice/invoiceToGnosis.d.ts +7 -0
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -0
- package/dist/editors/invoice/invoiceToGnosis.js +139 -0
- package/dist/editors/invoice/legalEntity/bankSection.d.ts +14 -0
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/bankSection.js +156 -0
- package/dist/editors/invoice/legalEntity/common.d.ts +6 -0
- package/dist/editors/invoice/legalEntity/common.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/common.js +6 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +40 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/legalEntity.js +63 -0
- package/dist/editors/invoice/legalEntity/walletSection.d.ts +13 -0
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/walletSection.js +55 -0
- package/dist/editors/invoice/lineItems.d.ts +23 -0
- package/dist/editors/invoice/lineItems.d.ts.map +1 -0
- package/dist/editors/invoice/lineItems.js +157 -0
- package/dist/editors/invoice/requestFinance.d.ts +7 -0
- package/dist/editors/invoice/requestFinance.d.ts.map +1 -0
- package/dist/editors/invoice/requestFinance.js +155 -0
- package/dist/editors/invoice/uploadPdfChunked.d.ts +10 -0
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -0
- package/dist/editors/invoice/uploadPdfChunked.js +79 -0
- package/dist/editors/invoice/utils/utils.d.ts +2 -0
- package/dist/editors/invoice/utils/utils.d.ts.map +1 -0
- package/dist/editors/invoice/utils/utils.js +54 -0
- package/dist/editors/invoice/validation/validationManager.d.ts +28 -0
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -0
- package/dist/editors/invoice/validation/validationManager.js +65 -0
- package/dist/editors/invoice/validation/validationRules.d.ts +14 -0
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -0
- package/dist/editors/invoice/validation/validationRules.js +334 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/powerhouse.manifest.json +31 -0
- package/dist/processors/index.d.ts +2 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +1 -0
- package/dist/scripts/invoice/exampleBatchTxn.d.ts +2 -0
- package/dist/scripts/invoice/exampleBatchTxn.d.ts.map +1 -0
- package/dist/scripts/invoice/exampleBatchTxn.js +44 -0
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts +28 -0
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -0
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +74 -0
- package/dist/scripts/invoice/pdfToDocumentAi.d.ts +5 -0
- package/dist/scripts/invoice/pdfToDocumentAi.d.ts.map +1 -0
- package/dist/scripts/invoice/pdfToDocumentAi.js +659 -0
- package/dist/scripts/invoice/requestFinance.d.ts +2 -0
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -0
- package/dist/scripts/invoice/requestFinance.js +38 -0
- package/dist/style.css +6463 -0
- package/dist/subgraphs/index.d.ts +2 -0
- package/dist/subgraphs/index.d.ts.map +1 -0
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/invoice/customResolvers.d.ts +50 -0
- package/dist/subgraphs/invoice/customResolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice/customResolvers.js +327 -0
- package/dist/subgraphs/invoice/index.d.ts +10 -0
- package/dist/subgraphs/invoice/index.d.ts.map +1 -0
- package/dist/subgraphs/invoice/index.js +30 -0
- package/dist/subgraphs/invoice/resolvers.d.ts +3 -0
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice/resolvers.js +184 -0
- package/dist/subgraphs/invoice/schema.d.ts +3 -0
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -0
- package/dist/subgraphs/invoice/schema.js +460 -0
- package/dist/tailwind.config.d.ts +13 -0
- package/dist/tailwind.config.d.ts.map +1 -0
- package/dist/tailwind.config.js +15 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +8 -0
- package/editors/invoice/assets/custom.d.ts +4 -0
- package/editors/invoice/assets/powerhouseLogo.png +0 -0
- package/package.json +117 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Document, Page, Text, View, StyleSheet, Image, } from "@react-pdf/renderer";
|
|
3
|
+
import powerhouseLogo from "./assets/powerhouseLogo.png";
|
|
4
|
+
import countries from "world-countries";
|
|
5
|
+
const countriesArray = countries;
|
|
6
|
+
function getCountryName(countryCode) {
|
|
7
|
+
const country = countriesArray.find((c) => c.cca2 === countryCode);
|
|
8
|
+
return country?.name.common;
|
|
9
|
+
}
|
|
10
|
+
// Create styles
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
defaultText: {
|
|
13
|
+
fontFamily: "Helvetica", // Built-in font as fallback
|
|
14
|
+
},
|
|
15
|
+
pageBackground: {
|
|
16
|
+
backgroundColor: "#f8fafc",
|
|
17
|
+
},
|
|
18
|
+
page: {
|
|
19
|
+
flexDirection: "column",
|
|
20
|
+
backgroundColor: "#FFFFFF",
|
|
21
|
+
padding: 15,
|
|
22
|
+
margin: 15,
|
|
23
|
+
height: "92%",
|
|
24
|
+
borderRadius: 15,
|
|
25
|
+
borderColor: "#fcfbfb",
|
|
26
|
+
borderWidth: 0.5,
|
|
27
|
+
},
|
|
28
|
+
header: {
|
|
29
|
+
marginBottom: 20,
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
justifyContent: "space-between",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
},
|
|
34
|
+
title: {
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
fontWeight: "bold",
|
|
37
|
+
fontFamily: "Helvetica",
|
|
38
|
+
},
|
|
39
|
+
invoiceNumber: {
|
|
40
|
+
fontSize: 12,
|
|
41
|
+
marginLeft: 0,
|
|
42
|
+
},
|
|
43
|
+
section: {
|
|
44
|
+
margin: 10,
|
|
45
|
+
padding: 10,
|
|
46
|
+
},
|
|
47
|
+
sectionTitle: {
|
|
48
|
+
marginBottom: 5,
|
|
49
|
+
fontSize: 14,
|
|
50
|
+
marginRight: 4,
|
|
51
|
+
fontFamily: "Helvetica",
|
|
52
|
+
color: "#9ea0a2",
|
|
53
|
+
fontWeight: "normal",
|
|
54
|
+
},
|
|
55
|
+
row: {
|
|
56
|
+
flexDirection: "row",
|
|
57
|
+
marginBottom: 8,
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
width: 70,
|
|
61
|
+
color: "#4B5563", // text-gray-600
|
|
62
|
+
fontSize: 10,
|
|
63
|
+
},
|
|
64
|
+
value: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
fontSize: 10,
|
|
67
|
+
},
|
|
68
|
+
gridContainer: {
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
marginHorizontal: 5,
|
|
71
|
+
marginTop: 20,
|
|
72
|
+
},
|
|
73
|
+
gridColumn: {
|
|
74
|
+
flex: 2,
|
|
75
|
+
},
|
|
76
|
+
table: {
|
|
77
|
+
marginTop: 20,
|
|
78
|
+
},
|
|
79
|
+
tableHeader: {
|
|
80
|
+
flexDirection: "row",
|
|
81
|
+
backgroundColor: "#fff",
|
|
82
|
+
padding: 8,
|
|
83
|
+
borderBottomWidth: 1,
|
|
84
|
+
borderBottomColor: "#E5E7EB",
|
|
85
|
+
fontSize: 10,
|
|
86
|
+
textTransform: "uppercase",
|
|
87
|
+
color: "#9ea0a2",
|
|
88
|
+
fontWeight: "normal",
|
|
89
|
+
letterSpacing: 1,
|
|
90
|
+
},
|
|
91
|
+
tableRow: {
|
|
92
|
+
flexDirection: "row",
|
|
93
|
+
borderBottomWidth: 0,
|
|
94
|
+
padding: 8,
|
|
95
|
+
fontSize: 10,
|
|
96
|
+
alignItems: "flex-start",
|
|
97
|
+
},
|
|
98
|
+
itemName: {
|
|
99
|
+
fontWeight: "bold",
|
|
100
|
+
fontSize: 12,
|
|
101
|
+
color: "#374151",
|
|
102
|
+
marginBottom: 2,
|
|
103
|
+
},
|
|
104
|
+
itemDescription: {
|
|
105
|
+
fontSize: 12,
|
|
106
|
+
color: "#6B7280",
|
|
107
|
+
fontWeight: "normal",
|
|
108
|
+
},
|
|
109
|
+
tableCol40: {
|
|
110
|
+
width: "40%",
|
|
111
|
+
paddingRight: 8,
|
|
112
|
+
},
|
|
113
|
+
tableCol15: {
|
|
114
|
+
width: "15%",
|
|
115
|
+
textAlign: "right",
|
|
116
|
+
},
|
|
117
|
+
totals: {
|
|
118
|
+
marginTop: 20,
|
|
119
|
+
marginRight: 0,
|
|
120
|
+
alignItems: "flex-end",
|
|
121
|
+
width: "100%",
|
|
122
|
+
},
|
|
123
|
+
totalRow: {
|
|
124
|
+
flexDirection: "row",
|
|
125
|
+
marginBottom: 8,
|
|
126
|
+
justifyContent: "flex-end",
|
|
127
|
+
width: "100%",
|
|
128
|
+
},
|
|
129
|
+
totalLabel: {
|
|
130
|
+
marginRight: 8,
|
|
131
|
+
color: "#6B7280",
|
|
132
|
+
fontSize: 16,
|
|
133
|
+
fontWeight: "normal",
|
|
134
|
+
width: 120,
|
|
135
|
+
textAlign: "right",
|
|
136
|
+
},
|
|
137
|
+
totalValue: {
|
|
138
|
+
minWidth: 100,
|
|
139
|
+
textAlign: "right",
|
|
140
|
+
fontSize: 16,
|
|
141
|
+
fontWeight: "normal",
|
|
142
|
+
color: "#374151",
|
|
143
|
+
},
|
|
144
|
+
totalRowBold: {
|
|
145
|
+
flexDirection: "row",
|
|
146
|
+
justifyContent: "flex-end",
|
|
147
|
+
borderTopWidth: 1,
|
|
148
|
+
borderTopColor: "#E5E7EB",
|
|
149
|
+
paddingTop: 8,
|
|
150
|
+
marginTop: 8,
|
|
151
|
+
width: "100%",
|
|
152
|
+
},
|
|
153
|
+
totalLabelBold: {
|
|
154
|
+
marginRight: 8,
|
|
155
|
+
color: "#000",
|
|
156
|
+
fontSize: 18,
|
|
157
|
+
fontWeight: "bold",
|
|
158
|
+
width: 120,
|
|
159
|
+
textAlign: "right",
|
|
160
|
+
},
|
|
161
|
+
totalValueBold: {
|
|
162
|
+
minWidth: 100,
|
|
163
|
+
textAlign: "right",
|
|
164
|
+
fontSize: 18,
|
|
165
|
+
fontWeight: "bold",
|
|
166
|
+
color: "#000",
|
|
167
|
+
},
|
|
168
|
+
status: {
|
|
169
|
+
fontSize: 10,
|
|
170
|
+
fontWeight: "bold",
|
|
171
|
+
color: "#1F2937",
|
|
172
|
+
marginLeft: 4,
|
|
173
|
+
},
|
|
174
|
+
totalAmount: {
|
|
175
|
+
fontSize: 25,
|
|
176
|
+
paddingTop: 7,
|
|
177
|
+
fontWeight: "bold",
|
|
178
|
+
color: "#black",
|
|
179
|
+
},
|
|
180
|
+
paymentSection: {
|
|
181
|
+
marginTop: 20,
|
|
182
|
+
marginBottom: 20,
|
|
183
|
+
},
|
|
184
|
+
paymentTitle: {
|
|
185
|
+
fontSize: 12,
|
|
186
|
+
fontWeight: "bold",
|
|
187
|
+
marginBottom: 10,
|
|
188
|
+
color: "#1F2937",
|
|
189
|
+
},
|
|
190
|
+
paymentRow: {
|
|
191
|
+
flexDirection: "row",
|
|
192
|
+
marginBottom: 4,
|
|
193
|
+
},
|
|
194
|
+
logo: {
|
|
195
|
+
width: 170,
|
|
196
|
+
marginTop: -15,
|
|
197
|
+
marginLeft: -15,
|
|
198
|
+
},
|
|
199
|
+
statusLabel: {
|
|
200
|
+
fontSize: 14,
|
|
201
|
+
marginTop: -13,
|
|
202
|
+
fontFamily: "Helvetica",
|
|
203
|
+
fontWeight: "normal",
|
|
204
|
+
color: "#9ea0a2",
|
|
205
|
+
marginRight: 4,
|
|
206
|
+
},
|
|
207
|
+
invoiceLabel: {
|
|
208
|
+
fontSize: 14,
|
|
209
|
+
marginRight: 4,
|
|
210
|
+
marginBottom: 4,
|
|
211
|
+
fontFamily: "Helvetica",
|
|
212
|
+
color: "#9ea0a2",
|
|
213
|
+
fontWeight: "normal",
|
|
214
|
+
},
|
|
215
|
+
companyInfo: {
|
|
216
|
+
fontSize: 12,
|
|
217
|
+
color: "#4B5563",
|
|
218
|
+
marginBottom: 4,
|
|
219
|
+
},
|
|
220
|
+
companyName: {
|
|
221
|
+
fontSize: 12,
|
|
222
|
+
fontWeight: "bold",
|
|
223
|
+
marginBottom: 4,
|
|
224
|
+
},
|
|
225
|
+
termsTitle: {
|
|
226
|
+
fontSize: 10,
|
|
227
|
+
color: "#6B7280",
|
|
228
|
+
fontWeight: "bold",
|
|
229
|
+
marginTop: 0,
|
|
230
|
+
marginBottom: 4,
|
|
231
|
+
fontFamily: "Helvetica",
|
|
232
|
+
},
|
|
233
|
+
termsText: {
|
|
234
|
+
fontSize: 10,
|
|
235
|
+
color: "#374151",
|
|
236
|
+
fontWeight: "normal",
|
|
237
|
+
fontFamily: "Helvetica",
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
// Format date to readable string
|
|
241
|
+
const formatDate = (dateString) => {
|
|
242
|
+
if (!dateString)
|
|
243
|
+
return "";
|
|
244
|
+
const date = new Date(dateString);
|
|
245
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
246
|
+
const month = date
|
|
247
|
+
.toLocaleString("default", { month: "short" })
|
|
248
|
+
.toUpperCase();
|
|
249
|
+
const year = date.getFullYear();
|
|
250
|
+
return `${day}/${month}/${year}`;
|
|
251
|
+
};
|
|
252
|
+
// Format currency
|
|
253
|
+
const formatCurrency = (amount, currency) => {
|
|
254
|
+
// Format number with appropriate decimal places
|
|
255
|
+
const formattedAmount = formatNumber(amount);
|
|
256
|
+
return `${formattedAmount} ${currency}`;
|
|
257
|
+
};
|
|
258
|
+
// Helper function to format numbers with appropriate decimal places
|
|
259
|
+
function formatNumber(value) {
|
|
260
|
+
// Check if the value has decimal places
|
|
261
|
+
const hasDecimals = value % 1 !== 0;
|
|
262
|
+
// If no decimals or only trailing zeros after 2 decimal places, show 2 decimal places
|
|
263
|
+
if (!hasDecimals || value.toFixed(5).endsWith("000")) {
|
|
264
|
+
return Number(value.toFixed(2)).toLocaleString("en-US", {
|
|
265
|
+
minimumFractionDigits: 2,
|
|
266
|
+
maximumFractionDigits: 2,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
// Otherwise, show actual decimal places up to 5
|
|
270
|
+
const stringValue = value.toString();
|
|
271
|
+
const decimalPart = stringValue.split(".")[1] || "";
|
|
272
|
+
// Determine how many decimal places to show (up to 5)
|
|
273
|
+
const decimalPlaces = Math.min(Math.max(2, decimalPart.length), 5);
|
|
274
|
+
return Number(value).toLocaleString("en-US", {
|
|
275
|
+
minimumFractionDigits: decimalPlaces,
|
|
276
|
+
maximumFractionDigits: decimalPlaces,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
280
|
+
console.log(invoice);
|
|
281
|
+
return (_jsx(Document, { children: _jsxs(Page, { size: "A4", style: styles.pageBackground, children: [_jsxs(View, { style: styles.page, children: [_jsxs(View, { style: {
|
|
282
|
+
flexDirection: "row",
|
|
283
|
+
justifyContent: "space-between",
|
|
284
|
+
alignItems: "flex-start",
|
|
285
|
+
}, children: [_jsxs(View, { style: { flexDirection: "column", alignItems: "flex-start" }, children: [_jsx(Image, { style: styles.logo, src: powerhouseLogo }), _jsxs(View, { children: [_jsx(Text, { style: styles.invoiceLabel, children: "Invoice number" }), _jsx(Text, { style: styles.invoiceNumber, children: invoice.invoiceNo })] })] }), _jsxs(View, { style: { alignItems: "flex-end" }, children: [_jsxs(Text, { style: styles.invoiceLabel, children: ["Invoice of (", invoice.currency, ")"] }), _jsx(Text, { style: [
|
|
286
|
+
styles.invoiceNumber,
|
|
287
|
+
{ fontSize: 24, fontWeight: "bold" },
|
|
288
|
+
], children: formatNumber(invoice.totalPriceTaxIncl) })] })] }), _jsxs(View, { style: {
|
|
289
|
+
flexDirection: "row",
|
|
290
|
+
justifyContent: "space-between",
|
|
291
|
+
marginTop: 40,
|
|
292
|
+
}, children: [_jsxs(View, { style: { width: "45%" }, children: [_jsx(Text, { style: styles.sectionTitle, children: "Issuer" }), _jsx(Text, { style: styles.companyName, children: invoice.issuer.name }), _jsxs(Text, { style: styles.companyInfo, children: ["Tax/Corp ID:", " ", invoice.issuer.id?.taxId ||
|
|
293
|
+
invoice.issuer.id?.corpRegId || ""] }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.streetAddress || "" }), invoice.issuer.address?.extendedAddress && (_jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.extendedAddress || "" })), _jsxs(Text, { style: styles.companyInfo, children: [invoice.issuer.address?.city || "", ",", " ", getCountryName(invoice.issuer.address?.country || "") || "", " -", " ", invoice.issuer.address?.postalCode || "00000"] }), invoice.issuer.contactInfo?.email && (_jsx(Text, { style: styles.companyInfo, children: invoice.issuer.contactInfo.email }))] }), _jsxs(View, { style: { width: "45%" }, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payer" }), _jsx(Text, { style: styles.companyName, children: invoice.payer.name }), _jsxs(Text, { style: styles.companyInfo, children: ["Tax/Corp ID:", " ", invoice.payer.id?.taxId ||
|
|
294
|
+
invoice.payer.id?.corpRegId || ""] }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.streetAddress || "" }), invoice.payer.address?.extendedAddress && (_jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.extendedAddress || "" })), _jsxs(Text, { style: styles.companyInfo, children: [invoice.payer.address?.city || "", ",", " ", getCountryName(invoice.payer.address?.country || "") || "", " -", " ", invoice.payer.address?.postalCode || "00000"] }), invoice.payer.contactInfo?.email && (_jsx(Text, { style: styles.companyInfo, children: invoice.payer.contactInfo.email }))] }), _jsxs(View, { style: {
|
|
295
|
+
width: "30%",
|
|
296
|
+
alignItems: "flex-end",
|
|
297
|
+
textAlign: "right",
|
|
298
|
+
}, children: [_jsxs(View, { style: { marginBottom: 18, width: "100%" }, children: [_jsx(Text, { style: {
|
|
299
|
+
color: "#9ea0a2",
|
|
300
|
+
fontSize: 14,
|
|
301
|
+
textAlign: "right",
|
|
302
|
+
fontFamily: "Helvetica",
|
|
303
|
+
fontWeight: "normal",
|
|
304
|
+
}, children: "Invoice date" }), _jsx(Text, { style: {
|
|
305
|
+
fontWeight: 4,
|
|
306
|
+
fontSize: 14,
|
|
307
|
+
textAlign: "right",
|
|
308
|
+
color: "#000",
|
|
309
|
+
fontFamily: "Helvetica",
|
|
310
|
+
}, children: formatDate(invoice.dateIssued) })] }), _jsxs(View, { style: { marginBottom: 18, width: "100%" }, children: [_jsx(Text, { style: {
|
|
311
|
+
color: "#9ea0a2",
|
|
312
|
+
fontSize: 14,
|
|
313
|
+
textAlign: "right",
|
|
314
|
+
fontFamily: "Helvetica",
|
|
315
|
+
fontWeight: "normal",
|
|
316
|
+
}, children: "Due date" }), _jsx(Text, { style: {
|
|
317
|
+
fontWeight: 4,
|
|
318
|
+
fontSize: 14,
|
|
319
|
+
textAlign: "right",
|
|
320
|
+
color: "#000",
|
|
321
|
+
fontFamily: "Helvetica",
|
|
322
|
+
}, children: formatDate(invoice.dateDue) })] }), fiatMode && (_jsxs(View, { style: { marginBottom: 18, width: "100%" }, children: [_jsx(Text, { style: {
|
|
323
|
+
color: "#9ea0a2",
|
|
324
|
+
fontSize: 14,
|
|
325
|
+
textAlign: "right",
|
|
326
|
+
fontFamily: "Helvetica",
|
|
327
|
+
fontWeight: "normal",
|
|
328
|
+
}, children: "Account Type:" }), _jsx(Text, { style: {
|
|
329
|
+
fontWeight: 4,
|
|
330
|
+
fontSize: 14,
|
|
331
|
+
textAlign: "right",
|
|
332
|
+
color: "#000",
|
|
333
|
+
fontFamily: "Helvetica",
|
|
334
|
+
}, children: invoice.issuer.paymentRouting?.bank?.accountType ||
|
|
335
|
+
"CHECKING" })] }))] })] }), _jsxs(View, { style: styles.paymentSection, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (_jsxs("div", { children: [_jsx(PaymentSectionFiat, { paymentRouting: invoice.issuer.paymentRouting }), invoice.issuer.paymentRouting?.bank?.memo && (_jsxs(Text, { style: styles.companyInfo, children: ["Memo: ", invoice.issuer.paymentRouting?.bank?.memo || "", " "] }))] })) : (_jsx(PaymentSectionCrypto, { paymentRouting: invoice.issuer.paymentRouting }))] }), _jsxs(View, { style: styles.table, children: [_jsxs(View, { style: styles.tableHeader, children: [_jsx(Text, { style: styles.tableCol40, children: "Description" }), _jsx(Text, { style: styles.tableCol15, children: "Quantity" }), _jsx(Text, { style: styles.tableCol15, children: "Unit Price" }), _jsx(Text, { style: styles.tableCol15, children: "Tax" }), _jsx(Text, { style: styles.tableCol15, children: "Total" })] }), invoice.lineItems.map((item, index) => (_jsx(InvoiceLineItem, { item: item, currency: invoice.currency }, index)))] }), _jsxs(View, { style: styles.totals, children: [_jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Subtotal" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxExcl, 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Tax" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum +
|
|
336
|
+
item.quantity *
|
|
337
|
+
(item.unitPriceTaxIncl - item.unitPriceTaxExcl), 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRowBold, children: [_jsx(Text, { style: styles.totalLabelBold, children: "Total" }), _jsx(Text, { style: styles.totalValueBold, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxIncl, 0), invoice.currency) })] })] })] }), _jsxs(View, { style: { marginLeft: 40 }, children: [_jsx(Text, { style: styles.termsTitle, children: "Terms & Conditions" }), _jsx(Text, { style: styles.termsText, children: "Please pay within 30 days of receiving this invoice." })] })] }) }));
|
|
338
|
+
};
|
|
339
|
+
// New component for issuer and payer sections
|
|
340
|
+
const InvoiceSection = ({ title, data, }) => (_jsxs(View, { style: styles.gridColumn, children: [_jsx(Text, { style: styles.sectionTitle, children: title }), title === "Issuer" && (_jsxs(_Fragment, { children: [_jsx(InvoiceField, { label: "Issue Date", value: formatDate(data.dateIssued) }), _jsx(InvoiceField, { label: "Delivery Date", value: formatDate(data.dateDelivered) })] })), title === "Payer" && (_jsx(InvoiceField, { label: "Due Date", value: formatDate(data.dateDue) })), _jsx(InvoiceField, { label: "Name", value: data.name }), _jsx(InvoiceField, { label: data.id?.taxId ? "Tax ID" : data.id?.corpRegId ? "Corp. Reg" : "", value: data.id?.taxId || data.id?.corpRegId || "" }), _jsx(InvoiceField, { label: "Address", value: data.address?.streetAddress || "" }), _jsx(InvoiceField, { label: "City", value: data.address?.city || "" }), _jsx(InvoiceField, { label: "Country", value: getCountryName(data.address?.country || "") || "" }), _jsx(InvoiceField, { label: "Email", value: data.contactInfo?.email || "" })] }));
|
|
341
|
+
{
|
|
342
|
+
/* New component for individual fields */
|
|
343
|
+
}
|
|
344
|
+
const InvoiceField = ({ label, value, }) => value && (_jsx(View, { style: styles.row, children: _jsx(Text, { style: styles.value, children: value }) }));
|
|
345
|
+
{
|
|
346
|
+
/* New component for fiat payment section */
|
|
347
|
+
}
|
|
348
|
+
const PaymentSectionFiat = ({ paymentRouting, }) => (_jsxs(View, { style: [styles.gridContainer, { marginTop: 0 }], children: [_jsxs(View, { style: styles.gridColumn, children: [_jsx(Text, { style: styles.companyName, children: paymentRouting.bank?.name || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.streetAddress || "" }), paymentRouting.bank?.address?.extendedAddress && (_jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.extendedAddress })), _jsxs(Text, { style: styles.companyInfo, children: [paymentRouting.bank?.address?.city || "", ",", " ", getCountryName(paymentRouting.bank?.address?.country || "") || "", " -", " ", paymentRouting.bank?.address?.postalCode || ""] })] }), _jsxs(View, { style: styles.gridColumn, children: [_jsx(Text, { style: styles.companyName, children: paymentRouting.bank?.beneficiary || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountNum || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountType || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.BIC ||
|
|
349
|
+
paymentRouting.bank?.SWIFT ||
|
|
350
|
+
paymentRouting.bank?.ABA ||
|
|
351
|
+
"" })] })] }));
|
|
352
|
+
{
|
|
353
|
+
/* New component for crypto payment section */
|
|
354
|
+
}
|
|
355
|
+
const PaymentSectionCrypto = ({ paymentRouting, }) => (_jsx(View, { style: styles.row, children: _jsxs(View, { style: styles.gridColumn, children: [_jsx(InvoiceField, { label: "Chain", value: paymentRouting.wallet?.chainName || "" }), _jsx(InvoiceField, { label: "Address", value: paymentRouting.wallet?.address || "" })] }) }));
|
|
356
|
+
{
|
|
357
|
+
/* New component for line items */
|
|
358
|
+
}
|
|
359
|
+
const InvoiceLineItem = ({ item, currency, }) => (_jsxs(View, { style: styles.tableRow, children: [_jsxs(View, { style: styles.tableCol40, children: [_jsx(Text, { style: styles.itemName, children: item.description }), item.longDescription && (_jsx(Text, { style: styles.itemDescription, children: item.longDescription }))] }), _jsx(Text, { style: styles.tableCol15, children: item.quantity }), _jsx(Text, { style: styles.tableCol15, children: formatCurrency(item.unitPriceTaxExcl, currency) }), _jsx(Text, { style: styles.tableCol15, children: formatCurrency(item.unitPriceTaxIncl - item.unitPriceTaxExcl, currency) }), _jsx(Text, { style: styles.tableCol15, children: formatCurrency(item.quantity * item.unitPriceTaxIncl, currency) })] }));
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValidationResult } from "../validation/validationManager.js";
|
|
2
|
+
interface CountryFormProps {
|
|
3
|
+
country: string;
|
|
4
|
+
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
|
+
handleBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
validation?: ValidationResult | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const CountryForm: ({ country, handleInputChange, handleBlur, className, label, validation, }: CountryFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=countryForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/countryForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,GAAI,2EAOzB,gBAAgB,4CAyClB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Form, CountryCodeField } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
+
import { getCountryCodeFromName } from "../utils/utils.js";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
export const CountryForm = ({ country, handleInputChange, handleBlur, className, label, validation, }) => {
|
|
6
|
+
// Convert country name to country code if needed
|
|
7
|
+
const countryCode = getCountryCodeFromName(country);
|
|
8
|
+
const warnings = validation && !validation.isValid ? [validation.message] : undefined;
|
|
9
|
+
return (_jsx(Form, { defaultValues: { country: countryCode || "" }, onSubmit: () => { }, resetOnSuccessfulSubmit: true, children: _jsx(CountryCodeField, { enableSearch: true, name: "country", placeholder: "Country", onChange: (value) => {
|
|
10
|
+
const syntheticEvent = {
|
|
11
|
+
target: {
|
|
12
|
+
value: value,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
handleInputChange(syntheticEvent);
|
|
16
|
+
if (handleBlur) {
|
|
17
|
+
const blurEvent = {
|
|
18
|
+
target: {
|
|
19
|
+
value: value,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
handleBlur(blurEvent);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
// required
|
|
26
|
+
// defaultValue={countryCode}
|
|
27
|
+
value: countryCode, className: twMerge(className), label: label, warnings: warnings }) }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ValidationResult } from "../validation/validationManager.js";
|
|
2
|
+
interface CurrencyFormProps {
|
|
3
|
+
currency: string;
|
|
4
|
+
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
|
+
validation?: ValidationResult | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const currencyList: {
|
|
8
|
+
ticker: string;
|
|
9
|
+
crypto: boolean;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const CurrencyForm: ({ currency, handleInputChange, validation, }: CurrencyFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=currencyForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/currencyForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,YAAY;;;GAUxB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,8CAI1B,iBAAiB,4CA8BnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Form, CurrencyCodeField } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
+
export const currencyList = [
|
|
4
|
+
{ ticker: "USDS", crypto: true },
|
|
5
|
+
{ ticker: "DAI", crypto: true },
|
|
6
|
+
{ ticker: "USD", crypto: false },
|
|
7
|
+
{ ticker: "EUR", crypto: false },
|
|
8
|
+
{ ticker: "DKK", crypto: false },
|
|
9
|
+
{ ticker: "GBP", crypto: false },
|
|
10
|
+
{ ticker: "JPY", crypto: false },
|
|
11
|
+
{ ticker: "CNY", crypto: false },
|
|
12
|
+
{ ticker: "CHF", crypto: false },
|
|
13
|
+
];
|
|
14
|
+
export const CurrencyForm = ({ currency, handleInputChange, validation, }) => {
|
|
15
|
+
const warnings = validation && !validation.isValid ? [validation.message] : undefined;
|
|
16
|
+
return (_jsx(Form, { defaultValues: { currency }, onSubmit: () => { }, resetOnSuccessfulSubmit: true, children: _jsx(CurrencyCodeField, { style: {
|
|
17
|
+
width: "100px",
|
|
18
|
+
}, name: "currency", placeholder: "Currency", currencies: currencyList, searchable: false, value: currency, onChange: (value) => {
|
|
19
|
+
const syntheticEvent = {
|
|
20
|
+
target: {
|
|
21
|
+
value: value,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
handleInputChange(syntheticEvent);
|
|
25
|
+
}, warnings: warnings }) }));
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface DatePickerProps {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const DatePicker: (props: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=datePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePicker.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/datePicker.tsx"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,4CAqBhD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DatePickerField, Form } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
export const DatePicker = (props) => {
|
|
5
|
+
return (_jsx(Form, { defaultValues: {
|
|
6
|
+
input: props.value,
|
|
7
|
+
}, onSubmit: () => { }, resetOnSuccessfulSubmit: false, className: twMerge(props.className), children: _jsx(DatePickerField, { name: props.name, value: props.value, label: props.label, placeholder: props.placeholder, onChange: props.onChange, dateFormat: "YYYY-MM-DD" }) }, props.value));
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ValidationResult } from "../validation/validationManager.js";
|
|
2
|
+
interface InputFieldProps {
|
|
3
|
+
input?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
onBlur: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
8
|
+
handleInputChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
9
|
+
validation?: ValidationResult | null;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const InputField: (props: InputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=inputField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputField.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/inputField.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC3D,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IACvE,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,4CAsDhD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Form, StringField } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
export const InputField = (props) => {
|
|
5
|
+
const { input, value, label, placeholder, onBlur, handleInputChange, validation, className, } = props;
|
|
6
|
+
const warnings = validation && !validation.isValid ? [validation.message] : undefined;
|
|
7
|
+
return (_jsx(Form, { defaultValues: {
|
|
8
|
+
input: input,
|
|
9
|
+
}, onSubmit: () => { }, resetOnSuccessfulSubmit: true, children: _jsx(StringField, { style: {
|
|
10
|
+
color: "black",
|
|
11
|
+
}, label: label, placeholder: placeholder, name: "input", value: value, onBlur: onBlur, onChange: (e) => {
|
|
12
|
+
handleInputChange(e);
|
|
13
|
+
}, onKeyDown: (e) => {
|
|
14
|
+
if (e.key === 'Enter') {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.currentTarget.blur();
|
|
17
|
+
// Find and focus the next focusable element
|
|
18
|
+
const focusableElements = document.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
19
|
+
const currentIndex = Array.from(focusableElements).indexOf(e.currentTarget);
|
|
20
|
+
if (currentIndex > -1 && currentIndex < focusableElements.length - 1) {
|
|
21
|
+
focusableElements[currentIndex + 1].focus();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, warnings: warnings, className: twMerge(className) }) }));
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface NumberFormProps {
|
|
2
|
+
number: number | string;
|
|
3
|
+
precision?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const NumberForm: ({ number, precision, min, max, handleInputChange, placeholder, }: NumberFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=numberForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/numberForm.tsx"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,GAAI,kEAOxB,eAAe,4CAoBjB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Form, NumberField } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
+
export const NumberForm = ({ number, precision, min, max, handleInputChange, placeholder, }) => {
|
|
4
|
+
return (_jsx(Form, { defaultValues: { number }, onSubmit: () => { }, resetOnSuccessfulSubmit: true, children: _jsx(NumberField, { name: "number", onChange: (e) => {
|
|
5
|
+
handleInputChange(e);
|
|
6
|
+
}, precision: precision, min: min, max: max, value: Number(number), placeholder: placeholder }) }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface SelectFieldProps {
|
|
2
|
+
options: string[];
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const SelectField: (props: SelectFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=selectField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectField.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/selectField.tsx"],"names":[],"mappings":"AAMA,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAoFD,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAgPlD,CAAC"}
|