@spaceinvoices/react-ui 0.4.2 → 0.4.3
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/cli/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/advance-invoices/list/list-table.tsx +60 -0
- package/src/components/advance-invoices/list/locales/de.ts +1 -0
- package/src/components/advance-invoices/list/locales/en.ts +1 -0
- package/src/components/advance-invoices/list/locales/es.ts +1 -0
- package/src/components/advance-invoices/list/locales/fr.ts +1 -0
- package/src/components/advance-invoices/list/locales/hr.ts +1 -0
- package/src/components/advance-invoices/list/locales/it.ts +1 -0
- package/src/components/advance-invoices/list/locales/nl.ts +1 -0
- package/src/components/advance-invoices/list/locales/pl.ts +1 -0
- package/src/components/advance-invoices/list/locales/pt.ts +1 -0
- package/src/components/advance-invoices/list/locales/sl.ts +1 -0
- package/src/components/credit-notes/list/list-table.tsx +34 -6
- package/src/components/credit-notes/list/locales/de.ts +1 -1
- package/src/components/credit-notes/list/locales/en.ts +2 -0
- package/src/components/credit-notes/list/locales/es.ts +1 -1
- package/src/components/credit-notes/list/locales/fr.ts +1 -1
- package/src/components/credit-notes/list/locales/hr.ts +1 -1
- package/src/components/credit-notes/list/locales/it.ts +1 -1
- package/src/components/credit-notes/list/locales/nl.ts +1 -1
- package/src/components/credit-notes/list/locales/pl.ts +1 -1
- package/src/components/credit-notes/list/locales/pt.ts +1 -1
- package/src/components/credit-notes/list/locales/sl.ts +1 -1
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +2 -2
- package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +3 -3
- package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +1 -1
- package/src/components/dashboard/shared/use-revenue-data.ts +4 -4
- package/src/components/dashboard/shared/use-stats-counts.ts +4 -4
- package/src/components/dashboard/shared/use-stats-query.ts +1 -1
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +2 -2
- package/src/components/dashboard/top-customers-chart/use-top-customers.ts +1 -1
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +332 -0
- package/src/components/delivery-notes/create/locales/de.ts +50 -0
- package/src/components/delivery-notes/create/locales/es.ts +49 -0
- package/src/components/delivery-notes/create/locales/fr.ts +50 -0
- package/src/components/delivery-notes/create/locales/hr.ts +49 -0
- package/src/components/delivery-notes/create/locales/it.ts +49 -0
- package/src/components/delivery-notes/create/locales/nl.ts +50 -0
- package/src/components/delivery-notes/create/locales/pl.ts +49 -0
- package/src/components/delivery-notes/create/locales/pt.ts +50 -0
- package/src/components/delivery-notes/create/locales/sl.ts +49 -0
- package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +38 -0
- package/src/components/delivery-notes/create/use-delivery-note-customer-form.ts +1 -0
- package/src/components/delivery-notes/delivery-notes.hooks.ts +15 -0
- package/src/components/delivery-notes/list/index.ts +3 -0
- package/src/components/delivery-notes/list/list-row-actions.tsx +103 -0
- package/src/components/delivery-notes/list/list-table.tsx +214 -0
- package/src/components/delivery-notes/list/locales/de.ts +9 -0
- package/src/components/delivery-notes/list/locales/en.ts +11 -0
- package/src/components/delivery-notes/list/locales/es.ts +9 -0
- package/src/components/delivery-notes/list/locales/fr.ts +9 -0
- package/src/components/delivery-notes/list/locales/hr.ts +9 -0
- package/src/components/delivery-notes/list/locales/it.ts +9 -0
- package/src/components/delivery-notes/list/locales/nl.ts +9 -0
- package/src/components/delivery-notes/list/locales/pl.ts +9 -0
- package/src/components/delivery-notes/list/locales/pt.ts +9 -0
- package/src/components/delivery-notes/list/locales/sl.ts +9 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +63 -0
- package/src/components/documents/create/document-details-section.tsx +36 -32
- package/src/components/documents/create/live-preview.tsx +37 -10
- package/src/components/documents/create/prepare-document-submission.ts +1 -1
- package/src/components/documents/documents.hooks.ts +2 -1
- package/src/components/documents/shared/document-preview-display.tsx +12 -5
- package/src/components/documents/types.ts +10 -1
- package/src/components/documents/view/document-details-card.tsx +3 -3
- package/src/components/documents/view/document-payments-list.tsx +3 -3
- package/src/components/documents/view/document-relations-list.tsx +105 -0
- package/src/components/documents/view/locales/de.ts +21 -0
- package/src/components/documents/view/locales/es.ts +21 -0
- package/src/components/documents/view/locales/fr.ts +21 -0
- package/src/components/documents/view/locales/hr.ts +21 -0
- package/src/components/documents/view/locales/it.ts +21 -0
- package/src/components/documents/view/locales/nl.ts +21 -0
- package/src/components/documents/view/locales/pl.ts +21 -0
- package/src/components/documents/view/locales/pt.ts +21 -0
- package/src/components/documents/view/locales/sl.ts +21 -0
- package/src/components/documents/view/use-document-download.ts +5 -3
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +77 -65
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +7 -2
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +10 -1
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +7 -2
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +12 -4
- package/src/components/invoices/invoices-furs.hooks.ts +24 -9
- package/src/components/invoices/list/list-row-actions.tsx +3 -3
- package/src/components/invoices/list/list-table.tsx +68 -3
- package/src/components/invoices/list/locales/de.ts +1 -0
- package/src/components/invoices/list/locales/en.ts +1 -0
- package/src/components/invoices/list/locales/es.ts +1 -0
- package/src/components/invoices/list/locales/fr.ts +1 -0
- package/src/components/invoices/list/locales/hr.ts +1 -0
- package/src/components/invoices/list/locales/it.ts +1 -0
- package/src/components/invoices/list/locales/nl.ts +1 -0
- package/src/components/invoices/list/locales/pl.ts +1 -0
- package/src/components/invoices/list/locales/pt.ts +1 -0
- package/src/components/invoices/list/locales/sl.ts +1 -0
- package/src/components/items/item-list-table/item-list-row-actions.tsx +3 -2
- package/src/components/items/item-list-table/item-list-row.tsx +3 -2
- package/src/generated/schemas/deliverynote.ts +134 -0
- package/src/generated/schemas/entity.ts +4 -0
- package/src/generated/schemas/index.ts +3 -0
- package/src/generated/schemas/order.ts +5 -3
- package/src/generated/schemas/payment.ts +22 -2
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +1 -0
- package/src/generated/schemas/rendercreditnotepreview_body.ts +1 -0
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +185 -0
- package/src/generated/schemas/renderestimatepreview_body.ts +1 -0
- package/src/generated/schemas/renderinvoicepreview_body.ts +1 -0
- package/src/generated/schemas/startpdfexport_body.ts +18 -2
- package/src/generated/schemas/userfinasettings.ts +19 -0
- package/src/generated/schemas/webhook.ts +12 -0
- package/src/hooks/use-duplicate-document.ts +11 -3
- package/src/hooks/use-next-document-number.ts +2 -2
- package/src/providers/sdk-provider.tsx +5 -7
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delivery note schema for form validation.
|
|
3
|
+
* Based on the estimate schema pattern, adapted for delivery notes.
|
|
4
|
+
* Delivery notes differ from estimates: no date_valid_till, no title_type, has hide_prices.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Dependency schema for delivery note
|
|
10
|
+
const LineDiscount = z.object({
|
|
11
|
+
value: z.number().gte(0),
|
|
12
|
+
type: z.enum(["percent", "amount"]).optional().default("percent"),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Dependency schema for delivery note
|
|
17
|
+
const DocumentItemTax = z
|
|
18
|
+
.object({
|
|
19
|
+
rate: z.number(),
|
|
20
|
+
tax_id: z.string(),
|
|
21
|
+
classification: z.string(),
|
|
22
|
+
reverse_charge: z.boolean(),
|
|
23
|
+
amount: z.number(),
|
|
24
|
+
})
|
|
25
|
+
.partial();
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// Dependency schema for delivery note
|
|
29
|
+
const DocumentEntity = z
|
|
30
|
+
.object({
|
|
31
|
+
name: z.union([z.string(), z.null()]),
|
|
32
|
+
email: z.union([z.string(), z.null()]),
|
|
33
|
+
address: z.union([z.string(), z.null()]),
|
|
34
|
+
address_2: z.union([z.string(), z.null()]),
|
|
35
|
+
post_code: z.union([z.string(), z.null()]),
|
|
36
|
+
city: z.union([z.string(), z.null()]),
|
|
37
|
+
state: z.union([z.string(), z.null()]),
|
|
38
|
+
country: z.union([z.string(), z.null()]),
|
|
39
|
+
country_code: z.union([z.string(), z.null()]),
|
|
40
|
+
tax_number: z.union([z.string(), z.null()]),
|
|
41
|
+
tax_number_2: z.union([z.string(), z.null()]),
|
|
42
|
+
company_number: z.union([z.string(), z.null()]),
|
|
43
|
+
bank_account: z.union([
|
|
44
|
+
z
|
|
45
|
+
.object({
|
|
46
|
+
type: z
|
|
47
|
+
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
48
|
+
.default("iban"),
|
|
49
|
+
name: z.string(),
|
|
50
|
+
bank_name: z.string(),
|
|
51
|
+
iban: z.string(),
|
|
52
|
+
account_number: z.string(),
|
|
53
|
+
bic: z.string(),
|
|
54
|
+
routing_number: z.string(),
|
|
55
|
+
sort_code: z.string(),
|
|
56
|
+
})
|
|
57
|
+
.partial()
|
|
58
|
+
.passthrough(),
|
|
59
|
+
z.null(),
|
|
60
|
+
]),
|
|
61
|
+
})
|
|
62
|
+
.partial()
|
|
63
|
+
.passthrough();
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// Schema for create delivery note operation
|
|
67
|
+
const createDeliveryNoteSchemaDefinition = z.object({
|
|
68
|
+
is_draft: z.boolean().optional(),
|
|
69
|
+
date: z
|
|
70
|
+
.string()
|
|
71
|
+
.regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
|
|
72
|
+
.optional(),
|
|
73
|
+
issuer: DocumentEntity.optional(),
|
|
74
|
+
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
75
|
+
customer: DocumentEntity.and(
|
|
76
|
+
z.union([
|
|
77
|
+
z
|
|
78
|
+
.object({ save_customer: z.boolean().default(true) })
|
|
79
|
+
.partial()
|
|
80
|
+
.passthrough(),
|
|
81
|
+
z.null(),
|
|
82
|
+
])
|
|
83
|
+
).optional(),
|
|
84
|
+
note: z.union([z.string(), z.null()]).optional(),
|
|
85
|
+
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
86
|
+
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
87
|
+
currency_code: z.string().max(3).optional(),
|
|
88
|
+
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
89
|
+
hide_prices: z.boolean().optional(),
|
|
90
|
+
date_due: z.union([z.string(), z.null()]).optional(),
|
|
91
|
+
date_service: z.union([z.string(), z.null()]).optional(),
|
|
92
|
+
date_service_to: z.union([z.string(), z.null()]).optional(),
|
|
93
|
+
items: z
|
|
94
|
+
.array(
|
|
95
|
+
z.object({
|
|
96
|
+
name: z.string().min(1).optional(),
|
|
97
|
+
description: z.union([z.string().max(4000, "Description must not exceed 4000 characters"), z.null()]).optional(),
|
|
98
|
+
price: z.number().optional(),
|
|
99
|
+
gross_price: z.number().optional(),
|
|
100
|
+
quantity: z.number().gte(-140737488355328).lte(140737488355327),
|
|
101
|
+
unit: z.union([z.string(), z.null()]).optional(),
|
|
102
|
+
taxes: z.array(DocumentItemTax).optional(),
|
|
103
|
+
discounts: z.array(LineDiscount).max(5).optional(),
|
|
104
|
+
metadata: z
|
|
105
|
+
.union([
|
|
106
|
+
z.string(),
|
|
107
|
+
z.number(),
|
|
108
|
+
z.boolean(),
|
|
109
|
+
z.null(),
|
|
110
|
+
z.object({}).partial().passthrough(),
|
|
111
|
+
z.array(z.unknown()),
|
|
112
|
+
z.null(),
|
|
113
|
+
])
|
|
114
|
+
.optional(),
|
|
115
|
+
item_id: z.string().optional(),
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
.min(1),
|
|
119
|
+
eslog: z
|
|
120
|
+
.union([
|
|
121
|
+
z
|
|
122
|
+
.object({ validation_enabled: z.union([z.boolean(), z.null()]) })
|
|
123
|
+
.partial()
|
|
124
|
+
.passthrough(),
|
|
125
|
+
z.null(),
|
|
126
|
+
])
|
|
127
|
+
.optional(),
|
|
128
|
+
expected_total_with_tax: z.number().gt(0).optional(),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Type for create delivery note operation
|
|
132
|
+
export type CreateDeliveryNoteSchema = z.infer<typeof createDeliveryNoteSchemaDefinition>;
|
|
133
|
+
|
|
134
|
+
export const createDeliveryNoteSchema = createDeliveryNoteSchemaDefinition;
|
|
@@ -40,6 +40,7 @@ const createEntitySchemaDefinition = z.object({
|
|
|
40
40
|
estimate: z.union([z.string(), z.null()]),
|
|
41
41
|
credit_note: z.union([z.string(), z.null()]),
|
|
42
42
|
advance_invoice: z.union([z.string(), z.null()]),
|
|
43
|
+
delivery_note: z.union([z.string(), z.null()]),
|
|
43
44
|
})
|
|
44
45
|
.partial()
|
|
45
46
|
.passthrough(),
|
|
@@ -136,6 +137,7 @@ const createEntitySchemaDefinition = z.object({
|
|
|
136
137
|
]),
|
|
137
138
|
bank_accounts: z.union([z.array(z.any()), z.null()]),
|
|
138
139
|
eslog_validation_enabled: z.union([z.boolean(), z.null()]),
|
|
140
|
+
delivery_note_hide_prices: z.union([z.boolean(), z.null()]),
|
|
139
141
|
tax_clause_defaults: z.union([
|
|
140
142
|
z
|
|
141
143
|
.object({
|
|
@@ -189,6 +191,7 @@ const patchEntitySchemaDefinition = z
|
|
|
189
191
|
estimate: z.union([z.string(), z.null()]),
|
|
190
192
|
credit_note: z.union([z.string(), z.null()]),
|
|
191
193
|
advance_invoice: z.union([z.string(), z.null()]),
|
|
194
|
+
delivery_note: z.union([z.string(), z.null()]),
|
|
192
195
|
})
|
|
193
196
|
.partial()
|
|
194
197
|
.passthrough(),
|
|
@@ -285,6 +288,7 @@ const patchEntitySchemaDefinition = z
|
|
|
285
288
|
]),
|
|
286
289
|
bank_accounts: z.union([z.array(z.any()), z.null()]),
|
|
287
290
|
eslog_validation_enabled: z.union([z.boolean(), z.null()]),
|
|
291
|
+
delivery_note_hide_prices: z.union([z.boolean(), z.null()]),
|
|
288
292
|
tax_clause_defaults: z.union([
|
|
289
293
|
z
|
|
290
294
|
.object({
|
|
@@ -13,6 +13,7 @@ export * from './customadvanceinvoice';
|
|
|
13
13
|
export * from './customcreditnote';
|
|
14
14
|
export * from './customer';
|
|
15
15
|
export * from './customestimate';
|
|
16
|
+
export * from './deliverynote';
|
|
16
17
|
export * from './custominvoice';
|
|
17
18
|
export * from './entity';
|
|
18
19
|
export * from './entityuserrole';
|
|
@@ -34,6 +35,7 @@ export * from './registerfursmovablepremise_body';
|
|
|
34
35
|
export * from './registerfursrealestatepremise_body';
|
|
35
36
|
export * from './renderadvanceinvoicepreview_body';
|
|
36
37
|
export * from './rendercreditnotepreview_body';
|
|
38
|
+
export * from './renderdeliverynotepreview_body';
|
|
37
39
|
export * from './renderdocument_body';
|
|
38
40
|
export * from './renderestimatepreview_body';
|
|
39
41
|
export * from './renderinvoicepreview_body';
|
|
@@ -46,6 +48,7 @@ export * from './stripeappupdatesettings_body';
|
|
|
46
48
|
export * from './tax';
|
|
47
49
|
export * from './uploadfile_body';
|
|
48
50
|
export * from './uploadfurscertificate_body';
|
|
51
|
+
export * from './userfinasettings';
|
|
49
52
|
export * from './userfurssettings';
|
|
50
53
|
export * from './webhook';
|
|
51
54
|
|
|
@@ -64,7 +64,7 @@ const OrderItem = z
|
|
|
64
64
|
// Schema for create order operation
|
|
65
65
|
const createOrderSchemaDefinition = z.object({
|
|
66
66
|
order_integration_id: z.string().max(36),
|
|
67
|
-
source: z.
|
|
67
|
+
source: z.enum(["shopify", "woocommerce", "manual"]),
|
|
68
68
|
source_id: z.string().max(255),
|
|
69
69
|
source_order_number: z.union([z.string(), z.null()]).optional(),
|
|
70
70
|
customer_name: z.union([z.string(), z.null()]).optional(),
|
|
@@ -86,7 +86,9 @@ const createOrderSchemaDefinition = z.object({
|
|
|
86
86
|
.lte(140737488355327)
|
|
87
87
|
.optional(),
|
|
88
88
|
items: z.array(OrderItem).min(1),
|
|
89
|
-
payment_status: z
|
|
89
|
+
payment_status: z
|
|
90
|
+
.enum(["unpaid", "paid", "partially_paid", "refunded"])
|
|
91
|
+
.optional(),
|
|
90
92
|
payment_method: z.union([z.string(), z.null()]).optional(),
|
|
91
93
|
payment_gateway: z.union([z.string(), z.null()]).optional(),
|
|
92
94
|
ordered_at: z.union([z.string(), z.null()]).optional(),
|
|
@@ -112,7 +114,7 @@ const updateOrderSchemaDefinition = z
|
|
|
112
114
|
total_discount: z.number().gte(-140737488355328).lte(140737488355327),
|
|
113
115
|
total_shipping: z.number().gte(-140737488355328).lte(140737488355327),
|
|
114
116
|
items: z.array(OrderItem).min(1),
|
|
115
|
-
payment_status: z.
|
|
117
|
+
payment_status: z.enum(["unpaid", "paid", "partially_paid", "refunded"]),
|
|
116
118
|
payment_method: z.union([z.string(), z.null()]),
|
|
117
119
|
payment_gateway: z.union([z.string(), z.null()]),
|
|
118
120
|
ordered_at: z.union([z.string(), z.null()]),
|
|
@@ -14,7 +14,17 @@ const createPaymentSchemaDefinition = z.object({
|
|
|
14
14
|
credit_note_id: z.union([z.string(), z.null()]).optional(),
|
|
15
15
|
advance_invoice_id: z.union([z.string(), z.null()]).optional(),
|
|
16
16
|
amount: z.number().gt(0),
|
|
17
|
-
type: z.
|
|
17
|
+
type: z.enum([
|
|
18
|
+
"cash",
|
|
19
|
+
"bank_transfer",
|
|
20
|
+
"card",
|
|
21
|
+
"check",
|
|
22
|
+
"paypal",
|
|
23
|
+
"coupon",
|
|
24
|
+
"other",
|
|
25
|
+
"credit_note",
|
|
26
|
+
"advance",
|
|
27
|
+
]),
|
|
18
28
|
date: z.string().optional(),
|
|
19
29
|
tag: z.union([z.string(), z.null()]).optional(),
|
|
20
30
|
reference: z.union([z.string(), z.null()]).optional(),
|
|
@@ -30,7 +40,17 @@ export type CreatePaymentSchema = z.infer<typeof createPaymentSchemaDefinition>;
|
|
|
30
40
|
const updatePaymentSchemaDefinition = z
|
|
31
41
|
.object({
|
|
32
42
|
amount: z.number().gt(0),
|
|
33
|
-
type: z.
|
|
43
|
+
type: z.enum([
|
|
44
|
+
"cash",
|
|
45
|
+
"bank_transfer",
|
|
46
|
+
"card",
|
|
47
|
+
"check",
|
|
48
|
+
"paypal",
|
|
49
|
+
"coupon",
|
|
50
|
+
"other",
|
|
51
|
+
"credit_note",
|
|
52
|
+
"advance",
|
|
53
|
+
]),
|
|
34
54
|
date: z.string(),
|
|
35
55
|
tag: z.union([z.string(), z.null()]),
|
|
36
56
|
reference: z.union([z.string(), z.null()]),
|
|
@@ -163,6 +163,7 @@ const CreateDocumentItem = z.object({
|
|
|
163
163
|
unit: z.union([z.string(), z.null()]).optional(),
|
|
164
164
|
taxes: z.array(DocumentItemTax).optional(),
|
|
165
165
|
discounts: z.array(LineDiscount).max(5).optional(),
|
|
166
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
166
167
|
metadata: z
|
|
167
168
|
.union([
|
|
168
169
|
z.string(),
|
|
@@ -164,6 +164,7 @@ const CreateDocumentItem = z.object({
|
|
|
164
164
|
unit: z.union([z.string(), z.null()]).optional(),
|
|
165
165
|
taxes: z.array(DocumentItemTax).optional(),
|
|
166
166
|
discounts: z.array(LineDiscount).max(5).optional(),
|
|
167
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
167
168
|
metadata: z
|
|
168
169
|
.union([
|
|
169
170
|
z.string(),
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for renderdeliverynotepreview_body endpoints
|
|
10
|
+
|
|
11
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
12
|
+
const DocumentEntity = z
|
|
13
|
+
.object({
|
|
14
|
+
name: z.union([z.string(), z.null()]),
|
|
15
|
+
email: z.union([z.string(), z.null()]),
|
|
16
|
+
address: z.union([z.string(), z.null()]),
|
|
17
|
+
address_2: z.union([z.string(), z.null()]),
|
|
18
|
+
post_code: z.union([z.string(), z.null()]),
|
|
19
|
+
city: z.union([z.string(), z.null()]),
|
|
20
|
+
state: z.union([z.string(), z.null()]),
|
|
21
|
+
country: z.union([z.string(), z.null()]),
|
|
22
|
+
country_code: z.union([z.string(), z.null()]),
|
|
23
|
+
tax_number: z.union([z.string(), z.null()]),
|
|
24
|
+
tax_number_2: z.union([z.string(), z.null()]),
|
|
25
|
+
company_number: z.union([z.string(), z.null()]),
|
|
26
|
+
bank_account: z.union([
|
|
27
|
+
z
|
|
28
|
+
.object({
|
|
29
|
+
type: z
|
|
30
|
+
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
31
|
+
.default("iban"),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
bank_name: z.string(),
|
|
34
|
+
iban: z.string(),
|
|
35
|
+
account_number: z.string(),
|
|
36
|
+
bic: z.string(),
|
|
37
|
+
routing_number: z.string(),
|
|
38
|
+
sort_code: z.string(),
|
|
39
|
+
})
|
|
40
|
+
.partial()
|
|
41
|
+
.passthrough(),
|
|
42
|
+
z.null(),
|
|
43
|
+
]),
|
|
44
|
+
})
|
|
45
|
+
.partial()
|
|
46
|
+
.passthrough();
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
50
|
+
const CreateDocumentCustomer = DocumentEntity.and(
|
|
51
|
+
z.union([
|
|
52
|
+
z
|
|
53
|
+
.object({ save_customer: z.boolean().default(true) })
|
|
54
|
+
.partial()
|
|
55
|
+
.passthrough(),
|
|
56
|
+
z.null(),
|
|
57
|
+
])
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
62
|
+
const PartialDeliveryNotePreview = z.object({
|
|
63
|
+
is_draft: z.boolean().optional(),
|
|
64
|
+
date: z
|
|
65
|
+
.string()
|
|
66
|
+
.regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
|
|
67
|
+
.optional(),
|
|
68
|
+
issuer: DocumentEntity.optional(),
|
|
69
|
+
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
70
|
+
customer: CreateDocumentCustomer.optional(),
|
|
71
|
+
note: z.union([z.string(), z.null()]).optional(),
|
|
72
|
+
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
73
|
+
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
74
|
+
currency_code: z.string().max(3).optional(),
|
|
75
|
+
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
76
|
+
hide_prices: z.boolean().optional(),
|
|
77
|
+
date_due: z.union([z.string(), z.null()]).optional(),
|
|
78
|
+
date_service: z.union([z.string(), z.null()]).optional(),
|
|
79
|
+
date_service_to: z.union([z.string(), z.null()]).optional(),
|
|
80
|
+
items: z
|
|
81
|
+
.array(
|
|
82
|
+
z
|
|
83
|
+
.object({
|
|
84
|
+
name: z.string(),
|
|
85
|
+
quantity: z.number(),
|
|
86
|
+
price: z.number(),
|
|
87
|
+
gross_price: z.number(),
|
|
88
|
+
description: z.string(),
|
|
89
|
+
taxes: z.array(
|
|
90
|
+
z
|
|
91
|
+
.object({ rate: z.number(), tax_id: z.string() })
|
|
92
|
+
.partial()
|
|
93
|
+
.passthrough()
|
|
94
|
+
),
|
|
95
|
+
metadata: z.record(z.string(), z.any()),
|
|
96
|
+
})
|
|
97
|
+
.partial()
|
|
98
|
+
.passthrough()
|
|
99
|
+
)
|
|
100
|
+
.min(1),
|
|
101
|
+
linked_documents: z.array(z.string().min(1)).optional(),
|
|
102
|
+
expected_total_with_tax: z.number().gt(0).optional(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
107
|
+
const DocumentItemTax = z
|
|
108
|
+
.object({
|
|
109
|
+
rate: z.number(),
|
|
110
|
+
tax_id: z.string(),
|
|
111
|
+
classification: z.string(),
|
|
112
|
+
reverse_charge: z.boolean(),
|
|
113
|
+
amount: z.number(),
|
|
114
|
+
})
|
|
115
|
+
.partial();
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
119
|
+
const LineDiscount = z.object({
|
|
120
|
+
value: z.number().gte(0),
|
|
121
|
+
type: z.enum(["percent", "amount"]).optional().default("percent"),
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
126
|
+
const CreateDocumentItem = z.object({
|
|
127
|
+
name: z.string().min(1).optional(),
|
|
128
|
+
description: z.union([z.string(), z.null()]).optional(),
|
|
129
|
+
price: z.number().optional(),
|
|
130
|
+
gross_price: z.number().optional(),
|
|
131
|
+
quantity: z.number().gte(-140737488355328).lte(140737488355327),
|
|
132
|
+
unit: z.union([z.string(), z.null()]).optional(),
|
|
133
|
+
taxes: z.array(DocumentItemTax).optional(),
|
|
134
|
+
discounts: z.array(LineDiscount).max(5).optional(),
|
|
135
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
136
|
+
metadata: z
|
|
137
|
+
.union([
|
|
138
|
+
z.string(),
|
|
139
|
+
z.number(),
|
|
140
|
+
z.boolean(),
|
|
141
|
+
z.null(),
|
|
142
|
+
z.object({}).partial().passthrough(),
|
|
143
|
+
z.array(z.unknown()),
|
|
144
|
+
z.null(),
|
|
145
|
+
])
|
|
146
|
+
.optional(),
|
|
147
|
+
item_id: z.string().optional(),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
// Dependency schema for renderdeliverynotepreview_body
|
|
152
|
+
const CompleteDeliveryNotePreview = z.object({
|
|
153
|
+
is_draft: z.boolean().optional(),
|
|
154
|
+
date: z
|
|
155
|
+
.string()
|
|
156
|
+
.regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
|
|
157
|
+
.optional(),
|
|
158
|
+
issuer: DocumentEntity.optional(),
|
|
159
|
+
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
160
|
+
customer: CreateDocumentCustomer.optional(),
|
|
161
|
+
note: z.union([z.string(), z.null()]).optional(),
|
|
162
|
+
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
163
|
+
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
164
|
+
currency_code: z.string().max(3).optional(),
|
|
165
|
+
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
166
|
+
hide_prices: z.boolean().optional(),
|
|
167
|
+
date_due: z.union([z.string(), z.null()]).optional(),
|
|
168
|
+
date_service: z.union([z.string(), z.null()]).optional(),
|
|
169
|
+
date_service_to: z.union([z.string(), z.null()]).optional(),
|
|
170
|
+
items: z.array(CreateDocumentItem).min(1),
|
|
171
|
+
linked_documents: z.array(z.string().min(1)).optional(),
|
|
172
|
+
expected_total_with_tax: z.number().gt(0).optional(),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
// Schema for render deliverynotepreview operation
|
|
177
|
+
const renderDeliveryNotePreviewSchemaDefinition = z.union([
|
|
178
|
+
PartialDeliveryNotePreview,
|
|
179
|
+
CompleteDeliveryNotePreview,
|
|
180
|
+
]);
|
|
181
|
+
|
|
182
|
+
// Type for render deliverynotepreview operation
|
|
183
|
+
export type RenderDeliveryNotePreviewSchema = z.infer<typeof renderDeliveryNotePreviewSchemaDefinition>;
|
|
184
|
+
|
|
185
|
+
export const renderDeliveryNotePreviewSchema = renderDeliveryNotePreviewSchemaDefinition;
|
|
@@ -132,6 +132,7 @@ const CreateDocumentItem = z.object({
|
|
|
132
132
|
unit: z.union([z.string(), z.null()]).optional(),
|
|
133
133
|
taxes: z.array(DocumentItemTax).optional(),
|
|
134
134
|
discounts: z.array(LineDiscount).max(5).optional(),
|
|
135
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
135
136
|
metadata: z
|
|
136
137
|
.union([
|
|
137
138
|
z.string(),
|
|
@@ -164,6 +164,7 @@ const CreateDocumentItem = z.object({
|
|
|
164
164
|
unit: z.union([z.string(), z.null()]).optional(),
|
|
165
165
|
taxes: z.array(DocumentItemTax).optional(),
|
|
166
166
|
discounts: z.array(LineDiscount).max(5).optional(),
|
|
167
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
167
168
|
metadata: z
|
|
168
169
|
.union([
|
|
169
170
|
z.string(),
|
|
@@ -9,12 +9,28 @@ import { z } from 'zod';
|
|
|
9
9
|
// Schemas for startpdfexport_body endpoints
|
|
10
10
|
|
|
11
11
|
// Dependency schema for startpdfexport_body
|
|
12
|
-
const
|
|
12
|
+
const PdfExportByDocumentIds = z
|
|
13
13
|
.object({
|
|
14
|
-
type: z.enum(["invoice", "estimate", "credit_note"]),
|
|
14
|
+
type: z.enum(["invoice", "estimate", "credit_note", "advance_invoice"]),
|
|
15
|
+
document_ids: z.array(z.string()).min(1),
|
|
16
|
+
})
|
|
17
|
+
.passthrough();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// Dependency schema for startpdfexport_body
|
|
21
|
+
const PdfExportByDateRange = z
|
|
22
|
+
.object({
|
|
23
|
+
type: z.enum(["invoice", "estimate", "credit_note", "advance_invoice"]),
|
|
15
24
|
date_from: z.string().optional(),
|
|
16
25
|
date_to: z.string().optional(),
|
|
17
26
|
})
|
|
18
27
|
.passthrough();
|
|
19
28
|
|
|
20
29
|
|
|
30
|
+
// Dependency schema for startpdfexport_body
|
|
31
|
+
const startPdfExport_Body = z.union([
|
|
32
|
+
PdfExportByDocumentIds,
|
|
33
|
+
PdfExportByDateRange,
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for userfinasettings endpoints
|
|
10
|
+
|
|
11
|
+
// Schema for update userfinasettings operation
|
|
12
|
+
const updateUserFinaSettingsSchemaDefinition = z
|
|
13
|
+
.object({ operator_oib: z.string(), operator_label: z.string() })
|
|
14
|
+
.partial();
|
|
15
|
+
|
|
16
|
+
// Type for update userfinasettings operation
|
|
17
|
+
export type UpdateUserFinaSettingsSchema = z.infer<typeof updateUserFinaSettingsSchemaDefinition>;
|
|
18
|
+
|
|
19
|
+
export const updateUserFinaSettingsSchema = updateUserFinaSettingsSchemaDefinition;
|
|
@@ -43,6 +43,7 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
43
43
|
"estimate.restored",
|
|
44
44
|
"credit_note.created",
|
|
45
45
|
"credit_note.issued",
|
|
46
|
+
"credit_note.voided",
|
|
46
47
|
"credit_note.deleted",
|
|
47
48
|
"credit_note.restored",
|
|
48
49
|
"advance_invoice.created",
|
|
@@ -83,6 +84,11 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
83
84
|
"order_integration.created",
|
|
84
85
|
"order_integration.updated",
|
|
85
86
|
"order_integration.deleted",
|
|
87
|
+
"delivery_note.created",
|
|
88
|
+
"delivery_note.sent",
|
|
89
|
+
"delivery_note.cancelled",
|
|
90
|
+
"delivery_note.deleted",
|
|
91
|
+
"delivery_note.restored",
|
|
86
92
|
])
|
|
87
93
|
)
|
|
88
94
|
.min(1),
|
|
@@ -130,6 +136,7 @@ const updateWebhookSchemaDefinition = z
|
|
|
130
136
|
"estimate.restored",
|
|
131
137
|
"credit_note.created",
|
|
132
138
|
"credit_note.issued",
|
|
139
|
+
"credit_note.voided",
|
|
133
140
|
"credit_note.deleted",
|
|
134
141
|
"credit_note.restored",
|
|
135
142
|
"advance_invoice.created",
|
|
@@ -170,6 +177,11 @@ const updateWebhookSchemaDefinition = z
|
|
|
170
177
|
"order_integration.created",
|
|
171
178
|
"order_integration.updated",
|
|
172
179
|
"order_integration.deleted",
|
|
180
|
+
"delivery_note.created",
|
|
181
|
+
"delivery_note.sent",
|
|
182
|
+
"delivery_note.cancelled",
|
|
183
|
+
"delivery_note.deleted",
|
|
184
|
+
"delivery_note.restored",
|
|
173
185
|
])
|
|
174
186
|
)
|
|
175
187
|
.min(1),
|
|
@@ -2,9 +2,11 @@ import type {
|
|
|
2
2
|
AdvanceInvoice,
|
|
3
3
|
CreateAdvanceInvoiceRequest,
|
|
4
4
|
CreateCreditNoteRequest,
|
|
5
|
+
CreateDeliveryNoteRequest,
|
|
5
6
|
CreateEstimateRequest,
|
|
6
7
|
CreateInvoiceRequest,
|
|
7
8
|
CreditNote,
|
|
9
|
+
DeliveryNote,
|
|
8
10
|
Estimate,
|
|
9
11
|
Invoice,
|
|
10
12
|
} from "@spaceinvoices/js-sdk";
|
|
@@ -13,13 +15,14 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
13
15
|
import { useEntities } from "@/ui/providers/entities-context";
|
|
14
16
|
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
15
17
|
|
|
16
|
-
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice";
|
|
17
|
-
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice;
|
|
18
|
+
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
19
|
+
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
18
20
|
type CreateRequest =
|
|
19
21
|
| CreateInvoiceRequest
|
|
20
22
|
| CreateEstimateRequest
|
|
21
23
|
| CreateCreditNoteRequest
|
|
22
|
-
| CreateAdvanceInvoiceRequest
|
|
24
|
+
| CreateAdvanceInvoiceRequest
|
|
25
|
+
| CreateDeliveryNoteRequest;
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
28
|
* Get document type from ID prefix
|
|
@@ -29,6 +32,7 @@ export function getDocumentTypeFromId(id: string): DocumentType | null {
|
|
|
29
32
|
if (id.startsWith("est_")) return "estimate";
|
|
30
33
|
if (id.startsWith("cn_")) return "credit_note";
|
|
31
34
|
if (id.startsWith("adv_")) return "advance_invoice";
|
|
35
|
+
if (id.startsWith("dn_")) return "delivery_note";
|
|
32
36
|
return null;
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -45,6 +49,8 @@ export function getAllowedDuplicateTargets(sourceType: DocumentType): DocumentTy
|
|
|
45
49
|
return ["credit_note"];
|
|
46
50
|
case "advance_invoice":
|
|
47
51
|
return ["advance_invoice", "invoice"];
|
|
52
|
+
case "delivery_note":
|
|
53
|
+
return ["delivery_note"];
|
|
48
54
|
default:
|
|
49
55
|
return [];
|
|
50
56
|
}
|
|
@@ -170,6 +176,8 @@ export function useDuplicateDocument({
|
|
|
170
176
|
source = await sdk.estimates.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
171
177
|
} else if (sourceType === "advance_invoice") {
|
|
172
178
|
source = await sdk.advanceInvoices.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
179
|
+
} else if (sourceType === "delivery_note") {
|
|
180
|
+
source = await sdk.deliveryNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
173
181
|
} else {
|
|
174
182
|
// Credit note
|
|
175
183
|
source = await sdk.creditNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
@@ -4,7 +4,7 @@ import { useSDK } from "@/ui/providers/sdk-provider";
|
|
|
4
4
|
|
|
5
5
|
export const NEXT_DOCUMENT_NUMBER_CACHE_KEY = "next-document-number";
|
|
6
6
|
|
|
7
|
-
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice";
|
|
7
|
+
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
8
8
|
|
|
9
9
|
/** Response type for next document number preview */
|
|
10
10
|
export type NextDocumentNumberResponse = {
|
|
@@ -43,7 +43,7 @@ export function useNextDocumentNumber(
|
|
|
43
43
|
queryFn: async () => {
|
|
44
44
|
const response = await sdk.documents.getNextNumber(
|
|
45
45
|
{
|
|
46
|
-
type,
|
|
46
|
+
type: type as "invoice",
|
|
47
47
|
business_premise_name: options?.businessPremiseName,
|
|
48
48
|
electronic_device_name: options?.electronicDeviceName,
|
|
49
49
|
},
|