@powerhousedao/contributor-billing 0.0.99 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/general.js +8 -26
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/line-items.js +19 -29
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/tags.js +20 -25
- package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.js +29 -44
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +31 -56
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +63 -88
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +199 -229
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts +3 -2
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/lineItemsTable.js +12 -8
- package/dist/editors/billing-statement/components/objectSetTable.d.ts +3 -2
- package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.d.ts +3 -1
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +2 -2
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts +2 -2
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +8 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +18 -64
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +21 -7
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +8 -10
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +27 -24
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +6 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +8 -17
- package/dist/editors/contributor-billing/editor.d.ts +1 -10
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +2 -23
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +2 -1
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
- package/dist/editors/contributor-billing/index.js +1 -1
- package/dist/editors/hooks/useBillingStatementDocument.d.ts +4 -0
- package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useBillingStatementDocument.js +8 -0
- package/dist/editors/hooks/useIntegrationsDocument.d.ts +4 -0
- package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useIntegrationsDocument.js +8 -0
- package/dist/editors/hooks/useInvoiceDocument.d.ts +4 -0
- package/dist/editors/hooks/useInvoiceDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useInvoiceDocument.js +8 -0
- package/dist/editors/integrations/editor.d.ts +4 -1
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +7 -12
- package/dist/editors/invoice/editor.d.ts +4 -1
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +5 -4
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +3 -3
- package/dist/editors/invoice/invoiceToGnosis.d.ts +3 -2
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +11 -11
- package/dist/editors/invoice/legalEntity/bankSection.d.ts +1 -0
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/bankSection.js +36 -12
- 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 +2 -2
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/lineItems.js +8 -6
- package/dist/editors/invoice/requestFinance.js +2 -2
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- 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 +25 -9
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +3 -2
- package/dist/editors/invoice/validation/validationRules.d.ts +2 -0
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +37 -7
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts +5 -0
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -0
- package/dist/scripts/contributor-billing/createExpenseReportCsv.js +122 -0
- package/dist/style.css +9 -6
- package/package.json +12 -12
- package/dist/reducers/general.d.ts +0 -8
- package/dist/reducers/general.d.ts.map +0 -1
- package/dist/reducers/general.js +0 -73
- package/dist/reducers/items.d.ts +0 -8
- package/dist/reducers/items.d.ts.map +0 -1
- package/dist/reducers/items.js +0 -195
- package/dist/reducers/parties.d.ts +0 -8
- package/dist/reducers/parties.d.ts.map +0 -1
- package/dist/reducers/parties.js +0 -266
- package/dist/reducers/transitions.d.ts +0 -8
- package/dist/reducers/transitions.d.ts.map +0 -1
- package/dist/reducers/transitions.js +0 -162
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAEL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAEL,mBAAmB,EACnB,KAAK,sBAAsB,EAC5B,MAAM,qDAAqD,CAAC;AAG7D,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CAC5C;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,sBAAsB,2CAyKxB"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { type DriveEditorProps } from "@powerhousedao/reactor-browser";
|
|
1
|
+
import { type DriveEditorProps, type Reactor } from "@powerhousedao/reactor-browser";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
driveContext?: {
|
|
5
|
+
reactor?: Reactor;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* Main drive explorer component with sidebar navigation and content area.
|
|
4
11
|
* Layout: Left sidebar (folder tree) + Right content area (files/folders + document editor)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,gBAAgB,EAOrB,KAAK,OAAO,EACb,MAAM,gCAAgC,CAAC;AAOxC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,CAAC,EAAE;YACb,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,CAAC;KACH;CACF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,2CAsSpD"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CreateDocumentModal, ToastContainer, } from "@powerhousedao/design-system";
|
|
3
|
-
import { addDocument, useDocumentModelModules, useEditorModules, useFileChildNodes, useSelectedDrive, useSelectedDriveDocuments, useSelectedFolder,
|
|
3
|
+
import { addDocument, useDocumentModelModules, useEditorModules, useFileChildNodes, useSelectedDrive, useSelectedDriveDocuments, useSelectedFolder, } from "@powerhousedao/reactor-browser";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
import { EditorContainer } from "./EditorContainer.js";
|
|
6
5
|
import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
|
|
7
6
|
import { HeaderStats } from "./InvoiceTable/HeaderStats.js";
|
|
8
7
|
/**
|
|
@@ -10,6 +9,7 @@ import { HeaderStats } from "./InvoiceTable/HeaderStats.js";
|
|
|
10
9
|
* Layout: Left sidebar (folder tree) + Right content area (files/folders + document editor)
|
|
11
10
|
*/
|
|
12
11
|
export function DriveExplorer(props) {
|
|
12
|
+
const { children, editorConfig } = props;
|
|
13
13
|
const [selected, setSelected] = useState({});
|
|
14
14
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
15
15
|
// Handler for status filter changes
|
|
@@ -18,13 +18,9 @@ export function DriveExplorer(props) {
|
|
|
18
18
|
}, []);
|
|
19
19
|
// === DOCUMENT EDITOR STATE ===
|
|
20
20
|
// Customize document opening/closing behavior here
|
|
21
|
-
const [activeDocumentId, setActiveDocumentId] = useState();
|
|
22
21
|
const [openModal, setOpenModal] = useState(false);
|
|
23
22
|
const selectedDocumentModel = useRef(null);
|
|
24
23
|
const editorModules = useEditorModules();
|
|
25
|
-
// === NODE ACTIONS HOOK ===
|
|
26
|
-
// Get all node operations from reactor-browser
|
|
27
|
-
const { onRenameNode, onDuplicateNode } = useNodeActions();
|
|
28
24
|
// === STATE MANAGEMENT HOOKS ===
|
|
29
25
|
// Core state hooks for drive navigation
|
|
30
26
|
const [selectedDrive] = useSelectedDrive(); // Currently selected drive
|
|
@@ -32,7 +28,6 @@ export function DriveExplorer(props) {
|
|
|
32
28
|
const fileChildren = useFileChildNodes();
|
|
33
29
|
// All document states
|
|
34
30
|
const allDocuments = useSelectedDriveDocuments();
|
|
35
|
-
const state = allDocuments;
|
|
36
31
|
// Handler for row selection (does not affect status filter display)
|
|
37
32
|
const handleRowSelection = useCallback((rowId, checked, rowStatus) => {
|
|
38
33
|
setSelected((prev) => ({
|
|
@@ -55,9 +50,11 @@ export function DriveExplorer(props) {
|
|
|
55
50
|
if (selectedRowIds.length === 0)
|
|
56
51
|
return false;
|
|
57
52
|
// Check if all selected rows have allowed statuses
|
|
58
|
-
const selectedRows =
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
const selectedRows = allDocuments?.filter((doc) => selectedRowIds.includes(doc.header.id)) ||
|
|
54
|
+
[];
|
|
55
|
+
return selectedRows.every((row) => allowedStatuses.includes(row.state.global
|
|
56
|
+
.status));
|
|
57
|
+
}, [selected, allDocuments]);
|
|
61
58
|
// Create a stable dispatcher map using useRef only (no useState to avoid re-renders)
|
|
62
59
|
const dispatchersRef = useRef(new Map());
|
|
63
60
|
// Create a working dispatch function that uses the existing reactor system
|
|
@@ -80,9 +77,9 @@ export function DriveExplorer(props) {
|
|
|
80
77
|
// Alternative: Try to access through the context
|
|
81
78
|
// The DriveContextProvider might expose the reactor instance
|
|
82
79
|
if (window.driveContext?.reactor) {
|
|
83
|
-
const result = await window.driveContext
|
|
84
|
-
if (result
|
|
85
|
-
throw new Error(result
|
|
80
|
+
const result = await window.driveContext?.reactor?.addAction(docId, action);
|
|
81
|
+
if (result?.status !== "SUCCESS") {
|
|
82
|
+
throw new Error(result?.error?.message ?? "Failed to dispatch action");
|
|
86
83
|
}
|
|
87
84
|
return;
|
|
88
85
|
}
|
|
@@ -108,14 +105,14 @@ export function DriveExplorer(props) {
|
|
|
108
105
|
// Update dispatchers when state changes - use a more stable approach
|
|
109
106
|
useEffect(() => {
|
|
110
107
|
// Only update if the document IDs have actually changed
|
|
111
|
-
const currentDocIds =
|
|
108
|
+
const currentDocIds = allDocuments?.map((doc) => doc.header.id) || [];
|
|
112
109
|
const previousDocIds = Array.from(dispatchersRef.current.keys());
|
|
113
110
|
// Check if the document list has actually changed
|
|
114
111
|
const hasChanged = currentDocIds.length !== previousDocIds.length ||
|
|
115
112
|
!currentDocIds.every((id) => previousDocIds.includes(id));
|
|
116
113
|
if (!hasChanged) {
|
|
117
114
|
// Just update the document states without recreating dispatchers
|
|
118
|
-
|
|
115
|
+
allDocuments?.forEach((doc) => {
|
|
119
116
|
const docId = doc.header.id;
|
|
120
117
|
if (dispatchersRef.current.has(docId)) {
|
|
121
118
|
const [, dispatchFunction] = dispatchersRef.current.get(docId);
|
|
@@ -126,7 +123,7 @@ export function DriveExplorer(props) {
|
|
|
126
123
|
}
|
|
127
124
|
// Only recreate dispatchers when the document list actually changes
|
|
128
125
|
const newDispatchers = new Map();
|
|
129
|
-
|
|
126
|
+
allDocuments?.forEach((doc) => {
|
|
130
127
|
const docId = doc.header.id;
|
|
131
128
|
// Check if we already have a dispatcher for this document
|
|
132
129
|
if (dispatchersRef.current.has(docId)) {
|
|
@@ -148,43 +145,10 @@ export function DriveExplorer(props) {
|
|
|
148
145
|
}
|
|
149
146
|
// Update the ref
|
|
150
147
|
dispatchersRef.current = newDispatchers;
|
|
151
|
-
}, [
|
|
148
|
+
}, [allDocuments, createDispatchFunction]);
|
|
152
149
|
const getDocDispatcher = (id) => {
|
|
153
150
|
return dispatchersRef.current.get(id) || null;
|
|
154
151
|
};
|
|
155
|
-
// === EVENT HANDLERS ===
|
|
156
|
-
// Wrapper for rename that handles node ID
|
|
157
|
-
const handleRenameNode = useCallback(async (nodeId, newName) => {
|
|
158
|
-
const node = fileChildren.find((n) => n.id === nodeId);
|
|
159
|
-
if (node) {
|
|
160
|
-
await onRenameNode(newName, node);
|
|
161
|
-
}
|
|
162
|
-
}, [fileChildren, onRenameNode]);
|
|
163
|
-
// Wrapper for delete that clears selection
|
|
164
|
-
const handleDeleteNode = useCallback(async (nodeId) => {
|
|
165
|
-
const node = fileChildren.find((n) => n.id === nodeId);
|
|
166
|
-
if (node &&
|
|
167
|
-
window.confirm(`Are you sure you want to delete "${node.name}"?`)) {
|
|
168
|
-
// Delete via context menu or direct call
|
|
169
|
-
// The FileItem component will call showDeleteNodeModal instead
|
|
170
|
-
setSelected((prev) => {
|
|
171
|
-
const newSelected = { ...prev };
|
|
172
|
-
delete newSelected[nodeId];
|
|
173
|
-
return newSelected;
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}, [fileChildren]);
|
|
177
|
-
// Wrapper for showDeleteNodeModal (for FileItem) - uses the reactor-browser function
|
|
178
|
-
const handleShowDeleteModal = useCallback(async (node) => {
|
|
179
|
-
showDeleteNodeModal(node.id);
|
|
180
|
-
// Clear selection after deletion is confirmed
|
|
181
|
-
setSelected((prev) => {
|
|
182
|
-
const newSelected = { ...prev };
|
|
183
|
-
delete newSelected[node.id];
|
|
184
|
-
return newSelected;
|
|
185
|
-
});
|
|
186
|
-
return undefined;
|
|
187
|
-
}, []);
|
|
188
152
|
// Handle document creation from modal
|
|
189
153
|
const onCreateDocument = useCallback(async (fileName) => {
|
|
190
154
|
setOpenModal(false);
|
|
@@ -214,20 +178,10 @@ export function DriveExplorer(props) {
|
|
|
214
178
|
// Filter available document types here if needed
|
|
215
179
|
const documentModelModules = useDocumentModelModules();
|
|
216
180
|
// Get active document and its editor components
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
: undefined;
|
|
220
|
-
const documentModelModule = activeDocument
|
|
221
|
-
? documentModelModules?.find((m) => m.documentModel.id === activeDocument.documentType)
|
|
222
|
-
: null;
|
|
223
|
-
const editorModule = activeDocument
|
|
224
|
-
? editorModules?.find((e) => e.documentTypes.includes(activeDocument.documentType))
|
|
225
|
-
: null;
|
|
181
|
+
// if a document is selected then it's editor will be passed as children
|
|
182
|
+
const showDocumentEditor = !!children;
|
|
226
183
|
// === RENDER ===
|
|
227
|
-
return (_jsx("div", { className: "flex h-full editor-container", children: _jsxs("div", { className: "h-full", 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: "flex-1
|
|
184
|
+
return (_jsx("div", { className: "flex h-full editor-container", children: _jsxs("div", { className: "h-full", 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: "flex-1", children: showDocumentEditor ? (
|
|
228
185
|
// Document editor view
|
|
229
|
-
|
|
230
|
-
await onDuplicateNode(node);
|
|
231
|
-
return undefined;
|
|
232
|
-
}, showDeleteNodeModal: handleShowDeleteModal, filteredDocumentModels: documentModelModules, onSelectDocumentModel: onSelectDocumentModel, getDocDispatcher: getDocDispatcher, selectedStatuses: selectedStatuses, onStatusChange: handleStatusChange, onRowSelection: handleRowSelection, canExportSelectedRows: canExportSelectedRows })] })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }) }));
|
|
186
|
+
children) : (_jsxs(_Fragment, { children: [_jsx(HeaderStats, {}), _jsx(InvoiceTable, { files: fileChildren, state: allDocuments || [], selected: selected, setSelected: setSelected, filteredDocumentModels: documentModelModules, onSelectDocumentModel: onSelectDocumentModel, getDocDispatcher: getDocDispatcher, selectedStatuses: selectedStatuses, onStatusChange: handleStatusChange, onRowSelection: handleRowSelection, canExportSelectedRows: canExportSelectedRows })] })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }) }));
|
|
233
187
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
export declare const HeaderControls: ({
|
|
2
|
-
contributorOptions?: {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
}[];
|
|
1
|
+
export declare const HeaderControls: ({ statusOptions, onStatusChange, onSearchChange, onExport, onExpenseReportExport, selectedStatuses, createIntegrationsDocument, integrationsDoc, canExportSelectedRows, }: {
|
|
6
2
|
statusOptions?: {
|
|
7
3
|
label: string;
|
|
8
4
|
value: string;
|
|
9
5
|
}[];
|
|
10
|
-
onContributorChange?: (value: string | string[]) => void;
|
|
11
6
|
onStatusChange?: (value: string | string[]) => void;
|
|
12
7
|
onSearchChange?: (value: string) => void;
|
|
13
8
|
onExport?: (baseCurrency: string) => void;
|
|
14
|
-
|
|
9
|
+
onExpenseReportExport?: (baseCurrency: string) => void;
|
|
15
10
|
selectedStatuses?: string[];
|
|
16
11
|
createIntegrationsDocument?: () => void;
|
|
17
12
|
integrationsDoc?: any | null;
|
|
18
|
-
setActiveDocumentId?: (id: string) => void;
|
|
19
13
|
canExportSelectedRows?: () => boolean;
|
|
20
14
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
15
|
//# sourceMappingURL=HeaderControls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,GAAI,
|
|
1
|
+
{"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,GAAI,2KAU5B;IACD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC;CACvC,4CA6LA,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { Select } from "@powerhousedao/document-engineering";
|
|
4
4
|
import ConfirmationModal from "../../../invoice/components/confirmationModal.js";
|
|
5
5
|
import { Icon } from "@powerhousedao/design-system";
|
|
6
|
+
import { setSelectedNode } from "@powerhousedao/reactor-browser";
|
|
6
7
|
const currencyOptions = [
|
|
7
8
|
{ label: "CHF", value: "CHF" },
|
|
8
9
|
{ label: "USD", value: "USD" },
|
|
@@ -10,29 +11,34 @@ const currencyOptions = [
|
|
|
10
11
|
{ label: "GBP", value: "GBP" },
|
|
11
12
|
{ label: "JPY", value: "JPY" },
|
|
12
13
|
];
|
|
13
|
-
export const HeaderControls = ({
|
|
14
|
+
export const HeaderControls = ({ statusOptions = [], onStatusChange, onSearchChange, onExport, onExpenseReportExport, selectedStatuses = [], createIntegrationsDocument, integrationsDoc, canExportSelectedRows, }) => {
|
|
14
15
|
const batchOptions = [
|
|
15
16
|
{ label: "$ Pay Selected", value: "pay" },
|
|
16
17
|
{ label: "Approve Selected", value: "approve" },
|
|
17
18
|
{ label: "Reject Selected", value: "reject" },
|
|
19
|
+
{ label: "Export CSV Expense Report", value: "export-csv-expense-report" },
|
|
18
20
|
];
|
|
19
21
|
// Use the function to determine if export should be enabled based on selected rows
|
|
20
22
|
const canExport = canExportSelectedRows ? canExportSelectedRows() : false;
|
|
21
23
|
const [showCurrencyModal, setShowCurrencyModal] = useState(false);
|
|
22
24
|
const [selectedCurrency, setSelectedCurrency] = useState("CHF");
|
|
25
|
+
const [showExpenseReportCurrencyModal, setShowExpenseReportCurrencyModal] = useState(false);
|
|
26
|
+
const [selectedExpenseReportCurrency, setSelectedExpenseReportCurrency] = useState("CHF");
|
|
27
|
+
const handleBatchAction = (action) => {
|
|
28
|
+
if (action === "export-csv-expense-report") {
|
|
29
|
+
setShowExpenseReportCurrencyModal(true);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
23
32
|
return (_jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
|
|
24
33
|
width: "200px",
|
|
25
34
|
height: "30px",
|
|
26
|
-
}, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true, value: selectedStatuses }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { className: `bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 ${!canExport ? "opacity-50 cursor-not-allowed" : ""}`, onClick: () => setShowCurrencyModal(true), disabled: !canExport, children: "Export to CSV" }), _jsx(Select, {
|
|
27
|
-
width: "180px",
|
|
28
|
-
height: "30px",
|
|
29
|
-
}, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" }), _jsx("div", { className: "cursor-pointer", children: _jsx(Icon, { name: "Settings", className: "hover:text-blue-300", onClick: () => {
|
|
35
|
+
}, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true, value: selectedStatuses }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { className: `bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 ${!canExport ? "opacity-50 cursor-not-allowed" : ""}`, onClick: () => setShowCurrencyModal(true), disabled: !canExport, children: "Export to CSV" }), _jsx(Select, { className: "h-[29px]", contentClassName: "w-54", options: batchOptions, onChange: (value) => handleBatchAction(value), placeholder: "Batch Action" }), _jsx("div", { className: "cursor-pointer", children: _jsx(Icon, { name: "Settings", className: "hover:text-blue-300", onClick: () => {
|
|
30
36
|
console.log("Settings");
|
|
31
37
|
if (!integrationsDoc) {
|
|
32
38
|
createIntegrationsDocument?.();
|
|
33
39
|
}
|
|
34
40
|
else {
|
|
35
|
-
|
|
41
|
+
setSelectedNode(integrationsDoc.id);
|
|
36
42
|
}
|
|
37
43
|
} }) })] })] }), showCurrencyModal && (_jsx("div", { className: "fixed inset-0", children: _jsxs("div", { className: "absolute left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 bg-white rounded shadow-lg p-6 min-w-[300px] flex flex-col items-center", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Select Base Currency" }), _jsx("p", { className: "text-red-600 text-sm mb-2", children: "Chosen currency should match the base currency of the accounting." }), _jsx("select", { className: "border border-gray-300 rounded px-2 py-1 mb-4", value: selectedCurrency, onChange: (e) => setSelectedCurrency(e.target.value), children: currencyOptions.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { className: "bg-blue-600 text-white px-4 py-1 rounded hover:bg-blue-700", onClick: () => {
|
|
38
44
|
setShowCurrencyModal(false);
|
|
@@ -45,5 +51,13 @@ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], on
|
|
|
45
51
|
marginTop: "1rem",
|
|
46
52
|
marginBottom: "1rem",
|
|
47
53
|
fontWeight: 500,
|
|
48
|
-
}, children: "\u26A0 Warning: the chosen currency should match the base currency of the accounting system." }), _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" })] })
|
|
54
|
+
}, children: "\u26A0 Warning: the chosen currency should match the base currency of the accounting system." }), _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" })] }), _jsxs(ConfirmationModal, { open: showExpenseReportCurrencyModal, onCancel: () => setShowExpenseReportCurrencyModal(false), onContinue: () => {
|
|
55
|
+
setShowExpenseReportCurrencyModal(false);
|
|
56
|
+
onExpenseReportExport?.(selectedExpenseReportCurrency);
|
|
57
|
+
}, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: [_jsx("p", { style: {
|
|
58
|
+
color: "red",
|
|
59
|
+
marginTop: "1rem",
|
|
60
|
+
marginBottom: "1rem",
|
|
61
|
+
fontWeight: 500,
|
|
62
|
+
}, children: "\u26A0 Warning: the chosen currency should match the base currency of the accounting system." }), _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedExpenseReportCurrency(value), placeholder: "Select Base Currency", value: selectedExpenseReportCurrency, contentClassName: "w-20" })] })] }));
|
|
49
63
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { Node } from "document-drive";
|
|
2
1
|
import { type DocumentModelModule } from "document-model";
|
|
2
|
+
type FileNodeLite = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
documentType?: string;
|
|
6
|
+
};
|
|
3
7
|
interface InvoiceTableProps {
|
|
4
|
-
files:
|
|
5
|
-
state:
|
|
6
|
-
setActiveDocumentId: (id: string) => void;
|
|
8
|
+
files: FileNodeLite[];
|
|
9
|
+
state: any[];
|
|
7
10
|
selected: {
|
|
8
11
|
[id: string]: boolean;
|
|
9
12
|
};
|
|
@@ -14,11 +17,6 @@ interface InvoiceTableProps {
|
|
|
14
17
|
}) => {
|
|
15
18
|
[id: string]: boolean;
|
|
16
19
|
})) => void;
|
|
17
|
-
onBatchAction: (action: string) => void;
|
|
18
|
-
onDeleteNode: (nodeId: string) => void;
|
|
19
|
-
renameNode: (nodeId: string, name: string) => void;
|
|
20
|
-
onDuplicateNode: (node: Node) => Promise<Node | undefined>;
|
|
21
|
-
showDeleteNodeModal: (node: Node) => Promise<Node | undefined>;
|
|
22
20
|
filteredDocumentModels: DocumentModelModule[];
|
|
23
21
|
onSelectDocumentModel: (model: DocumentModelModule) => void;
|
|
24
22
|
getDocDispatcher: (id: string) => any;
|
|
@@ -27,6 +25,6 @@ interface InvoiceTableProps {
|
|
|
27
25
|
onRowSelection: (rowId: string, checked: boolean, rowStatus: string) => void;
|
|
28
26
|
canExportSelectedRows: () => boolean;
|
|
29
27
|
}
|
|
30
|
-
export declare const InvoiceTable: ({ files, state,
|
|
28
|
+
export declare const InvoiceTable: ({ files, state, selected, filteredDocumentModels, onSelectDocumentModel, getDocDispatcher, selectedStatuses, onStatusChange, onRowSelection, canExportSelectedRows, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
29
|
export {};
|
|
32
30
|
//# sourceMappingURL=InvoiceTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AA6B1D,KAAK,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,GAAG,CAAC;IACtC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,qBAAqB,EAAE,MAAM,OAAO,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,GAAI,uKAW1B,iBAAiB,4CA0nBnB,CAAC"}
|
|
@@ -5,9 +5,10 @@ import { InvoiceTableSection } from "./InvoiceTableSection.js";
|
|
|
5
5
|
import { InvoiceTableRow } from "./InvoiceTableRow.js";
|
|
6
6
|
import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
|
|
7
7
|
import { exportInvoicesToXeroCSV } from "../../../../scripts/contributor-billing/createXeroCsv.js";
|
|
8
|
+
import { exportExpenseReportCSV } from "../../../../scripts/contributor-billing/createExpenseReportCsv.js";
|
|
8
9
|
import { toast } from "@powerhousedao/design-system";
|
|
9
10
|
import { actions, } from "../../../../document-models/invoice/index.js";
|
|
10
|
-
import { addDocument, useSelectedDrive, dispatchActions, } from "@powerhousedao/reactor-browser";
|
|
11
|
+
import { addDocument, useSelectedDrive, dispatchActions, setSelectedNode, } from "@powerhousedao/reactor-browser";
|
|
11
12
|
import { actions as billingStatementActions } from "../../../../document-models/billing-statement/index.js";
|
|
12
13
|
const statusOptions = [
|
|
13
14
|
{ label: "Draft", value: "DRAFT" },
|
|
@@ -20,7 +21,7 @@ const statusOptions = [
|
|
|
20
21
|
{ label: "Rejected", value: "REJECTED" },
|
|
21
22
|
{ label: "Other", value: "OTHER" },
|
|
22
23
|
];
|
|
23
|
-
export const InvoiceTable = ({ files, state,
|
|
24
|
+
export const InvoiceTable = ({ files, state, selected, filteredDocumentModels, onSelectDocumentModel, getDocDispatcher, selectedStatuses, onStatusChange, onRowSelection, canExportSelectedRows, }) => {
|
|
24
25
|
const [selectedDrive] = useSelectedDrive();
|
|
25
26
|
const billingDocStates = state
|
|
26
27
|
.filter((doc) => doc.header.documentType === "powerhouse/billing-statement")
|
|
@@ -80,25 +81,6 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, selected, setS
|
|
|
80
81
|
const paymentClosed = getInvoicesByStatus("PAYMENTCLOSED");
|
|
81
82
|
const rejected = getInvoicesByStatus("REJECTED");
|
|
82
83
|
const otherInvoices = getOtherInvoices();
|
|
83
|
-
const handleDelete = (id) => {
|
|
84
|
-
onDeleteNode(id);
|
|
85
|
-
// Clear selection for deleted item
|
|
86
|
-
};
|
|
87
|
-
const cleanName = (name) => {
|
|
88
|
-
const dotIndex = name.lastIndexOf(".");
|
|
89
|
-
if (dotIndex > 0) {
|
|
90
|
-
return name.substring(0, dotIndex);
|
|
91
|
-
}
|
|
92
|
-
return name;
|
|
93
|
-
};
|
|
94
|
-
// Remove all non-alphanumeric, non-hyphen, non-underscore chars for slug safety
|
|
95
|
-
const makeSlug = (name) => {
|
|
96
|
-
return name
|
|
97
|
-
.replace(/\./g, "") // remove dots
|
|
98
|
-
.replace(/\s+/g, "-") // replace spaces with hyphens
|
|
99
|
-
.replace(/[^\w-]/g, "") // remove all non-word chars except hyphen/underscore
|
|
100
|
-
.toLowerCase();
|
|
101
|
-
};
|
|
102
84
|
const handleCreateBillingStatement = async (id) => {
|
|
103
85
|
const invoiceFile = files.find((file) => file.id === id);
|
|
104
86
|
const invoiceState = state.find((doc) => doc.header.id === id);
|
|
@@ -165,7 +147,6 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, selected, setS
|
|
|
165
147
|
return doc ? { ...doc, id } : null;
|
|
166
148
|
})
|
|
167
149
|
.filter((inv) => inv !== null); // Filter out null/undefined invoices
|
|
168
|
-
const selectedInvoiceStatuses = selectedInvoices.map((inv) => inv?.state?.global?.status || inv?.state?.global?.status);
|
|
169
150
|
const handleCSVExport = async (baseCurrency) => {
|
|
170
151
|
console.log("Exporting selected invoices:", selectedInvoices.map((inv) => ({
|
|
171
152
|
id: inv.id,
|
|
@@ -200,6 +181,28 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, selected, setS
|
|
|
200
181
|
toast(_jsxs(_Fragment, { children: ["Invoice Line Item Tags need to be set for:", _jsx("br", {}), missingExpenseTagInvoicesList.map((name, idx) => (_jsxs(React.Fragment, { children: ["- ", name, _jsx("br", {})] }, name)))] }), { type: "error" });
|
|
201
182
|
}
|
|
202
183
|
};
|
|
184
|
+
const handleExportCSVExpenseReport = async (baseCurrency) => {
|
|
185
|
+
console.log("Exporting expense report for selected invoices:", selectedInvoices.map((inv) => ({
|
|
186
|
+
id: inv.id,
|
|
187
|
+
state: inv,
|
|
188
|
+
})));
|
|
189
|
+
try {
|
|
190
|
+
await exportExpenseReportCSV(selectedInvoices, baseCurrency);
|
|
191
|
+
toast("Expense report exported successfully", {
|
|
192
|
+
type: "success",
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
console.error("Error exporting expense report:", error);
|
|
197
|
+
const missingTagInvoices = error.missingTagInvoices || [];
|
|
198
|
+
const missingTagInvoicesList = missingTagInvoices.map((invoiceId) => {
|
|
199
|
+
const invoice = files.find((file) => file.id === invoiceId);
|
|
200
|
+
return invoice?.name || invoiceId;
|
|
201
|
+
});
|
|
202
|
+
console.log("missingTagInvoicesList", missingTagInvoicesList);
|
|
203
|
+
toast(_jsxs(_Fragment, { children: ["Invoice Line Item Tags need to be set for:", _jsx("br", {}), missingTagInvoicesList.map((name, idx) => (_jsxs(React.Fragment, { children: ["- ", name, _jsx("br", {})] }, name)))] }), { type: "error" });
|
|
204
|
+
}
|
|
205
|
+
};
|
|
203
206
|
// check if integrations document exists
|
|
204
207
|
const integrationsDoc = files.find((file) => file.documentType === "powerhouse/integrations");
|
|
205
208
|
const createIntegrationsDocument = async () => {
|
|
@@ -211,8 +214,8 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, selected, setS
|
|
|
211
214
|
console.error("Failed to create integrations document");
|
|
212
215
|
return null;
|
|
213
216
|
}
|
|
214
|
-
|
|
217
|
+
setSelectedNode(createdNode.id);
|
|
215
218
|
}
|
|
216
219
|
};
|
|
217
|
-
return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: onStatusChange, onBatchAction: onBatchAction, onExport: handleCSVExport, selectedStatuses: selectedStatuses, createIntegrationsDocument: createIntegrationsDocument, integrationsDoc: integrationsDoc, setActiveDocumentId: setActiveDocumentId, canExportSelectedRows: canExportSelectedRows }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal }, row.id))) })] }) })), shouldShowSection("ISSUED") && (_jsx(InvoiceTableSection, { title: "Issued", count: issued.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: issued.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("ACCEPTED") && (_jsx(InvoiceTableSection, { title: "Accepted", count: accepted.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: accepted.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSCHEDULED") && (_jsx(InvoiceTableSection, { title: "Payment Scheduled", count: paymentScheduled.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentScheduled.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSENT") && (_jsx(InvoiceTableSection, { title: "Payment Sent", count: paymentSent.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentSent.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTISSUE") && (_jsx(InvoiceTableSection, { title: "Payment Issue", count: paymentIssue.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentIssue.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTCLOSED") && (_jsx(InvoiceTableSection, { title: "Payment Closed", count: paymentClosed.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentClosed.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal }, row.id))) })] }) })), shouldShowSection("OTHER") && (_jsx(InvoiceTableSection, { title: "Other", count: otherInvoices.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: otherInvoices.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onDuplicateNode: onDuplicateNode, showDeleteNodeModal: showDeleteNodeModal }, row.id))) })] }) }))] }, `${state.length}`));
|
|
220
|
+
return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: onStatusChange, onExport: handleCSVExport, onExpenseReportExport: handleExportCSVExpenseReport, selectedStatuses: selectedStatuses, createIntegrationsDocument: createIntegrationsDocument, integrationsDoc: integrationsDoc, canExportSelectedRows: canExportSelectedRows }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status) }, row.id))) })] }) })), shouldShowSection("ISSUED") && (_jsx(InvoiceTableSection, { title: "Issued", count: issued.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: issued.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("ACCEPTED") && (_jsx(InvoiceTableSection, { title: "Accepted", count: accepted.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: accepted.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSCHEDULED") && (_jsx(InvoiceTableSection, { title: "Payment Scheduled", count: paymentScheduled.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentScheduled.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSENT") && (_jsx(InvoiceTableSection, { title: "Payment Sent", count: paymentSent.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentSent.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTISSUE") && (_jsx(InvoiceTableSection, { title: "Payment Issue", count: paymentIssue.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentIssue.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTCLOSED") && (_jsx(InvoiceTableSection, { title: "Payment Closed", count: paymentClosed.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentClosed.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status) }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status) }, row.id))) })] }) })), shouldShowSection("OTHER") && (_jsx(InvoiceTableSection, { title: "Other", count: otherInvoices.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: otherInvoices.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status) }, row.id))) })] }) }))] }, `${state.length}`));
|
|
218
221
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, onCreateBillingStatement, billingDocStates, }: {
|
|
2
|
+
files?: {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
documentType?: string;
|
|
6
|
+
}[];
|
|
4
7
|
row: any;
|
|
5
8
|
isSelected: boolean;
|
|
6
9
|
onSelect: (checked: boolean) => void;
|
|
7
|
-
setActiveDocumentId: (id: string) => void;
|
|
8
|
-
onDeleteNode: (nodeId: string) => void;
|
|
9
|
-
renameNode: (nodeId: string, name: string) => void;
|
|
10
|
-
onDuplicateNode?: (node: Node) => Promise<Node | undefined>;
|
|
11
|
-
showDeleteNodeModal?: (node: Node) => Promise<Node | undefined>;
|
|
12
10
|
onCreateBillingStatement?: (id: string) => void;
|
|
13
11
|
billingDocStates?: {
|
|
14
12
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe,GAAI,mFAO7B;IACD,KAAK,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9D,GAAG,EAAE,GAAG,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D,4CAoJA,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef } from "react";
|
|
3
2
|
import { FileItem } from "@powerhousedao/design-system";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
3
|
+
import { getSyncStatusSync, setSelectedNode, showDeleteNodeModal, useDriveSharingType, useNodeActions, useSelectedDriveDocument, } from "@powerhousedao/reactor-browser";
|
|
4
|
+
export const InvoiceTableRow = ({ files, row, isSelected, onSelect, onCreateBillingStatement, billingDocStates, }) => {
|
|
5
|
+
const [selectedDrive] = useSelectedDriveDocument(); // Currently selected drive
|
|
6
|
+
const sharingType = useDriveSharingType(selectedDrive.header.id);
|
|
7
|
+
// Core drive operations and document models
|
|
8
|
+
const { onAddFile, onAddFolder, onCopyNode, onDuplicateNode, onMoveNode, onRenameNode, } = useNodeActions();
|
|
7
9
|
const formatTimestamp = (timestamp) => {
|
|
8
10
|
const date = new Date(timestamp);
|
|
9
11
|
const day = date.getDate().toString().padStart(2, "0");
|
|
@@ -41,21 +43,10 @@ export const InvoiceTableRow = ({ files, row, isSelected, onSelect, setActiveDoc
|
|
|
41
43
|
const billingFile = files?.find((file) => file.id === billingDoc?.id);
|
|
42
44
|
const file = files?.find((file) => file.id === row.id);
|
|
43
45
|
const hasExportedData = row.exported != null && Boolean(row.exported.timestamp?.trim());
|
|
44
|
-
|
|
45
|
-
const handleRenameNode = async (newName, node) => {
|
|
46
|
-
await renameNode(node.id, newName);
|
|
47
|
-
return undefined;
|
|
48
|
-
};
|
|
49
|
-
const handleDuplicateNode = async (node) => {
|
|
50
|
-
if (onDuplicateNode) {
|
|
51
|
-
await onDuplicateNode(node);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const handleShowDeleteModal = showDeleteNodeModal || (async () => undefined);
|
|
55
|
-
return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { fileNode: file, sharingType: "PUBLIC", onRenameNode: handleRenameNode, onDuplicateNode: handleDuplicateNode, showDeleteNodeModal: handleShowDeleteModal, isAllowedToCreateDocuments: true, className: "h-10", onAddFile: () => new Promise((resolve) => resolve(undefined)), onAddFolder: () => new Promise((resolve) => resolve(undefined)), onCopyNode: () => new Promise((resolve) => resolve(undefined)), onMoveNode: () => new Promise((resolve) => resolve(undefined)), onAddAndSelectNewFolder: () => new Promise((resolve) => resolve(undefined)), getSyncStatusSync: () => undefined, setSelectedNode: () => setActiveDocumentId(row.id) }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: formatAmount(row.amount) }), (row.status === "ISSUED" ||
|
|
46
|
+
return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { fileNode: file, sharingType: sharingType || "LOCAL", isAllowedToCreateDocuments: true, className: "h-10", onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddAndSelectNewFolder: () => new Promise((resolve) => resolve(undefined)), getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode, showDeleteNodeModal: (node) => showDeleteNodeModal(node.id) }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: formatAmount(row.amount) }), (row.status === "ISSUED" ||
|
|
56
47
|
row.status === "ACCEPTED" ||
|
|
57
48
|
row.status === "PAYMENTSCHEDULED" ||
|
|
58
49
|
row.status === "PAYMENTRECEIVED" ||
|
|
59
50
|
row.status === "PAYMENTSENT") &&
|
|
60
|
-
!billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { fileNode: billingFile, sharingType: "
|
|
51
|
+
!billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { fileNode: billingFile, sharingType: sharingType || "LOCAL", showDeleteNodeModal: (node) => showDeleteNodeModal(node.id), isAllowedToCreateDocuments: true, className: "h-10", onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddAndSelectNewFolder: () => new Promise((resolve) => resolve(undefined)), getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: hasExportedData ? (_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("span", { className: "text-green-500", children: "Yes" }), _jsx("span", { className: "text-green-500 text-xs", children: formatTimestamp(row.exported.timestamp) })] })) : (_jsx("span", { className: "text-red-500", children: "No" })) })] }));
|
|
61
52
|
};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Base editor component that renders the drive explorer interface.
|
|
4
|
-
* Customize document opening behavior and drive-level actions here.
|
|
5
|
-
*/
|
|
6
|
-
export declare function BaseEditor(props: DriveEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
/**
|
|
8
|
-
* Main editor entry point with required providers.
|
|
9
|
-
*/
|
|
10
|
-
export default function Editor(props: DriveEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const Editor: import("react").ComponentType<import("@powerhousedao/reactor-browser").DriveEditorProps>;
|
|
11
2
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/editor.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,0FAA8B,CAAC"}
|