@spaceinvoices/react-ui 0.4.8 → 0.4.11
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/README.md +24 -8
- package/cli/dist/index.js +89 -26
- package/package.json +4 -1
- package/spaceinvoices.schema.json +6 -1
- package/src/common/autocomplete.tsx +69 -6
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +124 -285
- package/src/components/advance-invoices/list/list-table.tsx +10 -3
- package/src/components/advance-invoices/list/locales/de.ts +2 -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/advance-invoices/list/use-advance-invoice-download.ts +1 -12
- package/src/components/credit-notes/create/create-credit-note-form.tsx +116 -238
- package/src/components/credit-notes/list/list-table.tsx +6 -3
- package/src/components/credit-notes/list/use-credit-note-download.ts +1 -12
- package/src/components/customers/customer-autocomplete.tsx +64 -11
- package/src/components/customers/customer-list-table/customer-list-table.tsx +3 -2
- package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +9 -1
- package/src/components/dashboard/collection-rate-card/locales/bg.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/cs.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/et.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/fi.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/is.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/nb.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/sk.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/sv.ts +3 -0
- package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +10 -2
- package/src/components/dashboard/invoice-status-chart/locales/bg.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/cs.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/de.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/es.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/et.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/fi.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/fr.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/hr.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/is.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/it.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/nb.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/nl.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/pl.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/pt.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/sk.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/sl.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/sv.ts +10 -0
- package/src/components/dashboard/payment-methods-chart/locales/bg.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/cs.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/et.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/fi.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/is.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/nb.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/sk.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/sv.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +9 -1
- package/src/components/dashboard/payment-trend-chart/locales/bg.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/cs.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/de.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/es.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/et.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/fi.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/fr.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/hr.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/is.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/it.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/nb.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/nl.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/pl.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/pt.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/sk.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/sl.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/sv.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +15 -8
- package/src/components/dashboard/revenue-trend-chart/locales/bg.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/cs.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/de.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/es.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/et.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/fi.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/fr.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/hr.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/is.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/it.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/nb.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/nl.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/pl.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/pt.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sk.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sl.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sv.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +15 -8
- package/src/components/dashboard/tax-collected-card/locales.ts +110 -0
- package/src/components/dashboard/tax-collected-card/tax-collected-card.tsx +8 -2
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +4 -4
- package/src/components/dashboard/top-customers-chart/locales/bg.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/cs.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/de.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/es.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/et.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/fi.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/fr.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/hr.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/is.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/it.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/nb.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/nl.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/pl.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/pt.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/sk.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/sl.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/sv.ts +7 -0
- package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +23 -12
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +33 -20
- package/src/components/delivery-notes/list/list-table.tsx +22 -13
- package/src/components/delivery-notes/list/locales/de.ts +2 -0
- package/src/components/delivery-notes/list/locales/en.ts +1 -0
- package/src/components/delivery-notes/list/locales/es.ts +1 -0
- package/src/components/delivery-notes/list/locales/fr.ts +1 -0
- package/src/components/delivery-notes/list/locales/hr.ts +1 -0
- package/src/components/delivery-notes/list/locales/it.ts +1 -0
- package/src/components/delivery-notes/list/locales/nl.ts +1 -0
- package/src/components/delivery-notes/list/locales/pl.ts +1 -0
- package/src/components/delivery-notes/list/locales/pt.ts +1 -0
- package/src/components/delivery-notes/list/locales/sl.ts +1 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +1 -12
- package/src/components/documents/create/document-add-item-form.tsx +28 -16
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +12 -2
- package/src/components/documents/create/document-items-section.tsx +70 -39
- package/src/components/documents/create/document-recipient-section.tsx +10 -1
- package/src/components/documents/create/live-preview.tsx +113 -15
- package/src/components/documents/create/prepare-document-submission.ts +35 -16
- package/src/components/documents/create/use-document-customer-form.ts +14 -3
- package/src/components/documents/documents.hooks.ts +7 -2
- package/src/components/documents/shared/document-preview-display.tsx +136 -67
- package/src/components/documents/shared/scaled-document-preview.tsx +45 -5
- package/src/components/documents/view/document-actions-bar.tsx +284 -182
- package/src/components/documents/view/document-activities-list.tsx +3 -0
- package/src/components/documents/view/document-payments-list.tsx +3 -0
- package/src/components/documents/view/locales/de.ts +8 -0
- package/src/components/documents/view/locales/es.ts +8 -0
- package/src/components/documents/view/locales/fr.ts +8 -0
- package/src/components/documents/view/locales/hr.ts +8 -0
- package/src/components/documents/view/locales/it.ts +8 -0
- package/src/components/documents/view/locales/nl.ts +8 -0
- package/src/components/documents/view/locales/pl.ts +8 -0
- package/src/components/documents/view/locales/pt.ts +8 -0
- package/src/components/documents/view/locales/sl.ts +8 -0
- package/src/components/documents/view/use-document-download.ts +14 -25
- package/src/components/entities/create-entity-form.tsx +101 -16
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +10 -10
- 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-operator-required-dialog.tsx +3 -3
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +78 -124
- package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +8 -1
- package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +14 -2
- package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +7 -2
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +56 -130
- package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +8 -1
- package/src/components/entities/furs-settings-form/sections/enable-fiscalization-section.tsx +1 -0
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +15 -2
- package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +20 -3
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +38 -12
- package/src/components/entities/settings/defaults-settings-form.tsx +6 -6
- package/src/components/entities/settings/eslog-settings-form.tsx +13 -1
- package/src/components/entities/settings/pdf-template-selector/demo-invoice-data.ts +3 -22
- package/src/components/entities/shared/fiscalization-step-flow.ts +77 -0
- package/src/components/entities/shared/fiscalization-step-tabs.tsx +71 -0
- package/src/components/estimates/create/create-estimate-form.tsx +34 -21
- package/src/components/estimates/list/list-table.tsx +23 -14
- 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 +1 -0
- package/src/components/estimates/list/locales/fr.ts +1 -0
- package/src/components/estimates/list/locales/hr.ts +1 -0
- package/src/components/estimates/list/locales/it.ts +1 -0
- package/src/components/estimates/list/locales/nl.ts +1 -0
- package/src/components/estimates/list/locales/pl.ts +1 -0
- package/src/components/estimates/list/locales/pt.ts +1 -0
- package/src/components/estimates/list/locales/sl.ts +1 -0
- package/src/components/estimates/list/use-estimate-download.ts +1 -12
- package/src/components/export/document-export-form.tsx +33 -7
- package/src/components/export/sales-per-item-export-form.tsx +23 -7
- package/src/components/invoices/create/create-invoice-form.tsx +295 -329
- package/src/components/invoices/create/prepare-invoice-submission.ts +0 -8
- package/src/components/invoices/list/list-table.tsx +7 -4
- package/src/components/invoices/list/use-invoice-download.ts +1 -11
- package/src/components/invoices/send-email-dialog/locales/de.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +20 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +20 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +77 -8
- package/src/components/invoices/view/eslog-info-display.tsx +17 -1
- package/src/components/invoices/view/fiscalization-status-card.tsx +7 -3
- package/src/components/items/item-combobox.tsx +26 -6
- package/src/components/items/item-list-table/item-list-table.tsx +5 -2
- package/src/components/payments/create-payment-form/index.ts +1 -0
- package/src/components/payments/list/list-table.tsx +14 -4
- package/src/components/recurring-invoices/list/list-table.tsx +7 -4
- package/src/components/request-logs/locales.ts +412 -0
- package/src/components/request-logs/request-log-detail.tsx +37 -21
- package/src/components/request-logs/request-log-list-table.tsx +57 -11
- package/src/components/table/data-table.tsx +5 -2
- package/src/components/table/date-cell.tsx +3 -1
- package/src/components/table/filter-bar.tsx +14 -2
- package/src/components/table/hooks/use-table-query.ts +1 -1
- package/src/components/table/locales.ts +1116 -0
- package/src/components/table/search-input.tsx +12 -3
- package/src/components/table/selection-toolbar.tsx +23 -6
- package/src/components/table/table-empty-state.tsx +43 -3
- package/src/components/table/table-no-results.tsx +3 -3
- package/src/components/table/table-pagination.tsx +4 -3
- package/src/components/table/types.ts +1 -0
- package/src/components/tax-reports/index.ts +1 -0
- package/src/components/tax-reports/kir-export-form.tsx +46 -8
- package/src/components/tax-reports/slovenia-tax-profile-step.tsx +191 -0
- package/src/components/tax-reports/slovenia-yearly-export-form.tsx +509 -0
- package/src/components/tax-reports/slovenia-yearly-review-step.tsx +253 -0
- package/src/components/tax-reports/slovenia-yearly-summary.tsx +19 -0
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +3 -2
- package/src/components/ui/sidebar.tsx +3 -2
- package/src/components/ui/sticky-form-footer.tsx +7 -1
- package/src/components/webhook-logs/index.ts +6 -0
- package/src/components/webhook-logs/locales.ts +392 -0
- package/src/components/webhook-logs/webhook-delivery-detail.tsx +255 -0
- package/src/components/webhook-logs/webhook-delivery-list-table.tsx +278 -0
- package/src/components/wl-subscription/index.ts +1 -0
- package/src/components/wl-subscription/locked-feature.tsx +1 -0
- package/src/components/wl-subscription/paywall.tsx +193 -0
- package/src/components/wl-subscription/upgrade-modal.tsx +93 -29
- package/src/generate-schemas.ts +12 -7
- package/src/generated/schemas/customer.ts +2 -0
- package/src/generated/schemas/entity.ts +134 -0
- package/src/generated/schemas/exportsloveniayearlynormiranireport_body.ts +27 -0
- package/src/generated/schemas/index.ts +2 -0
- package/src/generated/schemas/me.ts +20 -1
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +40 -34
- package/src/generated/schemas/rendercreditnotepreview_body.ts +42 -36
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +23 -13
- package/src/generated/schemas/renderestimatepreview_body.ts +23 -13
- package/src/generated/schemas/renderinvoicepreview_body.ts +40 -34
- package/src/generated/schemas/sendemail_body.ts +44 -0
- package/src/generated/schemas/sloveniataxprofile.ts +42 -0
- package/src/generated/schemas/startpdfexport_body.ts +91 -1
- package/src/generated/schemas/webhook.ts +10 -0
- package/src/hooks/use-duplicate-document.ts +51 -13
- package/src/hooks/use-eslog-validation.ts +59 -0
- package/src/hooks/use-premise-selection.ts +186 -0
- package/src/lib/browser-cookies.ts +4 -4
- package/src/lib/date-fns-locale.ts +48 -0
- package/src/lib/fiscalization-options.ts +81 -0
- package/src/lib/locale.ts +38 -0
- package/src/lib/template-variables.tsx +1 -1
- package/src/lib/translation.ts +14 -3
- package/src/providers/entities-context.tsx +1 -0
- package/src/providers/entities-provider.tsx +102 -3
- package/src/providers/form-footer-context.tsx +37 -4
- package/src/providers/sdk-provider.tsx +7 -2
- package/src/providers/white-label-provider.tsx +4 -1
- package/src/providers/wl-subscription-provider.tsx +90 -3
|
@@ -35,19 +35,8 @@ export function useCreditNoteDownload({
|
|
|
35
35
|
onDownloadStart?.();
|
|
36
36
|
|
|
37
37
|
try {
|
|
38
|
-
// SDK signature: renderPdf(id, params?, SDKMethodOptions?)
|
|
39
|
-
// entity_id goes in SDKMethodOptions (last arg), not params
|
|
40
|
-
// Note: renderPdf is on invoices module but works with any document ID
|
|
41
|
-
const blob = await sdk.invoices.renderPdf(creditNote.id, {}, { entity_id: activeEntity.id });
|
|
42
|
-
const downloadUrl = window.URL.createObjectURL(blob);
|
|
43
|
-
const link = document.createElement("a");
|
|
44
|
-
link.href = downloadUrl;
|
|
45
38
|
const fileName = `${t("Credit Note")} ${creditNote.number}.pdf`;
|
|
46
|
-
|
|
47
|
-
document.body.appendChild(link);
|
|
48
|
-
link.click();
|
|
49
|
-
document.body.removeChild(link);
|
|
50
|
-
window.URL.revokeObjectURL(downloadUrl);
|
|
39
|
+
await sdk.invoices.downloadPdf(creditNote.id, fileName, {}, { entity_id: activeEntity.id });
|
|
51
40
|
|
|
52
41
|
onDownloadSuccess?.(fileName);
|
|
53
42
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Customer } from "@spaceinvoices/js-sdk";
|
|
2
2
|
|
|
3
3
|
import { Plus } from "lucide-react";
|
|
4
|
-
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
|
|
6
6
|
import { Autocomplete } from "@/ui/common/autocomplete";
|
|
7
7
|
import { useDebounce } from "@/ui/hooks/use-debounce";
|
|
@@ -17,7 +17,9 @@ const truncateText = (text: string, maxLength: number = MAX_TEXT_LENGTH): string
|
|
|
17
17
|
type CustomerAutocompleteProps = {
|
|
18
18
|
entityId: string;
|
|
19
19
|
value?: string | null;
|
|
20
|
+
committedDisplayName?: string;
|
|
20
21
|
onValueChange?: (value: string, customer: Customer) => void;
|
|
22
|
+
onCommitInlineName?: (value: string) => void;
|
|
21
23
|
onClear?: () => void;
|
|
22
24
|
placeholder?: string;
|
|
23
25
|
className?: string;
|
|
@@ -25,20 +27,29 @@ type CustomerAutocompleteProps = {
|
|
|
25
27
|
onBlur?: () => void; // Added onBlur prop
|
|
26
28
|
/** Initial display name when pre-populating with a customer (e.g., for duplication) */
|
|
27
29
|
initialDisplayName?: string;
|
|
30
|
+
inputTestId?: string;
|
|
31
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
32
|
+
commitOnBlurMode?: "none" | "create" | "update-inline";
|
|
28
33
|
};
|
|
29
34
|
|
|
30
35
|
export function CustomerAutocomplete({
|
|
31
36
|
entityId,
|
|
32
37
|
value,
|
|
38
|
+
committedDisplayName,
|
|
33
39
|
onValueChange,
|
|
40
|
+
onCommitInlineName,
|
|
34
41
|
placeholder = "Name",
|
|
35
42
|
className,
|
|
36
43
|
disabled,
|
|
37
44
|
onBlur: onBlurPropFromParent, // Destructure the onBlur prop from parent
|
|
38
45
|
initialDisplayName,
|
|
46
|
+
inputTestId,
|
|
47
|
+
inputRef,
|
|
48
|
+
commitOnBlurMode = "none",
|
|
39
49
|
}: CustomerAutocompleteProps) {
|
|
40
50
|
const [search, setSearch] = useState(initialDisplayName || "");
|
|
41
51
|
const [displayValue, setDisplayValue] = useState(initialDisplayName || "");
|
|
52
|
+
const preserveSearchOnClearRef = useRef(false);
|
|
42
53
|
const debouncedSearch = useDebounce(search, 300);
|
|
43
54
|
|
|
44
55
|
const handleSearch = (value: string) => {
|
|
@@ -137,22 +148,59 @@ export function CustomerAutocomplete({
|
|
|
137
148
|
}
|
|
138
149
|
};
|
|
139
150
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
const commitCustomerName = (customerName: string) => {
|
|
152
|
+
const trimmedName = customerName.trim();
|
|
153
|
+
if (!trimmedName) return;
|
|
154
|
+
|
|
155
|
+
if (commitOnBlurMode === "update-inline") {
|
|
156
|
+
onCommitInlineName?.(trimmedName);
|
|
157
|
+
const truncatedName = truncateText(trimmedName);
|
|
158
|
+
setSearch(truncatedName);
|
|
159
|
+
setDisplayValue(truncatedName);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (onValueChange) {
|
|
164
|
+
onValueChange("", {
|
|
165
|
+
name: trimmedName,
|
|
166
|
+
address: null,
|
|
167
|
+
address_2: null,
|
|
168
|
+
post_code: null,
|
|
169
|
+
city: null,
|
|
170
|
+
state: null,
|
|
171
|
+
country: null,
|
|
172
|
+
tax_number: null,
|
|
173
|
+
} as Customer);
|
|
145
174
|
}
|
|
146
|
-
|
|
175
|
+
|
|
176
|
+
const truncatedName = truncateText(trimmedName);
|
|
177
|
+
setSearch(truncatedName);
|
|
178
|
+
setDisplayValue(truncatedName);
|
|
147
179
|
};
|
|
148
180
|
|
|
149
|
-
|
|
181
|
+
const handleBlur = () => {
|
|
182
|
+
onBlurPropFromParent?.();
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Sync visible input when committed customer state changes externally
|
|
150
186
|
useEffect(() => {
|
|
151
|
-
if (
|
|
152
|
-
|
|
187
|
+
if (value) {
|
|
188
|
+
const nextDisplayValue = committedDisplayName || initialDisplayName || "";
|
|
189
|
+
if (nextDisplayValue) {
|
|
190
|
+
setSearch(nextDisplayValue);
|
|
191
|
+
setDisplayValue(nextDisplayValue);
|
|
192
|
+
}
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (!committedDisplayName) {
|
|
197
|
+
if (!preserveSearchOnClearRef.current) {
|
|
198
|
+
setSearch("");
|
|
199
|
+
}
|
|
200
|
+
preserveSearchOnClearRef.current = false;
|
|
153
201
|
setDisplayValue("");
|
|
154
202
|
}
|
|
155
|
-
}, [value]);
|
|
203
|
+
}, [committedDisplayName, initialDisplayName, value]);
|
|
156
204
|
|
|
157
205
|
return (
|
|
158
206
|
<Autocomplete
|
|
@@ -160,6 +208,8 @@ export function CustomerAutocomplete({
|
|
|
160
208
|
onSearch={handleSearch}
|
|
161
209
|
value={value ?? undefined}
|
|
162
210
|
onValueChange={handleValueChange}
|
|
211
|
+
onCommitUnselectedInput={commitCustomerName}
|
|
212
|
+
commitUnselectedOnBlur={commitOnBlurMode !== "none"}
|
|
163
213
|
onBlur={handleBlur} // Pass the new handleBlur to Autocomplete
|
|
164
214
|
options={options}
|
|
165
215
|
placeholder={placeholder}
|
|
@@ -168,6 +218,9 @@ export function CustomerAutocomplete({
|
|
|
168
218
|
loading={isLoading}
|
|
169
219
|
emptyText={debouncedSearch ? "No customers found" : "Recent customers"}
|
|
170
220
|
displayValue={displayValue}
|
|
221
|
+
inputTestId={inputTestId}
|
|
222
|
+
committedDisplayValue={committedDisplayName}
|
|
223
|
+
inputRef={inputRef}
|
|
171
224
|
/>
|
|
172
225
|
);
|
|
173
226
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Customer } from "@spaceinvoices/js-sdk";
|
|
2
2
|
import { User } from "lucide-react";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
+
import { withTableTranslations } from "../../table/locales";
|
|
4
5
|
import { Button } from "@/ui/components/ui/button";
|
|
5
6
|
import { createTranslation } from "@/ui/lib/translation";
|
|
6
7
|
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
@@ -20,7 +21,7 @@ import pl from "./locales/pl";
|
|
|
20
21
|
import pt from "./locales/pt";
|
|
21
22
|
import sl from "./locales/sl";
|
|
22
23
|
|
|
23
|
-
const translations = {
|
|
24
|
+
const translations = withTableTranslations({
|
|
24
25
|
en,
|
|
25
26
|
sl,
|
|
26
27
|
de,
|
|
@@ -31,7 +32,7 @@ const translations = {
|
|
|
31
32
|
nl,
|
|
32
33
|
pl,
|
|
33
34
|
hr,
|
|
34
|
-
} as const;
|
|
35
|
+
} as const);
|
|
35
36
|
|
|
36
37
|
type CustomerListTableProps = {
|
|
37
38
|
t?: (key: string) => string;
|
|
@@ -3,18 +3,26 @@
|
|
|
3
3
|
import { Card, CardContent, CardHeader, CardTitle } from "@/ui/components/ui/card";
|
|
4
4
|
import { createTranslation } from "@/ui/lib/translation";
|
|
5
5
|
import { LoadingCard } from "../loading-card";
|
|
6
|
+
import bg from "./locales/bg";
|
|
7
|
+
import cs from "./locales/cs";
|
|
6
8
|
import de from "./locales/de";
|
|
9
|
+
import et from "./locales/et";
|
|
7
10
|
import es from "./locales/es";
|
|
11
|
+
import fi from "./locales/fi";
|
|
8
12
|
import fr from "./locales/fr";
|
|
9
13
|
import hr from "./locales/hr";
|
|
14
|
+
import is from "./locales/is";
|
|
10
15
|
import it from "./locales/it";
|
|
16
|
+
import nb from "./locales/nb";
|
|
11
17
|
import nl from "./locales/nl";
|
|
12
18
|
import pl from "./locales/pl";
|
|
13
19
|
import pt from "./locales/pt";
|
|
20
|
+
import sk from "./locales/sk";
|
|
14
21
|
import sl from "./locales/sl";
|
|
22
|
+
import sv from "./locales/sv";
|
|
15
23
|
import { useCollectionRateData } from "./use-collection-rate";
|
|
16
24
|
|
|
17
|
-
const translations = { de, es, fr, hr, it, nl, pl, pt, sl } as const;
|
|
25
|
+
const translations = { bg, cs, de, et, es, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } as const;
|
|
18
26
|
|
|
19
27
|
type BaseProps = {
|
|
20
28
|
locale?: string;
|
|
@@ -13,18 +13,26 @@ import {
|
|
|
13
13
|
import { createTranslation } from "@/ui/lib/translation";
|
|
14
14
|
import { ChartEmptyState } from "../chart-empty-state";
|
|
15
15
|
import { LoadingCard } from "../loading-card";
|
|
16
|
+
import bg from "./locales/bg";
|
|
17
|
+
import cs from "./locales/cs";
|
|
16
18
|
import de from "./locales/de";
|
|
19
|
+
import et from "./locales/et";
|
|
17
20
|
import es from "./locales/es";
|
|
21
|
+
import fi from "./locales/fi";
|
|
18
22
|
import fr from "./locales/fr";
|
|
19
23
|
import hr from "./locales/hr";
|
|
24
|
+
import is from "./locales/is";
|
|
20
25
|
import it from "./locales/it";
|
|
26
|
+
import nb from "./locales/nb";
|
|
21
27
|
import nl from "./locales/nl";
|
|
22
28
|
import pl from "./locales/pl";
|
|
23
29
|
import pt from "./locales/pt";
|
|
30
|
+
import sk from "./locales/sk";
|
|
24
31
|
import sl from "./locales/sl";
|
|
32
|
+
import sv from "./locales/sv";
|
|
25
33
|
import { useInvoiceStatusData } from "./use-invoice-status";
|
|
26
34
|
|
|
27
|
-
const translations = { de, es, fr, hr, it, nl, pl, pt, sl } as const;
|
|
35
|
+
const translations = { bg, cs, de, et, es, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } as const;
|
|
28
36
|
|
|
29
37
|
export type InvoiceStatusChartData = {
|
|
30
38
|
paid: number;
|
|
@@ -115,7 +123,7 @@ export function InvoiceStatusChart(props: InvoiceStatusChartProps) {
|
|
|
115
123
|
<Cell key={entry.name} fill={entry.fill} />
|
|
116
124
|
))}
|
|
117
125
|
</Pie>
|
|
118
|
-
<ChartTooltip content={<ChartTooltipContent nameKey="name" formatter={(value) => `${value}
|
|
126
|
+
<ChartTooltip content={<ChartTooltipContent nameKey="name" formatter={(value) => `${value} ${t("Invoices")}`} />} />
|
|
119
127
|
<ChartLegend
|
|
120
128
|
content={<ChartLegendContent nameKey="name" />}
|
|
121
129
|
className="-translate-y-2 flex-wrap gap-2 [&>*]:basis-1/4 [&>*]:justify-center"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Статус на фактури",
|
|
3
|
+
"Breakdown of invoices by payment status": "Разбивка на фактурите по статус на плащане",
|
|
4
|
+
"Paid": "Платени",
|
|
5
|
+
"Pending": "Очакващи",
|
|
6
|
+
"Overdue": "Просрочени",
|
|
7
|
+
"Voided": "Анулирани",
|
|
8
|
+
"No data available": "Няма налични данни",
|
|
9
|
+
"Invoices": "Фактури",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Stav faktur",
|
|
3
|
+
"Breakdown of invoices by payment status": "Rozdělení faktur podle stavu platby",
|
|
4
|
+
"Paid": "Uhrazené",
|
|
5
|
+
"Pending": "Čekající",
|
|
6
|
+
"Overdue": "Po splatnosti",
|
|
7
|
+
"Voided": "Stornované",
|
|
8
|
+
"No data available": "Žádná data k dispozici",
|
|
9
|
+
"Invoices": "Faktury",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Arvete olek",
|
|
3
|
+
"Breakdown of invoices by payment status": "Arvete jaotus makse oleku järgi",
|
|
4
|
+
"Paid": "Makstud",
|
|
5
|
+
"Pending": "Ootel",
|
|
6
|
+
"Overdue": "Üle tähtaja",
|
|
7
|
+
"Voided": "Tühistatud",
|
|
8
|
+
"No data available": "Andmed puuduvad",
|
|
9
|
+
"Invoices": "Arved",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Invoice Status",
|
|
3
|
+
"Breakdown of invoices by payment status": "Breakdown of invoices by payment status",
|
|
4
|
+
"Paid": "Paid",
|
|
5
|
+
"Pending": "Pending",
|
|
6
|
+
"Overdue": "Overdue",
|
|
7
|
+
"Voided": "Voided",
|
|
8
|
+
"No data available": "No data available",
|
|
9
|
+
"Invoices": "Invoices",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Staða reikninga",
|
|
3
|
+
"Breakdown of invoices by payment status": "Sundurliðun reikninga eftir greiðslustöðu",
|
|
4
|
+
"Paid": "Greiddur",
|
|
5
|
+
"Pending": "Í bið",
|
|
6
|
+
"Overdue": "Á gjalddaga",
|
|
7
|
+
"Voided": "Ógildur",
|
|
8
|
+
"No data available": "Engin gögn tiltæk",
|
|
9
|
+
"Invoices": "Reikningar",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Fakturastatus",
|
|
3
|
+
"Breakdown of invoices by payment status": "Fordeling av fakturaer etter betalingsstatus",
|
|
4
|
+
"Paid": "Betalt",
|
|
5
|
+
"Pending": "Venter",
|
|
6
|
+
"Overdue": "Forfalt",
|
|
7
|
+
"Voided": "Annullert",
|
|
8
|
+
"No data available": "Ingen data tilgjengelig",
|
|
9
|
+
"Invoices": "Fakturaer",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Stav faktúr",
|
|
3
|
+
"Breakdown of invoices by payment status": "Rozdelenie faktúr podľa stavu platby",
|
|
4
|
+
"Paid": "Zaplatené",
|
|
5
|
+
"Pending": "Čakajúce",
|
|
6
|
+
"Overdue": "Po splatnosti",
|
|
7
|
+
"Voided": "Stornované",
|
|
8
|
+
"No data available": "Žiadne dostupné údaje",
|
|
9
|
+
"Invoices": "Faktúry",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Invoice Status": "Fakturastatus",
|
|
3
|
+
"Breakdown of invoices by payment status": "Fördelning av fakturor efter betalningsstatus",
|
|
4
|
+
"Paid": "Betald",
|
|
5
|
+
"Pending": "Väntande",
|
|
6
|
+
"Overdue": "Förfallen",
|
|
7
|
+
"Voided": "Makulerad",
|
|
8
|
+
"No data available": "Ingen data tillgänglig",
|
|
9
|
+
"Invoices": "Fakturor",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Методи на плащане",
|
|
3
|
+
"Breakdown of payments by method": "Разбивка на плащанията по метод",
|
|
4
|
+
"Cash": "В брой",
|
|
5
|
+
"Bank Transfer": "Банков превод",
|
|
6
|
+
"Card": "Карта",
|
|
7
|
+
"Check": "Чек",
|
|
8
|
+
"Credit Note": "Кредитно известие",
|
|
9
|
+
"Advance": "Авансова фактура",
|
|
10
|
+
"Other": "Друго",
|
|
11
|
+
"No data available": "Няма налични данни",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Způsoby platby",
|
|
3
|
+
"Breakdown of payments by method": "Rozdělení plateb podle způsobu",
|
|
4
|
+
"Cash": "Hotovost",
|
|
5
|
+
"Bank Transfer": "Bankovní převod",
|
|
6
|
+
"Card": "Karta",
|
|
7
|
+
"Check": "Šek",
|
|
8
|
+
"Credit Note": "Dobropis",
|
|
9
|
+
"Advance": "Zálohová faktura",
|
|
10
|
+
"Other": "Jiné",
|
|
11
|
+
"No data available": "Žádná data k dispozici",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Makseviisid",
|
|
3
|
+
"Breakdown of payments by method": "Maksete jaotus viisi järgi",
|
|
4
|
+
"Cash": "Sularaha",
|
|
5
|
+
"Bank Transfer": "Pangaülekanne",
|
|
6
|
+
"Card": "Kaart",
|
|
7
|
+
"Check": "Tšekk",
|
|
8
|
+
"Credit Note": "Kreeditarve",
|
|
9
|
+
"Advance": "Ettemaksuarve",
|
|
10
|
+
"Other": "Muu",
|
|
11
|
+
"No data available": "Andmed puuduvad",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Payment Methods",
|
|
3
|
+
"Breakdown of payments by method": "Breakdown of payments by method",
|
|
4
|
+
"Cash": "Cash",
|
|
5
|
+
"Bank Transfer": "Bank Transfer",
|
|
6
|
+
"Card": "Card",
|
|
7
|
+
"Check": "Check",
|
|
8
|
+
"Credit Note": "Credit Note",
|
|
9
|
+
"Advance": "Advance Invoice",
|
|
10
|
+
"Other": "Other",
|
|
11
|
+
"No data available": "No data available",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Greiðslumátar",
|
|
3
|
+
"Breakdown of payments by method": "Sundurliðun greiðslna eftir máta",
|
|
4
|
+
"Cash": "Reiðufé",
|
|
5
|
+
"Bank Transfer": "Bankamillifærsla",
|
|
6
|
+
"Card": "Kort",
|
|
7
|
+
"Check": "Ávísun",
|
|
8
|
+
"Credit Note": "Kreditreikningur",
|
|
9
|
+
"Advance": "Fyrirframreikningur",
|
|
10
|
+
"Other": "Annað",
|
|
11
|
+
"No data available": "Engin gögn tiltæk",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Betalingsmetoder",
|
|
3
|
+
"Breakdown of payments by method": "Fordeling av betalinger etter metode",
|
|
4
|
+
"Cash": "Kontant",
|
|
5
|
+
"Bank Transfer": "Bankoverføring",
|
|
6
|
+
"Card": "Kort",
|
|
7
|
+
"Check": "Sjekk",
|
|
8
|
+
"Credit Note": "Kreditnota",
|
|
9
|
+
"Advance": "Forskuddsfaktura",
|
|
10
|
+
"Other": "Annet",
|
|
11
|
+
"No data available": "Ingen data tilgjengelig",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Spôsoby platby",
|
|
3
|
+
"Breakdown of payments by method": "Rozdelenie platieb podľa spôsobu",
|
|
4
|
+
"Cash": "Hotovosť",
|
|
5
|
+
"Bank Transfer": "Bankový prevod",
|
|
6
|
+
"Card": "Karta",
|
|
7
|
+
"Check": "Šek",
|
|
8
|
+
"Credit Note": "Dobropis",
|
|
9
|
+
"Advance": "Zálohová faktúra",
|
|
10
|
+
"Other": "Iné",
|
|
11
|
+
"No data available": "Žiadne dostupné údaje",
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Payment Methods": "Betalningsmetoder",
|
|
3
|
+
"Breakdown of payments by method": "Fördelning av betalningar efter metod",
|
|
4
|
+
"Cash": "Kontant",
|
|
5
|
+
"Bank Transfer": "Banköverföring",
|
|
6
|
+
"Card": "Kort",
|
|
7
|
+
"Check": "Check",
|
|
8
|
+
"Credit Note": "Kreditnota",
|
|
9
|
+
"Advance": "Förskottsfaktura",
|
|
10
|
+
"Other": "Övrigt",
|
|
11
|
+
"No data available": "Ingen data tillgänglig",
|
|
12
|
+
} as const;
|
|
@@ -13,18 +13,26 @@ import {
|
|
|
13
13
|
import { createTranslation } from "@/ui/lib/translation";
|
|
14
14
|
import { ChartEmptyState } from "../chart-empty-state";
|
|
15
15
|
import { LoadingCard } from "../loading-card";
|
|
16
|
+
import bg from "./locales/bg";
|
|
17
|
+
import cs from "./locales/cs";
|
|
16
18
|
import de from "./locales/de";
|
|
19
|
+
import et from "./locales/et";
|
|
17
20
|
import es from "./locales/es";
|
|
21
|
+
import fi from "./locales/fi";
|
|
18
22
|
import fr from "./locales/fr";
|
|
19
23
|
import hr from "./locales/hr";
|
|
24
|
+
import is from "./locales/is";
|
|
20
25
|
import it from "./locales/it";
|
|
26
|
+
import nb from "./locales/nb";
|
|
21
27
|
import nl from "./locales/nl";
|
|
22
28
|
import pl from "./locales/pl";
|
|
23
29
|
import pt from "./locales/pt";
|
|
30
|
+
import sk from "./locales/sk";
|
|
24
31
|
import sl from "./locales/sl";
|
|
32
|
+
import sv from "./locales/sv";
|
|
25
33
|
import { usePaymentMethodsData } from "./use-payment-methods";
|
|
26
34
|
|
|
27
|
-
const translations = { de, es, fr, hr, it, nl, pl, pt, sl } as const;
|
|
35
|
+
const translations = { bg, cs, de, et, es, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } as const;
|
|
28
36
|
|
|
29
37
|
export type PaymentMethodsChartData = { type: string; count: number; amount: number }[];
|
|
30
38
|
|