@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.
Files changed (282) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +22 -0
  3. package/dist/document-models/index.d.ts +2 -0
  4. package/dist/document-models/index.d.ts.map +1 -0
  5. package/dist/document-models/index.js +1 -0
  6. package/dist/document-models/invoice/gen/actions.d.ts +8 -0
  7. package/dist/document-models/invoice/gen/actions.d.ts.map +1 -0
  8. package/dist/document-models/invoice/gen/actions.js +3 -0
  9. package/dist/document-models/invoice/gen/creators.d.ts +4 -0
  10. package/dist/document-models/invoice/gen/creators.d.ts.map +1 -0
  11. package/dist/document-models/invoice/gen/creators.js +3 -0
  12. package/dist/document-models/invoice/gen/document-model.d.ts +3 -0
  13. package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -0
  14. package/dist/document-models/invoice/gen/document-model.js +227 -0
  15. package/dist/document-models/invoice/gen/general/actions.d.ts +10 -0
  16. package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -0
  17. package/dist/document-models/invoice/gen/general/actions.js +1 -0
  18. package/dist/document-models/invoice/gen/general/creators.d.ts +9 -0
  19. package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -0
  20. package/dist/document-models/invoice/gen/general/creators.js +8 -0
  21. package/dist/document-models/invoice/gen/general/error.d.ts +2 -0
  22. package/dist/document-models/invoice/gen/general/error.d.ts.map +1 -0
  23. package/dist/document-models/invoice/gen/general/error.js +1 -0
  24. package/dist/document-models/invoice/gen/general/object.d.ts +12 -0
  25. package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -0
  26. package/dist/document-models/invoice/gen/general/object.js +22 -0
  27. package/dist/document-models/invoice/gen/general/operations.d.ts +12 -0
  28. package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -0
  29. package/dist/document-models/invoice/gen/general/operations.js +1 -0
  30. package/dist/document-models/invoice/gen/index.d.ts +6 -0
  31. package/dist/document-models/invoice/gen/index.d.ts.map +1 -0
  32. package/dist/document-models/invoice/gen/index.js +5 -0
  33. package/dist/document-models/invoice/gen/items/actions.d.ts +8 -0
  34. package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -0
  35. package/dist/document-models/invoice/gen/items/actions.js +1 -0
  36. package/dist/document-models/invoice/gen/items/creators.d.ts +7 -0
  37. package/dist/document-models/invoice/gen/items/creators.d.ts.map +1 -0
  38. package/dist/document-models/invoice/gen/items/creators.js +6 -0
  39. package/dist/document-models/invoice/gen/items/error.d.ts +2 -0
  40. package/dist/document-models/invoice/gen/items/error.d.ts.map +1 -0
  41. package/dist/document-models/invoice/gen/items/error.js +1 -0
  42. package/dist/document-models/invoice/gen/items/object.d.ts +10 -0
  43. package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -0
  44. package/dist/document-models/invoice/gen/items/object.js +16 -0
  45. package/dist/document-models/invoice/gen/items/operations.d.ts +10 -0
  46. package/dist/document-models/invoice/gen/items/operations.d.ts.map +1 -0
  47. package/dist/document-models/invoice/gen/items/operations.js +1 -0
  48. package/dist/document-models/invoice/gen/object.d.ts +20 -0
  49. package/dist/document-models/invoice/gen/object.d.ts.map +1 -0
  50. package/dist/document-models/invoice/gen/object.js +29 -0
  51. package/dist/document-models/invoice/gen/parties/actions.d.ts +10 -0
  52. package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -0
  53. package/dist/document-models/invoice/gen/parties/actions.js +1 -0
  54. package/dist/document-models/invoice/gen/parties/creators.d.ts +9 -0
  55. package/dist/document-models/invoice/gen/parties/creators.d.ts.map +1 -0
  56. package/dist/document-models/invoice/gen/parties/creators.js +8 -0
  57. package/dist/document-models/invoice/gen/parties/error.d.ts +2 -0
  58. package/dist/document-models/invoice/gen/parties/error.d.ts.map +1 -0
  59. package/dist/document-models/invoice/gen/parties/error.js +1 -0
  60. package/dist/document-models/invoice/gen/parties/object.d.ts +12 -0
  61. package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -0
  62. package/dist/document-models/invoice/gen/parties/object.js +22 -0
  63. package/dist/document-models/invoice/gen/parties/operations.d.ts +12 -0
  64. package/dist/document-models/invoice/gen/parties/operations.d.ts.map +1 -0
  65. package/dist/document-models/invoice/gen/parties/operations.js +1 -0
  66. package/dist/document-models/invoice/gen/reducer.d.ts +3 -0
  67. package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -0
  68. package/dist/document-models/invoice/gen/reducer.js +79 -0
  69. package/dist/document-models/invoice/gen/schema/index.d.ts +3 -0
  70. package/dist/document-models/invoice/gen/schema/index.d.ts.map +1 -0
  71. package/dist/document-models/invoice/gen/schema/index.js +2 -0
  72. package/dist/document-models/invoice/gen/schema/types.d.ts +390 -0
  73. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -0
  74. package/dist/document-models/invoice/gen/schema/types.js +1 -0
  75. package/dist/document-models/invoice/gen/schema/zod.d.ts +56 -0
  76. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -0
  77. package/dist/document-models/invoice/gen/schema/zod.js +362 -0
  78. package/dist/document-models/invoice/gen/types.d.ts +10 -0
  79. package/dist/document-models/invoice/gen/types.d.ts.map +1 -0
  80. package/dist/document-models/invoice/gen/types.js +1 -0
  81. package/dist/document-models/invoice/gen/utils.d.ts +7 -0
  82. package/dist/document-models/invoice/gen/utils.d.ts.map +1 -0
  83. package/dist/document-models/invoice/gen/utils.js +166 -0
  84. package/dist/document-models/invoice/index.d.ts +41 -0
  85. package/dist/document-models/invoice/index.d.ts.map +1 -0
  86. package/dist/document-models/invoice/index.js +21 -0
  87. package/dist/document-models/invoice/src/reducers/general.d.ts +8 -0
  88. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -0
  89. package/dist/document-models/invoice/src/reducers/general.js +79 -0
  90. package/dist/document-models/invoice/src/reducers/items.d.ts +8 -0
  91. package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -0
  92. package/dist/document-models/invoice/src/reducers/items.js +108 -0
  93. package/dist/document-models/invoice/src/reducers/parties.d.ts +8 -0
  94. package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -0
  95. package/dist/document-models/invoice/src/reducers/parties.js +266 -0
  96. package/dist/document-models/invoice/src/tests/document-model.test.d.ts +6 -0
  97. package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -0
  98. package/dist/document-models/invoice/src/tests/document-model.test.js +17 -0
  99. package/dist/document-models/invoice/src/tests/general.test.d.ts +6 -0
  100. package/dist/document-models/invoice/src/tests/general.test.d.ts.map +1 -0
  101. package/dist/document-models/invoice/src/tests/general.test.js +75 -0
  102. package/dist/document-models/invoice/src/tests/items.test.d.ts +6 -0
  103. package/dist/document-models/invoice/src/tests/items.test.d.ts.map +1 -0
  104. package/dist/document-models/invoice/src/tests/items.test.js +45 -0
  105. package/dist/document-models/invoice/src/tests/parties.test.d.ts +6 -0
  106. package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +1 -0
  107. package/dist/document-models/invoice/src/tests/parties.test.js +75 -0
  108. package/dist/document-models/invoice/src/utils.d.ts +2 -0
  109. package/dist/document-models/invoice/src/utils.d.ts.map +1 -0
  110. package/dist/document-models/invoice/src/utils.js +1 -0
  111. package/dist/editors/contributor-billing/components/CreateDocument.d.ts +8 -0
  112. package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
  113. package/dist/editors/contributor-billing/components/CreateDocument.js +14 -0
  114. package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts +12 -0
  115. package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts.map +1 -0
  116. package/dist/editors/contributor-billing/components/DocumentDispatch.js +20 -0
  117. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +17 -0
  118. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -0
  119. package/dist/editors/contributor-billing/components/DriveExplorer.js +112 -0
  120. package/dist/editors/contributor-billing/components/EditorContainer.d.ts +14 -0
  121. package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -0
  122. package/dist/editors/contributor-billing/components/EditorContainer.js +28 -0
  123. package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts +12 -0
  124. package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts.map +1 -0
  125. package/dist/editors/contributor-billing/components/FileItemsGrid.js +7 -0
  126. package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts +17 -0
  127. package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts.map +1 -0
  128. package/dist/editors/contributor-billing/components/FolderItemsGrid.js +14 -0
  129. package/dist/editors/contributor-billing/components/FolderTree.d.ts +9 -0
  130. package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
  131. package/dist/editors/contributor-billing/components/FolderTree.js +31 -0
  132. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +16 -0
  133. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
  134. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +16 -0
  135. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +21 -0
  136. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
  137. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +45 -0
  138. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +12 -0
  139. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
  140. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +12 -0
  141. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +7 -0
  142. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
  143. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +7 -0
  144. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts +8 -0
  145. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
  146. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
  147. package/dist/editors/contributor-billing/editor.d.ts +6 -0
  148. package/dist/editors/contributor-billing/editor.d.ts.map +1 -0
  149. package/dist/editors/contributor-billing/editor.js +48 -0
  150. package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts +9 -0
  151. package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts.map +1 -0
  152. package/dist/editors/contributor-billing/hooks/useDispatchMap.js +21 -0
  153. package/dist/editors/contributor-billing/hooks/useDrop.d.ts +22 -0
  154. package/dist/editors/contributor-billing/hooks/useDrop.d.ts.map +1 -0
  155. package/dist/editors/contributor-billing/hooks/useDrop.js +57 -0
  156. package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts +8 -0
  157. package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts.map +1 -0
  158. package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.js +19 -0
  159. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +4 -0
  160. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -0
  161. package/dist/editors/contributor-billing/hooks/useTransformedNodes.js +32 -0
  162. package/dist/editors/contributor-billing/index.d.ts +5 -0
  163. package/dist/editors/contributor-billing/index.d.ts.map +1 -0
  164. package/dist/editors/contributor-billing/index.js +12 -0
  165. package/dist/editors/index.d.ts +3 -0
  166. package/dist/editors/index.d.ts.map +1 -0
  167. package/dist/editors/index.js +2 -0
  168. package/dist/editors/invoice/InvoicePDF.d.ts +8 -0
  169. package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -0
  170. package/dist/editors/invoice/InvoicePDF.js +359 -0
  171. package/dist/editors/invoice/assets/custom.d.ts +4 -0
  172. package/dist/editors/invoice/assets/powerhouseLogo.png +0 -0
  173. package/dist/editors/invoice/components/countryForm.d.ts +12 -0
  174. package/dist/editors/invoice/components/countryForm.d.ts.map +1 -0
  175. package/dist/editors/invoice/components/countryForm.js +28 -0
  176. package/dist/editors/invoice/components/currencyForm.d.ts +13 -0
  177. package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -0
  178. package/dist/editors/invoice/components/currencyForm.js +26 -0
  179. package/dist/editors/invoice/components/datePicker.d.ts +11 -0
  180. package/dist/editors/invoice/components/datePicker.d.ts.map +1 -0
  181. package/dist/editors/invoice/components/datePicker.js +8 -0
  182. package/dist/editors/invoice/components/inputField.d.ts +14 -0
  183. package/dist/editors/invoice/components/inputField.d.ts.map +1 -0
  184. package/dist/editors/invoice/components/inputField.js +25 -0
  185. package/dist/editors/invoice/components/numberForm.d.ts +11 -0
  186. package/dist/editors/invoice/components/numberForm.d.ts.map +1 -0
  187. package/dist/editors/invoice/components/numberForm.js +7 -0
  188. package/dist/editors/invoice/components/selectField.d.ts +8 -0
  189. package/dist/editors/invoice/components/selectField.d.ts.map +1 -0
  190. package/dist/editors/invoice/components/selectField.js +323 -0
  191. package/dist/editors/invoice/editor.d.ts +5 -0
  192. package/dist/editors/invoice/editor.d.ts.map +1 -0
  193. package/dist/editors/invoice/editor.js +377 -0
  194. package/dist/editors/invoice/exportUBL.d.ts +85 -0
  195. package/dist/editors/invoice/exportUBL.d.ts.map +1 -0
  196. package/dist/editors/invoice/exportUBL.js +382 -0
  197. package/dist/editors/invoice/index.d.ts +5 -0
  198. package/dist/editors/invoice/index.d.ts.map +1 -0
  199. package/dist/editors/invoice/index.js +12 -0
  200. package/dist/editors/invoice/ingestPDF.d.ts +12 -0
  201. package/dist/editors/invoice/ingestPDF.d.ts.map +1 -0
  202. package/dist/editors/invoice/ingestPDF.js +193 -0
  203. package/dist/editors/invoice/ingestUBL.d.ts +21 -0
  204. package/dist/editors/invoice/ingestUBL.d.ts.map +1 -0
  205. package/dist/editors/invoice/ingestUBL.js +169 -0
  206. package/dist/editors/invoice/invoiceToGnosis.d.ts +7 -0
  207. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -0
  208. package/dist/editors/invoice/invoiceToGnosis.js +139 -0
  209. package/dist/editors/invoice/legalEntity/bankSection.d.ts +14 -0
  210. package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -0
  211. package/dist/editors/invoice/legalEntity/bankSection.js +156 -0
  212. package/dist/editors/invoice/legalEntity/common.d.ts +6 -0
  213. package/dist/editors/invoice/legalEntity/common.d.ts.map +1 -0
  214. package/dist/editors/invoice/legalEntity/common.js +6 -0
  215. package/dist/editors/invoice/legalEntity/legalEntity.d.ts +40 -0
  216. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -0
  217. package/dist/editors/invoice/legalEntity/legalEntity.js +63 -0
  218. package/dist/editors/invoice/legalEntity/walletSection.d.ts +13 -0
  219. package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -0
  220. package/dist/editors/invoice/legalEntity/walletSection.js +55 -0
  221. package/dist/editors/invoice/lineItems.d.ts +23 -0
  222. package/dist/editors/invoice/lineItems.d.ts.map +1 -0
  223. package/dist/editors/invoice/lineItems.js +157 -0
  224. package/dist/editors/invoice/requestFinance.d.ts +7 -0
  225. package/dist/editors/invoice/requestFinance.d.ts.map +1 -0
  226. package/dist/editors/invoice/requestFinance.js +155 -0
  227. package/dist/editors/invoice/uploadPdfChunked.d.ts +10 -0
  228. package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -0
  229. package/dist/editors/invoice/uploadPdfChunked.js +79 -0
  230. package/dist/editors/invoice/utils/utils.d.ts +2 -0
  231. package/dist/editors/invoice/utils/utils.d.ts.map +1 -0
  232. package/dist/editors/invoice/utils/utils.js +54 -0
  233. package/dist/editors/invoice/validation/validationManager.d.ts +28 -0
  234. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -0
  235. package/dist/editors/invoice/validation/validationManager.js +65 -0
  236. package/dist/editors/invoice/validation/validationRules.d.ts +14 -0
  237. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -0
  238. package/dist/editors/invoice/validation/validationRules.js +334 -0
  239. package/dist/index.d.ts +5 -0
  240. package/dist/index.d.ts.map +1 -0
  241. package/dist/index.js +6 -0
  242. package/dist/powerhouse.manifest.json +31 -0
  243. package/dist/processors/index.d.ts +2 -0
  244. package/dist/processors/index.d.ts.map +1 -0
  245. package/dist/processors/index.js +1 -0
  246. package/dist/scripts/invoice/exampleBatchTxn.d.ts +2 -0
  247. package/dist/scripts/invoice/exampleBatchTxn.d.ts.map +1 -0
  248. package/dist/scripts/invoice/exampleBatchTxn.js +44 -0
  249. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts +28 -0
  250. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -0
  251. package/dist/scripts/invoice/gnosisTransactionBuilder.js +74 -0
  252. package/dist/scripts/invoice/pdfToDocumentAi.d.ts +5 -0
  253. package/dist/scripts/invoice/pdfToDocumentAi.d.ts.map +1 -0
  254. package/dist/scripts/invoice/pdfToDocumentAi.js +659 -0
  255. package/dist/scripts/invoice/requestFinance.d.ts +2 -0
  256. package/dist/scripts/invoice/requestFinance.d.ts.map +1 -0
  257. package/dist/scripts/invoice/requestFinance.js +38 -0
  258. package/dist/style.css +6463 -0
  259. package/dist/subgraphs/index.d.ts +2 -0
  260. package/dist/subgraphs/index.d.ts.map +1 -0
  261. package/dist/subgraphs/index.js +1 -0
  262. package/dist/subgraphs/invoice/customResolvers.d.ts +50 -0
  263. package/dist/subgraphs/invoice/customResolvers.d.ts.map +1 -0
  264. package/dist/subgraphs/invoice/customResolvers.js +327 -0
  265. package/dist/subgraphs/invoice/index.d.ts +10 -0
  266. package/dist/subgraphs/invoice/index.d.ts.map +1 -0
  267. package/dist/subgraphs/invoice/index.js +30 -0
  268. package/dist/subgraphs/invoice/resolvers.d.ts +3 -0
  269. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -0
  270. package/dist/subgraphs/invoice/resolvers.js +184 -0
  271. package/dist/subgraphs/invoice/schema.d.ts +3 -0
  272. package/dist/subgraphs/invoice/schema.d.ts.map +1 -0
  273. package/dist/subgraphs/invoice/schema.js +460 -0
  274. package/dist/tailwind.config.d.ts +13 -0
  275. package/dist/tailwind.config.d.ts.map +1 -0
  276. package/dist/tailwind.config.js +15 -0
  277. package/dist/vitest.config.d.ts +3 -0
  278. package/dist/vitest.config.d.ts.map +1 -0
  279. package/dist/vitest.config.js +8 -0
  280. package/editors/invoice/assets/custom.d.ts +4 -0
  281. package/editors/invoice/assets/powerhouseLogo.png +0 -0
  282. package/package.json +117 -0
