@powerhousedao/contributor-billing 0.0.76 → 0.0.78
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/gen/general/actions.d.ts +13 -4
- package/dist/document-models/billing-statement/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/general/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/index.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.js +1 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +9 -3
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.d.ts +4 -5
- package/dist/document-models/billing-statement/gen/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.js +2 -2
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/ph-factories.js +58 -0
- package/dist/document-models/billing-statement/gen/reducer.d.ts +4 -2
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +4 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +4 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts +5 -2
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/tags/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/types.d.ts +4 -4
- package/dist/document-models/billing-statement/gen/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.d.ts +18 -3
- package/dist/document-models/billing-statement/gen/utils.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.js +33 -29
- package/dist/document-models/billing-statement/index.d.ts +8 -9
- package/dist/document-models/billing-statement/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.d.ts +2 -0
- package/dist/document-models/integrations/gen/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.js +1 -0
- package/dist/document-models/integrations/gen/integrations/actions.d.ts +13 -4
- package/dist/document-models/integrations/gen/integrations/actions.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/integrations/object.d.ts +3 -3
- package/dist/document-models/integrations/gen/integrations/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.d.ts +4 -5
- package/dist/document-models/integrations/gen/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.js +2 -2
- package/dist/document-models/integrations/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/integrations/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/integrations/gen/ph-factories.js +75 -0
- package/dist/document-models/integrations/gen/reducer.d.ts +4 -2
- package/dist/document-models/integrations/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/reducer.js +4 -1
- package/dist/document-models/integrations/gen/schema/types.d.ts +4 -0
- package/dist/document-models/integrations/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/types.d.ts +4 -4
- package/dist/document-models/integrations/gen/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.d.ts +18 -3
- package/dist/document-models/integrations/gen/utils.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.js +36 -32
- package/dist/document-models/integrations/index.d.ts +8 -9
- package/dist/document-models/integrations/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.d.ts +2 -0
- package/dist/document-models/invoice/gen/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.js +1 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.d.ts +4 -5
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.js +2 -2
- package/dist/document-models/invoice/gen/parties/actions.d.ts +25 -7
- package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/parties/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/ph-factories.js +190 -0
- package/dist/document-models/invoice/gen/reducer.d.ts +4 -2
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +4 -1
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/actions.d.ts +49 -13
- package/dist/document-models/invoice/gen/transitions/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/transitions/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.d.ts +18 -3
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +33 -29
- package/dist/document-models/invoice/index.d.ts +8 -9
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.d.ts +2 -3
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +11 -3
- package/dist/editors/billing-statement/index.d.ts +1 -2
- package/dist/editors/billing-statement/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +5 -7
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -9
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +6 -16
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +179 -88
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts +9 -13
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/EditorContainer.js +37 -26
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +7 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +11 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +4 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +125 -119
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +24 -4
- package/dist/editors/contributor-billing/editor.d.ts +9 -4
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +15 -41
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +1 -2
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
- package/dist/editors/contributor-billing/index.d.ts +1 -2
- package/dist/editors/contributor-billing/index.d.ts.map +1 -1
- package/dist/editors/integrations/editor.d.ts +1 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +10 -1
- package/dist/editors/integrations/index.d.ts +1 -2
- package/dist/editors/integrations/index.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +3 -3
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +10 -1
- package/dist/editors/invoice/index.d.ts +1 -2
- package/dist/editors/invoice/index.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +3 -3
- package/dist/editors/invoice/requestFinance.js +2 -2
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/reducers/general.d.ts +8 -0
- package/dist/reducers/general.d.ts.map +1 -0
- package/dist/reducers/general.js +73 -0
- package/dist/reducers/items.d.ts +8 -0
- package/dist/reducers/items.d.ts.map +1 -0
- package/dist/reducers/items.js +195 -0
- package/dist/reducers/parties.d.ts +8 -0
- package/dist/reducers/parties.d.ts.map +1 -0
- package/dist/reducers/parties.js +266 -0
- package/dist/reducers/transitions.d.ts +8 -0
- package/dist/reducers/transitions.d.ts.map +1 -0
- package/dist/reducers/transitions.js +162 -0
- package/dist/scripts/contributor-billing/createXeroCsv.js +2 -2
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +1 -1
- package/dist/style.css +730 -108
- package/dist/subgraphs/billing-statement/index.d.ts +2 -1
- package/dist/subgraphs/billing-statement/index.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +101 -69
- package/dist/subgraphs/billing-statement/schema.js +3 -3
- package/dist/subgraphs/integrations/index.d.ts +2 -1
- package/dist/subgraphs/integrations/index.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +61 -46
- package/dist/subgraphs/integrations/schema.js +3 -3
- package/dist/subgraphs/invoice/index.d.ts +2 -1
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +323 -181
- package/dist/subgraphs/invoice/schema.js +3 -3
- package/package.json +14 -14
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { DocumentToolbar, RevisionHistory,
|
|
4
|
-
import {
|
|
2
|
+
import { getRevisionFromDate, useTimelineItems } from "@powerhousedao/common";
|
|
3
|
+
import { DocumentToolbar, RevisionHistory, } from "@powerhousedao/design-system";
|
|
4
|
+
import { exportFile, useDocumentById, useEditorModuleById, useSelectedDrive, } from "@powerhousedao/reactor-browser";
|
|
5
|
+
import { Suspense, useCallback, useState } from "react";
|
|
6
|
+
/**
|
|
7
|
+
* Document editor container that wraps individual document editors.
|
|
8
|
+
* Handles document loading, toolbar, revision history, and dynamic editor loading.
|
|
9
|
+
* Customize toolbar actions and editor context here.
|
|
10
|
+
*/
|
|
5
11
|
export const EditorContainer = (props) => {
|
|
6
|
-
const {
|
|
12
|
+
const { handleClose } = props;
|
|
13
|
+
// UI state for revision history and timeline
|
|
14
|
+
const [selectedTimelineItem, setSelectedTimelineItem] = useState(null);
|
|
7
15
|
const [showRevisionHistory, setShowRevisionHistory] = useState(false);
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
user,
|
|
16
|
-
});
|
|
16
|
+
const [selectedDocument, dispatch] = useDocumentById(props.activeDocumentId);
|
|
17
|
+
const [selectedDrive] = useSelectedDrive();
|
|
18
|
+
// Timeline data for revision history
|
|
19
|
+
const timelineItems = useTimelineItems(selectedDocument?.header.id, selectedDocument?.header.createdAtUtcIso, selectedDrive?.header.id);
|
|
20
|
+
const preferredEditor = selectedDocument?.header.meta?.preferredEditor ?? "powerhouse-invoice-editor";
|
|
21
|
+
const editorModule = useEditorModuleById(preferredEditor);
|
|
22
|
+
// Document export functionality - customize export behavior here
|
|
17
23
|
const onExport = useCallback(async () => {
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
await exportDocument(document, title, ext);
|
|
24
|
+
if (selectedDocument) {
|
|
25
|
+
await exportFile(selectedDocument);
|
|
21
26
|
}
|
|
22
|
-
}, [
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
}, [selectedDocument]);
|
|
28
|
+
// Loading state component
|
|
29
|
+
const loadingContent = (_jsx("div", { className: "flex h-full flex-1 items-center justify-center", children: "Sth wrong with the document" }));
|
|
30
|
+
if (!selectedDocument)
|
|
25
31
|
return loadingContent;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// Dynamically load the appropriate editor component for this document type
|
|
33
|
+
const EditorComponent = editorModule?.Component;
|
|
34
|
+
if (!EditorComponent)
|
|
35
|
+
return loadingContent;
|
|
36
|
+
return showRevisionHistory ? (
|
|
37
|
+
// Revision history view
|
|
38
|
+
_jsx(RevisionHistory, { documentId: selectedDocument.header.id, documentTitle: selectedDocument.header.name, globalOperations: selectedDocument.operations.global, localOperations: selectedDocument.operations.local, onClose: () => setShowRevisionHistory(false) }, selectedDocument.header.id)) : (
|
|
39
|
+
// Main editor view
|
|
40
|
+
_jsxs(Suspense, { fallback: loadingContent, children: [_jsx(DocumentToolbar, { onClose: handleClose, onExport: onExport, onShowRevisionHistory: () => setShowRevisionHistory(true), onSwitchboardLinkClick: () => { }, title: selectedDocument.header.name, timelineButtonVisible: editorModule.config.timelineEnabled, timelineItems: timelineItems.data, onTimelineItemClick: setSelectedTimelineItem }), _jsx(EditorComponent, { context: {
|
|
41
|
+
readMode: !!selectedTimelineItem,
|
|
42
|
+
selectedTimelineRevision: getRevisionFromDate(selectedTimelineItem?.startDate, selectedTimelineItem?.endDate, selectedDocument.operations.global),
|
|
43
|
+
}, dispatch: dispatch, document: selectedDocument, error: console.error })] }));
|
|
33
44
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FolderNode } from "document-drive";
|
|
2
2
|
interface FolderTreeProps {
|
|
3
|
-
folders:
|
|
3
|
+
folders: FolderNode[];
|
|
4
4
|
selectedNodeId?: string;
|
|
5
|
-
onSelectNode: (
|
|
5
|
+
onSelectNode: (nodeId: string | undefined) => void;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Hierarchical folder tree navigation component.
|
|
9
|
+
* Displays folders in a tree structure with expand/collapse functionality.
|
|
10
|
+
*/
|
|
7
11
|
export declare function FolderTree({ folders, selectedNodeId, onSelectNode, }: FolderTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
8
12
|
export {};
|
|
9
13
|
//# sourceMappingURL=FolderTree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FolderTree.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/FolderTree.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FolderTree.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/FolderTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,UAAU,eAAe;IACvB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACpD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,cAAc,EACd,YAAY,GACb,EAAE,eAAe,2CAiFjB"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Hierarchical folder tree navigation component.
|
|
5
|
+
* Displays folders in a tree structure with expand/collapse functionality.
|
|
6
|
+
*/
|
|
3
7
|
export function FolderTree({ folders, selectedNodeId, onSelectNode, }) {
|
|
8
|
+
// Track which folders are expanded
|
|
4
9
|
const [expandedFolders, setExpandedFolders] = useState(new Set());
|
|
10
|
+
// Toggle folder expansion state
|
|
5
11
|
const toggleFolder = (folderId) => {
|
|
6
12
|
setExpandedFolders((prev) => {
|
|
7
13
|
const next = new Set(prev);
|
|
@@ -14,18 +20,19 @@ export function FolderTree({ folders, selectedNodeId, onSelectNode, }) {
|
|
|
14
20
|
return next;
|
|
15
21
|
});
|
|
16
22
|
};
|
|
23
|
+
// Recursive function to render folder tree structure
|
|
17
24
|
const renderFolder = (folder, level = 0) => {
|
|
18
25
|
const hasChildren = folders.some((f) => f.parentFolder === folder.id);
|
|
19
26
|
const isExpanded = expandedFolders.has(folder.id);
|
|
20
27
|
const isSelected = selectedNodeId === folder.id;
|
|
21
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: `flex items-center
|
|
28
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: `flex cursor-pointer items-center rounded px-2 py-1 text-sm hover:bg-gray-100 ${isSelected ? "bg-blue-100 text-blue-800" : ""}`, style: { paddingLeft: `${level * 16 + 8}px` }, onClick: () => onSelectNode(folder.id), children: [hasChildren && (_jsxs("button", { className: "mr-1 flex h-4 w-4 items-center justify-center", onClick: (e) => {
|
|
22
29
|
e.stopPropagation();
|
|
23
30
|
toggleFolder(folder.id);
|
|
24
|
-
}, children: isExpanded ? "▼" : "▶" })), _jsx("
|
|
31
|
+
}, children: [isExpanded ? "▼" : "▶", " "] })), !hasChildren && _jsx("div", { className: "mr-1 w-5" }), _jsxs("span", { children: ["\uD83D\uDCC1 ", folder.name] })] }), isExpanded && hasChildren && (_jsx("div", { children: folders
|
|
25
32
|
.filter((f) => f.parentFolder === folder.id)
|
|
26
33
|
.map((child) => renderFolder(child, level + 1)) }))] }, folder.id));
|
|
27
34
|
};
|
|
28
|
-
return (_jsxs("div", { className: "space-y-1", children: [_jsx("div", { className: `flex items-center
|
|
35
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx("div", { className: `flex cursor-pointer items-center rounded px-2 py-1 text-sm hover:bg-gray-100 ${!selectedNodeId ? "bg-blue-100 text-blue-800" : ""}`, onClick: () => onSelectNode(undefined), children: _jsx("span", { children: "\uD83C\uDFE0 Root" }) }), folders
|
|
29
36
|
.filter((folder) => !folder.parentFolder)
|
|
30
37
|
.map((folder) => renderFolder(folder))] }));
|
|
31
38
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UiFileNode } from "@powerhousedao/design-system";
|
|
2
1
|
export declare const HeaderControls: ({ contributorOptions, statusOptions, onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses, createIntegrationsDocument, integrationsDoc, setActiveDocumentId }: {
|
|
3
2
|
contributorOptions?: {
|
|
4
3
|
label: string;
|
|
@@ -15,7 +14,7 @@ export declare const HeaderControls: ({ contributorOptions, statusOptions, onCon
|
|
|
15
14
|
onBatchAction?: (action: string) => void;
|
|
16
15
|
selectedStatuses?: string[];
|
|
17
16
|
createIntegrationsDocument?: () => void;
|
|
18
|
-
integrationsDoc?:
|
|
17
|
+
integrationsDoc?: any | null;
|
|
19
18
|
setActiveDocumentId?: (id: string) => void;
|
|
20
19
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,GAAI,yMAY5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,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,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC7B,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,4CAgKA,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { type UiFileNode } from "@powerhousedao/design-system";
|
|
2
1
|
import { type DocumentModelModule } from "document-model";
|
|
3
|
-
import { type InvoiceAction } from "../../../../document-models/invoice/index.js";
|
|
4
2
|
interface InvoiceTableProps {
|
|
5
|
-
files:
|
|
6
|
-
state: Record<string, any
|
|
3
|
+
files: any[];
|
|
4
|
+
state: Record<string, any>[];
|
|
7
5
|
setActiveDocumentId: (id: string) => void;
|
|
8
|
-
getDispatch: () => (action: any, onErrorCallback?: any) => void;
|
|
9
6
|
selected: {
|
|
10
7
|
[id: string]: boolean;
|
|
11
8
|
};
|
|
@@ -21,9 +18,8 @@ interface InvoiceTableProps {
|
|
|
21
18
|
renameNode: (nodeId: string, name: string) => void;
|
|
22
19
|
filteredDocumentModels: DocumentModelModule[];
|
|
23
20
|
onSelectDocumentModel: (model: DocumentModelModule) => void;
|
|
24
|
-
|
|
25
|
-
driveId: string;
|
|
21
|
+
getDocDispatcher: (id: string) => any;
|
|
26
22
|
}
|
|
27
|
-
export declare const InvoiceTable: ({ files, state, setActiveDocumentId,
|
|
23
|
+
export declare const InvoiceTable: ({ files, state, setActiveDocumentId, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, getDocDispatcher, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
24
|
export {};
|
|
29
25
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAsB1D,UAAU,iBAAiB;IACzB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAC7B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,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,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,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;CACvC;AAED,eAAO,MAAM,YAAY,GAAI,yKAY1B,iBAAiB,4CA+qBnB,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { useState
|
|
3
|
+
import { useState } from "react";
|
|
4
4
|
import { HeaderControls } from "./HeaderControls.js";
|
|
5
5
|
import { InvoiceTableSection } from "./InvoiceTableSection.js";
|
|
6
6
|
import { InvoiceTableRow } from "./InvoiceTableRow.js";
|
|
7
|
-
import { useDriveContext } from "@powerhousedao/reactor-browser";
|
|
8
7
|
import { createPresignedHeader } from "document-model";
|
|
9
8
|
import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
|
|
10
9
|
import { exportInvoicesToXeroCSV } from "../../../../scripts/contributor-billing/createXeroCsv.js";
|
|
11
10
|
import { toast } from "@powerhousedao/design-system";
|
|
11
|
+
import { actions, } from "../../../../document-models/invoice/index.js";
|
|
12
|
+
import { addDocument, useSelectedDrive } from "@powerhousedao/reactor-browser";
|
|
12
13
|
const statusOptions = [
|
|
13
14
|
{ label: "Draft", value: "DRAFT" },
|
|
14
15
|
{ label: "Issued", value: "ISSUED" },
|
|
@@ -20,21 +21,15 @@ const statusOptions = [
|
|
|
20
21
|
{ label: "Rejected", value: "REJECTED" },
|
|
21
22
|
{ label: "Other", value: "OTHER" },
|
|
22
23
|
];
|
|
23
|
-
export const InvoiceTable = ({ files, state, setActiveDocumentId,
|
|
24
|
+
export const InvoiceTable = ({ files, state, setActiveDocumentId, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, getDocDispatcher, }) => {
|
|
24
25
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
25
|
-
const
|
|
26
|
-
const billingDocStates =
|
|
27
|
-
.filter((
|
|
28
|
-
.map((
|
|
29
|
-
id,
|
|
30
|
-
contributor: doc.global.contributor,
|
|
26
|
+
const [selectedDrive] = useSelectedDrive();
|
|
27
|
+
const billingDocStates = state
|
|
28
|
+
.filter((doc) => doc.header.documentType === "powerhouse/billing-statement")
|
|
29
|
+
.map((doc) => ({
|
|
30
|
+
id: doc.header.id,
|
|
31
|
+
contributor: doc.state.global.contributor,
|
|
31
32
|
}));
|
|
32
|
-
const getMenuOptions = () => {
|
|
33
|
-
return [
|
|
34
|
-
{ label: "View Invoice", value: "view-invoice" },
|
|
35
|
-
// { label: "View Payment Transaction", value: "view-payment" },
|
|
36
|
-
];
|
|
37
|
-
};
|
|
38
33
|
const handleStatusChange = (value) => {
|
|
39
34
|
setSelectedStatuses(Array.isArray(value) ? value : [value]);
|
|
40
35
|
};
|
|
@@ -42,44 +37,43 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
42
37
|
return selectedStatuses.length === 0 || selectedStatuses.includes(status);
|
|
43
38
|
};
|
|
44
39
|
const getInvoicesByStatus = (status) => {
|
|
45
|
-
return
|
|
46
|
-
.filter((
|
|
47
|
-
doc.global.status === status)
|
|
48
|
-
.map((
|
|
49
|
-
id,
|
|
50
|
-
issuer: doc.global.issuer?.name || "Unknown",
|
|
51
|
-
status: doc.global.status,
|
|
52
|
-
invoiceNo: doc.global.invoiceNo,
|
|
53
|
-
issueDate: doc.global.dateIssued,
|
|
54
|
-
dueDate: doc.global.dateDue,
|
|
55
|
-
currency: doc.global.currency,
|
|
56
|
-
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
57
|
-
exported: doc.global.exported,
|
|
40
|
+
return state
|
|
41
|
+
.filter((doc) => doc.header.documentType === "powerhouse/invoice" &&
|
|
42
|
+
doc.state.global.status === status)
|
|
43
|
+
.map((doc) => ({
|
|
44
|
+
id: doc.header.id,
|
|
45
|
+
issuer: doc.state.global.issuer?.name || "Unknown",
|
|
46
|
+
status: doc.state.global.status,
|
|
47
|
+
invoiceNo: doc.state.global.invoiceNo,
|
|
48
|
+
issueDate: doc.state.global.dateIssued,
|
|
49
|
+
dueDate: doc.state.global.dateDue,
|
|
50
|
+
currency: doc.state.global.currency,
|
|
51
|
+
amount: doc.state.global.totalPriceTaxIncl?.toString() ?? "",
|
|
52
|
+
exported: doc.state.global.exported,
|
|
58
53
|
}));
|
|
59
54
|
};
|
|
60
|
-
// console.log('filteredDocumentModels', filteredDocumentModels)
|
|
61
55
|
const getOtherInvoices = () => {
|
|
62
|
-
return
|
|
63
|
-
.filter((
|
|
64
|
-
doc.global.status !== "DRAFT" &&
|
|
65
|
-
doc.global.status !== "ISSUED" &&
|
|
66
|
-
doc.global.status !== "ACCEPTED" &&
|
|
67
|
-
doc.global.status !== "PAYMENTSCHEDULED" &&
|
|
68
|
-
doc.global.status !== "PAYMENTSENT" &&
|
|
69
|
-
doc.global.status !== "PAYMENTISSUE" &&
|
|
70
|
-
doc.global.status !== "PAYMENTCLOSED" &&
|
|
71
|
-
doc.global.status !== "REJECTED")
|
|
72
|
-
.map((
|
|
73
|
-
id,
|
|
74
|
-
issuer: doc.global.issuer?.name || "Unknown",
|
|
75
|
-
status: doc.global.status,
|
|
76
|
-
invoiceNo: doc.global.invoiceNo,
|
|
77
|
-
issueDate: doc.global.dateIssued,
|
|
78
|
-
dueDate: doc.global.dateDue,
|
|
79
|
-
currency: doc.global.currency,
|
|
80
|
-
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
81
|
-
documentType: doc.documentType,
|
|
82
|
-
exported: doc.global.exported,
|
|
56
|
+
return state
|
|
57
|
+
.filter((doc) => doc.header.documentType === "powerhouse/invoice" &&
|
|
58
|
+
doc.state.global.status !== "DRAFT" &&
|
|
59
|
+
doc.state.global.status !== "ISSUED" &&
|
|
60
|
+
doc.state.global.status !== "ACCEPTED" &&
|
|
61
|
+
doc.state.global.status !== "PAYMENTSCHEDULED" &&
|
|
62
|
+
doc.state.global.status !== "PAYMENTSENT" &&
|
|
63
|
+
doc.state.global.status !== "PAYMENTISSUE" &&
|
|
64
|
+
doc.state.global.status !== "PAYMENTCLOSED" &&
|
|
65
|
+
doc.state.global.status !== "REJECTED")
|
|
66
|
+
.map((doc) => ({
|
|
67
|
+
id: doc.header.id,
|
|
68
|
+
issuer: doc.state.global.issuer?.name || "Unknown",
|
|
69
|
+
status: doc.state.global.status,
|
|
70
|
+
invoiceNo: doc.state.global.invoiceNo,
|
|
71
|
+
issueDate: doc.state.global.dateIssued,
|
|
72
|
+
dueDate: doc.state.global.dateDue,
|
|
73
|
+
currency: doc.state.global.currency,
|
|
74
|
+
amount: doc.state.global.totalPriceTaxIncl?.toString() ?? "",
|
|
75
|
+
documentType: doc.header.documentType,
|
|
76
|
+
exported: doc.state.global.exported,
|
|
83
77
|
}));
|
|
84
78
|
};
|
|
85
79
|
const draft = getInvoicesByStatus("DRAFT");
|
|
@@ -111,12 +105,12 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
111
105
|
.toLowerCase();
|
|
112
106
|
};
|
|
113
107
|
const handleCreateBillingStatement = async (id) => {
|
|
114
|
-
const driveId = selectedNode?.id;
|
|
115
|
-
if (!driveId)
|
|
116
|
-
return;
|
|
117
108
|
const invoiceFile = files.find((file) => file.id === id);
|
|
118
|
-
const invoiceState = state
|
|
119
|
-
|
|
109
|
+
const invoiceState = state.find((doc) => doc.header.id === id);
|
|
110
|
+
if (!invoiceState) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
await addDocument(selectedDrive?.header.id || "", `bill-${invoiceFile?.name}`, "powerhouse/billing-statement", undefined, {
|
|
120
114
|
header: {
|
|
121
115
|
...createPresignedHeader(),
|
|
122
116
|
...{
|
|
@@ -126,46 +120,16 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
126
120
|
},
|
|
127
121
|
},
|
|
128
122
|
state: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
dateDue: invoiceState.global.dateDue,
|
|
133
|
-
lineItems: invoiceState.global.lineItems.map((item) => {
|
|
134
|
-
return {
|
|
135
|
-
id: item.id,
|
|
136
|
-
description: item.description,
|
|
137
|
-
quantity: item.quantity,
|
|
138
|
-
unit: "UNIT",
|
|
139
|
-
unitPricePwt: 0,
|
|
140
|
-
unitPriceCash: item.unitPriceTaxIncl,
|
|
141
|
-
totalPricePwt: 0,
|
|
142
|
-
totalPriceCash: item.totalPriceTaxIncl,
|
|
143
|
-
lineItemTag: mapTags(item.lineItemTag || []),
|
|
144
|
-
};
|
|
145
|
-
}),
|
|
146
|
-
status: invoiceState.global.status,
|
|
147
|
-
currency: invoiceState.global.currency,
|
|
148
|
-
totalCash: invoiceState.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
149
|
-
totalPowt: 0,
|
|
150
|
-
notes: invoiceState.global.notes,
|
|
123
|
+
auth: {},
|
|
124
|
+
document: {
|
|
125
|
+
version: "1.0.0",
|
|
151
126
|
},
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
operations: {
|
|
155
|
-
global: [],
|
|
156
|
-
local: [],
|
|
157
|
-
},
|
|
158
|
-
history: {
|
|
159
|
-
global: [],
|
|
160
|
-
local: [],
|
|
161
|
-
},
|
|
162
|
-
initialState: {
|
|
163
|
-
state: {
|
|
127
|
+
...{
|
|
164
128
|
global: {
|
|
165
129
|
contributor: id,
|
|
166
|
-
dateIssued: invoiceState.global.dateIssued,
|
|
167
|
-
dateDue: invoiceState.global.dateDue,
|
|
168
|
-
lineItems: invoiceState.global.lineItems.map((item) => {
|
|
130
|
+
dateIssued: invoiceState.state.global.dateIssued,
|
|
131
|
+
dateDue: invoiceState.state.global.dateDue,
|
|
132
|
+
lineItems: invoiceState.state.global.lineItems.map((item) => {
|
|
169
133
|
return {
|
|
170
134
|
id: item.id,
|
|
171
135
|
description: item.description,
|
|
@@ -178,44 +142,86 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
178
142
|
lineItemTag: mapTags(item.lineItemTag || []),
|
|
179
143
|
};
|
|
180
144
|
}),
|
|
181
|
-
status: invoiceState.global.status,
|
|
182
|
-
currency: invoiceState.global.currency,
|
|
183
|
-
totalCash: invoiceState.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
145
|
+
status: invoiceState.state.global.status,
|
|
146
|
+
currency: invoiceState.state.global.currency,
|
|
147
|
+
totalCash: invoiceState.state.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
184
148
|
totalPowt: 0,
|
|
185
|
-
notes: invoiceState.global.notes,
|
|
149
|
+
notes: invoiceState.state.global.notes,
|
|
186
150
|
},
|
|
187
151
|
local: {},
|
|
188
152
|
},
|
|
189
153
|
},
|
|
154
|
+
operations: {
|
|
155
|
+
global: [],
|
|
156
|
+
local: [],
|
|
157
|
+
},
|
|
158
|
+
history: {
|
|
159
|
+
global: [],
|
|
160
|
+
local: [],
|
|
161
|
+
},
|
|
162
|
+
initialState: {
|
|
163
|
+
...{
|
|
164
|
+
state: {
|
|
165
|
+
global: {
|
|
166
|
+
contributor: id,
|
|
167
|
+
dateIssued: invoiceState.state.global.dateIssued,
|
|
168
|
+
dateDue: invoiceState.state.global.dateDue,
|
|
169
|
+
lineItems: invoiceState.state.global.lineItems.map((item) => {
|
|
170
|
+
return {
|
|
171
|
+
id: item.id,
|
|
172
|
+
description: item.description,
|
|
173
|
+
quantity: item.quantity,
|
|
174
|
+
unit: "UNIT",
|
|
175
|
+
unitPricePwt: 0,
|
|
176
|
+
unitPriceCash: item.unitPriceTaxIncl,
|
|
177
|
+
totalPricePwt: 0,
|
|
178
|
+
totalPriceCash: item.totalPriceTaxIncl,
|
|
179
|
+
lineItemTag: mapTags(item.lineItemTag || []),
|
|
180
|
+
};
|
|
181
|
+
}),
|
|
182
|
+
status: invoiceState.state.global.status,
|
|
183
|
+
currency: invoiceState.state.global.currency,
|
|
184
|
+
totalCash: invoiceState.state.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
185
|
+
totalPowt: 0,
|
|
186
|
+
notes: invoiceState.state.global.notes,
|
|
187
|
+
},
|
|
188
|
+
local: {},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
190
192
|
clipboard: [],
|
|
191
|
-
});
|
|
193
|
+
}, undefined, "powerhouse-billing-statement-editor");
|
|
192
194
|
};
|
|
193
195
|
const selectedInvoiceIds = Object.keys(selected).filter((id) => selected[id]);
|
|
194
|
-
const selectedInvoices = selectedInvoiceIds
|
|
195
|
-
|
|
196
|
-
id
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
const map = {};
|
|
202
|
-
selectedInvoiceIds.forEach((invoiceId) => {
|
|
203
|
-
if (dispatchMap[invoiceId]) {
|
|
204
|
-
map[invoiceId] = dispatchMap[invoiceId];
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
return map;
|
|
208
|
-
}, [selectedInvoiceIds, dispatchMap]);
|
|
196
|
+
const selectedInvoices = selectedInvoiceIds
|
|
197
|
+
.map((id) => {
|
|
198
|
+
const doc = state.find((doc) => doc.header.id === id);
|
|
199
|
+
return doc ? { ...doc, id } : null;
|
|
200
|
+
})
|
|
201
|
+
.filter((inv) => inv !== null); // Filter out null/undefined invoices
|
|
202
|
+
const selectedInvoiceStatuses = selectedInvoices.map((inv) => inv?.state?.global?.status || inv?.state?.global?.status);
|
|
209
203
|
const handleCSVExport = async (baseCurrency) => {
|
|
210
|
-
console.log("Exporting selected invoices:",
|
|
211
|
-
id,
|
|
212
|
-
state:
|
|
204
|
+
console.log("Exporting selected invoices:", selectedInvoices.map((inv) => ({
|
|
205
|
+
id: inv.id,
|
|
206
|
+
state: inv,
|
|
213
207
|
})));
|
|
214
208
|
try {
|
|
215
|
-
await exportInvoicesToXeroCSV(selectedInvoices, baseCurrency);
|
|
209
|
+
const exportedData = await exportInvoicesToXeroCSV(selectedInvoices, baseCurrency);
|
|
216
210
|
toast("Invoices exported successfully", {
|
|
217
211
|
type: "success",
|
|
218
212
|
});
|
|
213
|
+
selectedInvoices.forEach((invoice) => {
|
|
214
|
+
const invoiceDoc = getDocDispatcher(invoice.id);
|
|
215
|
+
const exportedInvoiceData = exportedData[invoice.id];
|
|
216
|
+
if (!invoiceDoc || !exportedInvoiceData) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const invoiceDispatcher = invoiceDoc[1];
|
|
220
|
+
invoiceDispatcher(actions.setExportedData({
|
|
221
|
+
timestamp: exportedInvoiceData.timestamp,
|
|
222
|
+
exportedLineItems: exportedInvoiceData.exportedLineItems,
|
|
223
|
+
}));
|
|
224
|
+
});
|
|
219
225
|
}
|
|
220
226
|
catch (error) {
|
|
221
227
|
console.error("Error exporting invoices:", error);
|
|
@@ -229,9 +235,9 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
229
235
|
}
|
|
230
236
|
};
|
|
231
237
|
// check if integrations document exists
|
|
232
|
-
const integrationsDoc = files.find(file => file.documentType === "powerhouse/integrations");
|
|
238
|
+
const integrationsDoc = files.find((file) => file.documentType === "powerhouse/integrations");
|
|
233
239
|
const createIntegrationsDocument = () => {
|
|
234
|
-
const integrationsDocument = filteredDocumentModels?.find(model => model.documentModel.id === "powerhouse/integrations");
|
|
240
|
+
const integrationsDocument = filteredDocumentModels?.find((model) => model.documentModel.id === "powerhouse/integrations");
|
|
235
241
|
if (integrationsDocument) {
|
|
236
242
|
onSelectDocumentModel(integrationsDocument);
|
|
237
243
|
}
|
|
@@ -263,5 +269,5 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
263
269
|
})), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, 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) => setSelected((prev) => ({
|
|
264
270
|
...prev,
|
|
265
271
|
[row.id]: checked,
|
|
266
|
-
})), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) }))] }, `${
|
|
272
|
+
})), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) }))] }, `${state.length}`));
|
|
267
273
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type UiFileNode } from "@powerhousedao/design-system";
|
|
2
1
|
export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }: {
|
|
3
|
-
files?:
|
|
2
|
+
files?: any[];
|
|
4
3
|
row: any;
|
|
5
4
|
isSelected: boolean;
|
|
6
5
|
onSelect: (checked: boolean) => void;
|
|
@@ -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":"AAKA,eAAO,MAAM,eAAe,GAAI,kIAU7B;IACD,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,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,4CA2JA,CAAC"}
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef } from "react";
|
|
3
|
-
import { FileItem
|
|
3
|
+
import { FileItem } from "@powerhousedao/design-system";
|
|
4
|
+
import { useDriveContext } from "@powerhousedao/reactor-browser";
|
|
4
5
|
export const InvoiceTableRow = ({ files, row, isSelected, onSelect, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }) => {
|
|
5
6
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
6
7
|
const menuRef = useRef(null);
|
|
8
|
+
const formatTimestamp = (timestamp) => {
|
|
9
|
+
const date = new Date(timestamp);
|
|
10
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
11
|
+
// Use ISO short month names (Jan, Feb, etc.)
|
|
12
|
+
const monthNames = [
|
|
13
|
+
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
|
14
|
+
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
|
|
15
|
+
];
|
|
16
|
+
const month = monthNames[date.getMonth()];
|
|
17
|
+
const year = date.getFullYear();
|
|
18
|
+
const hours = date.getHours().toString().padStart(2, '0');
|
|
19
|
+
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
20
|
+
return `${day}-${month}-${year} ${hours}:${minutes}`;
|
|
21
|
+
};
|
|
7
22
|
const billingDoc = billingDocStates?.find((doc) => doc.contributor === row.id);
|
|
8
23
|
const billingFile = files?.find((file) => file.id === billingDoc?.id);
|
|
9
24
|
const file = files?.find((file) => file.id === row.id);
|
|
10
|
-
const hasExportedData = row.exported != null &&
|
|
11
|
-
|
|
12
|
-
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, {
|
|
25
|
+
const hasExportedData = row.exported != null && Boolean(row.exported.timestamp?.trim());
|
|
26
|
+
const { onAddFile, onAddFolder, onCopyNode, onDuplicateNode, onMoveNode, onRenameNode, showDeleteNodeModal, } = useDriveContext();
|
|
27
|
+
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: onRenameNode, onDuplicateNode: () => new Promise((resolve) => resolve(undefined)), showDeleteNodeModal: showDeleteNodeModal, 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: row.amount }), (row.status === "ISSUED" ||
|
|
28
|
+
row.status === "ACCEPTED" ||
|
|
29
|
+
row.status === "PAYMENTSCHEDULED" ||
|
|
30
|
+
row.status === "PAYMENTRECEIVED" ||
|
|
31
|
+
row.status === "PAYMENTSENT") &&
|
|
32
|
+
!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: "PUBLIC", onRenameNode: onRenameNode, onDuplicateNode: () => new Promise((resolve) => resolve(undefined)), showDeleteNodeModal: showDeleteNodeModal, 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(billingDoc?.id) }, 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" })) })] }));
|
|
13
33
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type DriveEditorProps } from "@powerhousedao/reactor-browser";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
6
11
|
//# 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":"AACA,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAGxC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,2CAOjD;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,gBAAgB,2CAarD"}
|