@powerhousedao/contributor-billing 0.1.53 → 1.0.0-dev.10
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/account-transactions/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/account-transactions/gen/schema/zod.js +3 -3
- package/dist/document-models/account-transactions/module.d.ts +1 -1
- package/dist/document-models/account-transactions/module.d.ts.map +1 -1
- package/dist/document-models/account-transactions/module.js +1 -1
- package/dist/document-models/accounts/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/accounts/module.d.ts +1 -1
- package/dist/document-models/accounts/module.d.ts.map +1 -1
- package/dist/document-models/accounts/module.js +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.js +4 -4
- package/dist/document-models/billing-statement/module.d.ts +1 -1
- package/dist/document-models/billing-statement/module.d.ts.map +1 -1
- package/dist/document-models/billing-statement/module.js +1 -1
- package/dist/document-models/expense-report/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/expense-report/gen/schema/zod.js +38 -18
- package/dist/document-models/expense-report/module.d.ts +1 -1
- package/dist/document-models/expense-report/module.d.ts.map +1 -1
- package/dist/document-models/expense-report/module.js +1 -1
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/document-model.js +150 -150
- package/dist/document-models/invoice/gen/schema/types.d.ts +3 -6
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +2 -8
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +14 -25
- package/dist/document-models/invoice/module.d.ts +1 -1
- package/dist/document-models/invoice/module.d.ts.map +1 -1
- package/dist/document-models/invoice/module.js +1 -1
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +8 -0
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +2 -1
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +6 -2
- package/dist/document-models/invoice/src/reducers/transitions.d.ts +0 -5
- package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/transitions.js +19 -6
- package/dist/document-models/invoice/tests/general.test.js +11 -2
- package/dist/document-models/invoice/tests/items.test.js +1 -1
- package/dist/document-models/invoice/tests/parties.test.js +1 -1
- package/dist/document-models/invoice/tests/transitions.test.js +7 -2
- package/dist/document-models/operational-hub-profile/module.d.ts +1 -1
- package/dist/document-models/operational-hub-profile/module.d.ts.map +1 -1
- package/dist/document-models/operational-hub-profile/module.js +1 -1
- package/dist/document-models/snapshot-report/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/snapshot-report/gen/schema/zod.js +12 -12
- package/dist/document-models/snapshot-report/module.d.ts +1 -1
- package/dist/document-models/snapshot-report/module.d.ts.map +1 -1
- package/dist/document-models/snapshot-report/module.js +1 -1
- package/dist/editors/accounts-editor/editor.d.ts.map +1 -1
- package/dist/editors/accounts-editor/editor.js +2 -2
- package/dist/editors/builder-team-admin/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/builder-team-admin/components/DriveExplorer.js +64 -4
- package/dist/editors/builder-team-admin/module.js +1 -1
- package/dist/editors/contributor-billing/components/DashboardHome.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DashboardHome.js +2 -8
- package/dist/editors/contributor-billing/components/DocumentDropZone.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DocumentDropZone.js +37 -8
- package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveContents.js +4 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +54 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +6 -15
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +41 -6
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +16 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.d.ts +3 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.js +13 -11
- package/dist/editors/contributor-billing/components/MonthReportCard.d.ts +11 -4
- package/dist/editors/contributor-billing/components/MonthReportCard.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/MonthReportCard.js +55 -6
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts +1 -1
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.js +104 -7
- package/dist/editors/contributor-billing/components/ReportingView.d.ts +0 -3
- package/dist/editors/contributor-billing/components/ReportingView.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/ReportingView.js +65 -8
- package/dist/editors/contributor-billing/components/ToastRenderer.d.ts +2 -0
- package/dist/editors/contributor-billing/components/ToastRenderer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/ToastRenderer.js +14 -0
- package/dist/editors/contributor-billing/components/cbToast.d.ts +16 -0
- package/dist/editors/contributor-billing/components/cbToast.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/cbToast.js +29 -0
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.d.ts.map +1 -1
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.js +42 -2
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts +4 -0
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts.map +1 -1
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.js +4 -0
- package/dist/editors/contributor-billing/module.js +1 -1
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +12 -9
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +6 -10
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
- package/dist/editors/invoice/exportUBL.js +1 -2
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +25 -22
- package/dist/editors/invoice/invoiceToast.d.ts +4 -0
- package/dist/editors/invoice/invoiceToast.d.ts.map +1 -0
- package/dist/editors/invoice/invoiceToast.js +6 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +2 -1
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.js +3 -14
- package/dist/editors/invoice/legalEntity/walletSection.d.ts +1 -0
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.js +2 -2
- package/dist/editors/invoice/lineItems.js +1 -1
- package/dist/editors/invoice/requestFinance.d.ts +3 -2
- package/dist/editors/invoice/requestFinance.d.ts.map +1 -1
- package/dist/editors/invoice/requestFinance.js +38 -42
- package/dist/editors/invoice/validation/validationHandler.d.ts +1 -1
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationHandler.js +15 -2
- package/dist/editors/invoice/validation/validationManager.d.ts +1 -1
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +2 -1
- package/dist/editors/invoice/validation/validationRules.d.ts +1 -0
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +26 -1
- package/dist/editors/snapshot-report-editor/components/DateRangePicker.d.ts +19 -0
- package/dist/editors/snapshot-report-editor/components/DateRangePicker.d.ts.map +1 -0
- package/dist/editors/snapshot-report-editor/components/DateRangePicker.js +66 -0
- package/dist/editors/snapshot-report-editor/editor.d.ts.map +1 -1
- package/dist/editors/snapshot-report-editor/editor.js +72 -48
- package/dist/scripts/download-all-drive-documents/download-drive-documents.d.ts +33 -0
- package/dist/scripts/download-all-drive-documents/download-drive-documents.d.ts.map +1 -0
- package/dist/scripts/download-all-drive-documents/download-drive-documents.js +583 -0
- package/dist/scripts/invoice/requestFinance.d.ts +18 -1
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
- package/dist/scripts/invoice/requestFinance.js +17 -5
- package/dist/scripts/upload-phd-documents/upload-phd-documents.d.ts +20 -0
- package/dist/scripts/upload-phd-documents/upload-phd-documents.d.ts.map +1 -0
- package/dist/scripts/upload-phd-documents/upload-phd-documents.js +313 -0
- package/dist/style.css +201 -106
- package/dist/subgraphs/budget-statements/resolvers.d.ts +38 -0
- package/dist/subgraphs/budget-statements/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/budget-statements/resolvers.js +192 -62
- package/dist/subgraphs/budget-statements/resolvers.test.d.ts +2 -0
- package/dist/subgraphs/budget-statements/resolvers.test.d.ts.map +1 -0
- package/dist/subgraphs/budget-statements/resolvers.test.js +339 -0
- package/dist/subgraphs/budget-statements/schema.d.ts.map +1 -1
- package/dist/subgraphs/budget-statements/schema.js +8 -0
- package/dist/subgraphs/index.d.ts +0 -1
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +0 -1
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts +70 -11
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice-addon/customResolvers.js +12 -27
- package/package.json +35 -28
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/document-model.test.js +0 -104
- package/dist/document-models/invoice/src/tests/general.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/general.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/general.test.js +0 -49
- package/dist/document-models/invoice/src/tests/items.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/items.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/items.test.js +0 -59
- package/dist/document-models/invoice/src/tests/parties.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/parties.test.js +0 -69
- package/dist/document-models/invoice/src/tests/transitions.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/transitions.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/transitions.test.js +0 -59
- package/dist/document-models/invoice/utils/statusTransitions.d.ts +0 -13
- package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +0 -1
- package/dist/document-models/invoice/utils/statusTransitions.js +0 -13
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts +0 -15
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts.map +0 -1
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.js +0 -61
- package/dist/editors/contributor-billing/components/CreateHubProfileModal.d.ts +0 -12
- package/dist/editors/contributor-billing/components/CreateHubProfileModal.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/CreateHubProfileModal.js +0 -74
- package/dist/subgraphs/resources-services/index.d.ts +0 -11
- package/dist/subgraphs/resources-services/index.d.ts.map +0 -1
- package/dist/subgraphs/resources-services/index.js +0 -11
- package/dist/subgraphs/resources-services/resolvers.d.ts +0 -3
- package/dist/subgraphs/resources-services/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/resources-services/resolvers.js +0 -462
- package/dist/subgraphs/resources-services/schema.d.ts +0 -3
- package/dist/subgraphs/resources-services/schema.d.ts.map +0 -1
- package/dist/subgraphs/resources-services/schema.js +0 -284
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useDocumentsInSelectedDrive, setSelectedNode, addDocument, dispatchActions, useSelectedDrive, isFileNodeKind, } from "@powerhousedao/reactor-browser";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
|
-
import { FileText, Camera, Plus } from "lucide-react";
|
|
4
|
+
import { FileText, Camera, Plus, Trash2 } from "lucide-react";
|
|
5
5
|
import { setName } from "document-model";
|
|
6
|
-
import { moveNode } from "document-drive";
|
|
6
|
+
import { moveNode, deleteNode } from "document-drive";
|
|
7
|
+
import { ConfirmationModal } from "./InvoiceTable/ConfirmationModal.js";
|
|
7
8
|
import { actions as expenseReportActions } from "../../../document-models/expense-report/index.js";
|
|
8
9
|
import { actions as snapshotReportActions } from "../../../document-models/snapshot-report/index.js";
|
|
10
|
+
import { useMonthlyReports } from "../hooks/useMonthlyReports.js";
|
|
9
11
|
/**
|
|
10
12
|
* Parse a month name like "January 2026" into start and end dates
|
|
11
13
|
*/
|
|
@@ -13,8 +15,9 @@ function parseMonthDates(monthName) {
|
|
|
13
15
|
const date = new Date(monthName + " 1"); // e.g., "January 2026 1"
|
|
14
16
|
if (isNaN(date.getTime()))
|
|
15
17
|
return null;
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
+
// Use UTC to avoid timezone offset being baked into .toISOString()
|
|
19
|
+
const start = new Date(Date.UTC(date.getFullYear(), date.getMonth(), 1));
|
|
20
|
+
const end = new Date(Date.UTC(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59, 999));
|
|
18
21
|
return { start, end };
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
@@ -24,17 +27,42 @@ function formatMonthCode(monthName) {
|
|
|
24
27
|
const date = new Date(monthName + " 1");
|
|
25
28
|
if (isNaN(date.getTime()))
|
|
26
29
|
return monthName;
|
|
27
|
-
const month = String(date.
|
|
28
|
-
const year = date.
|
|
30
|
+
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
|
|
31
|
+
const year = date.getUTCFullYear();
|
|
29
32
|
return `${month}-${year}`;
|
|
30
33
|
}
|
|
31
34
|
/**
|
|
32
35
|
* View for the Reporting folder showing Expense Reports and Snapshot Reports
|
|
33
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Get the suggested start date for a new snapshot report based on the previous
|
|
39
|
+
* month's snapshot period end date.
|
|
40
|
+
*/
|
|
41
|
+
function getSuggestedSnapshotStartDate(monthName, monthReportSets) {
|
|
42
|
+
const monthDates = parseMonthDates(monthName);
|
|
43
|
+
if (!monthDates)
|
|
44
|
+
return null;
|
|
45
|
+
const currentIndex = monthReportSets.findIndex((s) => s.monthName === monthName);
|
|
46
|
+
if (currentIndex === -1)
|
|
47
|
+
return null;
|
|
48
|
+
const previousMonth = monthReportSets[currentIndex + 1];
|
|
49
|
+
if (!previousMonth?.snapshotEndDate)
|
|
50
|
+
return null;
|
|
51
|
+
const previousEnd = new Date(previousMonth.snapshotEndDate);
|
|
52
|
+
if (isNaN(previousEnd.getTime()))
|
|
53
|
+
return null;
|
|
54
|
+
const suggestedStart = new Date(previousEnd);
|
|
55
|
+
suggestedStart.setUTCDate(suggestedStart.getUTCDate() + 1);
|
|
56
|
+
suggestedStart.setUTCHours(0, 0, 0, 0);
|
|
57
|
+
return suggestedStart;
|
|
58
|
+
}
|
|
34
59
|
export function ReportingView({ folderId, monthName }) {
|
|
35
60
|
const documentsInDrive = useDocumentsInSelectedDrive();
|
|
36
61
|
const [selectedDrive] = useSelectedDrive();
|
|
37
62
|
const [isCreating, setIsCreating] = useState(false);
|
|
63
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
64
|
+
const [deleteTarget, setDeleteTarget] = useState(null);
|
|
65
|
+
const { monthReportSets } = useMonthlyReports();
|
|
38
66
|
// Find expense reports and snapshot reports in this Reporting folder
|
|
39
67
|
// Also includes documents that match the month by name (for backwards compatibility)
|
|
40
68
|
const { expenseReports, snapshotReports } = useMemo(() => {
|
|
@@ -83,6 +111,21 @@ export function ReportingView({ folderId, monthName }) {
|
|
|
83
111
|
setSelectedNode(docId);
|
|
84
112
|
};
|
|
85
113
|
const driveId = selectedDrive?.header.id;
|
|
114
|
+
const handleDeleteReport = async () => {
|
|
115
|
+
if (!driveId || !deleteTarget)
|
|
116
|
+
return;
|
|
117
|
+
setIsDeleting(true);
|
|
118
|
+
try {
|
|
119
|
+
await dispatchActions(deleteNode({ id: deleteTarget.id }), driveId);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.error("Failed to delete report:", error);
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
setIsDeleting(false);
|
|
126
|
+
setDeleteTarget(null);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
86
129
|
const handleCreateExpenseReport = async () => {
|
|
87
130
|
if (!driveId || !monthName || isCreating)
|
|
88
131
|
return;
|
|
@@ -134,9 +177,12 @@ export function ReportingView({ folderId, monthName }) {
|
|
|
134
177
|
}
|
|
135
178
|
// Set the document name
|
|
136
179
|
await dispatchActions(setName(reportName), createdNode.id);
|
|
137
|
-
// Set period
|
|
180
|
+
// Set reporting period to calendar month boundaries
|
|
138
181
|
const dates = parseMonthDates(monthName);
|
|
139
182
|
if (dates) {
|
|
183
|
+
const suggestedStart = getSuggestedSnapshotStartDate(monthName, monthReportSets);
|
|
184
|
+
// Transaction filtering start: previous period end + 1 day, or month start
|
|
185
|
+
const txStartDate = suggestedStart || dates.start;
|
|
140
186
|
await dispatchActions([
|
|
141
187
|
snapshotReportActions.setPeriodStart({
|
|
142
188
|
periodStart: dates.start.toISOString(),
|
|
@@ -145,6 +191,11 @@ export function ReportingView({ folderId, monthName }) {
|
|
|
145
191
|
periodEnd: dates.end.toISOString(),
|
|
146
192
|
}),
|
|
147
193
|
], createdNode.id);
|
|
194
|
+
// Set the transaction filtering range (snapshot period) separately
|
|
195
|
+
await dispatchActions(snapshotReportActions.setReportConfig({
|
|
196
|
+
startDate: txStartDate.toISOString(),
|
|
197
|
+
endDate: dates.end.toISOString(),
|
|
198
|
+
}), createdNode.id);
|
|
148
199
|
}
|
|
149
200
|
// Open the created report
|
|
150
201
|
setSelectedNode(createdNode.id);
|
|
@@ -153,5 +204,11 @@ export function ReportingView({ folderId, monthName }) {
|
|
|
153
204
|
setIsCreating(false);
|
|
154
205
|
}
|
|
155
206
|
};
|
|
156
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: "mb-6", children: [_jsxs("h1", { className: "text-2xl font-bold text-gray-900", children: ["Reporting ", monthName ? `- ${monthName}` : ""] }), _jsxs("p", { className: "text-gray-600", children: ["Manage expense reports and snapshot reports", monthName ? ` for ${monthName}` : ""] })] }), _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [_jsxs("div", { className: "bg-white rounded-lg border border-gray-200 p-4", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "w-5 h-5 text-blue-600" }), _jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Expense Reports" }), expenseReports.length > 0 && (_jsxs("span", { className: "text-sm text-gray-500", children: ["(", expenseReports.length, ")"] }))] }), _jsxs("button", { onClick: () => void handleCreateExpenseReport(), disabled: isCreating, className: "flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-blue-600 hover:bg-blue-50 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: [_jsx(Plus, { className: "w-4 h-4" }), isCreating ? "Creating..." : "New"] })] }), expenseReports.length === 0 ? (_jsx("p", { className: "text-gray-500 text-sm", children: "No expense reports yet" })) : (_jsx("div", { className: "space-y-2", children: expenseReports.map((doc) => (_jsxs("
|
|
207
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "mb-6", children: [_jsxs("h1", { className: "text-2xl font-bold text-gray-900", children: ["Reporting ", monthName ? `- ${monthName}` : ""] }), _jsxs("p", { className: "text-gray-600", children: ["Manage expense reports and snapshot reports", monthName ? ` for ${monthName}` : ""] })] }), _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [_jsxs("div", { className: "bg-white rounded-lg border border-gray-200 p-4", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "w-5 h-5 text-blue-600" }), _jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Expense Reports" }), expenseReports.length > 0 && (_jsxs("span", { className: "text-sm text-gray-500", children: ["(", expenseReports.length, ")"] }))] }), _jsxs("button", { onClick: () => void handleCreateExpenseReport(), disabled: isCreating, className: "flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-blue-600 hover:bg-blue-50 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: [_jsx(Plus, { className: "w-4 h-4" }), isCreating ? "Creating..." : "New"] })] }), expenseReports.length === 0 ? (_jsx("p", { className: "text-gray-500 text-sm", children: "No expense reports yet" })) : (_jsx("div", { className: "space-y-2", children: expenseReports.map((doc) => (_jsxs("div", { className: "flex items-center rounded-md border border-gray-100", children: [_jsxs("button", { onClick: () => handleOpenDocument(doc.header.id), className: "flex-1 flex items-center gap-3 p-3 text-left hover:bg-gray-50 rounded-l-md transition-colors min-w-0", children: [_jsx(FileText, { className: "w-4 h-4 text-gray-400" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-gray-900 truncate", children: doc.header.name || "Untitled" }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Modified:", " ", new Date(doc.header.lastModifiedAtUtcIso || Date.now()).toLocaleDateString()] })] })] }), _jsx("button", { onClick: () => setDeleteTarget({
|
|
208
|
+
id: doc.header.id,
|
|
209
|
+
name: doc.header.name || "Untitled",
|
|
210
|
+
}), className: "p-3 text-gray-400 hover:text-red-500 transition-colors flex-shrink-0", title: "Delete report", children: _jsx(Trash2, { className: "w-4 h-4" }) })] }, doc.header.id))) }))] }), _jsxs("div", { className: "bg-white rounded-lg border border-gray-200 p-4", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Camera, { className: "w-5 h-5 text-purple-600" }), _jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Snapshot Reports" })] }), snapshotReports.length === 0 && (_jsxs("button", { onClick: () => void handleCreateSnapshotReport(), disabled: isCreating, className: "flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-purple-600 hover:bg-purple-50 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: [_jsx(Plus, { className: "w-4 h-4" }), isCreating ? "Creating..." : "New"] }))] }), snapshotReports.length === 0 ? (_jsx("p", { className: "text-gray-500 text-sm", children: "No snapshot reports yet" })) : (_jsx("div", { className: "space-y-2", children: snapshotReports.map((doc) => (_jsxs("div", { className: "flex items-center rounded-md border border-gray-100", children: [_jsxs("button", { onClick: () => handleOpenDocument(doc.header.id), className: "flex-1 flex items-center gap-3 p-3 text-left hover:bg-gray-50 rounded-l-md transition-colors min-w-0", children: [_jsx(Camera, { className: "w-4 h-4 text-gray-400" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-gray-900 truncate", children: doc.header.name || "Untitled" }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Modified:", " ", new Date(doc.header.lastModifiedAtUtcIso || Date.now()).toLocaleDateString()] })] })] }), _jsx("button", { onClick: () => setDeleteTarget({
|
|
211
|
+
id: doc.header.id,
|
|
212
|
+
name: doc.header.name || "Untitled",
|
|
213
|
+
}), className: "p-3 text-gray-400 hover:text-red-500 transition-colors flex-shrink-0", title: "Delete report", children: _jsx(Trash2, { className: "w-4 h-4" }) })] }, doc.header.id))) }))] })] }), _jsxs(ConfirmationModal, { open: !!deleteTarget, header: "Delete Report", onCancel: () => setDeleteTarget(null), onContinue: () => void handleDeleteReport(), cancelLabel: "Cancel", continueLabel: isDeleting ? "Deleting..." : "Delete", continueDisabled: isDeleting, children: [_jsx("p", { className: "text-red-600 text-sm mb-2 font-medium", children: "This will permanently delete this report from the drive. This action cannot be undone." }), deleteTarget && (_jsx("p", { className: "text-gray-700 text-sm font-medium", children: deleteTarget.name }))] })] }));
|
|
157
214
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastRenderer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/ToastRenderer.tsx"],"names":[],"mappings":"AASA,wBAAgB,aAAa,mDAwB5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useToasts } from "./cbToast.js";
|
|
3
|
+
const typeStyles = {
|
|
4
|
+
success: "bg-green-600",
|
|
5
|
+
error: "bg-red-600",
|
|
6
|
+
warning: "bg-yellow-500 text-black",
|
|
7
|
+
info: "bg-blue-600",
|
|
8
|
+
};
|
|
9
|
+
export function ToastRenderer() {
|
|
10
|
+
const { toasts, removeToast } = useToasts();
|
|
11
|
+
if (toasts.length === 0)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsx("div", { className: "fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 max-w-sm", children: toasts.map((t) => (_jsxs("div", { className: `${typeStyles[t.type] ?? typeStyles.info} text-white px-4 py-3 rounded shadow-lg text-sm flex items-start gap-2 animate-[slideIn_0.2s_ease-out]`, children: [_jsx("span", { className: "flex-1", children: t.message }), _jsx("button", { type: "button", className: "opacity-70 hover:opacity-100 text-lg leading-none", onClick: () => removeToast(t.id), children: "\u00D7" })] }, t.id))) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type ToastType = "success" | "error" | "warning" | "info";
|
|
2
|
+
interface ToastItem {
|
|
3
|
+
id: number;
|
|
4
|
+
message: string;
|
|
5
|
+
type: ToastType;
|
|
6
|
+
}
|
|
7
|
+
declare function removeToast(id: number): void;
|
|
8
|
+
export declare function cbToast(message: string, options?: {
|
|
9
|
+
type?: ToastType;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare function useToasts(): {
|
|
12
|
+
toasts: ToastItem[];
|
|
13
|
+
removeToast: typeof removeToast;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=cbToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbToast.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/cbToast.ts"],"names":[],"mappings":"AAEA,KAAK,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;CACjB;AAcD,iBAAS,WAAW,CAAC,EAAE,EAAE,MAAM,QAG9B;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,QAKtE;AAED,wBAAgB,SAAS;;;EAWxB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
let nextId = 0;
|
|
3
|
+
let toasts = [];
|
|
4
|
+
const listeners = new Set();
|
|
5
|
+
function emit() {
|
|
6
|
+
for (const listener of listeners) {
|
|
7
|
+
listener([...toasts]);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function removeToast(id) {
|
|
11
|
+
toasts = toasts.filter((t) => t.id !== id);
|
|
12
|
+
emit();
|
|
13
|
+
}
|
|
14
|
+
export function cbToast(message, options) {
|
|
15
|
+
const id = nextId++;
|
|
16
|
+
toasts = [...toasts, { id, message, type: options?.type ?? "info" }];
|
|
17
|
+
emit();
|
|
18
|
+
setTimeout(() => removeToast(id), 5000);
|
|
19
|
+
}
|
|
20
|
+
export function useToasts() {
|
|
21
|
+
const [state, setState] = useState([]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
listeners.add(setState);
|
|
24
|
+
return () => {
|
|
25
|
+
listeners.delete(setState);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return { toasts: state, removeToast };
|
|
29
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentAutoPlacement.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useDocumentAutoPlacement.ts"],"names":[],"mappings":"AAiBA,UAAU,8BAA8B;IACtC,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,IAAI,8BAA8B,
|
|
1
|
+
{"version":3,"file":"useDocumentAutoPlacement.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useDocumentAutoPlacement.ts"],"names":[],"mappings":"AAiBA,UAAU,8BAA8B;IACtC,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,IAAI,8BAA8B,CAmNzE"}
|
|
@@ -20,7 +20,7 @@ export function useDocumentAutoPlacement() {
|
|
|
20
20
|
const [driveDocument] = useSelectedDrive();
|
|
21
21
|
const documentsInDrive = useDocumentsInSelectedDrive();
|
|
22
22
|
const { reportingFolderIds, monthFolders, billingFolder, createMonthFolder } = useBillingFolderStructure();
|
|
23
|
-
const { onMoveNode } = useNodeActions();
|
|
23
|
+
const { onMoveNode, onRenameNode } = useNodeActions();
|
|
24
24
|
const driveId = driveDocument?.header.id;
|
|
25
25
|
// Initialize module-level tracking for this drive
|
|
26
26
|
if (driveId && !globalProcessingState.processedDocs.has(driveId)) {
|
|
@@ -61,6 +61,17 @@ export function useDocumentAutoPlacement() {
|
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
// Convert "August 2025" → "08-2025"
|
|
65
|
+
const formatMonthCode = (monthName) => {
|
|
66
|
+
const date = new Date(monthName + " 1");
|
|
67
|
+
if (isNaN(date.getTime()))
|
|
68
|
+
return monthName;
|
|
69
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
70
|
+
const year = date.getFullYear();
|
|
71
|
+
return `${month}-${year}`;
|
|
72
|
+
};
|
|
73
|
+
// Standard naming pattern: "MM-YYYY Expense Report N"
|
|
74
|
+
const STANDARD_NAME_PATTERN = /^\d{2}-\d{4} Expense Report \d+$/;
|
|
64
75
|
// Auto-place expense reports into appropriate Reporting folders
|
|
65
76
|
useEffect(() => {
|
|
66
77
|
if (!driveId || !driveDocument || !documentsInDrive)
|
|
@@ -73,6 +84,17 @@ export function useDocumentAutoPlacement() {
|
|
|
73
84
|
const expenseReportNodesToProcess = allNodes.filter((node) => isFileNodeKind(node) &&
|
|
74
85
|
node.documentType === "powerhouse/expense-report" &&
|
|
75
86
|
!reportingFolderIds.has(node.parentFolder || ""));
|
|
87
|
+
// Count existing expense reports per reporting folder for numbering
|
|
88
|
+
const expenseCountByFolder = new Map();
|
|
89
|
+
for (const node of allNodes) {
|
|
90
|
+
if (isFileNodeKind(node) &&
|
|
91
|
+
node.documentType === "powerhouse/expense-report" &&
|
|
92
|
+
node.parentFolder &&
|
|
93
|
+
reportingFolderIds.has(node.parentFolder)) {
|
|
94
|
+
const count = expenseCountByFolder.get(node.parentFolder) || 0;
|
|
95
|
+
expenseCountByFolder.set(node.parentFolder, count + 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
76
98
|
// Process each expense report
|
|
77
99
|
for (const fileNode of expenseReportNodesToProcess) {
|
|
78
100
|
// Skip if already processed
|
|
@@ -94,9 +116,26 @@ export function useDocumentAutoPlacement() {
|
|
|
94
116
|
if (reportingFolder) {
|
|
95
117
|
// Move to the appropriate Reporting folder
|
|
96
118
|
console.log(`[DocumentAutoPlacement] Moving expense report ${fileNode.id} to Reporting folder for ${monthName}`);
|
|
119
|
+
// Compute the new name before moving (increment folder count)
|
|
120
|
+
const folderId = reportingFolder.id;
|
|
121
|
+
const currentCount = expenseCountByFolder.get(folderId) || 0;
|
|
122
|
+
const reportNumber = currentCount + 1;
|
|
123
|
+
expenseCountByFolder.set(folderId, reportNumber);
|
|
124
|
+
const monthCode = formatMonthCode(monthName);
|
|
125
|
+
const standardName = `${monthCode} Expense Report ${reportNumber}`;
|
|
97
126
|
onMoveNode(fileNode, reportingFolder)
|
|
98
|
-
.then(() => {
|
|
127
|
+
.then(async () => {
|
|
99
128
|
console.log(`[DocumentAutoPlacement] Successfully moved expense report to ${monthName} Reporting folder`);
|
|
129
|
+
// Rename if the node name doesn't match the standard pattern
|
|
130
|
+
if (!STANDARD_NAME_PATTERN.test(fileNode.name)) {
|
|
131
|
+
try {
|
|
132
|
+
await onRenameNode(standardName, fileNode);
|
|
133
|
+
console.log(`[DocumentAutoPlacement] Renamed "${fileNode.name}" → "${standardName}"`);
|
|
134
|
+
}
|
|
135
|
+
catch (renameError) {
|
|
136
|
+
console.error(`[DocumentAutoPlacement] Failed to rename expense report:`, renameError);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
100
139
|
})
|
|
101
140
|
.catch((error) => {
|
|
102
141
|
console.error(`[DocumentAutoPlacement] Failed to move expense report to Reporting folder:`, error);
|
|
@@ -142,6 +181,7 @@ export function useDocumentAutoPlacement() {
|
|
|
142
181
|
billingFolder,
|
|
143
182
|
createMonthFolder,
|
|
144
183
|
onMoveNode,
|
|
184
|
+
onRenameNode,
|
|
145
185
|
]);
|
|
146
186
|
return {
|
|
147
187
|
isActive: !!driveId,
|
|
@@ -24,6 +24,10 @@ export interface MonthReportSet {
|
|
|
24
24
|
reportingFolderId: string | null;
|
|
25
25
|
/** The month folder info */
|
|
26
26
|
folderInfo: MonthFolderInfo;
|
|
27
|
+
/** The snapshot report's transaction period start date (startDate), if any */
|
|
28
|
+
snapshotStartDate: string | null;
|
|
29
|
+
/** The snapshot report's transaction period end date (endDate), if any */
|
|
30
|
+
snapshotEndDate: string | null;
|
|
27
31
|
}
|
|
28
32
|
export interface UseMonthlyReportsResult {
|
|
29
33
|
/** All months with their reports, sorted by date descending */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMonthlyReports.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useMonthlyReports.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,2BAA2B,GAAG,4BAA4B,CAAC;IACzE,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACzC,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,2EAA2E;IAC3E,aAAa,EAAE,YAAY,CAAC;IAC5B,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,4BAA4B;IAC5B,UAAU,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"useMonthlyReports.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useMonthlyReports.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,2BAA2B,GAAG,4BAA4B,CAAC;IACzE,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACzC,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,2EAA2E;IAC3E,aAAa,EAAE,YAAY,CAAC;IAC5B,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,4BAA4B;IAC5B,UAAU,EAAE,eAAe,CAAC;IAC5B,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,0EAA0E;IAC1E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,wCAAwC;IACxC,SAAS,EAAE,OAAO,CAAC;CACpB;AAgFD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CAsH3D"}
|
|
@@ -139,6 +139,8 @@ export function useMonthlyReports() {
|
|
|
139
139
|
const snapshotReport = snapshotDoc
|
|
140
140
|
? toReportDocument(snapshotDoc, "powerhouse/snapshot-report")
|
|
141
141
|
: null;
|
|
142
|
+
// Extract snapshot transaction period dates from document state
|
|
143
|
+
const snapshotState = snapshotDoc?.state;
|
|
142
144
|
// Combine all reports for status calculation
|
|
143
145
|
const allReports = [...expenseReports];
|
|
144
146
|
if (snapshotReport)
|
|
@@ -152,6 +154,8 @@ export function useMonthlyReports() {
|
|
|
152
154
|
reportCount: allReports.length,
|
|
153
155
|
reportingFolderId: folderInfo.reportingFolder?.id || null,
|
|
154
156
|
folderInfo,
|
|
157
|
+
snapshotStartDate: snapshotState?.global?.startDate || null,
|
|
158
|
+
snapshotEndDate: snapshotState?.global?.endDate || null,
|
|
155
159
|
});
|
|
156
160
|
}
|
|
157
161
|
// Sort by date descending (most recent first)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,wCAAwC,CAAC;AAiThD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,wCAAwC,CAAC;AAiThD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4ZhD,CAAC"}
|
|
@@ -334,10 +334,8 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
334
334
|
flexDirection: "column",
|
|
335
335
|
paddingRight: 30,
|
|
336
336
|
marginRight: 20,
|
|
337
|
-
}, children: [_jsx(Text, { style: styles.sectionTitle, children: "Issuer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.id
|
|
338
|
-
?.
|
|
339
|
-
invoice.issuer
|
|
340
|
-
.id?.corpRegId ||
|
|
337
|
+
}, children: [_jsx(Text, { style: styles.sectionTitle, children: "Issuer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.id?.taxId ||
|
|
338
|
+
invoice.issuer.id?.corpRegId ||
|
|
341
339
|
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.address?.streetAddress || "" })] }), invoice.issuer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, children: [invoice.issuer.address?.city || "", ",", " ", invoice.issuer.address?.stateProvince || "", ",", " ", getCountryName(invoice.issuer.address?.country || "") || ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.postalCode || "00000" })] }), invoice.issuer.contactInfo?.email && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Email:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.contactInfo.email })] }))] }), _jsxs(View, { style: {
|
|
342
340
|
width: "48%",
|
|
343
341
|
minWidth: 0,
|
|
@@ -345,8 +343,7 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
345
343
|
paddingRight: 0,
|
|
346
344
|
marginRight: 10,
|
|
347
345
|
}, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, hyphenationCallback: (word) => [word], children: invoice.payer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.id?.taxId ||
|
|
348
|
-
invoice.payer
|
|
349
|
-
.id?.corpRegId ||
|
|
346
|
+
invoice.payer.id?.corpRegId ||
|
|
350
347
|
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, hyphenationCallback: (word) => [word], children: invoice.payer.address?.streetAddress || "" })] }), invoice.payer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, hyphenationCallback: (word) => [word] }), _jsx(Text, { style: styles.companyInfo, wrap: true, hyphenationCallback: (word) => [word], children: invoice.payer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, hyphenationCallback: (word) => [word] }), _jsxs(Text, { style: styles.companyInfo, wrap: true, hyphenationCallback: (word) => [word], children: [invoice.payer.address?.city || "", ",", " ", invoice.payer.address?.stateProvince || "", ",", " ", getCountryName(invoice.payer.address?.country || "") ||
|
|
351
348
|
""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, hyphenationCallback: (word) => [word], children: invoice.payer.address?.postalCode || "" })] }), invoice.payer.contactInfo?.email && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Email:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.payer.contactInfo.email })] }))] })] }), _jsxs(View, { style: [styles.paymentSection, { marginLeft: 0 }], children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (_jsx("div", { children: _jsx(PaymentSectionFiat, { paymentRouting: invoice.issuer.paymentRouting }) })) : (_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.tableCol18, children: "Unit Price" }), _jsx(Text, { style: styles.tableCol12, children: "Tax" }), _jsx(Text, { style: styles.tableCol18, children: "Total" })] }), items.map((item, index) => (_jsx(InvoiceLineItem, { item: item, currency: invoice.currency }, index + pageIndex * 1000)))] }), pageIndex === totalPages - 1 && (_jsx(_Fragment, { children: _jsxs(View, { style: { flexDirection: "row", gap: 20 }, children: [_jsxs(View, { style: {
|
|
352
349
|
flex: 1,
|
|
@@ -369,7 +366,9 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
369
366
|
{
|
|
370
367
|
/* New component for fiat payment section */
|
|
371
368
|
}
|
|
372
|
-
const PaymentSectionFiat = ({ paymentRouting
|
|
369
|
+
const PaymentSectionFiat = ({ paymentRouting }) => {
|
|
370
|
+
if (!paymentRouting)
|
|
371
|
+
return null;
|
|
373
372
|
console.log("paymentRouting", paymentRouting.bank);
|
|
374
373
|
return (_jsxs(View, { style: [styles.gridContainer, { marginTop: 0, marginLeft: 0 }], children: [_jsxs(View, { style: styles.gridColumn, children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Bank Name:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.name || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.streetAddress || "" })] }), paymentRouting.bank?.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.extendedAddress })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, children: [paymentRouting.bank?.address?.city || "", ",", " ", paymentRouting.bank?.address?.stateProvince || "", ",", " ", getCountryName(paymentRouting.bank?.address?.country || "") || ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.postalCode || "00000" })] })] }), _jsxs(View, { style: [styles.gridColumn, { paddingLeft: 12 }], children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Beneficiary:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.beneficiary || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Acct No:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountNum || "" })] }), paymentRouting.bank?.ABA && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "ABA/ACH:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.ABA })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "BIC/SWIFT:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.BIC || paymentRouting.bank?.SWIFT || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Acct Type:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountType || "" })] }), paymentRouting.bank?.intermediaryBank?.accountNum && (_jsxs(_Fragment, { children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Intermediary Bank:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.intermediaryBank?.name })] }), paymentRouting.bank?.intermediaryBank?.accountNum && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Intermediary Acct:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.intermediaryBank?.accountNum })] })), paymentRouting.bank?.intermediaryBank?.accountType && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Intermediary Type:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.intermediaryBank?.accountType })] })), paymentRouting.bank?.intermediaryBank?.beneficiary && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Intermediary Beneficiary:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.intermediaryBank?.beneficiary })] })), paymentRouting.bank?.intermediaryBank?.ABA && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Intermediary ABA:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.intermediaryBank?.ABA })] })), (paymentRouting.bank?.intermediaryBank?.BIC ||
|
|
375
374
|
paymentRouting.bank?.intermediaryBank?.SWIFT) && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Intermediary BIC/SWIFT:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.intermediaryBank?.BIC ||
|
|
@@ -390,8 +389,12 @@ const PaymentSectionFiat = ({ paymentRouting, }) => {
|
|
|
390
389
|
{
|
|
391
390
|
/* New component for crypto payment section */
|
|
392
391
|
}
|
|
393
|
-
const PaymentSectionCrypto = ({ paymentRouting
|
|
392
|
+
const PaymentSectionCrypto = ({ paymentRouting }) => {
|
|
393
|
+
if (!paymentRouting)
|
|
394
|
+
return null;
|
|
395
|
+
return (_jsx(View, { style: styles.row, children: _jsxs(View, { style: styles.gridColumn, children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Chain:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.wallet?.chainName || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.wallet?.address || "" })] })] }) }));
|
|
396
|
+
};
|
|
394
397
|
{
|
|
395
398
|
/* New component for line items */
|
|
396
399
|
}
|
|
397
|
-
const InvoiceLineItem = ({ item, currency
|
|
400
|
+
const InvoiceLineItem = ({ item, currency }) => (_jsxs(View, { style: styles.tableRow, children: [_jsx(View, { style: styles.tableCol40, children: _jsx(Text, { style: styles.itemName, hyphenationCallback: (word) => [word], children: item.description }) }), _jsx(Text, { style: styles.tableCol15, children: item.quantity.toFixed(2) }), _jsx(Text, { style: styles.tableCol18, children: formatCurrency(item.unitPriceTaxExcl, currency) }), _jsx(Text, { style: styles.tableCol12, children: formatNumber(item.unitPriceTaxIncl - item.unitPriceTaxExcl) }), _jsx(Text, { style: styles.tableCol18, children: formatCurrency(item.quantity * item.unitPriceTaxIncl, currency) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AAgFA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAiiC7B"}
|
|
@@ -8,7 +8,8 @@ import { loadUBLFile } from "./ingestUBL.js";
|
|
|
8
8
|
import PDFUploader from "./ingestPDF.js";
|
|
9
9
|
import RequestFinance from "./requestFinance.js";
|
|
10
10
|
import InvoiceToGnosis from "./invoiceToGnosis.js";
|
|
11
|
-
import {
|
|
11
|
+
import { ToastContainer } from "@powerhousedao/design-system/connect";
|
|
12
|
+
import { invoiceToast as toast, INVOICE_TOAST_CONTAINER_ID, } from "./invoiceToast.js";
|
|
12
13
|
import { PDFDownloadLink } from "@react-pdf/renderer";
|
|
13
14
|
import { InvoicePDF } from "./InvoicePDF.js";
|
|
14
15
|
import { createRoot } from "react-dom/client";
|
|
@@ -56,8 +57,6 @@ export default function Editor() {
|
|
|
56
57
|
const [doc, dispatch] = useSelectedInvoiceDocument();
|
|
57
58
|
const state = doc?.state.global;
|
|
58
59
|
// ALL HOOKS MUST BE CALLED BEFORE ANY CONDITIONAL RETURNS
|
|
59
|
-
// Get the parent folder node for the currently selected node
|
|
60
|
-
const parentFolder = useParentFolderForSelectedNode();
|
|
61
60
|
// Initialize hooks with safe defaults that don't depend on state being available
|
|
62
61
|
const [fiatMode, setFiatMode] = useState(false);
|
|
63
62
|
const [uploadDropdownOpen, setUploadDropdownOpen] = useState(false);
|
|
@@ -83,6 +82,7 @@ export default function Editor() {
|
|
|
83
82
|
const [bankCountryValidation, setBankCountryValidation] = useState(null);
|
|
84
83
|
const [routingNumberValidation, setRoutingNumberValidation] = useState(null);
|
|
85
84
|
const [accountNumberValidation, setAccountNumberValidation] = useState(null);
|
|
85
|
+
const [chainValidation, setChainValidation] = useState(null);
|
|
86
86
|
// Replace showConfirmationModal and pendingStatus with a single modal state
|
|
87
87
|
const [activeModal, setActiveModal] = useState(null);
|
|
88
88
|
// Track warning state for modal
|
|
@@ -319,7 +319,7 @@ export default function Editor() {
|
|
|
319
319
|
}
|
|
320
320
|
// Replace handleStatusChange logic for opening modals
|
|
321
321
|
const handleStatusChange = (newStatus) => {
|
|
322
|
-
const validationResult = validateStatusBeforeContinue(newStatus, state, setInvoiceValidation, setWalletValidation, setCurrencyValidation, setMainCountryValidation, setBankCountryValidation, setIbanValidation, setBicValidation, setAccountNumberValidation, setBankNameValidation, setStreetAddressValidation, setCityValidation, setPostalCodeValidation, setPayerEmailValidation, setLineItemValidation, setRoutingNumberValidation, isFiatCurrency);
|
|
322
|
+
const validationResult = validateStatusBeforeContinue(newStatus, state, setInvoiceValidation, setWalletValidation, setCurrencyValidation, setMainCountryValidation, setBankCountryValidation, setIbanValidation, setBicValidation, setAccountNumberValidation, setBankNameValidation, setStreetAddressValidation, setCityValidation, setPostalCodeValidation, setPayerEmailValidation, setLineItemValidation, setRoutingNumberValidation, isFiatCurrency, setChainValidation);
|
|
323
323
|
if (validationResult) {
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
@@ -411,11 +411,7 @@ export default function Editor() {
|
|
|
411
411
|
reportPaymentIssue: "Confirm",
|
|
412
412
|
// Add more labels as needed
|
|
413
413
|
};
|
|
414
|
-
|
|
415
|
-
function handleClose() {
|
|
416
|
-
setSelectedNode(parentFolder);
|
|
417
|
-
}
|
|
418
|
-
return (_jsxs("div", { className: "w-full min-h-full flex flex-col", children: [_jsx(DocumentToolbar, { document: doc, onClose: handleClose }), _jsxs("div", { className: "flex-1 max-w-7xl mx-auto w-full mt-4 px-4 pb-8", children: [_jsx(ToastContainer, { position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsx("div", { className: "mb-6", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsx("h1", { className: "text-3xl font-bold whitespace-nowrap", children: "Invoice" }), _jsx("div", { className: "min-w-[200px]", children: _jsx(InputField, { placeholder: "Add invoice number", value: invoiceNoInput, handleInputChange: (e) => setInvoiceNoInput(e.target.value), onBlur: (e) => {
|
|
414
|
+
return (_jsxs("div", { className: "w-full min-h-full flex flex-col", children: [_jsx(DocumentToolbar, {}), _jsxs("div", { className: "flex-1 max-w-7xl mx-auto w-full mt-4 px-4 pb-8", children: [_jsx(ToastContainer, { containerId: INVOICE_TOAST_CONTAINER_ID, position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsx("div", { className: "mb-6", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsx("h1", { className: "text-3xl font-bold whitespace-nowrap", children: "Invoice" }), _jsx("div", { className: "min-w-[200px]", children: _jsx(InputField, { placeholder: "Add invoice number", value: invoiceNoInput, handleInputChange: (e) => setInvoiceNoInput(e.target.value), onBlur: (e) => {
|
|
419
415
|
const newValue = e.target.value;
|
|
420
416
|
if (newValue !== state.invoiceNo) {
|
|
421
417
|
dispatch(actions.editInvoice({ invoiceNo: newValue }));
|
|
@@ -445,7 +441,7 @@ export default function Editor() {
|
|
|
445
441
|
if (datetime !== state.dateDelivered) {
|
|
446
442
|
dispatch(actions.editInvoice({ dateDelivered: datetime }));
|
|
447
443
|
}
|
|
448
|
-
}, value: datetimeToDate(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, routingNumbervalidation: routingNumberValidation, accountNumbervalidation: accountNumberValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4 min-w-0", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2 w-64", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: String.raw `w-full p-0 bg-white`, onChange: (e) => {
|
|
444
|
+
}, value: datetimeToDate(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, chainvalidation: chainValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation, routingNumbervalidation: routingNumberValidation, accountNumbervalidation: accountNumberValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4 min-w-0", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2 w-64", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: String.raw `w-full p-0 bg-white`, onChange: (e) => {
|
|
449
445
|
const dateOnly = e.target.value.split("T")[0];
|
|
450
446
|
const datetime = dateToDatetime(dateOnly);
|
|
451
447
|
dispatch(actions.editInvoice({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportUBL.d.ts","sourceRoot":"","sources":["../../../editors/invoice/exportUBL.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,
|
|
1
|
+
{"version":3,"file":"exportUBL.d.ts","sourceRoot":"","sources":["../../../editors/invoice/exportUBL.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,wCAAwC,CAAC;AAEhD,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAqBD,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,OAAO,CAAC,CAAO;gBAEX,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,IAAI;IAKjD;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAiC5C;;;;OAIG;IACG,YAAY,CAAC,EACjB,QAAwB,GACzB,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7C;;OAEG;IACG,WAAW,CAAC,QAAQ,SAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;OAEG;IACH,OAAO,CAAC,UAAU;IAalB;;OAEG;IACH,OAAO,CAAC,SAAS;IASjB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAsD7B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAqC7B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkB5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuE1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA2BlC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA+B5B;;OAEG;YACW,qBAAqB;IAuBnC;;OAEG;IACH,OAAO,CAAC,YAAY;CAarB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,QAAwB,EACxB,OAAO,GACR,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlC;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,QAAwB,EACxB,OAAO,GACR,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlC"}
|
|
@@ -111,8 +111,7 @@ export class UBLExporter {
|
|
|
111
111
|
if (!issuer)
|
|
112
112
|
return "";
|
|
113
113
|
const taxId = issuer.id?.taxId;
|
|
114
|
-
const corpRegId = issuer.id
|
|
115
|
-
?.corpRegId;
|
|
114
|
+
const corpRegId = issuer.id?.corpRegId;
|
|
116
115
|
const companyId = taxId || corpRegId;
|
|
117
116
|
return `<cac:AccountingSupplierParty>
|
|
118
117
|
<cac:Party>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { actions, } from "../../document-models/invoice/index.js";
|
|
4
|
-
import { toast } from "
|
|
4
|
+
import { invoiceToast as toast } from "./invoiceToast.js";
|
|
5
5
|
import { uploadPdfChunked } from "./uploadPdfChunked.js";
|
|
6
6
|
import { getCountryCodeFromName, mapChainNameToConfig } from "./utils/utils.js";
|
|
7
7
|
import { LoaderCircle } from "lucide-react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACb,MAAM,wCAAwC,CAAC;AAKhD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACb,MAAM,wCAAwC,CAAC;AAKhD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkTnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|