@spaceinvoices/react-ui 0.4.3 → 0.4.5
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/common/autocomplete.tsx +18 -2
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +61 -12
- package/src/components/advance-invoices/create/locales/de.ts +17 -0
- package/src/components/advance-invoices/create/locales/es.ts +17 -0
- package/src/components/advance-invoices/create/locales/fr.ts +17 -0
- package/src/components/advance-invoices/create/locales/hr.ts +16 -0
- package/src/components/advance-invoices/create/locales/it.ts +17 -0
- package/src/components/advance-invoices/create/locales/nl.ts +17 -0
- package/src/components/advance-invoices/create/locales/pl.ts +16 -0
- package/src/components/advance-invoices/create/locales/pt.ts +16 -0
- package/src/components/advance-invoices/create/locales/sl.ts +16 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +0 -1
- package/src/components/advance-invoices/list/list-row-actions.tsx +48 -1
- package/src/components/advance-invoices/list/list-table.tsx +100 -50
- package/src/components/advance-invoices/list/locales/de.ts +9 -0
- package/src/components/advance-invoices/list/locales/en.ts +7 -0
- package/src/components/advance-invoices/list/locales/es.ts +9 -0
- package/src/components/advance-invoices/list/locales/fr.ts +9 -0
- package/src/components/advance-invoices/list/locales/hr.ts +8 -0
- package/src/components/advance-invoices/list/locales/it.ts +9 -0
- package/src/components/advance-invoices/list/locales/nl.ts +9 -0
- package/src/components/advance-invoices/list/locales/pl.ts +8 -0
- package/src/components/advance-invoices/list/locales/pt.ts +9 -0
- package/src/components/advance-invoices/list/locales/sl.ts +8 -0
- package/src/components/credit-notes/create/create-credit-note-form.tsx +185 -11
- package/src/components/credit-notes/create/locales/de.ts +18 -0
- package/src/components/credit-notes/create/locales/es.ts +18 -0
- package/src/components/credit-notes/create/locales/fr.ts +18 -0
- package/src/components/credit-notes/create/locales/hr.ts +17 -0
- package/src/components/credit-notes/create/locales/it.ts +18 -0
- package/src/components/credit-notes/create/locales/nl.ts +18 -0
- package/src/components/credit-notes/create/locales/pl.ts +17 -0
- package/src/components/credit-notes/create/locales/pt.ts +17 -0
- package/src/components/credit-notes/create/locales/sl.ts +18 -1
- package/src/components/credit-notes/credit-notes.hooks.ts +30 -0
- package/src/components/credit-notes/list/list-row-actions.tsx +44 -1
- package/src/components/credit-notes/list/list-table.tsx +93 -32
- package/src/components/credit-notes/list/locales/de.ts +7 -0
- package/src/components/credit-notes/list/locales/en.ts +6 -0
- package/src/components/credit-notes/list/locales/es.ts +7 -0
- package/src/components/credit-notes/list/locales/fr.ts +7 -0
- package/src/components/credit-notes/list/locales/hr.ts +7 -0
- package/src/components/credit-notes/list/locales/it.ts +7 -0
- package/src/components/credit-notes/list/locales/nl.ts +7 -0
- package/src/components/credit-notes/list/locales/pl.ts +7 -0
- package/src/components/credit-notes/list/locales/pt.ts +7 -0
- package/src/components/credit-notes/list/locales/sl.ts +7 -0
- package/src/components/customers/customer-list-table/customer-list-table.tsx +0 -3
- package/src/components/customers/customer-list-table/locales/de.ts +1 -0
- package/src/components/customers/customer-list-table/locales/es.ts +1 -0
- package/src/components/customers/customer-list-table/locales/fr.ts +1 -0
- package/src/components/customers/customer-list-table/locales/hr.ts +1 -0
- package/src/components/customers/customer-list-table/locales/it.ts +1 -0
- package/src/components/customers/customer-list-table/locales/nl.ts +1 -0
- package/src/components/customers/customer-list-table/locales/pl.ts +1 -0
- package/src/components/customers/customer-list-table/locales/pt.ts +1 -0
- package/src/components/customers/customer-list-table/locales/sl.ts +1 -0
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +48 -9
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +77 -48
- package/src/components/dashboard/shared/use-revenue-data.ts +77 -9
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +67 -7
- package/src/components/delivery-notes/create/locales/de.ts +16 -0
- package/src/components/delivery-notes/create/locales/es.ts +16 -0
- package/src/components/delivery-notes/create/locales/fr.ts +16 -0
- package/src/components/delivery-notes/create/locales/hr.ts +16 -0
- package/src/components/delivery-notes/create/locales/it.ts +16 -0
- package/src/components/delivery-notes/create/locales/nl.ts +16 -0
- package/src/components/delivery-notes/create/locales/pl.ts +16 -0
- package/src/components/delivery-notes/create/locales/pt.ts +16 -0
- package/src/components/delivery-notes/create/locales/sl.ts +17 -1
- package/src/components/delivery-notes/list/list-row-actions.tsx +20 -1
- package/src/components/delivery-notes/list/list-table.tsx +50 -8
- package/src/components/delivery-notes/list/locales/de.ts +35 -0
- package/src/components/delivery-notes/list/locales/en.ts +33 -0
- package/src/components/delivery-notes/list/locales/es.ts +35 -0
- package/src/components/delivery-notes/list/locales/fr.ts +35 -0
- package/src/components/delivery-notes/list/locales/hr.ts +35 -0
- package/src/components/delivery-notes/list/locales/it.ts +35 -0
- package/src/components/delivery-notes/list/locales/nl.ts +35 -0
- package/src/components/delivery-notes/list/locales/pl.ts +35 -0
- package/src/components/delivery-notes/list/locales/pt.ts +35 -0
- package/src/components/delivery-notes/list/locales/sl.ts +35 -0
- package/src/components/documents/create/document-add-item-form.tsx +70 -0
- package/src/components/documents/create/document-details-section.tsx +163 -29
- package/src/components/documents/create/document-items-section.tsx +21 -4
- package/src/components/documents/create/linked-documents-info.tsx +82 -0
- package/src/components/documents/create/live-preview.tsx +25 -5
- package/src/components/documents/create/mark-as-paid-section.tsx +29 -20
- package/src/components/documents/create/prepare-document-submission.ts +19 -7
- package/src/components/documents/shared/document-preview-display.tsx +3 -4
- package/src/components/documents/types.ts +2 -2
- package/src/components/documents/view/document-actions-bar.tsx +7 -27
- package/src/components/documents/view/document-activities-list.tsx +65 -47
- package/src/components/documents/view/document-details-card.tsx +118 -76
- package/src/components/documents/view/document-payments-list.tsx +99 -65
- package/src/components/documents/view/document-relations-list.tsx +43 -28
- package/src/components/documents/view/document-sidebar.tsx +151 -0
- package/src/components/documents/view/index.ts +2 -0
- package/src/components/documents/view/locales/de.ts +4 -0
- package/src/components/documents/view/locales/es.ts +4 -0
- package/src/components/documents/view/locales/fr.ts +4 -0
- package/src/components/documents/view/locales/hr.ts +4 -0
- package/src/components/documents/view/locales/it.ts +4 -0
- package/src/components/documents/view/locales/nl.ts +4 -0
- package/src/components/documents/view/locales/pl.ts +4 -0
- package/src/components/documents/view/locales/pt.ts +4 -0
- package/src/components/documents/view/locales/sl.ts +5 -1
- package/src/components/documents/view/use-document-download.ts +7 -3
- package/src/components/entities/create-entity-form.tsx +166 -13
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +101 -1
- package/src/components/entities/entity-settings-form/input-with-preview.tsx +30 -2
- package/src/components/entities/entity-settings-form/locales/de.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +10 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +10 -0
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +6 -6
- package/src/components/entities/fina-settings-form/locales/de.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/en.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/es.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/fr.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/hr.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/it.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/nl.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/pl.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/pt.ts +2 -2
- package/src/components/entities/fina-settings-form/locales/sl.ts +2 -2
- package/src/components/entities/furs-settings-form/locales/en.ts +0 -1
- package/src/components/entities/settings/company-settings-form.tsx +173 -20
- package/src/components/entities/settings/pdf-template-selector/locales/de.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/locales/es.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/locales/fr.ts +4 -1
- package/src/components/entities/settings/pdf-template-selector/locales/hr.ts +4 -1
- package/src/components/entities/settings/pdf-template-selector/locales/it.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/locales/nl.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/locales/pl.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/locales/pt.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/locales/sl.ts +3 -1
- package/src/components/entities/settings/pdf-template-selector/pdf-template-cards.tsx +1 -0
- package/src/components/estimates/create/create-estimate-form.tsx +93 -8
- package/src/components/estimates/create/locales/de.ts +16 -0
- package/src/components/estimates/create/locales/es.ts +16 -0
- package/src/components/estimates/create/locales/fr.ts +16 -0
- package/src/components/estimates/create/locales/hr.ts +16 -0
- package/src/components/estimates/create/locales/it.ts +16 -0
- package/src/components/estimates/create/locales/nl.ts +16 -0
- package/src/components/estimates/create/locales/pl.ts +16 -0
- package/src/components/estimates/create/locales/pt.ts +16 -0
- package/src/components/estimates/create/locales/sl.ts +17 -1
- package/src/components/estimates/list/list-table.tsx +14 -8
- package/src/components/estimates/list/locales/de.ts +2 -0
- package/src/components/estimates/list/locales/en.ts +1 -0
- package/src/components/estimates/list/locales/es.ts +2 -0
- package/src/components/estimates/list/locales/fr.ts +2 -0
- package/src/components/estimates/list/locales/hr.ts +2 -0
- package/src/components/estimates/list/locales/it.ts +2 -0
- package/src/components/estimates/list/locales/nl.ts +2 -0
- package/src/components/estimates/list/locales/pl.ts +2 -0
- package/src/components/estimates/list/locales/pt.ts +2 -0
- package/src/components/estimates/list/locales/sl.ts +2 -0
- package/src/components/export/document-export-form.tsx +55 -14
- package/src/components/export/index.ts +2 -0
- package/src/components/export/sales-per-item-export-form.tsx +223 -0
- package/src/components/invoices/create/create-invoice-form.tsx +106 -11
- package/src/components/invoices/create/locales/de.ts +26 -0
- package/src/components/invoices/create/locales/es.ts +26 -0
- package/src/components/invoices/create/locales/fr.ts +26 -0
- package/src/components/invoices/create/locales/hr.ts +25 -0
- package/src/components/invoices/create/locales/it.ts +26 -0
- package/src/components/invoices/create/locales/nl.ts +26 -0
- package/src/components/invoices/create/locales/pl.ts +25 -0
- package/src/components/invoices/create/locales/pt.ts +25 -0
- package/src/components/invoices/create/locales/sl.ts +26 -1
- package/src/components/invoices/invoices-furs.hooks.ts +4 -1
- package/src/components/invoices/list/list-table.tsx +77 -31
- package/src/components/invoices/list/locales/de.ts +5 -0
- package/src/components/invoices/list/locales/en.ts +4 -0
- package/src/components/invoices/list/locales/es.ts +5 -0
- package/src/components/invoices/list/locales/fr.ts +5 -0
- package/src/components/invoices/list/locales/hr.ts +5 -0
- package/src/components/invoices/list/locales/it.ts +5 -0
- package/src/components/invoices/list/locales/nl.ts +5 -0
- package/src/components/invoices/list/locales/pl.ts +5 -0
- package/src/components/invoices/list/locales/pt.ts +5 -0
- package/src/components/invoices/list/locales/sl.ts +5 -0
- package/src/components/invoices/view/fiscalization-status-card.tsx +44 -24
- package/src/components/items/item-combobox.tsx +5 -3
- package/src/components/items/item-list-table/item-list-header.tsx +4 -17
- package/src/components/items/item-list-table/item-list-table.tsx +3 -3
- package/src/components/items/item-list-table/locales/de.ts +1 -0
- package/src/components/items/item-list-table/locales/es.ts +1 -0
- package/src/components/items/item-list-table/locales/fr.ts +1 -0
- package/src/components/items/item-list-table/locales/hr.ts +1 -0
- package/src/components/items/item-list-table/locales/it.ts +1 -0
- package/src/components/items/item-list-table/locales/nl.ts +1 -0
- package/src/components/items/item-list-table/locales/pl.ts +1 -0
- package/src/components/items/item-list-table/locales/pt.ts +1 -0
- package/src/components/items/item-list-table/locales/sl.ts +1 -0
- package/src/components/payments/list/list-table.tsx +0 -4
- package/src/components/payments/list/locales/de.ts +1 -0
- package/src/components/payments/list/locales/es.ts +1 -0
- package/src/components/payments/list/locales/fr.ts +1 -0
- package/src/components/payments/list/locales/hr.ts +1 -0
- package/src/components/payments/list/locales/it.ts +1 -0
- package/src/components/payments/list/locales/nl.ts +1 -0
- package/src/components/payments/list/locales/pl.ts +1 -0
- package/src/components/payments/list/locales/pt.ts +1 -0
- package/src/components/payments/list/locales/sl.ts +1 -0
- package/src/components/recurring-invoices/list/list-table.tsx +0 -7
- package/src/components/recurring-invoices/list/locales/de.ts +1 -0
- package/src/components/recurring-invoices/list/locales/es.ts +1 -0
- package/src/components/recurring-invoices/list/locales/fr.ts +1 -0
- package/src/components/recurring-invoices/list/locales/hr.ts +1 -0
- package/src/components/recurring-invoices/list/locales/it.ts +1 -0
- package/src/components/recurring-invoices/list/locales/nl.ts +1 -0
- package/src/components/recurring-invoices/list/locales/pl.ts +1 -0
- package/src/components/recurring-invoices/list/locales/pt.ts +1 -0
- package/src/components/recurring-invoices/list/locales/sl.ts +1 -0
- package/src/components/request-logs/request-log-list-table.tsx +0 -3
- package/src/components/table/README.md +14 -121
- package/src/components/table/data-table.tsx +22 -37
- package/src/components/table/hooks/use-table-state.ts +3 -27
- package/src/components/table/index.ts +0 -2
- package/src/components/table/search-input.tsx +17 -0
- package/src/components/table/selection-toolbar.tsx +35 -1
- package/src/components/table/table-empty-state.tsx +6 -3
- package/src/components/table/table-no-results.tsx +10 -5
- package/src/components/table/types.ts +0 -5
- package/src/components/taxes/tax-list-table/locales/de.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/es.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/fr.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/hr.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/it.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/nl.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/pl.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/pt.ts +1 -0
- package/src/components/taxes/tax-list-table/locales/sl.ts +1 -0
- package/src/components/taxes/tax-list-table/tax-list-header.tsx +3 -14
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +3 -3
- package/src/components/ui/popover.tsx +3 -1
- package/src/components/ui/tooltip.tsx +3 -1
- package/src/generated/schemas/advanceinvoice.ts +4 -2
- package/src/generated/schemas/creditnote.ts +2 -1
- package/src/generated/schemas/deliverynote.ts +2 -1
- package/src/generated/schemas/estimate.ts +4 -2
- package/src/generated/schemas/index.ts +1 -1
- package/src/generated/schemas/invoice.ts +2 -1
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +17 -23
- package/src/generated/schemas/rendercreditnotepreview_body.ts +17 -23
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +17 -23
- package/src/generated/schemas/renderestimatepreview_body.ts +17 -23
- package/src/generated/schemas/renderinvoicepreview_body.ts +19 -23
- package/src/hooks/use-duplicate-document.ts +56 -14
- package/src/hooks/use-vies-check.ts +3 -0
- package/src/lib/fiscalization.ts +12 -0
- package/src/lib/schemas/advance-invoice.ts +0 -1
- package/src/components/table/sortable-header.tsx +0 -56
|
@@ -20,6 +20,7 @@ interface DocumentRelationsListProps extends ComponentTranslationProps {
|
|
|
20
20
|
documentRelations?: DocumentRelation[];
|
|
21
21
|
locale?: string;
|
|
22
22
|
onNavigate?: (documentId: string) => void;
|
|
23
|
+
variant?: "card" | "inline";
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
function getDocumentTypeLabel(type: string, t: (key: string) => string): string {
|
|
@@ -55,6 +56,7 @@ export function DocumentRelationsList({
|
|
|
55
56
|
documentRelations,
|
|
56
57
|
locale = "en",
|
|
57
58
|
onNavigate,
|
|
59
|
+
variant = "card",
|
|
58
60
|
...i18nProps
|
|
59
61
|
}: DocumentRelationsListProps) {
|
|
60
62
|
const t = createTranslation({ translations, locale, ...i18nProps });
|
|
@@ -65,6 +67,46 @@ export function DocumentRelationsList({
|
|
|
65
67
|
return null;
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
const bodyContent = (
|
|
71
|
+
<div className="space-y-2">
|
|
72
|
+
{relations.map((relation) => {
|
|
73
|
+
const isSource = relation.source_id === documentId;
|
|
74
|
+
const otherType = isSource ? relation.target_type : relation.source_type;
|
|
75
|
+
const otherId = isSource ? relation.target_id : relation.source_id;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div key={relation.id} className="flex items-center justify-between rounded-md border p-3">
|
|
79
|
+
<div className="flex flex-col gap-0.5">
|
|
80
|
+
<span className="font-medium text-sm">{getDocumentTypeLabel(otherType, t)}</span>
|
|
81
|
+
<span className="text-muted-foreground text-xs">{getRelationLabel(relation.relation_type, t)}</span>
|
|
82
|
+
</div>
|
|
83
|
+
{onNavigate ? (
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
onClick={() => onNavigate(otherId)}
|
|
87
|
+
className="flex items-center gap-1 text-primary text-sm hover:underline"
|
|
88
|
+
>
|
|
89
|
+
<Link2 className="h-3.5 w-3.5" />
|
|
90
|
+
{t("View")}
|
|
91
|
+
</button>
|
|
92
|
+
) : null}
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (variant === "inline") {
|
|
100
|
+
return (
|
|
101
|
+
<div>
|
|
102
|
+
<h3 className="mb-3 font-medium text-sm">
|
|
103
|
+
{t("Linked documents")} ({relations.length})
|
|
104
|
+
</h3>
|
|
105
|
+
{bodyContent}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
68
110
|
return (
|
|
69
111
|
<Card>
|
|
70
112
|
<CardHeader className="pb-3">
|
|
@@ -72,34 +114,7 @@ export function DocumentRelationsList({
|
|
|
72
114
|
{t("Linked documents")} ({relations.length})
|
|
73
115
|
</CardTitle>
|
|
74
116
|
</CardHeader>
|
|
75
|
-
<CardContent>
|
|
76
|
-
<div className="space-y-2">
|
|
77
|
-
{relations.map((relation) => {
|
|
78
|
-
const isSource = relation.source_id === documentId;
|
|
79
|
-
const otherType = isSource ? relation.target_type : relation.source_type;
|
|
80
|
-
const otherId = isSource ? relation.target_id : relation.source_id;
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div key={relation.id} className="flex items-center justify-between rounded-md border p-3">
|
|
84
|
-
<div className="flex flex-col gap-0.5">
|
|
85
|
-
<span className="font-medium text-sm">{getDocumentTypeLabel(otherType, t)}</span>
|
|
86
|
-
<span className="text-muted-foreground text-xs">{getRelationLabel(relation.relation_type, t)}</span>
|
|
87
|
-
</div>
|
|
88
|
-
{onNavigate ? (
|
|
89
|
-
<button
|
|
90
|
-
type="button"
|
|
91
|
-
onClick={() => onNavigate(otherId)}
|
|
92
|
-
className="flex items-center gap-1 text-primary text-sm hover:underline"
|
|
93
|
-
>
|
|
94
|
-
<Link2 className="h-3.5 w-3.5" />
|
|
95
|
-
{t("View")}
|
|
96
|
-
</button>
|
|
97
|
-
) : null}
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
})}
|
|
101
|
-
</div>
|
|
102
|
-
</CardContent>
|
|
117
|
+
<CardContent>{bodyContent}</CardContent>
|
|
103
118
|
</Card>
|
|
104
119
|
);
|
|
105
120
|
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AdvanceInvoice,
|
|
3
|
+
CreditNote,
|
|
4
|
+
DeliveryNote,
|
|
5
|
+
DocumentRelation,
|
|
6
|
+
Estimate,
|
|
7
|
+
Invoice,
|
|
8
|
+
Payment,
|
|
9
|
+
} from "@spaceinvoices/js-sdk";
|
|
10
|
+
import { Card, CardContent } from "@/ui/components/ui/card";
|
|
11
|
+
import { Separator } from "@/ui/components/ui/separator";
|
|
12
|
+
import type { ComponentTranslationProps } from "@/ui/lib/translation";
|
|
13
|
+
import { FiscalizationStatusCard } from "../../invoices/view/fiscalization-status-card";
|
|
14
|
+
import { DocumentActivitiesList } from "./document-activities-list";
|
|
15
|
+
import { DocumentDetailsCard } from "./document-details-card";
|
|
16
|
+
import { DocumentPaymentsList } from "./document-payments-list";
|
|
17
|
+
import { DocumentRelationsList } from "./document-relations-list";
|
|
18
|
+
|
|
19
|
+
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
20
|
+
type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
21
|
+
|
|
22
|
+
interface DocumentSidebarProps extends ComponentTranslationProps {
|
|
23
|
+
document: Document;
|
|
24
|
+
documentType: DocumentType;
|
|
25
|
+
entityId: string;
|
|
26
|
+
locale?: string;
|
|
27
|
+
currentUserId?: string;
|
|
28
|
+
/** Show payments section */
|
|
29
|
+
showPayments?: boolean;
|
|
30
|
+
onAddPayment?: () => void;
|
|
31
|
+
onEditPayment?: (payment: Payment) => void;
|
|
32
|
+
onPaymentDeleteSuccess?: () => void;
|
|
33
|
+
onPaymentDeleteError?: (error: string) => void;
|
|
34
|
+
/** Navigate to a related document */
|
|
35
|
+
onNavigateRelation?: (documentId: string) => void;
|
|
36
|
+
/** FURS fiscalization */
|
|
37
|
+
showFurs?: boolean;
|
|
38
|
+
fursFiscalizationData?: any;
|
|
39
|
+
/** FINA fiscalization */
|
|
40
|
+
showFina?: boolean;
|
|
41
|
+
finaFiscalizationData?: any;
|
|
42
|
+
onRetryFiscalization?: () => void;
|
|
43
|
+
isRetryingFiscalization?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function DocumentSidebar({
|
|
47
|
+
document,
|
|
48
|
+
documentType,
|
|
49
|
+
entityId,
|
|
50
|
+
locale = "en",
|
|
51
|
+
currentUserId,
|
|
52
|
+
showPayments,
|
|
53
|
+
onAddPayment,
|
|
54
|
+
onEditPayment,
|
|
55
|
+
onPaymentDeleteSuccess,
|
|
56
|
+
onPaymentDeleteError,
|
|
57
|
+
onNavigateRelation,
|
|
58
|
+
showFurs,
|
|
59
|
+
fursFiscalizationData,
|
|
60
|
+
showFina,
|
|
61
|
+
finaFiscalizationData,
|
|
62
|
+
onRetryFiscalization,
|
|
63
|
+
isRetryingFiscalization,
|
|
64
|
+
...i18nProps
|
|
65
|
+
}: DocumentSidebarProps) {
|
|
66
|
+
const documentRelations = (document as unknown as { document_relations?: DocumentRelation[] }).document_relations;
|
|
67
|
+
const hasRelations = documentRelations && documentRelations.length > 0;
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Card size="sm">
|
|
71
|
+
<CardContent className="space-y-5">
|
|
72
|
+
<DocumentDetailsCard
|
|
73
|
+
variant="inline"
|
|
74
|
+
document={document}
|
|
75
|
+
documentType={documentType}
|
|
76
|
+
locale={locale}
|
|
77
|
+
{...i18nProps}
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
{showPayments && (
|
|
81
|
+
<>
|
|
82
|
+
<Separator />
|
|
83
|
+
<DocumentPaymentsList
|
|
84
|
+
variant="inline"
|
|
85
|
+
documentId={document.id}
|
|
86
|
+
documentType={documentType as "invoice" | "credit_note" | "advance_invoice"}
|
|
87
|
+
entityId={entityId}
|
|
88
|
+
currencyCode={document.currency_code}
|
|
89
|
+
locale={locale}
|
|
90
|
+
onAddPayment={onAddPayment}
|
|
91
|
+
onEditPayment={onEditPayment}
|
|
92
|
+
onDeleteSuccess={onPaymentDeleteSuccess}
|
|
93
|
+
onDeleteError={onPaymentDeleteError}
|
|
94
|
+
{...i18nProps}
|
|
95
|
+
/>
|
|
96
|
+
</>
|
|
97
|
+
)}
|
|
98
|
+
|
|
99
|
+
{hasRelations && (
|
|
100
|
+
<>
|
|
101
|
+
<Separator />
|
|
102
|
+
<DocumentRelationsList
|
|
103
|
+
variant="inline"
|
|
104
|
+
documentId={document.id}
|
|
105
|
+
documentRelations={documentRelations}
|
|
106
|
+
locale={locale}
|
|
107
|
+
onNavigate={onNavigateRelation}
|
|
108
|
+
{...i18nProps}
|
|
109
|
+
/>
|
|
110
|
+
</>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
<Separator />
|
|
114
|
+
<DocumentActivitiesList
|
|
115
|
+
variant="inline"
|
|
116
|
+
documentId={document.id}
|
|
117
|
+
entityId={entityId}
|
|
118
|
+
currentUserId={currentUserId}
|
|
119
|
+
locale={locale}
|
|
120
|
+
{...i18nProps}
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
{(showFurs || showFina) && (
|
|
124
|
+
<>
|
|
125
|
+
<Separator />
|
|
126
|
+
{showFurs && (
|
|
127
|
+
<FiscalizationStatusCard
|
|
128
|
+
variant="inline"
|
|
129
|
+
fiscalizationType="furs"
|
|
130
|
+
fiscalizationData={fursFiscalizationData}
|
|
131
|
+
onRetry={onRetryFiscalization}
|
|
132
|
+
isRetrying={isRetryingFiscalization}
|
|
133
|
+
locale={locale}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
{showFina && (
|
|
137
|
+
<FiscalizationStatusCard
|
|
138
|
+
variant="inline"
|
|
139
|
+
fiscalizationType="fina"
|
|
140
|
+
fiscalizationData={finaFiscalizationData}
|
|
141
|
+
onRetry={onRetryFiscalization}
|
|
142
|
+
isRetrying={isRetryingFiscalization}
|
|
143
|
+
locale={locale}
|
|
144
|
+
/>
|
|
145
|
+
)}
|
|
146
|
+
</>
|
|
147
|
+
)}
|
|
148
|
+
</CardContent>
|
|
149
|
+
</Card>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -2,4 +2,6 @@ export { DocumentActionsBar } from "./document-actions-bar";
|
|
|
2
2
|
export { DocumentActivitiesList } from "./document-activities-list";
|
|
3
3
|
export { DocumentDetailsCard } from "./document-details-card";
|
|
4
4
|
export { DocumentPaymentsList } from "./document-payments-list";
|
|
5
|
+
export { DocumentRelationsList } from "./document-relations-list";
|
|
6
|
+
export { DocumentSidebar } from "./document-sidebar";
|
|
5
7
|
export { useDocumentDownload } from "./use-document-download";
|
|
@@ -20,10 +20,12 @@ export default {
|
|
|
20
20
|
"Duplicate estimate": "Angebot duplizieren",
|
|
21
21
|
"Duplicate credit_note": "Gutschrift duplizieren",
|
|
22
22
|
"Duplicate advance_invoice": "Anzahlungsrechnung duplizieren",
|
|
23
|
+
"Duplicate delivery_note": "Lieferschein duplizieren",
|
|
23
24
|
"Create invoice": "Rechnung erstellen",
|
|
24
25
|
"Create estimate": "Angebot erstellen",
|
|
25
26
|
"Create credit_note": "Gutschrift erstellen",
|
|
26
27
|
"Create advance_invoice": "Anzahlungsrechnung erstellen",
|
|
28
|
+
"Create delivery_note": "Lieferschein erstellen",
|
|
27
29
|
|
|
28
30
|
// Details card
|
|
29
31
|
Details: "Details",
|
|
@@ -36,6 +38,7 @@ export default {
|
|
|
36
38
|
Customer: "Kunde",
|
|
37
39
|
Subtotal: "Zwischensumme",
|
|
38
40
|
Tax: "Steuer",
|
|
41
|
+
of: "von",
|
|
39
42
|
Total: "Gesamt",
|
|
40
43
|
Paid: "Bezahlt",
|
|
41
44
|
Due: "Offen",
|
|
@@ -106,6 +109,7 @@ export default {
|
|
|
106
109
|
Pending: "Ausstehend",
|
|
107
110
|
Failed: "Fehlgeschlagen",
|
|
108
111
|
Skipped: "Übersprungen",
|
|
112
|
+
"Skipped by user": "Vom Benutzer übersprungen",
|
|
109
113
|
"Retry fiscalization": "Fiskalisierung wiederholen",
|
|
110
114
|
|
|
111
115
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Duplicar presupuesto",
|
|
20
20
|
"Duplicate credit_note": "Duplicar nota de crédito",
|
|
21
21
|
"Duplicate advance_invoice": "Duplicar factura anticipada",
|
|
22
|
+
"Duplicate delivery_note": "Duplicar albarán",
|
|
22
23
|
"Create invoice": "Crear factura",
|
|
23
24
|
"Create estimate": "Crear presupuesto",
|
|
24
25
|
"Create credit_note": "Crear nota de crédito",
|
|
25
26
|
"Create advance_invoice": "Crear factura anticipada",
|
|
27
|
+
"Create delivery_note": "Crear albarán",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Detalles",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Cliente",
|
|
36
38
|
Subtotal: "Subtotal",
|
|
37
39
|
Tax: "Impuesto",
|
|
40
|
+
of: "de",
|
|
38
41
|
Total: "Total",
|
|
39
42
|
Paid: "Pagado",
|
|
40
43
|
Due: "Pendiente",
|
|
@@ -104,6 +107,7 @@ export default {
|
|
|
104
107
|
Pending: "Pendiente",
|
|
105
108
|
Failed: "Fallido",
|
|
106
109
|
Skipped: "Omitido",
|
|
110
|
+
"Skipped by user": "Omitido por el usuario",
|
|
107
111
|
"Retry fiscalization": "Reintentar fiscalización",
|
|
108
112
|
|
|
109
113
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Dupliquer le devis",
|
|
20
20
|
"Duplicate credit_note": "Dupliquer l'avoir",
|
|
21
21
|
"Duplicate advance_invoice": "Dupliquer la facture d'acompte",
|
|
22
|
+
"Duplicate delivery_note": "Dupliquer le bon de livraison",
|
|
22
23
|
"Create invoice": "Créer une facture",
|
|
23
24
|
"Create estimate": "Créer un devis",
|
|
24
25
|
"Create credit_note": "Créer un avoir",
|
|
25
26
|
"Create advance_invoice": "Créer une facture d'acompte",
|
|
27
|
+
"Create delivery_note": "Créer un bon de livraison",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Détails",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Client",
|
|
36
38
|
Subtotal: "Sous-total",
|
|
37
39
|
Tax: "Taxe",
|
|
40
|
+
of: "de",
|
|
38
41
|
Total: "Total",
|
|
39
42
|
Paid: "Payé",
|
|
40
43
|
Due: "Dû",
|
|
@@ -104,6 +107,7 @@ export default {
|
|
|
104
107
|
Pending: "En attente",
|
|
105
108
|
Failed: "Échoué",
|
|
106
109
|
Skipped: "Ignoré",
|
|
110
|
+
"Skipped by user": "Ignoré par l'utilisateur",
|
|
107
111
|
"Retry fiscalization": "Réessayer la fiscalisation",
|
|
108
112
|
|
|
109
113
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Dupliciraj ponudu",
|
|
20
20
|
"Duplicate credit_note": "Dupliciraj knjižno odobrenje",
|
|
21
21
|
"Duplicate advance_invoice": "Dupliciraj avansni račun",
|
|
22
|
+
"Duplicate delivery_note": "Dupliciraj otpremnicu",
|
|
22
23
|
"Create invoice": "Stvori račun",
|
|
23
24
|
"Create estimate": "Stvori ponudu",
|
|
24
25
|
"Create credit_note": "Stvori knjižno odobrenje",
|
|
25
26
|
"Create advance_invoice": "Stvori avansni račun",
|
|
27
|
+
"Create delivery_note": "Stvori otpremnicu",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Pojedinosti",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Kupac",
|
|
36
38
|
Subtotal: "Međuzbroj",
|
|
37
39
|
Tax: "Porez",
|
|
40
|
+
of: "od",
|
|
38
41
|
Total: "Ukupno",
|
|
39
42
|
Paid: "Plaćeno",
|
|
40
43
|
Due: "Za plaćanje",
|
|
@@ -104,6 +107,7 @@ export default {
|
|
|
104
107
|
Pending: "Na čekanju",
|
|
105
108
|
Failed: "Neuspjelo",
|
|
106
109
|
Skipped: "Preskočeno",
|
|
110
|
+
"Skipped by user": "Korisnik preskočio",
|
|
107
111
|
"Retry fiscalization": "Ponovi fiskalizaciju",
|
|
108
112
|
|
|
109
113
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Duplica preventivo",
|
|
20
20
|
"Duplicate credit_note": "Duplica nota di credito",
|
|
21
21
|
"Duplicate advance_invoice": "Duplica fattura di acconto",
|
|
22
|
+
"Duplicate delivery_note": "Duplica bolla di consegna",
|
|
22
23
|
"Create invoice": "Crea fattura",
|
|
23
24
|
"Create estimate": "Crea preventivo",
|
|
24
25
|
"Create credit_note": "Crea nota di credito",
|
|
25
26
|
"Create advance_invoice": "Crea fattura di acconto",
|
|
27
|
+
"Create delivery_note": "Crea bolla di consegna",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Dettagli",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Cliente",
|
|
36
38
|
Subtotal: "Subtotale",
|
|
37
39
|
Tax: "Imposta",
|
|
40
|
+
of: "di",
|
|
38
41
|
Total: "Totale",
|
|
39
42
|
Paid: "Pagato",
|
|
40
43
|
Due: "Da pagare",
|
|
@@ -104,6 +107,7 @@ export default {
|
|
|
104
107
|
Pending: "In attesa",
|
|
105
108
|
Failed: "Fallito",
|
|
106
109
|
Skipped: "Saltato",
|
|
110
|
+
"Skipped by user": "Saltato dall'utente",
|
|
107
111
|
"Retry fiscalization": "Riprova fiscalizzazione",
|
|
108
112
|
|
|
109
113
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Offerte dupliceren",
|
|
20
20
|
"Duplicate credit_note": "Creditnota dupliceren",
|
|
21
21
|
"Duplicate advance_invoice": "Voorschotfactuur dupliceren",
|
|
22
|
+
"Duplicate delivery_note": "Afleverbon dupliceren",
|
|
22
23
|
"Create invoice": "Factuur aanmaken",
|
|
23
24
|
"Create estimate": "Offerte aanmaken",
|
|
24
25
|
"Create credit_note": "Creditnota aanmaken",
|
|
25
26
|
"Create advance_invoice": "Voorschotfactuur aanmaken",
|
|
27
|
+
"Create delivery_note": "Afleverbon aanmaken",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Details",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Klant",
|
|
36
38
|
Subtotal: "Subtotaal",
|
|
37
39
|
Tax: "Belasting",
|
|
40
|
+
of: "van",
|
|
38
41
|
Total: "Totaal",
|
|
39
42
|
Paid: "Betaald",
|
|
40
43
|
Due: "Openstaand",
|
|
@@ -105,6 +108,7 @@ export default {
|
|
|
105
108
|
Pending: "In behandeling",
|
|
106
109
|
Failed: "Mislukt",
|
|
107
110
|
Skipped: "Overgeslagen",
|
|
111
|
+
"Skipped by user": "Overgeslagen door gebruiker",
|
|
108
112
|
"Retry fiscalization": "Fiscalisatie opnieuw proberen",
|
|
109
113
|
|
|
110
114
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Duplikuj kosztorys",
|
|
20
20
|
"Duplicate credit_note": "Duplikuj notę kredytową",
|
|
21
21
|
"Duplicate advance_invoice": "Duplikuj fakturę zaliczkową",
|
|
22
|
+
"Duplicate delivery_note": "Duplikuj dowód dostawy",
|
|
22
23
|
"Create invoice": "Utwórz fakturę",
|
|
23
24
|
"Create estimate": "Utwórz kosztorys",
|
|
24
25
|
"Create credit_note": "Utwórz notę kredytową",
|
|
25
26
|
"Create advance_invoice": "Utwórz fakturę zaliczkową",
|
|
27
|
+
"Create delivery_note": "Utwórz dowód dostawy",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Szczegóły",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Klient",
|
|
36
38
|
Subtotal: "Suma częściowa",
|
|
37
39
|
Tax: "Podatek",
|
|
40
|
+
of: "z",
|
|
38
41
|
Total: "Razem",
|
|
39
42
|
Paid: "Zapłacono",
|
|
40
43
|
Due: "Do zapłaty",
|
|
@@ -104,6 +107,7 @@ export default {
|
|
|
104
107
|
Pending: "Oczekuje",
|
|
105
108
|
Failed: "Niepowodzenie",
|
|
106
109
|
Skipped: "Pominięto",
|
|
110
|
+
"Skipped by user": "Pominięto przez użytkownika",
|
|
107
111
|
"Retry fiscalization": "Ponów fiskalizację",
|
|
108
112
|
|
|
109
113
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Duplicar orçamento",
|
|
20
20
|
"Duplicate credit_note": "Duplicar nota de crédito",
|
|
21
21
|
"Duplicate advance_invoice": "Duplicar fatura antecipada",
|
|
22
|
+
"Duplicate delivery_note": "Duplicar guia de remessa",
|
|
22
23
|
"Create invoice": "Criar fatura",
|
|
23
24
|
"Create estimate": "Criar orçamento",
|
|
24
25
|
"Create credit_note": "Criar nota de crédito",
|
|
25
26
|
"Create advance_invoice": "Criar fatura antecipada",
|
|
27
|
+
"Create delivery_note": "Criar guia de remessa",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Detalhes",
|
|
@@ -35,6 +37,7 @@ export default {
|
|
|
35
37
|
Customer: "Cliente",
|
|
36
38
|
Subtotal: "Subtotal",
|
|
37
39
|
Tax: "Imposto",
|
|
40
|
+
of: "de",
|
|
38
41
|
Total: "Total",
|
|
39
42
|
Paid: "Pago",
|
|
40
43
|
Due: "Em dívida",
|
|
@@ -104,6 +107,7 @@ export default {
|
|
|
104
107
|
Pending: "Pendente",
|
|
105
108
|
Failed: "Falhado",
|
|
106
109
|
Skipped: "Ignorado",
|
|
110
|
+
"Skipped by user": "Ignorado pelo utilizador",
|
|
107
111
|
"Retry fiscalization": "Tentar novamente fiscalização",
|
|
108
112
|
|
|
109
113
|
// PDF language names
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
"Duplicate estimate": "Podvoji predračun",
|
|
20
20
|
"Duplicate credit_note": "Podvoji dobropis",
|
|
21
21
|
"Duplicate advance_invoice": "Podvoji avansni račun",
|
|
22
|
+
"Duplicate delivery_note": "Podvoji dobavnico",
|
|
22
23
|
"Create invoice": "Ustvari račun",
|
|
23
24
|
"Create estimate": "Ustvari predračun",
|
|
24
25
|
"Create credit_note": "Ustvari dobropis",
|
|
25
26
|
"Create advance_invoice": "Ustvari avansni račun",
|
|
27
|
+
"Create delivery_note": "Ustvari dobavnico",
|
|
26
28
|
|
|
27
29
|
// Details card
|
|
28
30
|
Details: "Podrobnosti",
|
|
@@ -34,7 +36,8 @@ export default {
|
|
|
34
36
|
"Valid until": "Veljavno do",
|
|
35
37
|
Customer: "Stranka",
|
|
36
38
|
Subtotal: "Vmesni seštevek",
|
|
37
|
-
Tax: "
|
|
39
|
+
Tax: "DDV",
|
|
40
|
+
of: "od",
|
|
38
41
|
Total: "Skupaj",
|
|
39
42
|
Paid: "Plačano",
|
|
40
43
|
Due: "Za plačilo",
|
|
@@ -105,6 +108,7 @@ export default {
|
|
|
105
108
|
Pending: "V čakanju",
|
|
106
109
|
Failed: "Neuspešno",
|
|
107
110
|
Skipped: "Preskočeno",
|
|
111
|
+
"Skipped by user": "Uporabnik preskočil",
|
|
108
112
|
"Retry fiscalization": "Ponovi fiskalizacijo",
|
|
109
113
|
|
|
110
114
|
// PDF language names
|
|
@@ -36,9 +36,11 @@ export function useDocumentDownload({
|
|
|
36
36
|
const [isDownloadingEslog, setIsDownloadingEslog] = useState(false);
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Download PDF
|
|
39
|
+
* Download PDF with optional language override for translations
|
|
40
|
+
* Formatting (decimal separators, dates) always uses entity locale.
|
|
41
|
+
* The language param only changes labels/translations on the PDF.
|
|
40
42
|
*/
|
|
41
|
-
const downloadPdf = async (document: Document, documentType: DocumentType,
|
|
43
|
+
const downloadPdf = async (document: Document, documentType: DocumentType, language?: string) => {
|
|
42
44
|
if (!sdk || !activeEntity?.id) {
|
|
43
45
|
onDownloadError?.("Download failed");
|
|
44
46
|
return;
|
|
@@ -51,7 +53,9 @@ export function useDocumentDownload({
|
|
|
51
53
|
// SDK signature: renderPdf(id, params?, SDKMethodOptions?)
|
|
52
54
|
// entity_id goes in SDKMethodOptions (last arg), not params
|
|
53
55
|
// Note: renderPdf is on invoices module but works with any document ID via /documents/{id}/pdf
|
|
54
|
-
|
|
56
|
+
// Don't send locale — entity locale drives formatting. Send language for translation override.
|
|
57
|
+
const params = language ? { language } : {};
|
|
58
|
+
const blob = await sdk.invoices.renderPdf(document.id, params, { entity_id: activeEntity.id });
|
|
55
59
|
const downloadUrl = window.URL.createObjectURL(blob);
|
|
56
60
|
const link = window.document.createElement("a");
|
|
57
61
|
link.href = downloadUrl;
|