@@ -0,0 +1,323 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Select } from "@powerhousedao/document-engineering/ui";
3
+ import { Icon } from "@powerhousedao/design-system";
4
+ import { ArrowBigRight, FileCheck } from "lucide-react";
5
+ import { useState } from "react";
6
+ const STATUS_OPTIONS = [
7
+ "DRAFT",
8
+ "ISSUED",
9
+ "CANCELLED",
10
+ "ACCEPTED",
11
+ "REJECTED",
12
+ "AWAITINGPAYMENT",
13
+ "PAYMENTSCHEDULED",
14
+ "PAYMENTSENT",
15
+ "PAYMENTISSUE",
16
+ "PAYMENTRECEIVED",
17
+ ];
18
+ function warningIcon() {
19
+ return _jsx(Icon, { name: "WarningFill", color: "#eb4235" });
20
+ }
21
+ function clockIcon() {
22
+ return _jsx(FileCheck, { style: { width: 24, height: 24, fill: "#475264", color: 'white', padding: 0, margin: 0, borderColor: '#475264' } });
23
+ }
24
+ function checkCircleIcon(color) {
25
+ return _jsx(FileCheck, { style: { width: 24, height: 24, fill: color, color: 'white' } });
26
+ }
27
+ function arrowRightIcon(color) {
28
+ return _jsx(ArrowBigRight, { style: { width: 22, height: 22, fill: color, color: color } });
29
+ }
30
+ const STATUS_OPTIONS_MAP = [
31
+ {
32
+ label: "Draft",
33
+ value: "DRAFT",
34
+ icon: () => arrowRightIcon("#1890ff"),
35
+ },
36
+ {
37
+ label: "Issued",
38
+ value: "ISSUED",
39
+ icon: () => arrowRightIcon("#475264"),
40
+ },
41
+ {
42
+ label: "Cancelled",
43
+ value: "CANCELLED",
44
+ icon: warningIcon,
45
+ },
46
+ {
47
+ label: "Accepted",
48
+ value: "ACCEPTED",
49
+ icon: () => checkCircleIcon("#475264"),
50
+ },
51
+ {
52
+ label: "Rejected",
53
+ value: "REJECTED",
54
+ icon: warningIcon,
55
+ },
56
+ {
57
+ label: "Awaiting Payment",
58
+ value: "AWAITINGPAYMENT",
59
+ icon: () => checkCircleIcon("#475264"),
60
+ },
61
+ {
62
+ label: "Payment Scheduled",
63
+ value: "PAYMENTSCHEDULED",
64
+ icon: clockIcon,
65
+ },
66
+ {
67
+ label: "Payment Sent",
68
+ value: "PAYMENTSENT",
69
+ icon: clockIcon,
70
+ },
71
+ {
72
+ label: "Payment Issue",
73
+ value: "PAYMENTISSUE",
74
+ icon: warningIcon,
75
+ },
76
+ {
77
+ label: "Payment Received",
78
+ value: "PAYMENTRECEIVED",
79
+ icon: () => checkCircleIcon("#34a853"),
80
+ },
81
+ ];
82
+ export const SelectField = (props) => {
83
+ const { options, value: status, onChange } = props;
84
+ const [selectKey, setSelectKey] = useState(0);
85
+ // Determine what options to show
86
+ const draftActions = [
87
+ {
88
+ label: "Draft",
89
+ value: "DRAFT",
90
+ icon: () => arrowRightIcon("#1890ff"),
91
+ },
92
+ {
93
+ label: "Issue Invoice",
94
+ value: "ISSUE_INVOICE",
95
+ },
96
+ {
97
+ label: "Cancel Invoice",
98
+ value: "CANCEL_INVOICE",
99
+ },
100
+ ];
101
+ const cancelledActions = [
102
+ {
103
+ label: "Cancelled",
104
+ value: "CANCELLED",
105
+ icon: warningIcon,
106
+ },
107
+ {
108
+ label: "Re-draft Invoice",
109
+ value: "RE_DRAFT_INVOICE",
110
+ },
111
+ ];
112
+ const issuedActions = [
113
+ {
114
+ label: "Issued",
115
+ value: "ISSUED",
116
+ icon: () => arrowRightIcon("#475264"),
117
+ },
118
+ {
119
+ label: "Pay now",
120
+ value: "PAY_NOW",
121
+ },
122
+ {
123
+ label: "Pay later",
124
+ value: "PAY_LATER",
125
+ },
126
+ {
127
+ label: "Batch Payment",
128
+ value: "BATCH_PAYMENT",
129
+ },
130
+ {
131
+ label: "Reject Invoice",
132
+ value: "REJECT_INVOICE",
133
+ },
134
+ {
135
+ label: "Mark as paid",
136
+ value: "MARK_AS_PAID",
137
+ },
138
+ ];
139
+ const paymentScheduledActions = [
140
+ {
141
+ label: "Payment Scheduled",
142
+ value: "PAYMENTSCHEDULED",
143
+ icon: clockIcon,
144
+ },
145
+ {
146
+ label: "Payment Sent",
147
+ value: "PAYMENTSENT",
148
+ icon: clockIcon,
149
+ },
150
+ ];
151
+ const paymentSentActions = [
152
+ {
153
+ label: "Payment Sent",
154
+ value: "PAYMENTSENT",
155
+ icon: clockIcon,
156
+ },
157
+ {
158
+ label: "Payment Returned",
159
+ value: "PAYMENT_RETURNED",
160
+ },
161
+ {
162
+ label: "Report Issue",
163
+ value: "REPORT_ISSUE",
164
+ },
165
+ {
166
+ label: "Mark as paid",
167
+ value: "MARK_AS_PAID",
168
+ },
169
+ ];
170
+ const awaitingPaymentActions = [
171
+ {
172
+ label: "Awaiting Payment",
173
+ value: "AWAITINGPAYMENT",
174
+ icon: () => checkCircleIcon("#475264"),
175
+ },
176
+ {
177
+ label: "Pay now",
178
+ value: "PAY_NOW",
179
+ },
180
+ {
181
+ label: "Mark as paid",
182
+ value: "MARK_AS_PAID",
183
+ },
184
+ ];
185
+ const paymentIssueActions = [
186
+ {
187
+ label: "Payment Issue",
188
+ value: "PAYMENTISSUE",
189
+ icon: warningIcon,
190
+ },
191
+ {
192
+ label: "Re-draft Invoice",
193
+ value: "RE_DRAFT_INVOICE",
194
+ },
195
+ ];
196
+ const paymentReceivedActions = [
197
+ {
198
+ label: "Payment Received",
199
+ value: "PAYMENTRECEIVED",
200
+ icon: () => checkCircleIcon("#34a853"),
201
+ },
202
+ {
203
+ label: "Re-draft Invoice",
204
+ value: "RE_DRAFT_INVOICE",
205
+ },
206
+ ];
207
+ const acceptedActions = [
208
+ {
209
+ label: "Accepted",
210
+ value: "ACCEPTED",
211
+ icon: () => checkCircleIcon("#475264"),
212
+ },
213
+ {
214
+ label: "Pay now",
215
+ value: "PAY_NOW",
216
+ },
217
+ {
218
+ label: "Batch Payment",
219
+ value: "BATCH_PAYMENT",
220
+ },
221
+ ];
222
+ const rejectedActions = [
223
+ {
224
+ label: "Rejected",
225
+ value: "REJECTED",
226
+ icon: warningIcon,
227
+ },
228
+ {
229
+ label: "Re-draft Invoice",
230
+ value: "RE_DRAFT_INVOICE",
231
+ },
232
+ ];
233
+ const optionsToShow = () => {
234
+ switch (status) {
235
+ case "DRAFT":
236
+ return draftActions;
237
+ case "ISSUED":
238
+ return issuedActions;
239
+ case "CANCELLED":
240
+ return cancelledActions;
241
+ case "PAYMENTSCHEDULED":
242
+ return paymentScheduledActions;
243
+ case "PAYMENTSENT":
244
+ return paymentSentActions;
245
+ case "AWAITINGPAYMENT":
246
+ return awaitingPaymentActions;
247
+ case "PAYMENTISSUE":
248
+ return paymentIssueActions;
249
+ case "PAYMENTRECEIVED":
250
+ return paymentReceivedActions;
251
+ case "ACCEPTED":
252
+ return acceptedActions;
253
+ case "REJECTED":
254
+ return rejectedActions;
255
+ default:
256
+ return STATUS_OPTIONS_MAP.filter((opt) => opt.value === status);
257
+ }
258
+ };
259
+ // Stateless handleChange
260
+ const handleChange = (value) => {
261
+ setSelectKey((k) => k + 1);
262
+ if (typeof value === "string") {
263
+ if (status === "DRAFT") {
264
+ if (value === "ISSUE_INVOICE")
265
+ onChange("ISSUED");
266
+ else if (value === "CANCEL_INVOICE")
267
+ onChange("CANCELLED");
268
+ }
269
+ else if (status === "CANCELLED") {
270
+ if (value === "RE_DRAFT_INVOICE")
271
+ onChange("DRAFT");
272
+ }
273
+ else if (status === "ISSUED") {
274
+ if (value === "PAY_NOW")
275
+ onChange("PAYMENTSCHEDULED");
276
+ else if (value === "PAY_LATER")
277
+ onChange("ACCEPTED");
278
+ else if (value === "BATCH_PAYMENT")
279
+ onChange("AWAITINGPAYMENT");
280
+ else if (value === "REJECT_INVOICE")
281
+ onChange("REJECTED");
282
+ else if (value === "MARK_AS_PAID")
283
+ onChange("PAYMENTRECEIVED");
284
+ }
285
+ else if (status === "PAYMENTSCHEDULED") {
286
+ if (value === "PAYMENTSENT")
287
+ onChange("PAYMENTSENT");
288
+ }
289
+ else if (status === "PAYMENTSENT") {
290
+ if (value === "PAYMENT_RETURNED")
291
+ onChange("AWAITINGPAYMENT");
292
+ else if (value === "REPORT_ISSUE")
293
+ onChange("PAYMENTISSUE");
294
+ else if (value === "MARK_AS_PAID")
295
+ onChange("PAYMENTRECEIVED");
296
+ }
297
+ else if (status === "AWAITINGPAYMENT") {
298
+ if (value === "PAY_NOW")
299
+ onChange("PAYMENTSCHEDULED");
300
+ else if (value === "MARK_AS_PAID")
301
+ onChange("PAYMENTRECEIVED");
302
+ }
303
+ else if (status === "PAYMENTISSUE") {
304
+ if (value === "RE_DRAFT_INVOICE")
305
+ onChange("DRAFT");
306
+ }
307
+ else if (status === "PAYMENTRECEIVED") {
308
+ if (value === "RE_DRAFT_INVOICE")
309
+ onChange("DRAFT");
310
+ }
311
+ else if (status === "ACCEPTED") {
312
+ if (value === "PAY_NOW" || value === "BATCH_PAYMENT")
313
+ onChange("AWAITINGPAYMENT");
314
+ }
315
+ else if (status === "REJECTED") {
316
+ if (value === "RE_DRAFT_INVOICE")
317
+ onChange("DRAFT");
318
+ }
319
+ // Optionally, handle other statuses/actions here
320
+ }
321
+ };
322
+ return (_jsx(Select, { style: { width: 230 }, options: optionsToShow(), value: status || "DRAFT", onChange: handleChange, selectionIcon: "checkmark", selectionIconPosition: "left", defaultValue: STATUS_OPTIONS_MAP[0].value }, selectKey));
323
+ };
@@ -0,0 +1,5 @@
1
+ import type { EditorProps } from "document-model";
2
+ import { type InvoiceDocument } from "../../document-models/invoice/index.js";
3
+ export type IProps = EditorProps<InvoiceDocument>;
4
+ export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA6ChD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CA+tB3C"}