@powerhousedao/contributor-billing 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/document-model.js +14 -36
- package/dist/document-models/invoice/gen/general/actions.d.ts +2 -5
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.d.ts +2 -5
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.js +0 -3
- package/dist/document-models/invoice/gen/general/object.d.ts +1 -4
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.js +1 -10
- package/dist/document-models/invoice/gen/general/operations.d.ts +1 -4
- package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/actions.d.ts +3 -2
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/creators.d.ts +3 -2
- package/dist/document-models/invoice/gen/items/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/creators.js +1 -0
- package/dist/document-models/invoice/gen/items/object.d.ts +2 -1
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/object.js +4 -1
- package/dist/document-models/invoice/gen/items/operations.d.ts +2 -1
- package/dist/document-models/invoice/gen/items/operations.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +4 -12
- package/dist/document-models/invoice/gen/schema/types.d.ts +14 -17
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +3 -5
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +19 -26
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +2 -1
- package/dist/document-models/invoice/index.d.ts +1 -3
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +1 -38
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +29 -0
- package/dist/document-models/invoice/src/tests/general.test.js +0 -10
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +24 -6
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/countryForm.js +1 -1
- 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 +3 -2
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +44 -5
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts +4 -5
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +59 -35
- package/dist/editors/invoice/lineItemTags/tagMapping.d.ts +1 -0
- package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMapping.js +15 -0
- package/dist/editors/invoice/lineItems.d.ts +3 -3
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/lineItems.js +6 -12
- package/dist/style.css +51 -45
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +9 -23
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +18 -31
- package/dist/tailwind.config.js +0 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { AddLineItemInput,
|
|
2
|
+
import type { AddLineItemInput, AddRefInput, Address, Bank, ContactInfo, DeleteLineItemInput, DeleteRefInput, EditInvoiceInput, EditIssuerBankInput, EditIssuerInput, EditIssuerWalletInput, EditLineItemInput, EditPayerBankInput, EditPayerInput, EditPayerWalletInput, EditRefInput, EditStatusInput, IntermediaryBank, InvoiceLineItem, InvoiceState, InvoiceTag, InvoiceWallet, LegalEntity, LegalEntityCorporateRegistrationId, LegalEntityTaxId, PaymentRouting, Ref, SetInvoiceTagInput, SetLineItemTagInput, Token } from "./types.js";
|
|
3
3
|
type Properties<T> = Required<{
|
|
4
4
|
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
|
|
5
5
|
}>;
|
|
@@ -10,13 +10,11 @@ export declare const InvoiceAccountTypeSchema: z.ZodEnum<["CHECKING", "SAVINGS",
|
|
|
10
10
|
export declare const InvoiceAccountTypeInputSchema: z.ZodEnum<["CHECKING", "SAVINGS", "TRUST", "WALLET"]>;
|
|
11
11
|
export declare const StatusSchema: z.ZodEnum<["ACCEPTED", "AWAITINGPAYMENT", "CANCELLED", "DRAFT", "ISSUED", "PAYMENTISSUE", "PAYMENTRECEIVED", "PAYMENTSCHEDULED", "PAYMENTSENT", "REJECTED"]>;
|
|
12
12
|
export declare function AddLineItemInputSchema(): z.ZodObject<Properties<AddLineItemInput>>;
|
|
13
|
-
export declare function AddPaymentAccountInputSchema(): z.ZodObject<Properties<AddPaymentAccountInput>>;
|
|
14
13
|
export declare function AddRefInputSchema(): z.ZodObject<Properties<AddRefInput>>;
|
|
15
14
|
export declare function AddressSchema(): z.ZodObject<Properties<Address>>;
|
|
16
15
|
export declare function BankSchema(): z.ZodObject<Properties<Bank>>;
|
|
17
16
|
export declare function ContactInfoSchema(): z.ZodObject<Properties<ContactInfo>>;
|
|
18
17
|
export declare function DeleteLineItemInputSchema(): z.ZodObject<Properties<DeleteLineItemInput>>;
|
|
19
|
-
export declare function DeletePaymentAccountInputSchema(): z.ZodObject<Properties<DeletePaymentAccountInput>>;
|
|
20
18
|
export declare function DeleteRefInputSchema(): z.ZodObject<Properties<DeleteRefInput>>;
|
|
21
19
|
export declare function EditInvoiceInputSchema(): z.ZodObject<Properties<EditInvoiceInput>>;
|
|
22
20
|
export declare function EditIssuerBankInputSchema(): z.ZodObject<Properties<EditIssuerBankInput>>;
|
|
@@ -26,13 +24,12 @@ export declare function EditLineItemInputSchema(): z.ZodObject<Properties<EditLi
|
|
|
26
24
|
export declare function EditPayerBankInputSchema(): z.ZodObject<Properties<EditPayerBankInput>>;
|
|
27
25
|
export declare function EditPayerInputSchema(): z.ZodObject<Properties<EditPayerInput>>;
|
|
28
26
|
export declare function EditPayerWalletInputSchema(): z.ZodObject<Properties<EditPayerWalletInput>>;
|
|
29
|
-
export declare function EditPaymentAccountInputSchema(): z.ZodObject<Properties<EditPaymentAccountInput>>;
|
|
30
27
|
export declare function EditRefInputSchema(): z.ZodObject<Properties<EditRefInput>>;
|
|
31
28
|
export declare function EditStatusInputSchema(): z.ZodObject<Properties<EditStatusInput>>;
|
|
32
29
|
export declare function IntermediaryBankSchema(): z.ZodObject<Properties<IntermediaryBank>>;
|
|
33
30
|
export declare function InvoiceLineItemSchema(): z.ZodObject<Properties<InvoiceLineItem>>;
|
|
34
|
-
export declare function InvoiceLineItemTagSchema(): z.ZodObject<Properties<InvoiceLineItemTag>>;
|
|
35
31
|
export declare function InvoiceStateSchema(): z.ZodObject<Properties<InvoiceState>>;
|
|
32
|
+
export declare function InvoiceTagSchema(): z.ZodObject<Properties<InvoiceTag>>;
|
|
36
33
|
export declare function InvoiceWalletSchema(): z.ZodObject<Properties<InvoiceWallet>>;
|
|
37
34
|
export declare function LegalEntitySchema(): z.ZodObject<Properties<LegalEntity>>;
|
|
38
35
|
export declare function LegalEntityCorporateRegistrationIdSchema(): z.ZodObject<Properties<LegalEntityCorporateRegistrationId>>;
|
|
@@ -52,6 +49,7 @@ export declare function LegalEntityIdSchema(): z.ZodUnion<[z.ZodObject<Required<
|
|
|
52
49
|
export declare function LegalEntityTaxIdSchema(): z.ZodObject<Properties<LegalEntityTaxId>>;
|
|
53
50
|
export declare function PaymentRoutingSchema(): z.ZodObject<Properties<PaymentRouting>>;
|
|
54
51
|
export declare function RefSchema(): z.ZodObject<Properties<Ref>>;
|
|
52
|
+
export declare function SetInvoiceTagInputSchema(): z.ZodObject<Properties<SetInvoiceTagInput>>;
|
|
55
53
|
export declare function SetLineItemTagInputSchema(): z.ZodObject<Properties<SetLineItemTagInput>>;
|
|
56
54
|
export declare function TokenSchema(): z.ZodObject<Properties<Token>>;
|
|
57
55
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/gen/schema/zod.ts"],"names":[],"mappings":"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"}
|
|
@@ -40,11 +40,6 @@ export function AddLineItemInputSchema() {
|
|
|
40
40
|
unitPriceTaxIncl: z.number(),
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
export function AddPaymentAccountInputSchema() {
|
|
44
|
-
return z.object({
|
|
45
|
-
paymentAccount: z.string(),
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
43
|
export function AddRefInputSchema() {
|
|
49
44
|
return z.object({
|
|
50
45
|
id: z.string(),
|
|
@@ -89,11 +84,6 @@ export function DeleteLineItemInputSchema() {
|
|
|
89
84
|
id: z.string(),
|
|
90
85
|
});
|
|
91
86
|
}
|
|
92
|
-
export function DeletePaymentAccountInputSchema() {
|
|
93
|
-
return z.object({
|
|
94
|
-
paymentAccount: z.string(),
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
87
|
export function DeleteRefInputSchema() {
|
|
98
88
|
return z.object({
|
|
99
89
|
id: z.string(),
|
|
@@ -106,6 +96,7 @@ export function EditInvoiceInputSchema() {
|
|
|
106
96
|
dateDue: z.string().nullish(),
|
|
107
97
|
dateIssued: z.string().nullish(),
|
|
108
98
|
invoiceNo: z.string().nullish(),
|
|
99
|
+
notes: z.string().nullish(),
|
|
109
100
|
});
|
|
110
101
|
}
|
|
111
102
|
export function EditIssuerBankInputSchema() {
|
|
@@ -229,12 +220,6 @@ export function EditPayerWalletInputSchema() {
|
|
|
229
220
|
rpc: z.string().nullish(),
|
|
230
221
|
});
|
|
231
222
|
}
|
|
232
|
-
export function EditPaymentAccountInputSchema() {
|
|
233
|
-
return z.object({
|
|
234
|
-
existingPaymentAccount: z.string(),
|
|
235
|
-
newPaymentAccount: z.string(),
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
223
|
export function EditRefInputSchema() {
|
|
239
224
|
return z.object({
|
|
240
225
|
id: z.string(),
|
|
@@ -266,7 +251,7 @@ export function InvoiceLineItemSchema() {
|
|
|
266
251
|
currency: z.string(),
|
|
267
252
|
description: z.string(),
|
|
268
253
|
id: z.string(),
|
|
269
|
-
lineItemTag: z.array(
|
|
254
|
+
lineItemTag: z.array(InvoiceTagSchema()).nullable(),
|
|
270
255
|
quantity: z.number(),
|
|
271
256
|
taxPercent: z.number(),
|
|
272
257
|
totalPriceTaxExcl: z.number(),
|
|
@@ -275,14 +260,6 @@ export function InvoiceLineItemSchema() {
|
|
|
275
260
|
unitPriceTaxIncl: z.number(),
|
|
276
261
|
});
|
|
277
262
|
}
|
|
278
|
-
export function InvoiceLineItemTagSchema() {
|
|
279
|
-
return z.object({
|
|
280
|
-
__typename: z.literal("InvoiceLineItemTag").optional(),
|
|
281
|
-
dimension: z.string(),
|
|
282
|
-
label: z.string().nullable(),
|
|
283
|
-
value: z.string(),
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
263
|
export function InvoiceStateSchema() {
|
|
287
264
|
return z.object({
|
|
288
265
|
__typename: z.literal("InvoiceState").optional(),
|
|
@@ -291,16 +268,25 @@ export function InvoiceStateSchema() {
|
|
|
291
268
|
dateDue: z.string(),
|
|
292
269
|
dateIssued: z.string(),
|
|
293
270
|
invoiceNo: z.string(),
|
|
271
|
+
invoiceTags: z.array(InvoiceTagSchema()),
|
|
294
272
|
issuer: LegalEntitySchema(),
|
|
295
273
|
lineItems: z.array(InvoiceLineItemSchema()),
|
|
274
|
+
notes: z.string().nullable(),
|
|
296
275
|
payer: LegalEntitySchema(),
|
|
297
|
-
paymentAccounts: z.array(z.string()),
|
|
298
276
|
refs: z.array(RefSchema()),
|
|
299
277
|
status: StatusSchema,
|
|
300
278
|
totalPriceTaxExcl: z.number(),
|
|
301
279
|
totalPriceTaxIncl: z.number(),
|
|
302
280
|
});
|
|
303
281
|
}
|
|
282
|
+
export function InvoiceTagSchema() {
|
|
283
|
+
return z.object({
|
|
284
|
+
__typename: z.literal("InvoiceTag").optional(),
|
|
285
|
+
dimension: z.string(),
|
|
286
|
+
label: z.string().nullable(),
|
|
287
|
+
value: z.string(),
|
|
288
|
+
});
|
|
289
|
+
}
|
|
304
290
|
export function InvoiceWalletSchema() {
|
|
305
291
|
return z.object({
|
|
306
292
|
__typename: z.literal("InvoiceWallet").optional(),
|
|
@@ -353,6 +339,13 @@ export function RefSchema() {
|
|
|
353
339
|
value: z.string(),
|
|
354
340
|
});
|
|
355
341
|
}
|
|
342
|
+
export function SetInvoiceTagInputSchema() {
|
|
343
|
+
return z.object({
|
|
344
|
+
dimension: z.string(),
|
|
345
|
+
label: z.string().nullish(),
|
|
346
|
+
value: z.string(),
|
|
347
|
+
});
|
|
348
|
+
}
|
|
356
349
|
export function SetLineItemTagInputSchema() {
|
|
357
350
|
return z.object({
|
|
358
351
|
dimension: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,kBAAkB,EAAE,YAuIhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,iBAAsB,CAAC;AAEvD,QAAA,MAAM,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAgC9C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -22,9 +22,6 @@ declare const actions: {
|
|
|
22
22
|
addRef: (input: import("./gen/index.js").AddRefInput) => import("./gen/index.js").AddRefAction;
|
|
23
23
|
editRef: (input: import("./gen/index.js").EditRefInput) => import("./gen/index.js").EditRefAction;
|
|
24
24
|
deleteRef: (input: import("./gen/index.js").DeleteRefInput) => import("./gen/index.js").DeleteRefAction;
|
|
25
|
-
addPaymentAccount: (input: import("./gen/index.js").AddPaymentAccountInput) => import("./gen/index.js").AddPaymentAccountAction;
|
|
26
|
-
editPaymentAccount: (input: import("./gen/index.js").EditPaymentAccountInput) => import("./gen/index.js").EditPaymentAccountAction;
|
|
27
|
-
deletePaymentAccount: (input: import("./gen/index.js").DeletePaymentAccountInput) => import("./gen/index.js").DeletePaymentAccountAction;
|
|
28
25
|
editIssuer: (input: import("./gen/index.js").EditIssuerInput) => import("./gen/index.js").EditIssuerAction;
|
|
29
26
|
editIssuerBank: (input: import("./gen/index.js").EditIssuerBankInput) => import("./gen/index.js").EditIssuerBankAction;
|
|
30
27
|
editIssuerWallet: (input: import("./gen/index.js").EditIssuerWalletInput) => import("./gen/index.js").EditIssuerWalletAction;
|
|
@@ -35,6 +32,7 @@ declare const actions: {
|
|
|
35
32
|
editLineItem: (input: import("./gen/index.js").EditLineItemInput) => import("./gen/index.js").EditLineItemAction;
|
|
36
33
|
deleteLineItem: (input: import("./gen/index.js").DeleteLineItemInput) => import("./gen/index.js").DeleteLineItemAction;
|
|
37
34
|
setLineItemTag: (input: import("./gen/index.js").SetLineItemTagInput) => import("./gen/index.js").SetLineItemTagAction;
|
|
35
|
+
setInvoiceTag: (input: import("./gen/index.js").SetInvoiceTagInput) => import("./gen/index.js").SetInvoiceTagAction;
|
|
38
36
|
};
|
|
39
37
|
export declare const module: DocumentModelModule<InvoiceDocument>;
|
|
40
38
|
export { reducer, actions, utils, documentModel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/invoice/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,QAAA,MAAM,KAAK;;;;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/invoice/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,QAAA,MAAM,KAAK;;;;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;kBANwC,gDAClC;iBAKnB,+CAAsB;aASP,2CAAkB;cAIoC,4CAAmB;gBAA6J,8CAAqB;iBAhBnQ,+CAAqB;qBAKY,mDACpC;uBAUkB,qDAA4B;gBAAyL,8CAAqB;oBAAuK,kDAAyB;sBAAsL,oDAA2B;kBAjBjpB,gDAAsB;mBAIuB,iDAEhC;qBASY,mDACN;qBACwJ,mDAA0B;oBAAwL,kDAAyB;CAbjW,CAAC;AAEtD,eAAO,MAAM,MAAM,EAAE,mBAAmB,CAAC,eAAe,CAKvD,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAElD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,wBAwDrB,CAAC"}
|
|
@@ -13,6 +13,7 @@ export const reducer = {
|
|
|
13
13
|
newState.dateDue = action.input.dateDue ?? state.dateDue;
|
|
14
14
|
newState.dateIssued = action.input.dateIssued ?? state.dateIssued;
|
|
15
15
|
newState.invoiceNo = action.input.invoiceNo ?? state.invoiceNo;
|
|
16
|
+
newState.notes = action.input.notes ?? state.notes;
|
|
16
17
|
state = Object.assign(state, newState);
|
|
17
18
|
}
|
|
18
19
|
catch (e) {
|
|
@@ -66,42 +67,4 @@ export const reducer = {
|
|
|
66
67
|
console.error(e);
|
|
67
68
|
}
|
|
68
69
|
},
|
|
69
|
-
addPaymentAccountOperation(state, action, dispatch) {
|
|
70
|
-
try {
|
|
71
|
-
if (!action.input.paymentAccount)
|
|
72
|
-
throw new Error("No input.paymentAccount");
|
|
73
|
-
if (!state.paymentAccounts)
|
|
74
|
-
state.paymentAccounts = [];
|
|
75
|
-
state.paymentAccounts.push(action.input.paymentAccount);
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
console.error(e);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
editPaymentAccountOperation(state, action, dispatch) {
|
|
82
|
-
try {
|
|
83
|
-
if (!action.input.existingPaymentAccount)
|
|
84
|
-
throw new Error("No input.existingPaymentAccount");
|
|
85
|
-
if (!action.input.newPaymentAccount)
|
|
86
|
-
throw new Error("No input.newPaymentAccount");
|
|
87
|
-
if (!state.paymentAccounts)
|
|
88
|
-
state.paymentAccounts = [];
|
|
89
|
-
state.paymentAccounts = state.paymentAccounts.map((paymentAccount) => paymentAccount === action.input.existingPaymentAccount ? action.input.newPaymentAccount : paymentAccount);
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
console.error(e);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
deletePaymentAccountOperation(state, action, dispatch) {
|
|
96
|
-
try {
|
|
97
|
-
if (!action.input.paymentAccount)
|
|
98
|
-
throw new Error("No input.paymentAccount");
|
|
99
|
-
if (!state.paymentAccounts)
|
|
100
|
-
state.paymentAccounts = [];
|
|
101
|
-
state.paymentAccounts = state.paymentAccounts.filter((paymentAccount) => paymentAccount !== action.input.paymentAccount);
|
|
102
|
-
}
|
|
103
|
-
catch (e) {
|
|
104
|
-
console.error(e);
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/items.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/items.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,eAAO,MAAM,OAAO,EAAE,sBA6GrB,CAAC"}
|
|
@@ -69,6 +69,9 @@ export const reducer = {
|
|
|
69
69
|
value: action.input.value,
|
|
70
70
|
label: action.input.label || null,
|
|
71
71
|
};
|
|
72
|
+
if (!stateItem.lineItemTag) {
|
|
73
|
+
stateItem.lineItemTag = [];
|
|
74
|
+
}
|
|
72
75
|
// Add the new tag
|
|
73
76
|
stateItem.lineItemTag?.push(newTag);
|
|
74
77
|
}
|
|
@@ -77,6 +80,32 @@ export const reducer = {
|
|
|
77
80
|
console.error(e);
|
|
78
81
|
}
|
|
79
82
|
},
|
|
83
|
+
setInvoiceTagOperation(state, action, dispatch) {
|
|
84
|
+
try {
|
|
85
|
+
// if tag already exists with the same dimension, update the value and label
|
|
86
|
+
const existingTag = state.invoiceTags?.find((tag) => tag.dimension === action.input.dimension);
|
|
87
|
+
if (existingTag) {
|
|
88
|
+
existingTag.value = action.input.value;
|
|
89
|
+
existingTag.label = action.input.label || null;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// if tag does not exist, add it
|
|
93
|
+
const newTag = {
|
|
94
|
+
dimension: action.input.dimension,
|
|
95
|
+
value: action.input.value,
|
|
96
|
+
label: action.input.label || null,
|
|
97
|
+
};
|
|
98
|
+
if (!state.invoiceTags) {
|
|
99
|
+
state.invoiceTags = [];
|
|
100
|
+
}
|
|
101
|
+
// Add the new tag
|
|
102
|
+
state.invoiceTags.push(newTag);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
console.error(e);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
80
109
|
};
|
|
81
110
|
function updateTotals(state) {
|
|
82
111
|
state.totalPriceTaxExcl = state.lineItems.reduce((total, lineItem) => {
|
|
@@ -62,14 +62,4 @@ describe("General Operations", () => {
|
|
|
62
62
|
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
63
63
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
64
64
|
});
|
|
65
|
-
it("should handle setPaymentAccount operation", () => {
|
|
66
|
-
// generate a random id
|
|
67
|
-
// const id = documentModelUtils.hashKey();
|
|
68
|
-
const input = generateMock(z.AddPaymentAccountInputSchema());
|
|
69
|
-
const updatedDocument = reducer(document, creators.addPaymentAccount(input));
|
|
70
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
71
|
-
expect(updatedDocument.operations.global[0].type).toBe("SET_PAYMENT_ACCOUNT");
|
|
72
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
73
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
74
|
-
});
|
|
75
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAIb,MAAM,wCAAwC,CAAC;AAiThD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAIb,MAAM,wCAAwC,CAAC;AAiThD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2bhD,CAAC"}
|
|
@@ -310,18 +310,33 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
310
310
|
}, children: [_jsxs(View, { style: {
|
|
311
311
|
flexDirection: "column",
|
|
312
312
|
alignItems: "flex-start",
|
|
313
|
-
}, children: [_jsx(Text, { style: {
|
|
313
|
+
}, children: [_jsx(Text, { style: {
|
|
314
|
+
fontSize: 20,
|
|
315
|
+
fontWeight: "bold",
|
|
316
|
+
marginBottom: 10,
|
|
317
|
+
paddingRight: 65,
|
|
318
|
+
marginRight: 20,
|
|
319
|
+
}, children: invoice.issuer.name }), _jsxs(View, { children: [_jsx(Text, { style: styles.invoiceLabel, children: "Invoice number" }), _jsx(Text, { style: styles.invoiceNumber, children: invoice.invoiceNo })] })] }), _jsxs(View, { style: { alignItems: "flex-end" }, children: [_jsxs(Text, { style: styles.invoiceLabel, children: ["Invoice of (", invoice.currency, ")"] }), _jsx(Text, { style: [
|
|
314
320
|
styles.invoiceNumber,
|
|
315
321
|
{ fontSize: 18, fontWeight: "bold" },
|
|
316
322
|
], children: formatNumber(invoice.totalPriceTaxIncl) })] })] }), _jsxs(View, { style: {
|
|
317
323
|
flexDirection: "row",
|
|
318
324
|
justifyContent: "space-between",
|
|
319
325
|
marginTop: 20,
|
|
320
|
-
}, children: [_jsxs(View, { style: {
|
|
326
|
+
}, children: [_jsxs(View, { style: {
|
|
327
|
+
width: "50%",
|
|
328
|
+
minWidth: 0,
|
|
329
|
+
flexDirection: "column",
|
|
330
|
+
paddingRight: 65,
|
|
331
|
+
}, children: [_jsx(Text, { style: styles.sectionTitle, children: "Issuer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.id
|
|
321
332
|
?.taxId ||
|
|
322
333
|
invoice.issuer
|
|
323
334
|
.id?.corpRegId ||
|
|
324
|
-
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.address?.streetAddress || "" })] }), invoice.issuer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, children: [invoice.issuer.address?.city || "", ",", " ", getCountryName(invoice.issuer.address?.country || "") || ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.postalCode || "00000" })] }), invoice.issuer.contactInfo?.email && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Email:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.contactInfo.email })] }))] }), _jsxs(View, { style: {
|
|
335
|
+
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.address?.streetAddress || "" })] }), invoice.issuer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, children: [invoice.issuer.address?.city || "", ",", " ", getCountryName(invoice.issuer.address?.country || "") || ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.postalCode || "00000" })] }), invoice.issuer.contactInfo?.email && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Email:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.issuer.contactInfo.email })] }))] }), _jsxs(View, { style: {
|
|
336
|
+
width: "47%",
|
|
337
|
+
minWidth: 0,
|
|
338
|
+
flexDirection: "column",
|
|
339
|
+
}, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.payer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.id?.taxId ||
|
|
325
340
|
invoice.payer
|
|
326
341
|
.id?.corpRegId ||
|
|
327
342
|
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.payer.address?.streetAddress || "" })] }), invoice.payer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, wrap: true, children: invoice.payer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, children: [invoice.payer.address?.city || "", ",", " ", getCountryName(invoice.payer.address?.country || "") ||
|
|
@@ -365,9 +380,12 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
365
380
|
textAlign: "right",
|
|
366
381
|
color: "#000",
|
|
367
382
|
fontFamily: "Helvetica",
|
|
368
|
-
}, children: formatDate(invoice.dateDue) })] })] })] }), _jsxs(View, { style: [styles.paymentSection, { marginLeft: 0 }], children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (
|
|
369
|
-
|
|
370
|
-
|
|
383
|
+
}, children: formatDate(invoice.dateDue) })] })] })] }), _jsxs(View, { style: [styles.paymentSection, { marginLeft: 0 }], children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (_jsx("div", { children: _jsx(PaymentSectionFiat, { paymentRouting: invoice.issuer.paymentRouting }) })) : (_jsx(PaymentSectionCrypto, { paymentRouting: invoice.issuer.paymentRouting }))] })] })), _jsxs(View, { style: styles.table, children: [_jsxs(View, { style: styles.tableHeader, children: [_jsx(Text, { style: styles.tableCol40, children: "Description" }), _jsx(Text, { style: styles.tableCol15, children: "Quantity" }), _jsx(Text, { style: styles.tableCol15, children: "Unit Price" }), _jsx(Text, { style: styles.tableCol15, children: "Tax" }), _jsx(Text, { style: styles.tableCol15, children: "Total" })] }), items.map((item, index) => (_jsx(InvoiceLineItem, { item: item, currency: invoice.currency }, index + pageIndex * 1000)))] }), pageIndex === totalPages - 1 && (_jsx(_Fragment, { children: _jsxs(View, { style: { flexDirection: "row", gap: 20 }, children: [_jsxs(View, { style: {
|
|
384
|
+
flex: 1,
|
|
385
|
+
marginTop: 20,
|
|
386
|
+
}, children: [_jsx(Text, { style: [styles.sectionTitle, { marginBottom: 10 }], children: invoice.notes ? "Notes" : "" }), _jsx(Text, { style: styles.companyInfo, children: invoice.notes || "" })] }), _jsxs(View, { style: [styles.totals, { flex: 1 }], children: [_jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Subtotal" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxExcl, 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Tax" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum +
|
|
387
|
+
item.quantity *
|
|
388
|
+
(item.unitPriceTaxIncl - item.unitPriceTaxExcl), 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRowBold, children: [_jsx(Text, { style: styles.totalLabelBold, children: "Total" }), _jsx(Text, { style: styles.totalValueBold, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxIncl, 0), invoice.currency) })] })] })] }) }))] }), _jsxs(View, { style: {
|
|
371
389
|
marginLeft: 40,
|
|
372
390
|
flexDirection: "row",
|
|
373
391
|
alignItems: "center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countryForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/countryForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,GAAI,2EAOzB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"countryForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/countryForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,GAAI,2EAOzB,gBAAgB,4CA0ClB,CAAC"}
|
|
@@ -24,5 +24,5 @@ export const CountryForm = ({ country, handleInputChange, handleBlur, className,
|
|
|
24
24
|
},
|
|
25
25
|
// required
|
|
26
26
|
// defaultValue={countryCode}
|
|
27
|
-
value: countryCode, className: twMerge(className), label: label, warnings: warnings }) }));
|
|
27
|
+
value: countryCode, className: twMerge(className), label: label, warnings: warnings, includeDependentAreas: true }) }));
|
|
28
28
|
};
|
|
@@ -5,7 +5,8 @@ interface NumberFormProps {
|
|
|
5
5
|
max?: number;
|
|
6
6
|
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
7
|
placeholder?: string;
|
|
8
|
+
className?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const NumberForm: ({ number, precision, min, max, handleInputChange, placeholder, }: NumberFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const NumberForm: ({ number, precision, min, max, handleInputChange, placeholder, className, }: NumberFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=numberForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/numberForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numberForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/numberForm.tsx"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,GAAI,6EAQxB,eAAe,4CAqBjB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Form, NumberField } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
-
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
export const NumberForm = ({ number, precision, min, max, handleInputChange, placeholder, className, }) => {
|
|
4
5
|
return (_jsx(Form, { defaultValues: { number }, onSubmit: () => { }, resetOnSuccessfulSubmit: true, children: _jsx(NumberField, { name: "number", onChange: (e) => {
|
|
5
6
|
handleInputChange(e);
|
|
6
|
-
}, precision: precision, min: min, max: max, value: Number(number), placeholder: placeholder }) }));
|
|
7
|
+
}, precision: precision, min: min, max: max, value: Number(number), placeholder: placeholder, className: twMerge(className) }) }));
|
|
7
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA4BhD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA4BhD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CA6xB3C"}
|
|
@@ -18,6 +18,7 @@ import { validateField, } from "./validation/validationManager.js";
|
|
|
18
18
|
import { DatePicker } from "./components/datePicker.js";
|
|
19
19
|
import { SelectField } from "./components/selectField.js";
|
|
20
20
|
import { formatNumber } from "./lineItems.js";
|
|
21
|
+
import { Textarea } from "@powerhousedao/document-engineering/ui";
|
|
21
22
|
function isFiatCurrency(currency) {
|
|
22
23
|
return currencyList.find((c) => c.ticker === currency)?.crypto === false;
|
|
23
24
|
}
|
|
@@ -31,6 +32,7 @@ export default function Editor(props) {
|
|
|
31
32
|
const uploadDropdownRef = useRef(null);
|
|
32
33
|
const exportDropdownRef = useRef(null);
|
|
33
34
|
const [isPdfLoading, setIsPdfLoading] = useState(false);
|
|
35
|
+
const [notes, setNotes] = useState(state.notes || "");
|
|
34
36
|
// Validation state
|
|
35
37
|
const [invoiceValidation, setInvoiceValidation] = useState(null);
|
|
36
38
|
const [walletValidation, setWalletValidation] = useState(null);
|
|
@@ -45,6 +47,35 @@ export default function Editor(props) {
|
|
|
45
47
|
const [payerEmailValidation, setPayerEmailValidation] = useState(null);
|
|
46
48
|
const [lineItemValidation, setLineItemValidation] = useState(null);
|
|
47
49
|
const prevStatus = useRef(state.status);
|
|
50
|
+
const invoiceRootStyle = {
|
|
51
|
+
width: "100vw",
|
|
52
|
+
minHeight: "100vh",
|
|
53
|
+
margin: 0,
|
|
54
|
+
padding: 0,
|
|
55
|
+
boxSizing: "border-box",
|
|
56
|
+
transform: "scale(0.9)",
|
|
57
|
+
transformOrigin: "top left",
|
|
58
|
+
};
|
|
59
|
+
const [responsiveStyle, setResponsiveStyle] = useState(invoiceRootStyle);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
function handleResize() {
|
|
62
|
+
if (window.innerWidth >= 1024) {
|
|
63
|
+
setResponsiveStyle({
|
|
64
|
+
...invoiceRootStyle,
|
|
65
|
+
maxWidth: "1280px",
|
|
66
|
+
marginLeft: "auto",
|
|
67
|
+
marginRight: "auto",
|
|
68
|
+
padding: "1rem",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setResponsiveStyle(invoiceRootStyle);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
handleResize();
|
|
76
|
+
window.addEventListener("resize", handleResize);
|
|
77
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
78
|
+
}, []);
|
|
48
79
|
useEffect(() => {
|
|
49
80
|
setFiatMode(isFiatCurrency(state.currency));
|
|
50
81
|
}, [state.currency, state]);
|
|
@@ -316,7 +347,8 @@ export default function Editor(props) {
|
|
|
316
347
|
dispatch(actions.editStatus({ status: newStatus }));
|
|
317
348
|
};
|
|
318
349
|
const handleCurrencyChange = (currency) => {
|
|
319
|
-
if ((prevStatus.current === "PAYMENTSCHEDULED" ||
|
|
350
|
+
if ((prevStatus.current === "PAYMENTSCHEDULED" ||
|
|
351
|
+
prevStatus.current === "DRAFT") &&
|
|
320
352
|
!isFiatCurrency(currency) &&
|
|
321
353
|
state.issuer.paymentRouting?.wallet?.chainName === "") {
|
|
322
354
|
dispatch(actions.editStatus({ status: "DRAFT" }));
|
|
@@ -326,7 +358,7 @@ export default function Editor(props) {
|
|
|
326
358
|
}
|
|
327
359
|
dispatch(actions.editInvoice({ currency }));
|
|
328
360
|
};
|
|
329
|
-
return (_jsxs("div", {
|
|
361
|
+
return (_jsxs("div", { style: responsiveStyle, children: [_jsx(ToastContainer, { position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsxs("div", { className: "flex items-center justify-between gap-4 mb-6", children: [_jsxs("div", { className: "flex items-center gap-4 flex-nowrap", children: [_jsx("h1", { className: "text-3xl font-bold whitespace-nowrap", children: "Invoice" }), _jsx(InputField, { placeholder: "Add invoice number", value: invoiceNoInput, handleInputChange: (e) => setInvoiceNoInput(e.target.value), onBlur: (e) => {
|
|
330
362
|
const newValue = e.target.value;
|
|
331
363
|
if (newValue !== state.invoiceNo) {
|
|
332
364
|
dispatch(actions.editInvoice({ invoiceNo: newValue }));
|
|
@@ -342,7 +374,7 @@ export default function Editor(props) {
|
|
|
342
374
|
setExportDropdownOpen(false);
|
|
343
375
|
}, className: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 cursor-pointer", children: "Export PDF" })] }) }))] })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsx(CurrencyForm, { currency: state.currency, handleInputChange: (e) => {
|
|
344
376
|
handleCurrencyChange(e.target.value);
|
|
345
|
-
}, validation: currencyValidation }) }), _jsx(SelectField, { options: STATUS_OPTIONS, value: state.status, onChange: (value) => handleStatusChange(value) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-
|
|
377
|
+
}, validation: currencyValidation }) }), _jsx(SelectField, { options: STATUS_OPTIONS, value: state.status, onChange: (value) => handleStatusChange(value) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "border border-gray-200 rounded-lg p-6", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Issuer" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Issue Date:" }), _jsx(DatePicker, { name: "issueDate", className: "w-full", onChange: (e) => {
|
|
346
378
|
const newDate = e.target.value.split("T")[0];
|
|
347
379
|
dispatch(actions.editInvoice({
|
|
348
380
|
dateIssued: newDate,
|
|
@@ -356,11 +388,18 @@ export default function Editor(props) {
|
|
|
356
388
|
}
|
|
357
389
|
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, countryvalidation: countryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-6", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: "w-full", onChange: (e) => dispatch(actions.editInvoice({
|
|
358
390
|
dateDue: e.target.value.split("T")[0],
|
|
359
|
-
})), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map(item => ({
|
|
391
|
+
})), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
|
|
360
392
|
...item,
|
|
361
393
|
lineItemTag: item.lineItemTag ?? [],
|
|
362
394
|
})), onAddItem: (item) => dispatch(actions.addLineItem(item)), onDeleteItem: (input) => dispatch(actions.deleteLineItem(input)), onUpdateCurrency: (input) => {
|
|
363
395
|
setFiatMode(input.currency !== "USDS");
|
|
364
396
|
dispatch(actions.editInvoice(input));
|
|
365
|
-
}, onUpdateItem: (item) => dispatch(actions.editLineItem(item)), dispatch: dispatch, paymentAccounts: state.
|
|
397
|
+
}, onUpdateItem: (item) => dispatch(actions.editLineItem(item)), dispatch: dispatch, paymentAccounts: state.invoiceTags || [] }) }), _jsxs("div", { className: "grid grid-cols-2 md:grid-cols-2 gap-4", children: [_jsx("div", { className: "col-span-1", children: _jsx("div", { className: "", children: _jsx(Textarea, { label: "Notes", placeholder: "Add notes", autoExpand: false, rows: 4, multiline: true, value: notes, onBlur: (e) => {
|
|
398
|
+
const newValue = e.target.value;
|
|
399
|
+
if (newValue !== state.notes) {
|
|
400
|
+
dispatch(actions.editInvoice({ notes: newValue }));
|
|
401
|
+
}
|
|
402
|
+
}, onChange: (e) => {
|
|
403
|
+
setNotes(e.target.value);
|
|
404
|
+
}, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 pt-6 pb-5 px-6 shadow-sm h-32", children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), state.status === "PAYMENTSCHEDULED" && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state })) : (_jsx(RequestFinance, { docState: state })) }))] }));
|
|
366
405
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { InvoiceTag } from "../../../document-models/invoice/index.js";
|
|
3
3
|
interface TagAssignmentRow {
|
|
4
4
|
id: string;
|
|
5
5
|
item: string;
|
|
6
6
|
period: string;
|
|
7
7
|
expenseAccount: string;
|
|
8
8
|
total: string;
|
|
9
|
-
lineItemTag:
|
|
9
|
+
lineItemTag: InvoiceTag[];
|
|
10
10
|
}
|
|
11
11
|
interface LineItemTagsTableProps {
|
|
12
12
|
lineItems: TagAssignmentRow[];
|
|
13
|
-
onSave: (updatedLineItems: TagAssignmentRow[], paymentAccount: string) => void;
|
|
14
13
|
onClose: () => void;
|
|
15
14
|
dispatch: Dispatch<any>;
|
|
16
|
-
paymentAccounts:
|
|
15
|
+
paymentAccounts: InvoiceTag[];
|
|
17
16
|
}
|
|
18
|
-
export declare function LineItemTagsTable({ lineItems,
|
|
17
|
+
export declare function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccounts, }: LineItemTagsTableProps): import("react/jsx-runtime").JSX.Element;
|
|
19
18
|
export {};
|
|
20
19
|
//# sourceMappingURL=lineItemTags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CA6LxB"}
|