@powerhousedao/contributor-billing 0.0.33 → 0.0.35
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/dist/document-models/invoice/gen/actions.d.ts +3 -1
- package/dist/document-models/invoice/gen/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/actions.js +1 -0
- package/dist/document-models/invoice/gen/creators.d.ts +1 -0
- package/dist/document-models/invoice/gen/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/creators.js +1 -0
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/document-model.js +167 -50
- package/dist/document-models/invoice/gen/general/actions.d.ts +4 -6
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.d.ts +4 -6
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.js +2 -4
- package/dist/document-models/invoice/gen/general/object.d.ts +3 -5
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.js +6 -12
- package/dist/document-models/invoice/gen/general/operations.d.ts +3 -5
- package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.d.ts +3 -1
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.js +8 -1
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +56 -15
- package/dist/document-models/invoice/gen/schema/types.d.ts +89 -23
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +21 -7
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +124 -28
- package/dist/document-models/invoice/gen/transitions/actions.d.ts +16 -0
- package/dist/document-models/invoice/gen/transitions/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/transitions/actions.js +1 -0
- package/dist/document-models/invoice/gen/transitions/creators.d.ts +15 -0
- package/dist/document-models/invoice/gen/transitions/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/transitions/creators.js +14 -0
- package/dist/document-models/invoice/gen/transitions/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/transitions/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/transitions/error.js +1 -0
- package/dist/document-models/invoice/gen/transitions/object.d.ts +18 -0
- package/dist/document-models/invoice/gen/transitions/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/transitions/object.js +40 -0
- package/dist/document-models/invoice/gen/transitions/operations.d.ts +18 -0
- package/dist/document-models/invoice/gen/transitions/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/transitions/operations.js +1 -0
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +10 -6
- package/dist/document-models/invoice/index.d.ts +14 -4
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +26 -42
- package/dist/document-models/invoice/src/reducers/transitions.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/transitions.js +162 -0
- package/dist/document-models/invoice/src/tests/general.test.js +10 -31
- package/dist/document-models/invoice/src/tests/transitions.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/transitions.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/transitions.test.js +506 -0
- package/dist/document-models/invoice/utils/statusTransitions.d.ts +13 -0
- package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +1 -0
- package/dist/document-models/invoice/utils/statusTransitions.js +13 -0
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +64 -64
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +3 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +3 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +27 -3
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +4 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +91 -21
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +1 -1
- package/dist/editors/invoice/components/confirmationModal.d.ts +14 -0
- package/dist/editors/invoice/components/confirmationModal.d.ts.map +1 -0
- package/dist/editors/invoice/components/confirmationModal.js +7 -0
- package/dist/editors/invoice/components/selectField.d.ts.map +1 -1
- package/dist/editors/invoice/components/selectField.js +109 -112
- package/dist/editors/invoice/components/statusModalComponents.d.ts +52 -0
- package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -0
- package/dist/editors/invoice/components/statusModalComponents.js +78 -0
- package/dist/editors/invoice/editor.d.ts +1 -1
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +153 -158
- package/dist/editors/invoice/ingestUBL.d.ts.map +1 -1
- package/dist/editors/invoice/ingestUBL.js +0 -3
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +4 -3
- package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMapping.js +65 -64
- package/dist/editors/invoice/requestFinance.d.ts +1 -0
- package/dist/editors/invoice/requestFinance.d.ts.map +1 -1
- package/dist/editors/invoice/requestFinance.js +9 -2
- package/dist/editors/invoice/validation/validationHandler.d.ts +4 -0
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -0
- package/dist/editors/invoice/validation/validationHandler.js +117 -0
- package/dist/scripts/contributor-billing/createXeroCsv.d.ts +8 -0
- package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -0
- package/dist/scripts/contributor-billing/createXeroCsv.js +209 -0
- package/dist/style.css +164 -18
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +92 -22
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +181 -57
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { generateId } from "document-model";
|
|
3
4
|
import { actions, } from "../../document-models/invoice/index.js";
|
|
4
5
|
import { LegalEntityForm } from "./legalEntity/legalEntity.js";
|
|
5
6
|
import { LineItemsTable } from "./lineItems.js";
|
|
@@ -7,58 +8,26 @@ import { loadUBLFile } from "./ingestUBL.js";
|
|
|
7
8
|
import PDFUploader from "./ingestPDF.js";
|
|
8
9
|
import RequestFinance from "./requestFinance.js";
|
|
9
10
|
import InvoiceToGnosis from "./invoiceToGnosis.js";
|
|
10
|
-
import { toast, ToastContainer } from "@powerhousedao/design-system";
|
|
11
|
+
import { toast, ToastContainer, } from "@powerhousedao/design-system";
|
|
11
12
|
import { PDFDownloadLink } from "@react-pdf/renderer";
|
|
12
13
|
import { InvoicePDF } from "./InvoicePDF.js";
|
|
13
14
|
import { createRoot } from "react-dom/client";
|
|
14
15
|
import { downloadUBL } from "./exportUBL.js";
|
|
15
16
|
import { CurrencyForm, currencyList } from "./components/currencyForm.js";
|
|
16
17
|
import { InputField } from "./components/inputField.js";
|
|
17
|
-
import { validateField, } from "./validation/validationManager.js";
|
|
18
18
|
import { DatePicker } from "./components/datePicker.js";
|
|
19
19
|
import { SelectField } from "./components/selectField.js";
|
|
20
20
|
import { formatNumber } from "./lineItems.js";
|
|
21
21
|
import { Textarea } from "@powerhousedao/document-engineering/ui";
|
|
22
|
+
import ConfirmationModal from "./components/confirmationModal.js";
|
|
23
|
+
import { ClosePaymentModalContent, ConfirmPaymentModalContent, FinalRejectionModalContent, IssueInvoiceModalContent, RegisterPaymentTxModalContent, RejectInvoiceModalContent, ReportPaymentIssueModalContent, SchedulePaymentModalContent, } from "./components/statusModalComponents.js";
|
|
24
|
+
import validateStatusBeforeContinue from "./validation/validationHandler.js";
|
|
22
25
|
function isFiatCurrency(currency) {
|
|
23
26
|
return currencyList.find((c) => c.ticker === currency)?.crypto === false;
|
|
24
27
|
}
|
|
25
|
-
const useResponsiveEditorStyle = (options = { scale: 0.9, maxWidth: "1280px" }) => {
|
|
26
|
-
const baseStyle = {
|
|
27
|
-
width: "100vw",
|
|
28
|
-
minHeight: "100vh",
|
|
29
|
-
margin: 0,
|
|
30
|
-
padding: 0,
|
|
31
|
-
boxSizing: "border-box",
|
|
32
|
-
transform: `scale(${options.scale})`,
|
|
33
|
-
transformOrigin: "top left",
|
|
34
|
-
};
|
|
35
|
-
const [responsiveStyle, setResponsiveStyle] = useState(baseStyle);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
function handleResize() {
|
|
38
|
-
if (window.innerWidth >= 1024) {
|
|
39
|
-
setResponsiveStyle({
|
|
40
|
-
...baseStyle,
|
|
41
|
-
maxWidth: options.maxWidth,
|
|
42
|
-
marginLeft: "auto",
|
|
43
|
-
marginRight: "auto",
|
|
44
|
-
padding: "1rem",
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
setResponsiveStyle(baseStyle);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
handleResize();
|
|
52
|
-
window.addEventListener("resize", handleResize);
|
|
53
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
54
|
-
}, [options.scale, options.maxWidth]);
|
|
55
|
-
return responsiveStyle;
|
|
56
|
-
};
|
|
57
28
|
export default function Editor(props) {
|
|
58
29
|
const { document: doc, dispatch } = props;
|
|
59
30
|
const state = doc.state.global;
|
|
60
|
-
// Only use the hook if you need custom scaling or maxWidth
|
|
61
|
-
const customStyle = useResponsiveEditorStyle({ scale: 0.9, maxWidth: "1280px" });
|
|
62
31
|
const [fiatMode, setFiatMode] = useState(isFiatCurrency(state.currency));
|
|
63
32
|
const [uploadDropdownOpen, setUploadDropdownOpen] = useState(false);
|
|
64
33
|
const [exportDropdownOpen, setExportDropdownOpen] = useState(false);
|
|
@@ -81,6 +50,18 @@ export default function Editor(props) {
|
|
|
81
50
|
const [lineItemValidation, setLineItemValidation] = useState(null);
|
|
82
51
|
const [mainCountryValidation, setMainCountryValidation] = useState(null);
|
|
83
52
|
const [bankCountryValidation, setBankCountryValidation] = useState(null);
|
|
53
|
+
// Replace showConfirmationModal and pendingStatus with a single modal state
|
|
54
|
+
const [activeModal, setActiveModal] = useState(null);
|
|
55
|
+
// Track warning state for modal
|
|
56
|
+
const [modalWarning, setModalWarning] = useState(false);
|
|
57
|
+
const [rejectReason, setRejectReason] = useState("");
|
|
58
|
+
const [finalReason, setFinalReason] = useState(false);
|
|
59
|
+
const [paymentRef, setPaymentRef] = useState("");
|
|
60
|
+
const [closureReason, setClosureReason] = useState("");
|
|
61
|
+
const [paymentDate, setPaymentDate] = useState("");
|
|
62
|
+
const [txnRef, setTxnRef] = useState("");
|
|
63
|
+
const [paymentIssue, setPaymentIssue] = useState("");
|
|
64
|
+
const [paymentAmount, setPaymentAmount] = useState("");
|
|
84
65
|
const prevStatus = useRef(state.status);
|
|
85
66
|
useEffect(() => {
|
|
86
67
|
setFiatMode(isFiatCurrency(state.currency));
|
|
@@ -118,11 +99,11 @@ export default function Editor(props) {
|
|
|
118
99
|
"CANCELLED",
|
|
119
100
|
"ACCEPTED",
|
|
120
101
|
"REJECTED",
|
|
121
|
-
"AWAITINGPAYMENT",
|
|
122
102
|
"PAYMENTSCHEDULED",
|
|
123
103
|
"PAYMENTSENT",
|
|
124
104
|
"PAYMENTISSUE",
|
|
125
105
|
"PAYMENTRECEIVED",
|
|
106
|
+
"PAYMENTCLOSED",
|
|
126
107
|
];
|
|
127
108
|
const handleFileUpload = async (event) => {
|
|
128
109
|
const file = event.target.files?.[0];
|
|
@@ -243,131 +224,100 @@ export default function Editor(props) {
|
|
|
243
224
|
}
|
|
244
225
|
});
|
|
245
226
|
}
|
|
246
|
-
//
|
|
227
|
+
// Replace handleStatusChange logic for opening modals
|
|
247
228
|
const handleStatusChange = (newStatus) => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (invoiceValidation && !invoiceValidation.isValid) {
|
|
260
|
-
validationErrors.push(invoiceValidation);
|
|
261
|
-
}
|
|
262
|
-
// Validate wallet address if currency is crypto
|
|
263
|
-
if (!isFiatCurrency(state.currency)) {
|
|
264
|
-
const walletValidation = validateField("address", state.issuer.paymentRouting?.wallet?.address ?? "", context);
|
|
265
|
-
setWalletValidation(walletValidation);
|
|
266
|
-
if (walletValidation && !walletValidation.isValid) {
|
|
267
|
-
validationErrors.push(walletValidation);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// Validate currency
|
|
271
|
-
const currencyValidation = validateField("currency", state.currency, context);
|
|
272
|
-
setCurrencyValidation(currencyValidation);
|
|
273
|
-
if (currencyValidation && !currencyValidation.isValid) {
|
|
274
|
-
validationErrors.push(currencyValidation);
|
|
275
|
-
}
|
|
276
|
-
// Validate main country
|
|
277
|
-
const mainCountry = state.issuer.country ?? "";
|
|
278
|
-
const mainCountryValidation = validateField("mainCountry", mainCountry, context);
|
|
279
|
-
setMainCountryValidation(mainCountryValidation);
|
|
280
|
-
if (mainCountryValidation && !mainCountryValidation.isValid) {
|
|
281
|
-
validationErrors.push(mainCountryValidation);
|
|
282
|
-
}
|
|
283
|
-
// Validate bank country
|
|
284
|
-
const bankCountry = state.issuer.paymentRouting?.bank?.address?.country ?? "";
|
|
285
|
-
const bankCountryValidation = validateField("bankCountry", bankCountry, context);
|
|
286
|
-
setBankCountryValidation(bankCountryValidation);
|
|
287
|
-
if (bankCountryValidation && !bankCountryValidation.isValid) {
|
|
288
|
-
validationErrors.push(bankCountryValidation);
|
|
289
|
-
}
|
|
290
|
-
// Validate EUR&GBP IBAN account number
|
|
291
|
-
const ibanValidation = validateField("accountNum", state.issuer.paymentRouting?.bank?.accountNum, context);
|
|
292
|
-
setIbanValidation(ibanValidation);
|
|
293
|
-
if (ibanValidation && !ibanValidation.isValid) {
|
|
294
|
-
validationErrors.push(ibanValidation);
|
|
295
|
-
}
|
|
296
|
-
// Validate BIC number
|
|
297
|
-
const bicValidation = validateField("bicNumber", state.issuer.paymentRouting?.bank?.BIC, context);
|
|
298
|
-
setBicValidation(bicValidation);
|
|
299
|
-
if (bicValidation && !bicValidation.isValid) {
|
|
300
|
-
validationErrors.push(bicValidation);
|
|
301
|
-
}
|
|
302
|
-
// Validate bank name
|
|
303
|
-
const bankNameValidation = validateField("bankName", state.issuer.paymentRouting?.bank?.name, context);
|
|
304
|
-
setBankNameValidation(bankNameValidation);
|
|
305
|
-
if (bankNameValidation && !bankNameValidation.isValid) {
|
|
306
|
-
validationErrors.push(bankNameValidation);
|
|
307
|
-
}
|
|
308
|
-
// Validate street address
|
|
309
|
-
const streetAddressValidation = validateField("streetAddress", state.issuer.address?.streetAddress, context);
|
|
310
|
-
setStreetAddressValidation(streetAddressValidation);
|
|
311
|
-
if (streetAddressValidation && !streetAddressValidation.isValid) {
|
|
312
|
-
validationErrors.push(streetAddressValidation);
|
|
313
|
-
}
|
|
314
|
-
// Validate city
|
|
315
|
-
const cityValidation = validateField("city", state.issuer.address?.city, context);
|
|
316
|
-
setCityValidation(cityValidation);
|
|
317
|
-
if (cityValidation && !cityValidation.isValid) {
|
|
318
|
-
validationErrors.push(cityValidation);
|
|
319
|
-
}
|
|
320
|
-
// Validate postal code
|
|
321
|
-
const postalCodeValidation = validateField("postalCode", state.issuer.address?.postalCode, context);
|
|
322
|
-
setPostalCodeValidation(postalCodeValidation);
|
|
323
|
-
if (postalCodeValidation && !postalCodeValidation.isValid) {
|
|
324
|
-
validationErrors.push(postalCodeValidation);
|
|
325
|
-
}
|
|
326
|
-
// Validate payer email
|
|
327
|
-
const payerEmailValidation = validateField("email", state.payer.contactInfo?.email, context);
|
|
328
|
-
setPayerEmailValidation(payerEmailValidation);
|
|
329
|
-
if (payerEmailValidation && !payerEmailValidation.isValid) {
|
|
330
|
-
validationErrors.push(payerEmailValidation);
|
|
331
|
-
}
|
|
332
|
-
// Validate line items
|
|
333
|
-
const lineItemValidation = validateField("lineItem", state.lineItems, context);
|
|
334
|
-
setLineItemValidation(lineItemValidation);
|
|
335
|
-
if (lineItemValidation && !lineItemValidation.isValid) {
|
|
336
|
-
validationErrors.push(lineItemValidation);
|
|
337
|
-
}
|
|
338
|
-
if (newStatus === "PAYMENTSCHEDULED" &&
|
|
339
|
-
!isFiatCurrency(state.currency) &&
|
|
340
|
-
state.issuer.paymentRouting?.wallet?.chainName === "") {
|
|
341
|
-
validationErrors.push({
|
|
342
|
-
message: "Select currency and chain before accepting invoice",
|
|
343
|
-
severity: "warning",
|
|
344
|
-
isValid: false,
|
|
345
|
-
});
|
|
229
|
+
const validationResult = validateStatusBeforeContinue(newStatus, state, setInvoiceValidation, setWalletValidation, setCurrencyValidation, setMainCountryValidation, setBankCountryValidation, setIbanValidation, setBicValidation, setBankNameValidation, setStreetAddressValidation, setCityValidation, setPostalCodeValidation, setPayerEmailValidation, setLineItemValidation, isFiatCurrency);
|
|
230
|
+
if (validationResult) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (newStatus === "ISSUED") {
|
|
234
|
+
const trueRejection = state.rejections.find((rejection) => rejection.final === true);
|
|
235
|
+
if (state.status === "REJECTED" && trueRejection) {
|
|
236
|
+
setRejectReason(trueRejection.reason);
|
|
237
|
+
setFinalReason(trueRejection.final);
|
|
238
|
+
setActiveModal("finalRejection");
|
|
239
|
+
return;
|
|
346
240
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
241
|
+
setActiveModal("issueInvoice");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (newStatus === "CANCELLED") {
|
|
245
|
+
dispatch(actions.cancel({}));
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (newStatus === "ACCEPTED") {
|
|
249
|
+
if (state.status === "PAYMENTCLOSED") {
|
|
250
|
+
dispatch(actions.reapprovePayment({}));
|
|
354
251
|
return;
|
|
355
252
|
}
|
|
253
|
+
dispatch(actions.accept({ payAfter: new Date().toISOString() }));
|
|
254
|
+
return;
|
|
356
255
|
}
|
|
357
|
-
|
|
256
|
+
if (newStatus === "REJECTED") {
|
|
257
|
+
setActiveModal("rejectInvoice");
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (newStatus === "DRAFT") {
|
|
261
|
+
dispatch(actions.reset({}));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (newStatus === "PAYMENTSCHEDULED") {
|
|
265
|
+
setActiveModal("schedulePayment");
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (newStatus === "PAYMENTCLOSED") {
|
|
269
|
+
setActiveModal("closePayment");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (newStatus === "PAYMENTSENT") {
|
|
273
|
+
setActiveModal("registerPayment");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (newStatus === "PAYMENTISSUE") {
|
|
277
|
+
setActiveModal("reportPaymentIssue");
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (newStatus === "PAYMENTRECEIVED") {
|
|
281
|
+
setActiveModal("confirmPayment");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
// Add more status checks for other modals as needed
|
|
358
285
|
};
|
|
359
286
|
const handleCurrencyChange = (currency) => {
|
|
360
|
-
if ((prevStatus.current === "PAYMENTSCHEDULED" ||
|
|
361
|
-
prevStatus.current === "DRAFT") &&
|
|
362
|
-
!isFiatCurrency(currency) &&
|
|
363
|
-
state.issuer.paymentRouting?.wallet?.chainName === "") {
|
|
364
|
-
dispatch(actions.editStatus({ status: "DRAFT" }));
|
|
365
|
-
toast("Select currency and chain before accepting invoice", {
|
|
366
|
-
type: "warning",
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
287
|
dispatch(actions.editInvoice({ currency }));
|
|
370
288
|
};
|
|
289
|
+
// Modal content map
|
|
290
|
+
const modalContentMap = {
|
|
291
|
+
issueInvoice: (_jsx(IssueInvoiceModalContent, { invoiceNoInput: invoiceNoInput, setInvoiceNoInput: setInvoiceNoInput, state: state, dispatch: dispatch, setWarning: setModalWarning })),
|
|
292
|
+
rejectInvoice: (_jsx(RejectInvoiceModalContent, { state: state, dispatch: dispatch, setWarning: setModalWarning, setRejectReason: setRejectReason, rejectReason: rejectReason, setFinalReason: setFinalReason, finalReason: finalReason })),
|
|
293
|
+
finalRejection: _jsx(FinalRejectionModalContent, { rejectReason: rejectReason }),
|
|
294
|
+
schedulePayment: (_jsx(SchedulePaymentModalContent, { paymentRef: paymentRef, setPaymentRef: setPaymentRef })),
|
|
295
|
+
closePayment: (_jsx(ClosePaymentModalContent, { closureReason: closureReason, setClosureReason: setClosureReason })),
|
|
296
|
+
registerPayment: (_jsx(RegisterPaymentTxModalContent, { paymentDate: paymentDate, setPaymentDate: setPaymentDate, txnRef: txnRef, setTxnRef: setTxnRef })),
|
|
297
|
+
reportPaymentIssue: (_jsx(ReportPaymentIssueModalContent, { paymentIssue: paymentIssue, setPaymentIssue: setPaymentIssue })),
|
|
298
|
+
confirmPayment: (_jsx(ConfirmPaymentModalContent, { paymentAmount: paymentAmount, setPaymentAmount: setPaymentAmount, payments: state.payments })),
|
|
299
|
+
// Add more modal content mappings here
|
|
300
|
+
};
|
|
301
|
+
const modalHeaders = {
|
|
302
|
+
issueInvoice: _jsx("div", { children: "Issue Invoice" }),
|
|
303
|
+
rejectInvoice: _jsx("div", { children: "Reject Invoice" }),
|
|
304
|
+
finalRejection: _jsx("div", { children: "Invoice Rejected" }),
|
|
305
|
+
schedulePayment: _jsx("div", { children: "Schedule Payment" }),
|
|
306
|
+
closePayment: _jsx("div", { children: "Close Payment" }),
|
|
307
|
+
registerPayment: _jsx("div", { children: "Register Payment" }),
|
|
308
|
+
reportPaymentIssue: _jsx("div", { children: "Report Payment Issue" }),
|
|
309
|
+
confirmPayment: _jsx("div", { children: "Confirm Payment" }),
|
|
310
|
+
// Add more headers as needed
|
|
311
|
+
};
|
|
312
|
+
const modalContinueLabels = {
|
|
313
|
+
issueInvoice: "Confirm",
|
|
314
|
+
rejectInvoice: "Confirm",
|
|
315
|
+
schedulePayment: "Confirm",
|
|
316
|
+
closePayment: "Confirm",
|
|
317
|
+
registerPayment: "Confirm",
|
|
318
|
+
reportPaymentIssue: "Confirm",
|
|
319
|
+
// Add more labels as needed
|
|
320
|
+
};
|
|
371
321
|
return (_jsxs("div", { className: "editor-container", children: [_jsx(ToastContainer, { position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsxs("div", { className: "flex items-center justify-between gap-4 mb-6", children: [_jsxs("div", { className: "flex items-center gap-4 flex-nowrap", children: [_jsx("h1", { className: "text-3xl font-bold whitespace-nowrap", children: "Invoice" }), _jsx(InputField, { placeholder: "Add invoice number", value: invoiceNoInput, handleInputChange: (e) => setInvoiceNoInput(e.target.value), onBlur: (e) => {
|
|
372
322
|
const newValue = e.target.value;
|
|
373
323
|
if (newValue !== state.invoiceNo) {
|
|
@@ -392,11 +342,11 @@ export default function Editor(props) {
|
|
|
392
342
|
}, value: state.dateIssued })] }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Delivery Date:" }), _jsx(DatePicker, { name: "deliveryDate", className: String.raw `w-full p-0`, onChange: (e) => {
|
|
393
343
|
const newValue = e.target.value.split("T")[0];
|
|
394
344
|
if (newValue !== state.dateDelivered) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
345
|
+
// Remove dateDelivered from editInvoice, as it's not a valid property
|
|
346
|
+
// dispatch(actions.editInvoice({ dateDelivered: newValue }));
|
|
347
|
+
// If you need to update delivery date, implement the correct action here
|
|
398
348
|
}
|
|
399
|
-
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className:
|
|
349
|
+
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: "w-64", onChange: (e) => dispatch(actions.editInvoice({
|
|
400
350
|
dateDue: e.target.value.split("T")[0],
|
|
401
351
|
})), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
|
|
402
352
|
...item,
|
|
@@ -411,5 +361,50 @@ export default function Editor(props) {
|
|
|
411
361
|
}
|
|
412
362
|
}, onChange: (e) => {
|
|
413
363
|
setNotes(e.target.value);
|
|
414
|
-
}, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 p-6 shadow-sm h-32", children: _jsxs("div", { className: "", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }),
|
|
364
|
+
}, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 p-6 shadow-sm h-32", children: _jsxs("div", { className: "", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), activeModal && (_jsx(ConfirmationModal, { open: !!activeModal, header: modalHeaders[activeModal], onCancel: () => setActiveModal(null), onContinue: () => {
|
|
365
|
+
if (activeModal === "issueInvoice") {
|
|
366
|
+
dispatch(actions.issue({
|
|
367
|
+
invoiceNo: invoiceNoInput,
|
|
368
|
+
dateIssued: state.dateIssued,
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
if (activeModal === "rejectInvoice") {
|
|
372
|
+
dispatch(actions.reject({
|
|
373
|
+
final: finalReason,
|
|
374
|
+
id: generateId(),
|
|
375
|
+
reason: rejectReason,
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
if (activeModal === "schedulePayment") {
|
|
379
|
+
dispatch(actions.schedulePayment({
|
|
380
|
+
id: generateId(),
|
|
381
|
+
processorRef: paymentRef,
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
if (activeModal === "closePayment") {
|
|
385
|
+
dispatch(actions.closePayment({
|
|
386
|
+
closureReason: closureReason,
|
|
387
|
+
}));
|
|
388
|
+
}
|
|
389
|
+
if (activeModal === "registerPayment") {
|
|
390
|
+
dispatch(actions.registerPaymentTx({
|
|
391
|
+
id: state.payments[state.payments.length - 1].id,
|
|
392
|
+
timestamp: paymentDate,
|
|
393
|
+
txRef: txnRef,
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
if (activeModal === "reportPaymentIssue") {
|
|
397
|
+
dispatch(actions.reportPaymentIssue({
|
|
398
|
+
id: state.payments[state.payments.length - 1].id,
|
|
399
|
+
issue: paymentIssue,
|
|
400
|
+
}));
|
|
401
|
+
}
|
|
402
|
+
if (activeModal === "confirmPayment") {
|
|
403
|
+
dispatch(actions.confirmPayment({
|
|
404
|
+
id: state.payments[state.payments.length - 1].id,
|
|
405
|
+
amount: parseFloat(paymentAmount) || 0,
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
setActiveModal(null);
|
|
409
|
+
}, continueLabel: modalContinueLabels[activeModal], continueDisabled: modalWarning, children: modalContentMap[activeModal] })), (state.status === "ACCEPTED" || state.status === "PAYMENTSCHEDULED") && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state, dispatch: dispatch })) : (_jsx(RequestFinance, { docState: state, dispatch: dispatch })) }))] }));
|
|
415
410
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestUBL.d.ts","sourceRoot":"","sources":["../../../editors/invoice/ingestUBL.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEd,MAAM,wCAAwC,CAAC;AAEhD,UAAU,gBAAgB;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAkC;gBAEtC,MAAM,EAAE,kBAAkB;IAItC,mBAAmB,CAAC,MAAM,EAAE,MAAM;IAqBlC,cAAc,CACZ,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI;IAUhB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,kBAAkB;
|
|
1
|
+
{"version":3,"file":"ingestUBL.d.ts","sourceRoot":"","sources":["../../../editors/invoice/ingestUBL.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEd,MAAM,wCAAwC,CAAC;AAEhD,UAAU,gBAAgB;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAkC;gBAEtC,MAAM,EAAE,kBAAkB;IAItC,mBAAmB,CAAC,MAAM,EAAE,MAAM;IAqBlC,cAAc,CACZ,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI;IAUhB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,cAAc;IA8NtB,OAAO,CAAC,gBAAgB;CA4DzB;AAED,wBAAsB,WAAW,CAAC,EAChC,IAAI,EACJ,QAAQ,GACT,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlC"}
|
|
@@ -40,9 +40,6 @@ export class UBLConverter {
|
|
|
40
40
|
invoiceNo: this.getElementText(invoice, "ID, cbc\\:ID"),
|
|
41
41
|
dateIssued: this.getElementText(invoice, "IssueDate, cbc\\:IssueDate"),
|
|
42
42
|
dateDue: this.getElementText(invoice, "PaymentDueDate, cbc\\:PaymentDueDate"),
|
|
43
|
-
dateDelivered: this.getElementText(invoice, "ActualDeliveryDate, cbc\\:ActualDeliveryDate") ||
|
|
44
|
-
this.getElementText(invoice, "TaxPointDate, cbc\\:TaxPointDate") ||
|
|
45
|
-
null,
|
|
46
43
|
currency: this.getElementText(invoice, "CurrencyCode, cbc\\:CurrencyCode") ||
|
|
47
44
|
this.getElementText(invoice, "DocumentCurrencyCode, cbc\\:DocumentCurrencyCode"),
|
|
48
45
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6LnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { actions, } from "../../document-models/invoice/index.js";
|
|
4
|
+
import { generateId } from "document-model";
|
|
4
5
|
let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
|
|
5
6
|
if (!window.document.baseURI.includes('localhost')) {
|
|
6
7
|
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
@@ -92,9 +93,9 @@ const InvoiceToGnosis = ({ docState, dispatch }) => {
|
|
|
92
93
|
const dataObj = typeof data.data === "string" ? JSON.parse(data.data) : data.data;
|
|
93
94
|
setsafeTxHash(dataObj.txHash);
|
|
94
95
|
// add gnosis tx hash to invoice
|
|
95
|
-
dispatch(actions.
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
dispatch(actions.schedulePayment({
|
|
97
|
+
id: generateId(),
|
|
98
|
+
processorRef: dataObj.txHash,
|
|
98
99
|
}));
|
|
99
100
|
if (dataObj.paymentDetails) {
|
|
100
101
|
// Format the payment details for better readability
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagMapping.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/tagMapping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"tagMapping.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/tagMapping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAGtE,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAiE/C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAc/C,CAAC"}
|
|
@@ -1,68 +1,69 @@
|
|
|
1
|
+
// Removed non expense accounts from the list
|
|
1
2
|
export const expenseAccountOptions = [
|
|
2
|
-
{ label: "Grants from Maker DAO", value: "200" },
|
|
3
|
-
{ label: "Clearing Account", value: "2001" },
|
|
4
|
-
{ label: "Request Finance IC account", value: "2222" },
|
|
5
|
-
{ label: "Interest Income", value: "270" },
|
|
6
|
-
{ label: "Activities and Events", value: "3000" },
|
|
7
|
-
{ label: "Meals", value: "3001" },
|
|
8
|
-
{ label: "Airfare", value: "3002" },
|
|
9
|
-
{ label: "Hotels", value: "3003" },
|
|
10
|
-
{ label: "Transportation (Uber, Taxi etc)", value: "3004" },
|
|
11
|
-
{ label: "Other travel cost", value: "3005" },
|
|
12
|
-
{ label: "Cost of Goods Sold", value: "310" },
|
|
13
|
-
{ label: "Advertising", value: "400" },
|
|
14
|
-
{ label: "Legal Fees Abroad", value: "4001" },
|
|
15
|
-
{ label: "Legal Fees Switzerland", value: "4002" },
|
|
16
|
-
{ label: "Finance Team Fees Abroad", value: "4003" },
|
|
17
|
-
{ label: "Finance and Accounting Fees Switzerland", value: "4004" },
|
|
18
|
-
{ label: "Software Development Team Fees", value: "4005" },
|
|
19
|
-
{ label: "Research Team Fees", value: "4006" },
|
|
20
|
-
{ label: "Marketing Team Fees", value: "4007" },
|
|
21
|
-
{ label: "Health Care Fees", value: "4008" },
|
|
22
|
-
{ label: "Contractor Fees", value: "4009" },
|
|
23
|
-
{ label: "Insurance Fees Team", value: "4010" },
|
|
24
|
-
{ label: "HR Fees", value: "4011" },
|
|
25
|
-
{ label: "Team Bonus", value: "4012" },
|
|
26
|
-
{ label: "Refferal Fees", value: "4013" },
|
|
27
|
-
{ label: "Depreciation", value: "416" },
|
|
28
|
-
{ label: "Freight & Courier", value: "425" },
|
|
29
|
-
{ label: "Interest Expense", value: "437" },
|
|
30
|
-
{ label: "Office Expenses", value: "453" },
|
|
31
|
-
{ label: "Rent", value: "469" },
|
|
32
|
-
{ label: "Subscriptions", value: "485" },
|
|
33
|
-
{ label: "Bank Revaluations", value: "497" },
|
|
34
|
-
{ label: "Unrealised Currency Gains", value: "498" },
|
|
35
|
-
{ label: "Realised Currency Gains", value: "499" },
|
|
36
|
-
{ label: "Income Tax Expense", value: "505" },
|
|
37
|
-
{ label: "Accounts Receivable", value: "610" },
|
|
38
|
-
{ label: "Prepayments", value: "620" },
|
|
39
|
-
{ label: "Inventory", value: "630" },
|
|
40
|
-
{ label: "Software/IT Subscriptions", value: "701" },
|
|
41
|
-
{ label: "Telephone and Internet Charges", value: "702" },
|
|
42
|
-
{ label: "Office Equipment", value: "710" },
|
|
43
|
-
{ label: "Less Accumulated Depreciation on Office Equipment", value: "711" },
|
|
44
|
-
{ label: "Computer Equipment", value: "720" },
|
|
45
|
-
{ label: "Less Accumulated Depreciation on Computer Equipment", value: "721" },
|
|
46
|
-
{ label: "Accounts Payable", value: "800" },
|
|
47
|
-
{ label: "Bank Fees", value: "8000" },
|
|
48
|
-
{ label: "Gas Fees", value: "8001" },
|
|
49
|
-
{ label: "Exchange Fees", value: "8003" },
|
|
50
|
-
{ label: "Unpaid Expense Claims", value: "801" },
|
|
51
|
-
{ label: "Accrued Expenses", value: "802" },
|
|
52
|
-
{ label: "Wages Payable", value: "803" },
|
|
53
|
-
{ label: "Sales Tax", value: "820" },
|
|
54
|
-
{ label: "Employee Tax Payable", value: "825" },
|
|
55
|
-
{ label: "Superannuation Payable", value: "826" },
|
|
56
|
-
{ label: "Income Tax Payable", value: "830" },
|
|
57
|
-
{ label: "Historical Adjustment", value: "840" },
|
|
58
|
-
{ label: "Suspense", value: "850" },
|
|
59
|
-
{ label: "Rounding", value: "860" },
|
|
60
|
-
{ label: "Tracking Transfers", value: "877" },
|
|
61
|
-
{ label: "Owner A Drawings", value: "880" },
|
|
62
|
-
{ label: "Owner A Funds Introduced", value: "881" },
|
|
63
|
-
{ label: "Loan", value: "900" },
|
|
64
|
-
{ label: "Retained Earnings", value: "960" },
|
|
65
|
-
{ label: "Owner A Share Capital", value: "970" }
|
|
3
|
+
//{ label: "200 - Grants from Maker DAO", value: "200" },
|
|
4
|
+
{ label: "2001 - Clearing Account", value: "2001" },
|
|
5
|
+
{ label: "2222 - Request Finance IC account", value: "2222" },
|
|
6
|
+
//{ label: "270 - Interest Income", value: "270" },
|
|
7
|
+
{ label: "3000 - Activities and Events", value: "3000" },
|
|
8
|
+
{ label: "3001 - Meals", value: "3001" },
|
|
9
|
+
{ label: "3002 - Airfare", value: "3002" },
|
|
10
|
+
{ label: "3003 - Hotels", value: "3003" },
|
|
11
|
+
{ label: "3004 - Transportation (Uber, Taxi etc)", value: "3004" },
|
|
12
|
+
{ label: "3005 - Other travel cost", value: "3005" },
|
|
13
|
+
//{ label: "310 - Cost of Goods Sold", value: "310" },
|
|
14
|
+
{ label: "400 - Advertising", value: "400" },
|
|
15
|
+
{ label: "4001 - Legal Fees Abroad", value: "4001" },
|
|
16
|
+
{ label: "4002 - Legal Fees Switzerland", value: "4002" },
|
|
17
|
+
{ label: "4003 - Finance Team Fees Abroad", value: "4003" },
|
|
18
|
+
{ label: "4004 - Finance and Accounting Fees Switzerland", value: "4004" },
|
|
19
|
+
{ label: "4005 - Software Development Team Fees", value: "4005" },
|
|
20
|
+
{ label: "4006 - Research Team Fees", value: "4006" },
|
|
21
|
+
{ label: "4007 - Marketing Team Fees", value: "4007" },
|
|
22
|
+
{ label: "4008 - Health Care Fees", value: "4008" },
|
|
23
|
+
{ label: "4009 - Contractor Fees", value: "4009" },
|
|
24
|
+
{ label: "4010 - Insurance Fees Team", value: "4010" },
|
|
25
|
+
{ label: "4011 - HR Fees", value: "4011" },
|
|
26
|
+
{ label: "4012 - Team Bonus", value: "4012" },
|
|
27
|
+
{ label: "4013 - Refferal Fees", value: "4013" },
|
|
28
|
+
{ label: "416 - Depreciation", value: "416" },
|
|
29
|
+
{ label: "425 - Freight & Courier", value: "425" },
|
|
30
|
+
{ label: "437 - Interest Expense", value: "437" },
|
|
31
|
+
{ label: "453 - Office Expenses", value: "453" },
|
|
32
|
+
{ label: "469 - Rent", value: "469" },
|
|
33
|
+
{ label: "485 - Subscriptions", value: "485" },
|
|
34
|
+
//{ label: "497 - Bank Revaluations", value: "497" },
|
|
35
|
+
//{ label: "498 - Unrealised Currency Gains", value: "498" },
|
|
36
|
+
//{ label: "499 - Realised Currency Gains", value: "499" },
|
|
37
|
+
{ label: "505 - Income Tax Expense", value: "505" },
|
|
38
|
+
//{ label: "610 - Accounts Receivable", value: "610" },
|
|
39
|
+
//{ label: "620 - Prepayments", value: "620" },
|
|
40
|
+
//{ label: "630 - Inventory", value: "630" },
|
|
41
|
+
{ label: "701 - Software/IT Subscriptions", value: "701" },
|
|
42
|
+
{ label: "702 - Telephone and Internet Charges", value: "702" },
|
|
43
|
+
//{ label: "710 - Office Equipment", value: "710" },
|
|
44
|
+
//{ label: "711 - Less Accumulated Depreciation on Office Equipment", value: "711" },
|
|
45
|
+
//{ label: "720 - Computer Equipment", value: "720" },
|
|
46
|
+
//{ label: "721 - Less Accumulated Depreciation on Computer Equipment", value: "721" },
|
|
47
|
+
//{ label: "800 - Accounts Payable", value: "800" },
|
|
48
|
+
{ label: "8000 - Bank Fees", value: "8000" },
|
|
49
|
+
{ label: "8001 - Gas Fees", value: "8001" },
|
|
50
|
+
{ label: "8003 - Exchange Fees", value: "8003" },
|
|
51
|
+
//{ label: "801 - Unpaid Expense Claims", value: "801" },
|
|
52
|
+
//{ label: "802 - Accrued Expenses", value: "802" },
|
|
53
|
+
//{ label: "803 - Wages Payable", value: "803" },
|
|
54
|
+
// { label: "820 - Sales Tax", value: "820" },
|
|
55
|
+
// { label: "825 - Employee Tax Payable", value: "825" },
|
|
56
|
+
// { label: "826 - Superannuation Payable", value: "826" },
|
|
57
|
+
// { label: "830 - Income Tax Payable", value: "830" },
|
|
58
|
+
// { label: "840 - Historical Adjustment", value: "840" },
|
|
59
|
+
// { label: "850 - Suspense", value: "850" },
|
|
60
|
+
// { label: "860 - Rounding", value: "860" },
|
|
61
|
+
// { label: "877 - Tracking Transfers", value: "877" },
|
|
62
|
+
// { label: "880 - Owner A Drawings", value: "880" },
|
|
63
|
+
// { label: "881 - Owner A Funds Introduced", value: "881" },
|
|
64
|
+
// { label: "900 - Loan", value: "900" },
|
|
65
|
+
// { label: "960 - Retained Earnings", value: "960" },
|
|
66
|
+
// { label: "970 - Owner A Share Capital", value: "970" }
|
|
66
67
|
];
|
|
67
68
|
export const paymentAccountOptions = [
|
|
68
69
|
{ label: "Clearing Account USD", value: "USD" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestFinance.d.ts","sourceRoot":"","sources":["../../../editors/invoice/requestFinance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"requestFinance.d.ts","sourceRoot":"","sources":["../../../editors/invoice/requestFinance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgNjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { actions, } from "../../document-models/invoice/index.js";
|
|
4
|
+
import { generateId } from "document-model";
|
|
3
5
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
4
6
|
if (!window.document.baseURI.includes('localhost')) {
|
|
5
7
|
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
6
8
|
}
|
|
7
|
-
const RequestFinance = ({ docState }) => {
|
|
9
|
+
const RequestFinance = ({ docState, dispatch }) => {
|
|
8
10
|
const [isLoading, setIsLoading] = useState(false);
|
|
9
11
|
const [error, setError] = useState(null);
|
|
10
12
|
const [responseData, setResponseData] = useState(null);
|
|
@@ -84,7 +86,8 @@ const RequestFinance = ({ docState }) => {
|
|
|
84
86
|
})),
|
|
85
87
|
invoiceNumber: docState.invoiceNo,
|
|
86
88
|
buyerInfo: {
|
|
87
|
-
email: docState.payer.contactInfo.email,
|
|
89
|
+
// email: docState.payer.contactInfo.email,
|
|
90
|
+
email: 'prometheus@powerhouse.inc',
|
|
88
91
|
firstName: docState.payer.name,
|
|
89
92
|
// lastName: docState.payer.name.split(" ")[1] || "Liberty",
|
|
90
93
|
businessName: docState.payer.name,
|
|
@@ -134,6 +137,10 @@ const RequestFinance = ({ docState }) => {
|
|
|
134
137
|
// Process the response
|
|
135
138
|
if (directPaymentResult?.response?.invoiceLinks?.pay) {
|
|
136
139
|
setInvoiceLink(directPaymentResult.response.invoiceLinks.pay);
|
|
140
|
+
dispatch(actions.schedulePayment({
|
|
141
|
+
id: generateId(),
|
|
142
|
+
processorRef: directPaymentResult.response.invoiceLinks.pay,
|
|
143
|
+
}));
|
|
137
144
|
}
|
|
138
145
|
setResponseData(directPaymentResult);
|
|
139
146
|
setDirectPaymentStatus("Direct payment created successfully");
|