@spaceinvoices/react-ui 0.4.5 → 0.4.6
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/advance-invoices.hooks.ts +2 -2
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +91 -35
- package/src/components/advance-invoices/create/locales/de.ts +5 -0
- package/src/components/advance-invoices/create/locales/es.ts +5 -0
- package/src/components/advance-invoices/create/locales/fr.ts +5 -0
- package/src/components/advance-invoices/create/locales/hr.ts +5 -0
- package/src/components/advance-invoices/create/locales/it.ts +5 -0
- package/src/components/advance-invoices/create/locales/nl.ts +5 -0
- package/src/components/advance-invoices/create/locales/pl.ts +5 -0
- package/src/components/advance-invoices/create/locales/pt.ts +5 -0
- package/src/components/advance-invoices/create/locales/sl.ts +5 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +5 -5
- package/src/components/credit-notes/create/create-credit-note-form.tsx +91 -35
- package/src/components/credit-notes/create/locales/de.ts +5 -0
- package/src/components/credit-notes/create/locales/es.ts +5 -0
- package/src/components/credit-notes/create/locales/fr.ts +5 -0
- package/src/components/credit-notes/create/locales/hr.ts +5 -0
- package/src/components/credit-notes/create/locales/it.ts +5 -0
- package/src/components/credit-notes/create/locales/nl.ts +5 -0
- package/src/components/credit-notes/create/locales/pl.ts +5 -0
- package/src/components/credit-notes/create/locales/pt.ts +5 -0
- package/src/components/credit-notes/create/locales/sl.ts +5 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +2 -2
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +47 -0
- package/src/components/delivery-notes/create/locales/de.ts +5 -0
- package/src/components/delivery-notes/create/locales/es.ts +5 -0
- package/src/components/delivery-notes/create/locales/fr.ts +5 -0
- package/src/components/delivery-notes/create/locales/hr.ts +5 -0
- package/src/components/delivery-notes/create/locales/it.ts +5 -0
- package/src/components/delivery-notes/create/locales/nl.ts +5 -0
- package/src/components/delivery-notes/create/locales/pl.ts +5 -0
- package/src/components/delivery-notes/create/locales/pt.ts +5 -0
- package/src/components/delivery-notes/create/locales/sl.ts +5 -0
- package/src/components/documents/create/document-details-section.tsx +472 -346
- package/src/components/documents/create/prepare-document-submission.ts +3 -1
- package/src/components/documents/create/smart-code-insert-button.tsx +6 -0
- package/src/components/documents/view/document-details-card.tsx +6 -0
- package/src/components/documents/view/locales/de.ts +1 -0
- package/src/components/documents/view/locales/es.ts +1 -0
- package/src/components/documents/view/locales/fr.ts +1 -0
- package/src/components/documents/view/locales/hr.ts +1 -0
- package/src/components/documents/view/locales/it.ts +1 -0
- package/src/components/documents/view/locales/nl.ts +1 -0
- package/src/components/documents/view/locales/pl.ts +1 -0
- package/src/components/documents/view/locales/pt.ts +1 -0
- package/src/components/documents/view/locales/sl.ts +1 -0
- package/src/components/entities/entity-settings-form/email-template-variables-info.tsx +6 -0
- package/src/components/entities/entity-settings-form/input-with-preview.tsx +2 -145
- package/src/components/entities/entity-settings-form/locales/de.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +4 -0
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +15 -0
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +5 -1
- package/src/components/entities/fina-settings-form/locales/de.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/en.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/es.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/fr.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/hr.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/it.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/nl.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/pl.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/pt.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/sl.ts +3 -0
- package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +4 -4
- package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +3 -3
- package/src/components/entities/settings/defaults-settings-form.tsx +38 -1
- package/src/components/entities/settings/tax-rules-settings-form.tsx +1 -2
- package/src/components/estimates/create/create-estimate-form.tsx +43 -2
- package/src/components/estimates/create/locales/de.ts +5 -0
- package/src/components/estimates/create/locales/es.ts +5 -0
- package/src/components/estimates/create/locales/fr.ts +5 -0
- package/src/components/estimates/create/locales/hr.ts +5 -0
- package/src/components/estimates/create/locales/it.ts +5 -0
- package/src/components/estimates/create/locales/nl.ts +5 -0
- package/src/components/estimates/create/locales/pl.ts +5 -0
- package/src/components/estimates/create/locales/pt.ts +5 -0
- package/src/components/estimates/create/locales/sl.ts +5 -0
- package/src/components/invoices/create/create-invoice-form.tsx +130 -40
- package/src/components/invoices/create/locales/de.ts +13 -0
- package/src/components/invoices/create/locales/es.ts +13 -0
- package/src/components/invoices/create/locales/fr.ts +13 -0
- package/src/components/invoices/create/locales/hr.ts +13 -0
- package/src/components/invoices/create/locales/it.ts +13 -0
- package/src/components/invoices/create/locales/nl.ts +13 -0
- package/src/components/invoices/create/locales/pl.ts +13 -0
- package/src/components/invoices/create/locales/pt.ts +13 -0
- package/src/components/invoices/create/locales/sl.ts +13 -0
- package/src/components/invoices/create/prepare-invoice-submission.ts +5 -5
- package/src/components/invoices/invoices.hooks.ts +2 -2
- package/src/components/table/table-pagination.tsx +1 -1
- package/src/generated/schemas/advanceinvoice.ts +2 -0
- package/src/generated/schemas/creditnote.ts +1 -0
- package/src/generated/schemas/deliverynote.ts +1 -0
- package/src/generated/schemas/entity.ts +4 -4
- package/src/generated/schemas/entityapikey.ts +19 -0
- package/src/generated/schemas/estimate.ts +2 -0
- package/src/generated/schemas/index.ts +1 -0
- package/src/generated/schemas/invoice.ts +2 -0
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +1 -1
- package/src/generated/schemas/rendercreditnotepreview_body.ts +1 -1
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +1 -1
- package/src/generated/schemas/renderestimatepreview_body.ts +1 -1
- package/src/generated/schemas/renderinvoicepreview_body.ts +1 -1
- package/src/generated/schemas/startpdfexport_body.ts +14 -2
- package/src/generated/schemas/webhook.ts +4 -0
- package/src/lib/template-variables.tsx +167 -0
- package/src/providers/entities-context.tsx +2 -2
|
@@ -161,12 +161,14 @@ export function prepareDocumentSubmission<T extends BaseDocumentValues>(
|
|
|
161
161
|
|
|
162
162
|
// Build payload with date conversions
|
|
163
163
|
// Destructure to exclude fields we handle explicitly (number is always server-generated)
|
|
164
|
-
const { number: _number, note, payment_terms, ...restValues } = values as any;
|
|
164
|
+
const { number: _number, note, payment_terms, reference, signature, ...restValues } = values as any;
|
|
165
165
|
const payload: any = {
|
|
166
166
|
...restValues,
|
|
167
167
|
...(note?.trim() && { note: note.trim() }),
|
|
168
|
+
...(reference?.trim() && { reference: reference.trim() }),
|
|
168
169
|
// Advance invoices don't have payment terms - they are documents requesting payment
|
|
169
170
|
...(options.documentType !== "advance_invoice" && payment_terms?.trim() && { payment_terms: payment_terms.trim() }),
|
|
171
|
+
...(signature?.trim() && { signature: signature.trim() }),
|
|
170
172
|
date: values.date ? new Date(values.date) : undefined,
|
|
171
173
|
};
|
|
172
174
|
|
|
@@ -22,6 +22,12 @@ const TEMPLATE_VARIABLES = [
|
|
|
22
22
|
variables: [
|
|
23
23
|
{ code: "{entity_name}", label: "Company name" },
|
|
24
24
|
{ code: "{entity_email}", label: "Email address" },
|
|
25
|
+
{ code: "{entity_address}", label: "Address" },
|
|
26
|
+
{ code: "{entity_post_code}", label: "Post code" },
|
|
27
|
+
{ code: "{entity_city}", label: "City" },
|
|
28
|
+
{ code: "{entity_country}", label: "Country" },
|
|
29
|
+
{ code: "{entity_tax_number}", label: "Tax number" },
|
|
30
|
+
{ code: "{entity_company_number}", label: "Company number" },
|
|
25
31
|
],
|
|
26
32
|
},
|
|
27
33
|
{
|
|
@@ -148,6 +148,12 @@ export function DocumentDetailsCard({
|
|
|
148
148
|
|
|
149
149
|
{/* Totals */}
|
|
150
150
|
<div className="space-y-2 text-sm">
|
|
151
|
+
{document.total_discount != null && document.total_discount !== 0 && (
|
|
152
|
+
<div className="flex justify-between">
|
|
153
|
+
<span className="text-muted-foreground">{t("Discount")}</span>
|
|
154
|
+
<span>{fmt(document.total_discount * sign)}</span>
|
|
155
|
+
</div>
|
|
156
|
+
)}
|
|
151
157
|
<div className="flex justify-between">
|
|
152
158
|
<span className="text-muted-foreground">{t("Subtotal")}</span>
|
|
153
159
|
<span>{fmt(document.total * sign)}</span>
|
|
@@ -12,6 +12,12 @@ const TEMPLATE_VARIABLES = [
|
|
|
12
12
|
variables: [
|
|
13
13
|
{ name: "{entity_name}", description: "Your company or entity name" },
|
|
14
14
|
{ name: "{entity_email}", description: "Entity email address" },
|
|
15
|
+
{ name: "{entity_address}", description: "Entity address" },
|
|
16
|
+
{ name: "{entity_post_code}", description: "Entity post code" },
|
|
17
|
+
{ name: "{entity_city}", description: "Entity city" },
|
|
18
|
+
{ name: "{entity_country}", description: "Entity country" },
|
|
19
|
+
{ name: "{entity_tax_number}", description: "Entity tax number" },
|
|
20
|
+
{ name: "{entity_company_number}", description: "Entity company number" },
|
|
15
21
|
],
|
|
16
22
|
},
|
|
17
23
|
{
|
|
@@ -2,6 +2,7 @@ import type { Entity, Estimate, Invoice } from "@spaceinvoices/js-sdk";
|
|
|
2
2
|
import { forwardRef, useState } from "react";
|
|
3
3
|
import { Input } from "@/ui/components/ui/input";
|
|
4
4
|
import { Textarea } from "@/ui/components/ui/textarea";
|
|
5
|
+
import { replaceTemplateVariablesForPreview } from "@/ui/lib/template-variables";
|
|
5
6
|
import { cn } from "@/ui/lib/utils";
|
|
6
7
|
|
|
7
8
|
interface InputWithPreviewProps {
|
|
@@ -16,150 +17,6 @@ interface InputWithPreviewProps {
|
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
function formatVariableName(varName: string): string {
|
|
20
|
-
// Convert snake_case (with optional dot notation) to Title Case with spaces
|
|
21
|
-
// e.g., "document_number" -> "Document Number", "bank_account.iban" -> "Bank Account Iban"
|
|
22
|
-
return varName
|
|
23
|
-
.replace(/\./g, "_")
|
|
24
|
-
.split("_")
|
|
25
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
26
|
-
.join(" ");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getVariableValue(varName: string, entity: Entity, document?: Invoice | Estimate | null): string | null {
|
|
30
|
-
// Entity-related variables
|
|
31
|
-
if (varName === "entity_name") return entity.name || null;
|
|
32
|
-
if (varName === "entity_email") return (entity.settings as any)?.email || null;
|
|
33
|
-
|
|
34
|
-
// Date variables
|
|
35
|
-
if (varName === "current_date") {
|
|
36
|
-
return new Date().toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
|
|
37
|
-
}
|
|
38
|
-
if (varName === "current_year") return new Date().getFullYear().toString();
|
|
39
|
-
|
|
40
|
-
// Document-specific variables (only available when document is provided)
|
|
41
|
-
if (document) {
|
|
42
|
-
if (varName === "document_number") return document.number || null;
|
|
43
|
-
if (varName === "document_date") {
|
|
44
|
-
return document.date
|
|
45
|
-
? new Date(document.date).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })
|
|
46
|
-
: null;
|
|
47
|
-
}
|
|
48
|
-
if (varName === "document_total") {
|
|
49
|
-
return document.total_with_tax
|
|
50
|
-
? new Intl.NumberFormat("en-US", { style: "currency", currency: document.currency_code || "USD" }).format(
|
|
51
|
-
Number(document.total_with_tax),
|
|
52
|
-
)
|
|
53
|
-
: null;
|
|
54
|
-
}
|
|
55
|
-
if (varName === "document_currency") return document.currency_code || null;
|
|
56
|
-
|
|
57
|
-
// Invoice-specific
|
|
58
|
-
if ("date_due" in document && varName === "document_due_date") {
|
|
59
|
-
return document.date_due
|
|
60
|
-
? new Date(document.date_due).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })
|
|
61
|
-
: null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Estimate-specific
|
|
65
|
-
if ("date_valid_till" in document && varName === "document_valid_until") {
|
|
66
|
-
return document.date_valid_till
|
|
67
|
-
? new Date(document.date_valid_till).toLocaleDateString("en-US", {
|
|
68
|
-
month: "long",
|
|
69
|
-
day: "numeric",
|
|
70
|
-
year: "numeric",
|
|
71
|
-
})
|
|
72
|
-
: null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Customer variables
|
|
76
|
-
if (document.customer) {
|
|
77
|
-
if (varName === "customer_name") return document.customer.name || null;
|
|
78
|
-
if (varName === "customer_email") return (document.customer as any).email || null;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Bank account variables (from entity settings)
|
|
83
|
-
const bankAccounts = (entity.settings as any)?.bank_accounts as
|
|
84
|
-
| Array<{
|
|
85
|
-
iban?: string;
|
|
86
|
-
bank_name?: string;
|
|
87
|
-
bic?: string;
|
|
88
|
-
account_number?: string;
|
|
89
|
-
routing_number?: string;
|
|
90
|
-
sort_code?: string;
|
|
91
|
-
is_default?: boolean;
|
|
92
|
-
}>
|
|
93
|
-
| undefined;
|
|
94
|
-
const bankAccount = bankAccounts?.find((acc) => acc.is_default) ?? bankAccounts?.[0];
|
|
95
|
-
|
|
96
|
-
if (varName === "bank_account" && bankAccount) {
|
|
97
|
-
const lines: string[] = [];
|
|
98
|
-
if (bankAccount.bank_name) lines.push(bankAccount.bank_name);
|
|
99
|
-
if (bankAccount.iban) lines.push(`IBAN: ${bankAccount.iban}`);
|
|
100
|
-
else if (bankAccount.account_number) lines.push(`Account: ${bankAccount.account_number}`);
|
|
101
|
-
if (bankAccount.bic) lines.push(`BIC: ${bankAccount.bic}`);
|
|
102
|
-
return lines.join(", ") || null;
|
|
103
|
-
}
|
|
104
|
-
if (varName === "bank_account.iban") return bankAccount?.iban || null;
|
|
105
|
-
if (varName === "bank_account.bank_name") return bankAccount?.bank_name || null;
|
|
106
|
-
if (varName === "bank_account.bic") return bankAccount?.bic || null;
|
|
107
|
-
if (varName === "bank_account.account_number") return bankAccount?.account_number || null;
|
|
108
|
-
|
|
109
|
-
// Return null for unavailable variables - they will show as placeholders
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function replaceTemplateVariables(
|
|
114
|
-
template: string,
|
|
115
|
-
entity: Entity,
|
|
116
|
-
document?: Invoice | Estimate | null,
|
|
117
|
-
): React.ReactNode[] {
|
|
118
|
-
if (!template) return [];
|
|
119
|
-
|
|
120
|
-
// Split by variable pattern and process
|
|
121
|
-
const parts: React.ReactNode[] = [];
|
|
122
|
-
const regex = /\{([^}]+)\}/g;
|
|
123
|
-
let lastIndex = 0;
|
|
124
|
-
let match: RegExpExecArray | null = null;
|
|
125
|
-
|
|
126
|
-
match = regex.exec(template);
|
|
127
|
-
while (match !== null) {
|
|
128
|
-
// Add text before the match
|
|
129
|
-
if (match.index > lastIndex) {
|
|
130
|
-
parts.push(template.slice(lastIndex, match.index));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Add the replaced variable with styling
|
|
134
|
-
// Green for resolved values, primary color for placeholders
|
|
135
|
-
const varName = match[1];
|
|
136
|
-
const actualValue = getVariableValue(varName, entity, document);
|
|
137
|
-
const displayValue = actualValue || formatVariableName(varName);
|
|
138
|
-
|
|
139
|
-
parts.push(
|
|
140
|
-
<span
|
|
141
|
-
key={match.index}
|
|
142
|
-
className={cn(
|
|
143
|
-
"rounded px-1.5 py-0.5 font-medium text-xs",
|
|
144
|
-
actualValue ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary",
|
|
145
|
-
)}
|
|
146
|
-
>
|
|
147
|
-
{displayValue}
|
|
148
|
-
</span>,
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
lastIndex = regex.lastIndex;
|
|
152
|
-
match = regex.exec(template);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Add remaining text
|
|
156
|
-
if (lastIndex < template.length) {
|
|
157
|
-
parts.push(template.slice(lastIndex));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return parts;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
20
|
export const InputWithPreview = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputWithPreviewProps>(
|
|
164
21
|
function InputWithPreview(
|
|
165
22
|
{ value, onChange, placeholder, entity, document, multiline = false, className, rows, disabled = false },
|
|
@@ -167,7 +24,7 @@ export const InputWithPreview = forwardRef<HTMLInputElement | HTMLTextAreaElemen
|
|
|
167
24
|
) {
|
|
168
25
|
const [isFocused, setIsFocused] = useState(false);
|
|
169
26
|
|
|
170
|
-
const preview =
|
|
27
|
+
const preview = replaceTemplateVariablesForPreview(value, entity, document);
|
|
171
28
|
const hasValue = Boolean(value);
|
|
172
29
|
|
|
173
30
|
const showPreview = !isFocused && hasValue && !disabled;
|
|
@@ -106,6 +106,10 @@ export default {
|
|
|
106
106
|
"Footer text displayed at the bottom of all PDF documents": "Fußzeilentext am unteren Rand aller PDF-Dokumente",
|
|
107
107
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
108
108
|
"{entity_name} | Fällig am: {document_due_date} | Rechnung #{document_number}",
|
|
109
|
+
// Document signature
|
|
110
|
+
"Document Signature": "Dokumentunterschrift",
|
|
111
|
+
"Signature text displayed on all PDF documents": "Unterschriftstext auf allen PDF-Dokumenten",
|
|
112
|
+
"Add signature text...": "Unterschriftstext hinzufügen...",
|
|
109
113
|
// Overdue Notifications section
|
|
110
114
|
"Overdue Notifications": "Überfälligkeits-Benachrichtigungen",
|
|
111
115
|
"Automatically remind customers about overdue invoices": "Erinnern Sie Kunden automatisch an überfällige Rechnungen",
|
|
@@ -106,6 +106,10 @@ export default {
|
|
|
106
106
|
"Texto del pie de página mostrado en la parte inferior de todos los documentos PDF",
|
|
107
107
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
108
108
|
"{entity_name} | Vencimiento: {document_due_date} | Factura #{document_number}",
|
|
109
|
+
// Document signature
|
|
110
|
+
"Document Signature": "Firma del documento",
|
|
111
|
+
"Signature text displayed on all PDF documents": "Texto de firma mostrado en todos los documentos PDF",
|
|
112
|
+
"Add signature text...": "Añadir texto de firma...",
|
|
109
113
|
// Overdue Notifications section
|
|
110
114
|
"Overdue Notifications": "Notificaciones de vencimiento",
|
|
111
115
|
"Automatically remind customers about overdue invoices":
|
|
@@ -106,6 +106,10 @@ export default {
|
|
|
106
106
|
"Texte de pied de page affiché en bas de tous les documents PDF",
|
|
107
107
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
108
108
|
"{entity_name} | Échéance : {document_due_date} | Facture #{document_number}",
|
|
109
|
+
// Document signature
|
|
110
|
+
"Document Signature": "Signature du document",
|
|
111
|
+
"Signature text displayed on all PDF documents": "Texte de signature affiché sur tous les documents PDF",
|
|
112
|
+
"Add signature text...": "Ajouter un texte de signature...",
|
|
109
113
|
// Overdue Notifications section
|
|
110
114
|
"Overdue Notifications": "Notifications de retard",
|
|
111
115
|
"Automatically remind customers about overdue invoices":
|
|
@@ -105,6 +105,10 @@ export default {
|
|
|
105
105
|
"Footer text displayed at the bottom of all PDF documents": "Tekst podnožja prikazan na dnu svih PDF dokumenata",
|
|
106
106
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
107
107
|
"{entity_name} | Dospijeće: {document_due_date} | Račun #{document_number}",
|
|
108
|
+
// Document signature
|
|
109
|
+
"Document Signature": "Potpis dokumenta",
|
|
110
|
+
"Signature text displayed on all PDF documents": "Tekst potpisa prikazan na svim PDF dokumentima",
|
|
111
|
+
"Add signature text...": "Dodaj tekst potpisa...",
|
|
108
112
|
// Overdue Notifications section
|
|
109
113
|
"Overdue Notifications": "Obavijesti o dospjelim računima",
|
|
110
114
|
"Automatically remind customers about overdue invoices": "Automatski podsjećajte kupce o dospjelim računima",
|
|
@@ -106,6 +106,10 @@ export default {
|
|
|
106
106
|
"Testo del piè di pagina mostrato in fondo a tutti i documenti PDF",
|
|
107
107
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
108
108
|
"{entity_name} | Scadenza: {document_due_date} | Fattura #{document_number}",
|
|
109
|
+
// Document signature
|
|
110
|
+
"Document Signature": "Firma del documento",
|
|
111
|
+
"Signature text displayed on all PDF documents": "Testo della firma visualizzato su tutti i documenti PDF",
|
|
112
|
+
"Add signature text...": "Aggiungi testo della firma...",
|
|
109
113
|
// Overdue Notifications section
|
|
110
114
|
"Overdue Notifications": "Notifiche di scadenza",
|
|
111
115
|
"Automatically remind customers about overdue invoices": "Ricorda automaticamente ai clienti le fatture scadute",
|
|
@@ -105,6 +105,10 @@ export default {
|
|
|
105
105
|
"Footer text displayed at the bottom of all PDF documents": "Voettekst weergegeven onderaan alle PDF-documenten",
|
|
106
106
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
107
107
|
"{entity_name} | Vervaldatum: {document_due_date} | Factuur #{document_number}",
|
|
108
|
+
// Document signature
|
|
109
|
+
"Document Signature": "Documenthandtekening",
|
|
110
|
+
"Signature text displayed on all PDF documents": "Handtekeningtekst weergegeven op alle PDF-documenten",
|
|
111
|
+
"Add signature text...": "Handtekeningtekst toevoegen...",
|
|
108
112
|
// Overdue Notifications section
|
|
109
113
|
"Overdue Notifications": "Herinneringen voor achterstallige betalingen",
|
|
110
114
|
"Automatically remind customers about overdue invoices": "Klanten automatisch herinneren aan achterstallige facturen",
|
|
@@ -106,6 +106,10 @@ export default {
|
|
|
106
106
|
"Tekst stopki wyświetlany na dole wszystkich dokumentów PDF",
|
|
107
107
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
108
108
|
"{entity_name} | Termin: {document_due_date} | Faktura #{document_number}",
|
|
109
|
+
// Document signature
|
|
110
|
+
"Document Signature": "Podpis dokumentu",
|
|
111
|
+
"Signature text displayed on all PDF documents": "Tekst podpisu wyświetlany na wszystkich dokumentach PDF",
|
|
112
|
+
"Add signature text...": "Dodaj tekst podpisu...",
|
|
109
113
|
// Overdue Notifications section
|
|
110
114
|
"Overdue Notifications": "Powiadomienia o zaległych płatnościach",
|
|
111
115
|
"Automatically remind customers about overdue invoices": "Automatycznie przypominaj klientom o zaległych fakturach",
|
|
@@ -105,6 +105,10 @@ export default {
|
|
|
105
105
|
"Texto do rodapé apresentado na parte inferior de todos os documentos PDF",
|
|
106
106
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
107
107
|
"{entity_name} | Vencimento: {document_due_date} | Fatura #{document_number}",
|
|
108
|
+
// Document signature
|
|
109
|
+
"Document Signature": "Assinatura do documento",
|
|
110
|
+
"Signature text displayed on all PDF documents": "Texto de assinatura exibido em todos os documentos PDF",
|
|
111
|
+
"Add signature text...": "Adicionar texto de assinatura...",
|
|
108
112
|
// Overdue Notifications section
|
|
109
113
|
"Overdue Notifications": "Notificações de atraso",
|
|
110
114
|
"Automatically remind customers about overdue invoices":
|
|
@@ -104,6 +104,10 @@ export default {
|
|
|
104
104
|
"Footer text displayed at the bottom of all PDF documents": "Besedilo noge, prikazano na dnu vseh PDF dokumentov",
|
|
105
105
|
"{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
|
|
106
106
|
"{entity_name} | Rok plačila: {document_due_date} | Račun #{document_number}",
|
|
107
|
+
// Document signature
|
|
108
|
+
"Document Signature": "Podpis dokumenta",
|
|
109
|
+
"Signature text displayed on all PDF documents": "Besedilo podpisa, prikazano na vseh PDF dokumentih",
|
|
110
|
+
"Add signature text...": "Dodaj besedilo podpisa...",
|
|
107
111
|
// Overdue Notifications section
|
|
108
112
|
"Overdue Notifications": "Opomniki o zapadlih računih",
|
|
109
113
|
"Automatically remind customers about overdue invoices": "Samodejno opominjajte stranke o zapadlih računih",
|
|
@@ -178,6 +178,7 @@ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
|
|
|
178
178
|
const [formData, setFormData] = useState({
|
|
179
179
|
enabled: false,
|
|
180
180
|
numbering_sequence: "P" as "N" | "P",
|
|
181
|
+
unified_numbering: true,
|
|
181
182
|
operator_oib: "",
|
|
182
183
|
operator_label: "",
|
|
183
184
|
u_sust_pdv: true,
|
|
@@ -189,6 +190,7 @@ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
|
|
|
189
190
|
setFormData({
|
|
190
191
|
enabled: finaSettings.enabled || false,
|
|
191
192
|
numbering_sequence: finaSettings.numbering_sequence || "P",
|
|
193
|
+
unified_numbering: finaSettings.unified_numbering !== false,
|
|
192
194
|
operator_oib: finaSettings.operator_oib || "",
|
|
193
195
|
operator_label: finaSettings.operator_label || "",
|
|
194
196
|
u_sust_pdv: finaSettings.u_sust_pdv ?? true,
|
|
@@ -531,6 +533,19 @@ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
|
|
|
531
533
|
<Label htmlFor="seq-n">{translate("Per Device (N)")}</Label>
|
|
532
534
|
</div>
|
|
533
535
|
</RadioGroup>
|
|
536
|
+
|
|
537
|
+
<div className="mt-4 space-y-2">
|
|
538
|
+
<div className="flex items-center space-x-2">
|
|
539
|
+
<Switch
|
|
540
|
+
checked={formData.unified_numbering}
|
|
541
|
+
onCheckedChange={(checked) => setFormData((prev) => ({ ...prev, unified_numbering: checked }))}
|
|
542
|
+
/>
|
|
543
|
+
<Label>{translate("Unified document numbering")}</Label>
|
|
544
|
+
</div>
|
|
545
|
+
<p className="text-muted-foreground text-sm">
|
|
546
|
+
{translate("Use the same numbering sequence for all documents, including non-fiscalized ones")}
|
|
547
|
+
</p>
|
|
548
|
+
</div>
|
|
534
549
|
</div>,
|
|
535
550
|
)}
|
|
536
551
|
|
|
@@ -174,7 +174,11 @@ export function useRegisterFinaElectronicDevice(
|
|
|
174
174
|
...options,
|
|
175
175
|
mutationFn: async ({ entityId, premiseId, deviceId }) => {
|
|
176
176
|
if (!sdk) throw new Error("SDK not initialized");
|
|
177
|
-
return sdk.finaDevices.registerFinaDevice(
|
|
177
|
+
return sdk.finaDevices.registerFinaDevice(
|
|
178
|
+
premiseId,
|
|
179
|
+
{ electronic_device_name: deviceId },
|
|
180
|
+
{ entity_id: entityId },
|
|
181
|
+
);
|
|
178
182
|
},
|
|
179
183
|
onSuccess: (data, variables, context) => {
|
|
180
184
|
queryClient.invalidateQueries({
|
|
@@ -165,4 +165,7 @@ export default {
|
|
|
165
165
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
166
166
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
167
167
|
"Save & Retry": "Save & Retry",
|
|
168
|
+
"Unified document numbering": "Einheitliche Dokumentennummerierung",
|
|
169
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
170
|
+
"Verwenden Sie die gleiche Nummerierungsfolge für alle Dokumente, einschließlich nicht-fiskalisierter",
|
|
168
171
|
} as const;
|
|
@@ -159,4 +159,7 @@ export default {
|
|
|
159
159
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
161
161
|
"Save & Retry": "Save & Retry",
|
|
162
|
+
"Unified document numbering": "Unified document numbering",
|
|
163
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
164
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones",
|
|
162
165
|
} as const;
|
|
@@ -159,4 +159,7 @@ export default {
|
|
|
159
159
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
161
161
|
"Save & Retry": "Save & Retry",
|
|
162
|
+
"Unified document numbering": "Numeración unificada de documentos",
|
|
163
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
164
|
+
"Utilice la misma secuencia de numeración para todos los documentos, incluidos los no fiscalizados",
|
|
162
165
|
} as const;
|
|
@@ -158,4 +158,7 @@ export default {
|
|
|
158
158
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
159
159
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
160
160
|
"Save & Retry": "Save & Retry",
|
|
161
|
+
"Unified document numbering": "Numérotation unifiée des documents",
|
|
162
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
163
|
+
"Utiliser la même séquence de numérotation pour tous les documents, y compris les non-fiscalisés",
|
|
161
164
|
} as const;
|
|
@@ -160,4 +160,7 @@ export default {
|
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
161
161
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
162
162
|
"Save & Retry": "Save & Retry",
|
|
163
|
+
"Unified document numbering": "Jedinstveno numeriranje dokumenata",
|
|
164
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
165
|
+
"Koristite isti redoslijed numeriranja za sve dokumente, uključujući nefiskalizirane",
|
|
163
166
|
} as const;
|
|
@@ -160,4 +160,7 @@ export default {
|
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
161
161
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
162
162
|
"Save & Retry": "Save & Retry",
|
|
163
|
+
"Unified document numbering": "Numerazione unificata dei documenti",
|
|
164
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
165
|
+
"Utilizza la stessa sequenza di numerazione per tutti i documenti, compresi quelli non fiscalizzati",
|
|
163
166
|
} as const;
|
|
@@ -160,4 +160,7 @@ export default {
|
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
161
161
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
162
162
|
"Save & Retry": "Save & Retry",
|
|
163
|
+
"Unified document numbering": "Uniforme documentnummering",
|
|
164
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
165
|
+
"Gebruik dezelfde nummeringsvolgorde voor alle documenten, inclusief niet-gefiscaliseerde",
|
|
163
166
|
} as const;
|
|
@@ -158,4 +158,7 @@ export default {
|
|
|
158
158
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
159
159
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
160
160
|
"Save & Retry": "Save & Retry",
|
|
161
|
+
"Unified document numbering": "Jednolita numeracja dokumentów",
|
|
162
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
163
|
+
"Użyj tej samej sekwencji numeracji dla wszystkich dokumentów, w tym niefiskalizowanych",
|
|
161
164
|
} as const;
|
|
@@ -160,4 +160,7 @@ export default {
|
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
161
161
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
162
162
|
"Save & Retry": "Save & Retry",
|
|
163
|
+
"Unified document numbering": "Numeração unificada de documentos",
|
|
164
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
165
|
+
"Use a mesma sequência de numeração para todos os documentos, incluindo os não fiscalizados",
|
|
163
166
|
} as const;
|
|
@@ -160,4 +160,7 @@ export default {
|
|
|
160
160
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
|
|
161
161
|
"Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
|
|
162
162
|
"Save & Retry": "Save & Retry",
|
|
163
|
+
"Unified document numbering": "Enotno številčenje dokumentov",
|
|
164
|
+
"Use the same numbering sequence for all documents, including non-fiscalized ones":
|
|
165
|
+
"Uporabite enako zaporedje številčenja za vse dokumente, tudi za nefiskalizirane",
|
|
163
166
|
} as const;
|
|
@@ -5,7 +5,7 @@ import type { FinaSectionType } from "../fina-settings-form";
|
|
|
5
5
|
type FinaBusinessPremise = {
|
|
6
6
|
id: string;
|
|
7
7
|
entity_id: string;
|
|
8
|
-
|
|
8
|
+
business_premise_name: string;
|
|
9
9
|
type: string;
|
|
10
10
|
is_active: boolean;
|
|
11
11
|
registered_at: Date | string | null;
|
|
@@ -13,7 +13,7 @@ type FinaBusinessPremise = {
|
|
|
13
13
|
created_at: Date | string;
|
|
14
14
|
Devices?: Array<{
|
|
15
15
|
id: string;
|
|
16
|
-
|
|
16
|
+
electronic_device_name?: string;
|
|
17
17
|
}>;
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -174,7 +174,7 @@ export const PremisesManagementSection: FC<PremisesManagementSectionProps> = ({
|
|
|
174
174
|
<div className="flex items-start justify-between">
|
|
175
175
|
<div className="space-y-1">
|
|
176
176
|
<div className="flex items-center gap-2">
|
|
177
|
-
<CardTitle className="text-base">{premise.
|
|
177
|
+
<CardTitle className="text-base">{premise.business_premise_name}</CardTitle>
|
|
178
178
|
<Badge variant={premise.is_active ? "default" : "secondary"}>
|
|
179
179
|
{premise.is_active ? t("Active") : t("Inactive")}
|
|
180
180
|
</Badge>
|
|
@@ -219,7 +219,7 @@ export const PremisesManagementSection: FC<PremisesManagementSectionProps> = ({
|
|
|
219
219
|
{premise.Devices.map((d) => (
|
|
220
220
|
<div key={d.id} className="flex items-center gap-1 rounded border px-2 py-1 text-xs">
|
|
221
221
|
<Cpu className="h-3 w-3 text-muted-foreground" />
|
|
222
|
-
<span>{d.
|
|
222
|
+
<span>{d.electronic_device_name || "?"}</span>
|
|
223
223
|
{premise.is_active && (
|
|
224
224
|
<button
|
|
225
225
|
type="button"
|
|
@@ -24,7 +24,7 @@ import { Input } from "@/ui/components/ui/input";
|
|
|
24
24
|
import { useCreateFinaPremise } from "../fina-settings.hooks";
|
|
25
25
|
|
|
26
26
|
const createPremiseSchema = z.object({
|
|
27
|
-
|
|
27
|
+
business_premise_name: z
|
|
28
28
|
.string()
|
|
29
29
|
.min(1, "Premise ID is required")
|
|
30
30
|
.max(20)
|
|
@@ -53,7 +53,7 @@ export const RegisterFinaPremiseDialog: FC<RegisterFinaPremiseDialogProps> = ({
|
|
|
53
53
|
const form = useForm<CreatePremiseForm>({
|
|
54
54
|
resolver: zodResolver(createPremiseSchema),
|
|
55
55
|
defaultValues: {
|
|
56
|
-
|
|
56
|
+
business_premise_name: "",
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -88,7 +88,7 @@ export const RegisterFinaPremiseDialog: FC<RegisterFinaPremiseDialogProps> = ({
|
|
|
88
88
|
<form onSubmit={form.handleSubmit(handleSubmit)} className="space-y-4">
|
|
89
89
|
<FormField
|
|
90
90
|
control={form.control}
|
|
91
|
-
name="
|
|
91
|
+
name="business_premise_name"
|
|
92
92
|
render={({ field }) => (
|
|
93
93
|
<FormItem>
|
|
94
94
|
<FormLabel>{t("Premise ID")}</FormLabel>
|