@powerhousedao/contributor-billing 0.0.13 → 0.0.14
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/actions.d.ts +8 -0
- package/dist/document-models/billing-statement/gen/actions.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/actions.js +3 -0
- package/dist/document-models/billing-statement/gen/creators.d.ts +4 -0
- package/dist/document-models/billing-statement/gen/creators.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/creators.js +3 -0
- package/dist/document-models/billing-statement/gen/document-model.d.ts +3 -0
- package/dist/document-models/billing-statement/gen/document-model.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/document-model.js +117 -0
- package/dist/document-models/billing-statement/gen/general/actions.d.ts +7 -0
- package/dist/document-models/billing-statement/gen/general/actions.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/general/actions.js +1 -0
- package/dist/document-models/billing-statement/gen/general/creators.d.ts +6 -0
- package/dist/document-models/billing-statement/gen/general/creators.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/general/creators.js +5 -0
- package/dist/document-models/billing-statement/gen/general/error.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/general/error.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/general/error.js +1 -0
- package/dist/document-models/billing-statement/gen/general/object.d.ts +9 -0
- package/dist/document-models/billing-statement/gen/general/object.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/general/object.js +13 -0
- package/dist/document-models/billing-statement/gen/general/operations.d.ts +9 -0
- package/dist/document-models/billing-statement/gen/general/operations.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/general/operations.js +1 -0
- package/dist/document-models/billing-statement/gen/index.d.ts +6 -0
- package/dist/document-models/billing-statement/gen/index.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/index.js +5 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +6 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.js +1 -0
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts +5 -0
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/line-items/creators.js +4 -0
- package/dist/document-models/billing-statement/gen/line-items/error.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/line-items/error.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/line-items/error.js +1 -0
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts +8 -0
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/line-items/object.js +10 -0
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts +8 -0
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/line-items/operations.js +1 -0
- package/dist/document-models/billing-statement/gen/object.d.ts +20 -0
- package/dist/document-models/billing-statement/gen/object.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/object.js +33 -0
- package/dist/document-models/billing-statement/gen/reducer.d.ts +3 -0
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/reducer.js +39 -0
- package/dist/document-models/billing-statement/gen/schema/index.d.ts +3 -0
- package/dist/document-models/billing-statement/gen/schema/index.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/schema/index.js +2 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +202 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/schema/types.js +1 -0
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts +23 -0
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/schema/zod.js +117 -0
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts +5 -0
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/tags/actions.js +1 -0
- package/dist/document-models/billing-statement/gen/tags/creators.d.ts +4 -0
- package/dist/document-models/billing-statement/gen/tags/creators.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/tags/creators.js +3 -0
- package/dist/document-models/billing-statement/gen/tags/error.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/tags/error.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/tags/error.js +1 -0
- package/dist/document-models/billing-statement/gen/tags/object.d.ts +7 -0
- package/dist/document-models/billing-statement/gen/tags/object.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/tags/object.js +7 -0
- package/dist/document-models/billing-statement/gen/tags/operations.d.ts +7 -0
- package/dist/document-models/billing-statement/gen/tags/operations.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/tags/operations.js +1 -0
- package/dist/document-models/billing-statement/gen/types.d.ts +10 -0
- package/dist/document-models/billing-statement/gen/types.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/types.js +1 -0
- package/dist/document-models/billing-statement/gen/utils.d.ts +7 -0
- package/dist/document-models/billing-statement/gen/utils.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/utils.js +42 -0
- package/dist/document-models/billing-statement/index.d.ts +31 -0
- package/dist/document-models/billing-statement/index.d.ts.map +1 -0
- package/dist/document-models/billing-statement/index.js +21 -0
- package/dist/document-models/billing-statement/src/reducers/general.d.ts +8 -0
- package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/reducers/general.js +41 -0
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts +8 -0
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/reducers/line-items.js +49 -0
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts +8 -0
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/reducers/tags.js +36 -0
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts +6 -0
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/tests/document-model.test.js +17 -0
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts +5 -0
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/tests/general.test.js +93 -0
- package/dist/document-models/billing-statement/src/tests/line-items.test.d.ts +6 -0
- package/dist/document-models/billing-statement/src/tests/line-items.test.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/tests/line-items.test.js +131 -0
- package/dist/document-models/billing-statement/src/tests/tags.test.d.ts +6 -0
- package/dist/document-models/billing-statement/src/tests/tags.test.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/tests/tags.test.js +52 -0
- package/dist/document-models/billing-statement/src/utils.d.ts +2 -0
- package/dist/document-models/billing-statement/src/utils.d.ts.map +1 -0
- package/dist/document-models/billing-statement/src/utils.js +1 -0
- package/dist/document-models/index.d.ts +1 -0
- package/dist/document-models/index.d.ts.map +1 -1
- package/dist/document-models/index.js +1 -0
- package/dist/editors/billing-statement/components/lineItems.d.ts +3 -0
- package/dist/editors/billing-statement/components/lineItems.d.ts.map +1 -0
- package/dist/editors/billing-statement/components/lineItems.js +24 -0
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts +6 -0
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -0
- package/dist/editors/billing-statement/components/lineItemsTable.js +116 -0
- package/dist/editors/billing-statement/components/objectSetTable.d.ts +6 -0
- package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -0
- package/dist/editors/billing-statement/components/objectSetTable.js +96 -0
- package/dist/editors/billing-statement/editor.d.ts +5 -0
- package/dist/editors/billing-statement/editor.d.ts.map +1 -0
- package/dist/editors/billing-statement/editor.js +23 -0
- package/dist/editors/billing-statement/index.d.ts +5 -0
- package/dist/editors/billing-statement/index.d.ts.map +1 -0
- package/dist/editors/billing-statement/index.js +12 -0
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts +16 -0
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -0
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +58 -0
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts +4 -0
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -0
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +44 -0
- package/dist/editors/contributor-billing/editor.js +1 -1
- package/dist/editors/index.d.ts +1 -0
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +1 -0
- package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/currencyForm.js +2 -4
- package/dist/editors/invoice/components/datePicker.d.ts.map +1 -1
- package/dist/editors/invoice/components/datePicker.js +2 -2
- package/dist/editors/invoice/components/inputField.d.ts.map +1 -1
- package/dist/editors/invoice/components/inputField.js +1 -3
- package/dist/editors/invoice/components/numberForm.d.ts +2 -1
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/numberForm.js +2 -2
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +38 -33
- package/dist/editors/invoice/lineItems.d.ts +1 -1
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/lineItems.js +21 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/powerhouse.manifest.json +10 -1
- package/dist/style.css +102 -2
- package/dist/subgraphs/billing-statement/index.d.ts +10 -0
- package/dist/subgraphs/billing-statement/index.d.ts.map +1 -0
- package/dist/subgraphs/billing-statement/index.js +11 -0
- package/dist/subgraphs/billing-statement/resolvers.d.ts +3 -0
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/billing-statement/resolvers.js +110 -0
- package/dist/subgraphs/billing-statement/schema.d.ts +3 -0
- package/dist/subgraphs/billing-statement/schema.d.ts.map +1 -0
- package/dist/subgraphs/billing-statement/schema.js +165 -0
- package/dist/subgraphs/index.d.ts +1 -0
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +1 -0
- package/package.json +4 -4
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
/* eslint-disable react/jsx-no-bind */
|
|
4
4
|
/* eslint-disable react/button-has-type */
|
|
5
5
|
import { RWAButton } from "@powerhousedao/design-system";
|
|
6
|
-
import { forwardRef, useState, useMemo, useRef } from "react";
|
|
6
|
+
import { forwardRef, useState, useMemo, useRef, } from "react";
|
|
7
7
|
import { v4 as uuidv4 } from "uuid";
|
|
8
8
|
import { Tag } from "lucide-react";
|
|
9
9
|
import { NumberForm } from "./components/numberForm.js";
|
|
@@ -18,9 +18,9 @@ export function formatNumber(value) {
|
|
|
18
18
|
const hasDecimals = value % 1 !== 0;
|
|
19
19
|
// If no decimals or only trailing zeros after 2 decimal places, show 2 decimal places
|
|
20
20
|
if (!hasDecimals || value.toFixed(5).endsWith("000")) {
|
|
21
|
-
return value.toLocaleString(
|
|
21
|
+
return value.toLocaleString("en-US", {
|
|
22
22
|
minimumFractionDigits: 2,
|
|
23
|
-
maximumFractionDigits: 2
|
|
23
|
+
maximumFractionDigits: 2,
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
// Otherwise, show actual decimal places up to 5
|
|
@@ -28,9 +28,9 @@ export function formatNumber(value) {
|
|
|
28
28
|
const decimalPart = stringValue.split(".")[1] || "";
|
|
29
29
|
// Determine how many decimal places to show (up to 5)
|
|
30
30
|
const decimalPlaces = Math.min(Math.max(2, decimalPart.length), 5);
|
|
31
|
-
return value.toLocaleString(
|
|
31
|
+
return value.toLocaleString("en-US", {
|
|
32
32
|
minimumFractionDigits: decimalPlaces,
|
|
33
|
-
maximumFractionDigits: decimalPlaces
|
|
33
|
+
maximumFractionDigits: decimalPlaces,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
const EditableLineItem = forwardRef(function EditableLineItem(props, ref) {
|
|
@@ -96,6 +96,7 @@ const EditableLineItem = forwardRef(function EditableLineItem(props, ref) {
|
|
|
96
96
|
else if (field === "unitPriceTaxExcl") {
|
|
97
97
|
// For unit price, allow up to dynamic decimal places based on currency
|
|
98
98
|
const maxDecimals = getCurrencyPrecision(currency);
|
|
99
|
+
// Allow negative numbers with optional minus sign at start
|
|
99
100
|
const regex = new RegExp(`^-?\\d*\\.?\\d{0,${maxDecimals}}$`);
|
|
100
101
|
if (regex.test(value)) {
|
|
101
102
|
setEditedItem((prev) => ({ ...prev, [field]: value }));
|
|
@@ -141,9 +142,9 @@ const EditableLineItem = forwardRef(function EditableLineItem(props, ref) {
|
|
|
141
142
|
}
|
|
142
143
|
return (_jsxs("tr", { ref: ref, className: "hover:bg-gray-50 table-row", children: [_jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(InputField, { onBlur: () => { }, handleInputChange: (e) => {
|
|
143
144
|
setEditedItem((prev) => ({ ...prev, description: e.target.value }));
|
|
144
|
-
}, value: editedItem.description ?? "", placeholder: "Description", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.quantity ?? "", precision: 0, handleInputChange: handleInputChange("quantity"), placeholder: "Quantity", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.unitPriceTaxExcl ?? "", precision: getCurrencyPrecision(currency), handleInputChange: handleInputChange("unitPriceTaxExcl"), placeholder: "Unit Price (excl. tax)", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.taxPercent ?? "", precision: 0,
|
|
145
|
+
}, value: editedItem.description ?? "", placeholder: "Description", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.quantity ?? "", precision: 0, handleInputChange: handleInputChange("quantity"), placeholder: "Quantity", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.unitPriceTaxExcl ?? "", precision: getCurrencyPrecision(currency), handleInputChange: handleInputChange("unitPriceTaxExcl"), pattern: "^-?\\d*\\.?\\d*$", placeholder: "Unit Price (excl. tax)", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.taxPercent ?? "", precision: 0, pattern: "^(100|[1-9]?[0-9])$", handleInputChange: handleInputChange("taxPercent"), placeholder: "Tax %", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(calculatedValues.totalPriceTaxExcl) }), _jsx("td", { className: "border border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(calculatedValues.totalPriceTaxIncl) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsxs("div", { className: "flex space-x-2", children: [_jsx("button", { className: "rounded bg-blue-500 px-3 py-1 text-white hover:bg-blue-700", onClick: handleSave, children: "Save" }), _jsx("button", { className: "rounded bg-gray-500 px-3 py-1 text-white hover:bg-gray-600", onClick: onCancel, children: "Cancel" })] }) })] }));
|
|
145
146
|
});
|
|
146
|
-
export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, onDeleteItem, onUpdateCurrency, dispatch, paymentAccounts }) {
|
|
147
|
+
export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, onDeleteItem, onUpdateCurrency, dispatch, paymentAccounts, }) {
|
|
147
148
|
const [editingId, setEditingId] = useState(null);
|
|
148
149
|
const [isAddingNew, setIsAddingNew] = useState(false);
|
|
149
150
|
const [showTagTable, setShowTagTable] = useState(false);
|
|
@@ -162,19 +163,27 @@ export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, o
|
|
|
162
163
|
setIsAddingNew(false);
|
|
163
164
|
}
|
|
164
165
|
// Transform line items to TagAssignmentRow format for the tag table
|
|
165
|
-
const tagAssignmentRows = lineItems.map(item => ({
|
|
166
|
+
const tagAssignmentRows = lineItems.map((item) => ({
|
|
166
167
|
id: item.id,
|
|
167
168
|
item: item.description,
|
|
168
|
-
period:
|
|
169
|
-
expenseAccount:
|
|
169
|
+
period: "", // Default value
|
|
170
|
+
expenseAccount: "", // Default value
|
|
170
171
|
total: `$${formatNumber(item.totalPriceTaxIncl)}`,
|
|
171
172
|
lineItemTag: item.lineItemTag,
|
|
172
173
|
}));
|
|
173
174
|
if (showTagTable) {
|
|
174
175
|
return (_jsx(LineItemTagsTable, { lineItems: tagAssignmentRows, onClose: () => setShowTagTable(false), dispatch: dispatch, paymentAccounts: paymentAccounts }));
|
|
175
176
|
}
|
|
176
|
-
return (_jsx("div", { ref: containerRef, className: "relative w-full", children: _jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("div", { className: "flex items-center gap-4", children: _jsx("h4", { className: "text-xl font-semibold text-gray-900", children: "Line Items" }) }), _jsx(RWAButton, { className: "mb-2", disabled: isAddingNew, onClick: handleAddClick, children: "Add Line Item" })] }), _jsx("div", { ref: tableContainerRef, className: "overflow-x-auto rounded-lg border border-gray-200", children: _jsxs("table", { ref: tableRef, className: "w-full table-fixed border-collapse bg-white", children: [_jsxs("colgroup", { children: [_jsx("col", { style: { width:
|
|
177
|
+
return (_jsx("div", { ref: containerRef, className: "relative w-full", children: _jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("div", { className: "flex items-center gap-4", children: _jsx("h4", { className: "text-xl font-semibold text-gray-900", children: "Line Items" }) }), _jsx(RWAButton, { className: "mb-2", disabled: isAddingNew, onClick: handleAddClick, children: "Add Line Item" })] }), _jsx("div", { ref: tableContainerRef, className: "overflow-x-auto rounded-lg border border-gray-200", children: _jsxs("table", { ref: tableRef, className: "w-full table-fixed border-collapse bg-white", children: [_jsxs("colgroup", { children: [_jsx("col", { style: { width: "30%" } }), _jsx("col", { style: { width: "10%" } }), _jsx("col", { style: { width: "12%" } }), _jsx("col", { style: { width: "8%" } }), _jsx("col", {}), _jsx("col", {}), _jsx("col", {})] }), _jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Description" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Quantity" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Unit Price (excl. tax)" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Tax %" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Total (excl. tax)" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Total (incl. tax)" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-center", children: _jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx("span", { className: "text-sm", children: "Actions" }), _jsx(Tag, { onClick: () => setShowTagTable(true), style: {
|
|
178
|
+
cursor: "pointer",
|
|
179
|
+
width: 28,
|
|
180
|
+
height: 28,
|
|
181
|
+
color: "white",
|
|
182
|
+
fill: "#475264",
|
|
183
|
+
} })] }) })] }) }), _jsxs("tbody", { children: [lineItems.map((item) => editingId === item.id ? (_jsx(EditableLineItem, { currency: currency, item: item, onCancel: () => setEditingId(null), onSave: (updatedItem) => {
|
|
177
184
|
onUpdateItem(updatedItem);
|
|
178
185
|
setEditingId(null);
|
|
179
|
-
} }, item.id)) : (_jsxs("tr", { className: "hover:bg-gray-50 table-row", children: [_jsx("td", { className: "border-b border-gray-200 p-3 table-cell", children: item.description }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: item.quantity }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: formatNumber(item.unitPriceTaxExcl) }), _jsxs("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: [typeof item.taxPercent === "number"
|
|
186
|
+
} }, item.id)) : (_jsxs("tr", { className: "hover:bg-gray-50 table-row", children: [_jsx("td", { className: "border-b border-gray-200 p-3 table-cell", children: item.description }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: item.quantity }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: formatNumber(item.unitPriceTaxExcl) }), _jsxs("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: [typeof item.taxPercent === "number"
|
|
187
|
+
? Math.round(item.taxPercent)
|
|
188
|
+
: 0, "%"] }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(item.totalPriceTaxExcl) }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(item.totalPriceTaxIncl) }), _jsx("td", { className: "border-b border-gray-200 p-3 table-cell", children: _jsxs("div", { className: "flex justify-center space-x-2", children: [_jsx("button", { className: "rounded bg-blue-500 px-3 py-1 text-white hover:bg-blue-200", onClick: () => setEditingId(item.id), children: "Edit" }), _jsx("button", { className: "rounded bg-red-600 px-3 py-1 text-white hover:bg-red-700", onClick: () => onDeleteItem({ id: item.id }), children: "Delete" })] }) })] }, item.id))), isAddingNew ? (_jsx(EditableLineItem, { currency: currency, item: {}, onCancel: handleCancelNewItem, onSave: handleSaveNewItem })) : null] })] }) })] }) }));
|
|
180
189
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Manifest } from "document-model";
|
|
2
2
|
export declare const manifest: Manifest;
|
|
3
|
-
export declare const documentModels: import("document-model").DocumentModelModule<import("./document-models/invoice/index.js").InvoiceDocument>[];
|
|
4
|
-
export declare const editors: (import("document-model").EditorModule<import("./document-models/invoice/index.js").InvoiceDocument> | import("@powerhousedao/reactor-browser").DriveEditorModule<import("document-drive").DocumentDriveDocument>)[];
|
|
3
|
+
export declare const documentModels: (import("document-model").DocumentModelModule<import("./document-models/invoice/index.js").InvoiceDocument> | import("document-model").DocumentModelModule<import("./document-models/billing-statement/index.js").BillingStatementDocument>)[];
|
|
4
|
+
export declare const editors: (import("document-model").EditorModule<import("./document-models/invoice/index.js").InvoiceDocument> | import("@powerhousedao/reactor-browser").DriveEditorModule<import("document-drive").DocumentDriveDocument> | import("document-model").EditorModule<import("./document-models/billing-statement/index.js").BillingStatementDocument>)[];
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK1C,eAAO,MAAM,QAAQ,EAAE,QAAuB,CAAC;AAC/C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK1C,eAAO,MAAM,QAAQ,EAAE,QAAuB,CAAC;AAC/C,eAAO,MAAM,cAAc,gPAAuC,CAAC;AACnE,eAAO,MAAM,OAAO,+UAAgC,CAAC"}
|
|
@@ -16,7 +16,16 @@
|
|
|
16
16
|
{
|
|
17
17
|
"id": "powerhouse/invoice-editor",
|
|
18
18
|
"name": "Invoice",
|
|
19
|
-
"documentTypes": [
|
|
19
|
+
"documentTypes": [
|
|
20
|
+
"powerhouse/invoice"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "powerhouse/billing-statement-editor",
|
|
25
|
+
"name": "Billing Statement",
|
|
26
|
+
"documentTypes": [
|
|
27
|
+
"powerhouse/billing-statement"
|
|
28
|
+
]
|
|
20
29
|
}
|
|
21
30
|
],
|
|
22
31
|
"apps": [
|
package/dist/style.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.1.
|
|
1
|
+
/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
--color-orange-700: oklch(55.3% 0.195 38.402);
|
|
19
19
|
--color-orange-800: oklch(47% 0.157 37.304);
|
|
20
20
|
--color-orange-900: oklch(40.8% 0.123 38.172);
|
|
21
|
+
--color-yellow-50: oklch(98.7% 0.026 102.212);
|
|
21
22
|
--color-yellow-100: oklch(97.3% 0.071 103.193);
|
|
22
23
|
--color-yellow-300: oklch(90.5% 0.182 98.111);
|
|
23
24
|
--color-yellow-400: oklch(85.2% 0.199 91.936);
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
--color-green-900: oklch(39.3% 0.095 152.535);
|
|
32
33
|
--color-blue-50: oklch(97% 0.014 254.604);
|
|
33
34
|
--color-blue-100: oklch(93.2% 0.032 255.585);
|
|
35
|
+
--color-blue-200: oklch(88.2% 0.059 254.128);
|
|
34
36
|
--color-blue-400: oklch(70.7% 0.165 254.624);
|
|
35
37
|
--color-blue-500: oklch(62.3% 0.214 259.815);
|
|
36
38
|
--color-blue-600: oklch(54.6% 0.245 262.881);
|
|
@@ -311,12 +313,18 @@
|
|
|
311
313
|
.mt-4 {
|
|
312
314
|
margin-top: calc(var(--spacing) * 4);
|
|
313
315
|
}
|
|
316
|
+
.mt-6 {
|
|
317
|
+
margin-top: calc(var(--spacing) * 6);
|
|
318
|
+
}
|
|
314
319
|
.mt-8 {
|
|
315
320
|
margin-top: calc(var(--spacing) * 8);
|
|
316
321
|
}
|
|
317
322
|
.mr-1 {
|
|
318
323
|
margin-right: calc(var(--spacing) * 1);
|
|
319
324
|
}
|
|
325
|
+
.mr-2 {
|
|
326
|
+
margin-right: calc(var(--spacing) * 2);
|
|
327
|
+
}
|
|
320
328
|
.mb-1 {
|
|
321
329
|
margin-bottom: calc(var(--spacing) * 1);
|
|
322
330
|
}
|
|
@@ -399,6 +407,18 @@
|
|
|
399
407
|
.w-8 {
|
|
400
408
|
width: calc(var(--spacing) * 8);
|
|
401
409
|
}
|
|
410
|
+
.w-10 {
|
|
411
|
+
width: calc(var(--spacing) * 10);
|
|
412
|
+
}
|
|
413
|
+
.w-16 {
|
|
414
|
+
width: calc(var(--spacing) * 16);
|
|
415
|
+
}
|
|
416
|
+
.w-32 {
|
|
417
|
+
width: calc(var(--spacing) * 32);
|
|
418
|
+
}
|
|
419
|
+
.w-40 {
|
|
420
|
+
width: calc(var(--spacing) * 40);
|
|
421
|
+
}
|
|
402
422
|
.w-48 {
|
|
403
423
|
width: calc(var(--spacing) * 48);
|
|
404
424
|
}
|
|
@@ -411,6 +431,9 @@
|
|
|
411
431
|
.w-full {
|
|
412
432
|
width: 100%;
|
|
413
433
|
}
|
|
434
|
+
.min-w-\[900px\] {
|
|
435
|
+
min-width: 900px;
|
|
436
|
+
}
|
|
414
437
|
.flex-1 {
|
|
415
438
|
flex: 1;
|
|
416
439
|
}
|
|
@@ -444,6 +467,9 @@
|
|
|
444
467
|
.grid-cols-2 {
|
|
445
468
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
446
469
|
}
|
|
470
|
+
.grid-rows-2 {
|
|
471
|
+
grid-template-rows: repeat(2, minmax(0, 1fr));
|
|
472
|
+
}
|
|
447
473
|
.flex-col {
|
|
448
474
|
flex-direction: column;
|
|
449
475
|
}
|
|
@@ -534,6 +560,9 @@
|
|
|
534
560
|
.rounded-md {
|
|
535
561
|
border-radius: var(--radius-md);
|
|
536
562
|
}
|
|
563
|
+
.rounded-sm {
|
|
564
|
+
border-radius: var(--radius-sm);
|
|
565
|
+
}
|
|
537
566
|
.border {
|
|
538
567
|
border-style: var(--tw-border-style);
|
|
539
568
|
border-width: 1px;
|
|
@@ -570,6 +599,9 @@
|
|
|
570
599
|
.border-gray-400 {
|
|
571
600
|
border-color: var(--color-gray-400);
|
|
572
601
|
}
|
|
602
|
+
.border-gray-500 {
|
|
603
|
+
border-color: var(--color-gray-500);
|
|
604
|
+
}
|
|
573
605
|
.border-transparent {
|
|
574
606
|
border-color: transparent;
|
|
575
607
|
}
|
|
@@ -615,9 +647,15 @@
|
|
|
615
647
|
.bg-white {
|
|
616
648
|
background-color: var(--color-white);
|
|
617
649
|
}
|
|
650
|
+
.bg-yellow-50 {
|
|
651
|
+
background-color: var(--color-yellow-50);
|
|
652
|
+
}
|
|
618
653
|
.bg-yellow-100 {
|
|
619
654
|
background-color: var(--color-yellow-100);
|
|
620
655
|
}
|
|
656
|
+
.p-0 {
|
|
657
|
+
padding: calc(var(--spacing) * 0);
|
|
658
|
+
}
|
|
621
659
|
.p-2 {
|
|
622
660
|
padding: calc(var(--spacing) * 2);
|
|
623
661
|
}
|
|
@@ -630,6 +668,9 @@
|
|
|
630
668
|
.p-6 {
|
|
631
669
|
padding: calc(var(--spacing) * 6);
|
|
632
670
|
}
|
|
671
|
+
.px-1 {
|
|
672
|
+
padding-inline: calc(var(--spacing) * 1);
|
|
673
|
+
}
|
|
633
674
|
.px-2 {
|
|
634
675
|
padding-inline: calc(var(--spacing) * 2);
|
|
635
676
|
}
|
|
@@ -651,6 +692,9 @@
|
|
|
651
692
|
.py-2 {
|
|
652
693
|
padding-block: calc(var(--spacing) * 2);
|
|
653
694
|
}
|
|
695
|
+
.pt-2 {
|
|
696
|
+
padding-top: calc(var(--spacing) * 2);
|
|
697
|
+
}
|
|
654
698
|
.pt-4 {
|
|
655
699
|
padding-top: calc(var(--spacing) * 4);
|
|
656
700
|
}
|
|
@@ -783,7 +827,7 @@
|
|
|
783
827
|
--tw-ring-color: var(--color-black);
|
|
784
828
|
}
|
|
785
829
|
.transition {
|
|
786
|
-
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter;
|
|
830
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events;
|
|
787
831
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
788
832
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
789
833
|
}
|
|
@@ -797,6 +841,13 @@
|
|
|
797
841
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
798
842
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
799
843
|
}
|
|
844
|
+
.hover\:bg-blue-200 {
|
|
845
|
+
&:hover {
|
|
846
|
+
@media (hover: hover) {
|
|
847
|
+
background-color: var(--color-blue-200);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
800
851
|
.hover\:bg-blue-600 {
|
|
801
852
|
&:hover {
|
|
802
853
|
@media (hover: hover) {
|
|
@@ -922,6 +973,12 @@
|
|
|
922
973
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
923
974
|
}
|
|
924
975
|
}
|
|
976
|
+
.md\:text-2xl {
|
|
977
|
+
@media (width >= 48rem) {
|
|
978
|
+
font-size: var(--text-2xl);
|
|
979
|
+
line-height: var(--tw-leading, var(--text-2xl--line-height));
|
|
980
|
+
}
|
|
981
|
+
}
|
|
925
982
|
}
|
|
926
983
|
/*! tailwindcss v4.1.5 | MIT License | https://tailwindcss.com */
|
|
927
984
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
|
@@ -6256,6 +6313,49 @@ input[type="number"] {
|
|
|
6256
6313
|
}
|
|
6257
6314
|
}
|
|
6258
6315
|
}
|
|
6316
|
+
.editor-container {
|
|
6317
|
+
width: 100%;
|
|
6318
|
+
min-height: 100vh;
|
|
6319
|
+
margin: 0;
|
|
6320
|
+
padding: 0.5rem;
|
|
6321
|
+
box-sizing: border-box;
|
|
6322
|
+
overflow-x: hidden;
|
|
6323
|
+
}
|
|
6324
|
+
.editor-container > * {
|
|
6325
|
+
width: 100%;
|
|
6326
|
+
max-width: 100%;
|
|
6327
|
+
}
|
|
6328
|
+
@media (max-width: 640px) {
|
|
6329
|
+
.editor-container {
|
|
6330
|
+
padding: 0.25rem;
|
|
6331
|
+
transform: scale(0.95);
|
|
6332
|
+
transform-origin: top left;
|
|
6333
|
+
}
|
|
6334
|
+
}
|
|
6335
|
+
@media (min-width: 641px) and (max-width: 1023px) {
|
|
6336
|
+
.editor-container {
|
|
6337
|
+
padding: 0.5rem;
|
|
6338
|
+
transform: scale(0.9);
|
|
6339
|
+
transform-origin: top left;
|
|
6340
|
+
}
|
|
6341
|
+
}
|
|
6342
|
+
@media (min-width: 1024px) {
|
|
6343
|
+
.editor-container {
|
|
6344
|
+
max-width: 1280px;
|
|
6345
|
+
margin-left: auto;
|
|
6346
|
+
margin-right: auto;
|
|
6347
|
+
padding: 1rem;
|
|
6348
|
+
transform: none;
|
|
6349
|
+
}
|
|
6350
|
+
}
|
|
6351
|
+
@media (max-width: 768px) {
|
|
6352
|
+
.editor-grid {
|
|
6353
|
+
grid-template-columns: 1fr !important;
|
|
6354
|
+
}
|
|
6355
|
+
.editor-grid-item {
|
|
6356
|
+
width: 100% !important;
|
|
6357
|
+
}
|
|
6358
|
+
}
|
|
6259
6359
|
@property --tw-border-spacing-x {
|
|
6260
6360
|
syntax: "<length>";
|
|
6261
6361
|
inherits: false;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
export declare class BillingStatementSubgraph extends Subgraph {
|
|
3
|
+
name: string;
|
|
4
|
+
typeDefs: import("graphql").DocumentNode;
|
|
5
|
+
resolvers: Record<string, any>;
|
|
6
|
+
additionalContextFields: {};
|
|
7
|
+
onSetup(): Promise<void>;
|
|
8
|
+
onDisconnect(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/billing-statement/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAKtD,qBAAa,wBAAyB,SAAQ,QAAQ;IACpD,IAAI,SAAuB;IAE3B,QAAQ,iCAAU;IAClB,SAAS,sBAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import { schema } from "./schema.js";
|
|
3
|
+
import { getResolvers } from "./resolvers.js";
|
|
4
|
+
export class BillingStatementSubgraph extends Subgraph {
|
|
5
|
+
name = "billing-statement";
|
|
6
|
+
typeDefs = schema;
|
|
7
|
+
resolvers = getResolvers(this);
|
|
8
|
+
additionalContextFields = {};
|
|
9
|
+
async onSetup() { }
|
|
10
|
+
async onDisconnect() { }
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/billing-statement/resolvers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAO3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CA8JnE,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { addFile } from "document-drive";
|
|
2
|
+
import { actions } from "../../document-models/billing-statement/index.js";
|
|
3
|
+
import { generateId, hashKey } from "document-model";
|
|
4
|
+
const DEFAULT_DRIVE_ID = "powerhouse";
|
|
5
|
+
export const getResolvers = (subgraph) => {
|
|
6
|
+
const reactor = subgraph.reactor;
|
|
7
|
+
return {
|
|
8
|
+
Query: {
|
|
9
|
+
BillingStatement: async (_, args, ctx) => {
|
|
10
|
+
return {
|
|
11
|
+
getDocument: async (args) => {
|
|
12
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
13
|
+
const docId = args.docId || "";
|
|
14
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
15
|
+
return {
|
|
16
|
+
id: docId,
|
|
17
|
+
driveId: driveId,
|
|
18
|
+
...doc,
|
|
19
|
+
state: doc.state.global,
|
|
20
|
+
stateJSON: doc.state.global,
|
|
21
|
+
revision: doc.revision.global,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
getDocuments: async (args) => {
|
|
25
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
26
|
+
const docsIds = await reactor.getDocuments(driveId);
|
|
27
|
+
const docs = await Promise.all(docsIds.map(async (docId) => {
|
|
28
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
29
|
+
return {
|
|
30
|
+
id: docId,
|
|
31
|
+
driveId: driveId,
|
|
32
|
+
...doc,
|
|
33
|
+
state: doc.state.global,
|
|
34
|
+
stateJSON: doc.state.global,
|
|
35
|
+
revision: doc.revision.global,
|
|
36
|
+
};
|
|
37
|
+
}));
|
|
38
|
+
return docs.filter((doc) => doc.documentType === "powerhouse/billing-statement");
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
Mutation: {
|
|
44
|
+
BillingStatement_createDocument: async (_, args) => {
|
|
45
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
46
|
+
const docId = generateId();
|
|
47
|
+
await reactor.addDriveAction(driveId, addFile({
|
|
48
|
+
id: docId,
|
|
49
|
+
name: args.name,
|
|
50
|
+
documentType: "powerhouse/billing-statement",
|
|
51
|
+
synchronizationUnits: [
|
|
52
|
+
{
|
|
53
|
+
branch: "main",
|
|
54
|
+
scope: "global",
|
|
55
|
+
syncId: hashKey(),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
branch: "main",
|
|
59
|
+
scope: "local",
|
|
60
|
+
syncId: hashKey(),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}));
|
|
64
|
+
return docId;
|
|
65
|
+
},
|
|
66
|
+
BillingStatement_editBillingStatement: async (_, args) => {
|
|
67
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
68
|
+
const docId = args.docId || "";
|
|
69
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
70
|
+
await reactor.addAction(driveId, docId, actions.editBillingStatement({ ...args.input }));
|
|
71
|
+
return doc.revision.global + 1;
|
|
72
|
+
},
|
|
73
|
+
BillingStatement_editContributor: async (_, args) => {
|
|
74
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
75
|
+
const docId = args.docId || "";
|
|
76
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
77
|
+
await reactor.addAction(driveId, docId, actions.editContributor({ ...args.input }));
|
|
78
|
+
return doc.revision.global + 1;
|
|
79
|
+
},
|
|
80
|
+
BillingStatement_editStatus: async (_, args) => {
|
|
81
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
82
|
+
const docId = args.docId || "";
|
|
83
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
84
|
+
await reactor.addAction(driveId, docId, actions.editStatus({ ...args.input }));
|
|
85
|
+
return doc.revision.global + 1;
|
|
86
|
+
},
|
|
87
|
+
BillingStatement_addLineItem: async (_, args) => {
|
|
88
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
89
|
+
const docId = args.docId || "";
|
|
90
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
91
|
+
await reactor.addAction(driveId, docId, actions.addLineItem({ ...args.input }));
|
|
92
|
+
return doc.revision.global + 1;
|
|
93
|
+
},
|
|
94
|
+
BillingStatement_editLineItem: async (_, args) => {
|
|
95
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
96
|
+
const docId = args.docId || "";
|
|
97
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
98
|
+
await reactor.addAction(driveId, docId, actions.editLineItem({ ...args.input }));
|
|
99
|
+
return doc.revision.global + 1;
|
|
100
|
+
},
|
|
101
|
+
BillingStatement_editLineItemTag: async (_, args) => {
|
|
102
|
+
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
103
|
+
const docId = args.docId || "";
|
|
104
|
+
const doc = await reactor.getDocument(driveId, docId);
|
|
105
|
+
await reactor.addAction(driveId, docId, actions.editLineItemTag({ ...args.input }));
|
|
106
|
+
return doc.revision.global + 1;
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/billing-statement/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAmKpB,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { gql } from "graphql-tag";
|
|
2
|
+
export const schema = gql `
|
|
3
|
+
"""
|
|
4
|
+
Subgraph definition for BillingStatement (powerhouse/billing-statement)
|
|
5
|
+
"""
|
|
6
|
+
type BillingStatementState {
|
|
7
|
+
contributor: PHID # Change to AID when available
|
|
8
|
+
dateIssued: DateTime!
|
|
9
|
+
dateDue: DateTime
|
|
10
|
+
lineItems: [BillingStatementLineItem!]!
|
|
11
|
+
status: BillingStatementStatus!
|
|
12
|
+
currency: String!
|
|
13
|
+
totalCash: Float!
|
|
14
|
+
totalPowt: Float!
|
|
15
|
+
notes: String
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type BillingStatementLineItem {
|
|
19
|
+
id: OID!
|
|
20
|
+
description: String!
|
|
21
|
+
quantity: Float!
|
|
22
|
+
unit: BillingStatementUnit!
|
|
23
|
+
unitPricePwt: Float!
|
|
24
|
+
unitPriceCash: Float!
|
|
25
|
+
totalPricePwt: Float!
|
|
26
|
+
totalPriceCash: Float!
|
|
27
|
+
lineItemTag: [BillingStatementTag!]!
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type BillingStatementTag {
|
|
31
|
+
dimension: String!
|
|
32
|
+
value: String!
|
|
33
|
+
label: String
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
enum BillingStatementStatus {
|
|
37
|
+
DRAFT
|
|
38
|
+
ISSUED
|
|
39
|
+
ACCEPTED
|
|
40
|
+
REJECTED
|
|
41
|
+
PAID
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
enum BillingStatementStatusInput {
|
|
45
|
+
DRAFT
|
|
46
|
+
ISSUED
|
|
47
|
+
ACCEPTED
|
|
48
|
+
REJECTED
|
|
49
|
+
PAID
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
enum BillingStatementUnit {
|
|
53
|
+
MINUTE
|
|
54
|
+
HOUR
|
|
55
|
+
DAY
|
|
56
|
+
UNIT
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
enum BillingStatementUnitInput {
|
|
60
|
+
MINUTE
|
|
61
|
+
HOUR
|
|
62
|
+
DAY
|
|
63
|
+
UNIT
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
Queries: BillingStatement
|
|
68
|
+
"""
|
|
69
|
+
type BillingStatementQueries {
|
|
70
|
+
getDocument(driveId: String, docId: PHID): BillingStatement
|
|
71
|
+
getDocuments: [BillingStatement!]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type Query {
|
|
75
|
+
BillingStatement: BillingStatementQueries
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
Mutations: BillingStatement
|
|
80
|
+
"""
|
|
81
|
+
type Mutation {
|
|
82
|
+
BillingStatement_createDocument(driveId: String, name: String): String
|
|
83
|
+
|
|
84
|
+
BillingStatement_editBillingStatement(
|
|
85
|
+
driveId: String
|
|
86
|
+
docId: PHID
|
|
87
|
+
input: BillingStatement_EditBillingStatementInput
|
|
88
|
+
): Int
|
|
89
|
+
BillingStatement_editContributor(
|
|
90
|
+
driveId: String
|
|
91
|
+
docId: PHID
|
|
92
|
+
input: BillingStatement_EditContributorInput
|
|
93
|
+
): Int
|
|
94
|
+
BillingStatement_editStatus(
|
|
95
|
+
driveId: String
|
|
96
|
+
docId: PHID
|
|
97
|
+
input: BillingStatement_EditStatusInput
|
|
98
|
+
): Int
|
|
99
|
+
BillingStatement_addLineItem(
|
|
100
|
+
driveId: String
|
|
101
|
+
docId: PHID
|
|
102
|
+
input: BillingStatement_AddLineItemInput
|
|
103
|
+
): Int
|
|
104
|
+
BillingStatement_editLineItem(
|
|
105
|
+
driveId: String
|
|
106
|
+
docId: PHID
|
|
107
|
+
input: BillingStatement_EditLineItemInput
|
|
108
|
+
): Int
|
|
109
|
+
BillingStatement_editLineItemTag(
|
|
110
|
+
driveId: String
|
|
111
|
+
docId: PHID
|
|
112
|
+
input: BillingStatement_EditLineItemTagInput
|
|
113
|
+
): Int
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
"""
|
|
117
|
+
Module: General
|
|
118
|
+
"""
|
|
119
|
+
input BillingStatement_EditBillingStatementInput {
|
|
120
|
+
dateIssued: DateTime
|
|
121
|
+
dateDue: DateTime
|
|
122
|
+
currency: String
|
|
123
|
+
notes: String
|
|
124
|
+
}
|
|
125
|
+
input BillingStatement_EditContributorInput {
|
|
126
|
+
contributor: PHID!
|
|
127
|
+
}
|
|
128
|
+
input BillingStatement_EditStatusInput {
|
|
129
|
+
status: BillingStatementStatusInput!
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
"""
|
|
133
|
+
Module: LineItems
|
|
134
|
+
"""
|
|
135
|
+
input BillingStatement_AddLineItemInput {
|
|
136
|
+
id: OID!
|
|
137
|
+
description: String!
|
|
138
|
+
quantity: Float!
|
|
139
|
+
unit: BillingStatementUnitInput!
|
|
140
|
+
unitPricePwt: Float!
|
|
141
|
+
unitPriceCash: Float!
|
|
142
|
+
totalPricePwt: Float!
|
|
143
|
+
totalPriceCash: Float!
|
|
144
|
+
}
|
|
145
|
+
input BillingStatement_EditLineItemInput {
|
|
146
|
+
id: OID!
|
|
147
|
+
description: String
|
|
148
|
+
quantity: Float
|
|
149
|
+
unit: BillingStatementUnitInput
|
|
150
|
+
unitPricePwt: Float
|
|
151
|
+
unitPriceCash: Float
|
|
152
|
+
totalPricePwt: Float
|
|
153
|
+
totalPriceCash: Float
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
"""
|
|
157
|
+
Module: Tags
|
|
158
|
+
"""
|
|
159
|
+
input BillingStatement_EditLineItemTagInput {
|
|
160
|
+
lineItemId: OID!
|
|
161
|
+
dimension: String!
|
|
162
|
+
value: String!
|
|
163
|
+
label: String
|
|
164
|
+
}
|
|
165
|
+
`;
|