@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
|
@@ -6,18 +6,26 @@ import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } f
|
|
|
6
6
|
import { createTranslation } from "@/ui/lib/translation";
|
|
7
7
|
import { ChartEmptyState } from "../chart-empty-state";
|
|
8
8
|
import { LoadingCard } from "../loading-card";
|
|
9
|
+
import bg from "./locales/bg";
|
|
10
|
+
import cs from "./locales/cs";
|
|
9
11
|
import de from "./locales/de";
|
|
12
|
+
import et from "./locales/et";
|
|
10
13
|
import es from "./locales/es";
|
|
14
|
+
import fi from "./locales/fi";
|
|
11
15
|
import fr from "./locales/fr";
|
|
12
16
|
import hr from "./locales/hr";
|
|
17
|
+
import is from "./locales/is";
|
|
13
18
|
import it from "./locales/it";
|
|
19
|
+
import nb from "./locales/nb";
|
|
14
20
|
import nl from "./locales/nl";
|
|
15
21
|
import pl from "./locales/pl";
|
|
16
22
|
import pt from "./locales/pt";
|
|
23
|
+
import sk from "./locales/sk";
|
|
17
24
|
import sl from "./locales/sl";
|
|
25
|
+
import sv from "./locales/sv";
|
|
18
26
|
import { usePaymentTrendData } from "./use-payment-trend";
|
|
19
27
|
|
|
20
|
-
const translations = {
|
|
28
|
+
const translations = { bg, cs, de, et, es, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } as const;
|
|
21
29
|
|
|
22
30
|
export type PaymentTrendChartData = { month: string; amount: number }[];
|
|
23
31
|
|
|
@@ -41,13 +49,6 @@ type TurnkeyProps = BaseProps & {
|
|
|
41
49
|
|
|
42
50
|
export type PaymentTrendChartProps = DataProps | TurnkeyProps;
|
|
43
51
|
|
|
44
|
-
const chartConfig = {
|
|
45
|
-
amount: {
|
|
46
|
-
label: "Payments",
|
|
47
|
-
color: "var(--chart-3)",
|
|
48
|
-
},
|
|
49
|
-
} satisfies ChartConfig;
|
|
50
|
-
|
|
51
52
|
function formatMonth(month: string, locale?: string): string {
|
|
52
53
|
const date = new Date(`${month}-01`);
|
|
53
54
|
return date.toLocaleDateString(locale, { month: "short" });
|
|
@@ -79,6 +80,12 @@ export function PaymentTrendChart(props: PaymentTrendChartProps) {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
const hasData = data.some((d) => d.amount > 0);
|
|
83
|
+
const chartConfig = {
|
|
84
|
+
amount: {
|
|
85
|
+
label: t("Payments"),
|
|
86
|
+
color: "var(--chart-3)",
|
|
87
|
+
},
|
|
88
|
+
} satisfies ChartConfig;
|
|
82
89
|
|
|
83
90
|
// Placeholder data for empty state
|
|
84
91
|
const placeholderData =
|
|
@@ -6,18 +6,26 @@ import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } f
|
|
|
6
6
|
import { createTranslation } from "@/ui/lib/translation";
|
|
7
7
|
import { ChartEmptyState } from "../chart-empty-state";
|
|
8
8
|
import { LoadingCard } from "../loading-card";
|
|
9
|
+
import bg from "./locales/bg";
|
|
10
|
+
import cs from "./locales/cs";
|
|
9
11
|
import de from "./locales/de";
|
|
12
|
+
import et from "./locales/et";
|
|
10
13
|
import es from "./locales/es";
|
|
14
|
+
import fi from "./locales/fi";
|
|
11
15
|
import fr from "./locales/fr";
|
|
12
16
|
import hr from "./locales/hr";
|
|
17
|
+
import is from "./locales/is";
|
|
13
18
|
import it from "./locales/it";
|
|
19
|
+
import nb from "./locales/nb";
|
|
14
20
|
import nl from "./locales/nl";
|
|
15
21
|
import pl from "./locales/pl";
|
|
16
22
|
import pt from "./locales/pt";
|
|
23
|
+
import sk from "./locales/sk";
|
|
17
24
|
import sl from "./locales/sl";
|
|
25
|
+
import sv from "./locales/sv";
|
|
18
26
|
import { useRevenueTrendData } from "./use-revenue-trend";
|
|
19
27
|
|
|
20
|
-
const translations = {
|
|
28
|
+
const translations = { bg, cs, de, et, es, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } as const;
|
|
21
29
|
|
|
22
30
|
export type RevenueTrendChartData = { month: string; revenue: number }[];
|
|
23
31
|
|
|
@@ -41,13 +49,6 @@ type TurnkeyProps = BaseProps & {
|
|
|
41
49
|
|
|
42
50
|
export type RevenueTrendChartProps = DataProps | TurnkeyProps;
|
|
43
51
|
|
|
44
|
-
const chartConfig = {
|
|
45
|
-
revenue: {
|
|
46
|
-
label: "Revenue",
|
|
47
|
-
color: "var(--chart-1)",
|
|
48
|
-
},
|
|
49
|
-
} satisfies ChartConfig;
|
|
50
|
-
|
|
51
52
|
function formatMonth(month: string, locale?: string): string {
|
|
52
53
|
const date = new Date(`${month}-01`);
|
|
53
54
|
return date.toLocaleDateString(locale, { month: "short" });
|
|
@@ -79,6 +80,12 @@ export function RevenueTrendChart(props: RevenueTrendChartProps) {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
const hasData = data.some((d) => d.revenue > 0);
|
|
83
|
+
const chartConfig = {
|
|
84
|
+
revenue: {
|
|
85
|
+
label: t("Revenue"),
|
|
86
|
+
color: "var(--chart-1)",
|
|
87
|
+
},
|
|
88
|
+
} satisfies ChartConfig;
|
|
82
89
|
|
|
83
90
|
// Placeholder data for empty state
|
|
84
91
|
const placeholderData =
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const en = {
|
|
2
|
+
Tax: "Tax",
|
|
3
|
+
"No tax data": "No tax data",
|
|
4
|
+
} as const;
|
|
5
|
+
|
|
6
|
+
const sl = {
|
|
7
|
+
Tax: "Davek",
|
|
8
|
+
"No tax data": "Ni davčnih podatkov",
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
const de = {
|
|
12
|
+
Tax: "Steuer",
|
|
13
|
+
"No tax data": "Keine Steuerdaten",
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
const it = {
|
|
17
|
+
Tax: "Imposta",
|
|
18
|
+
"No tax data": "Nessun dato fiscale",
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
const fr = {
|
|
22
|
+
Tax: "Taxe",
|
|
23
|
+
"No tax data": "Aucune donnée fiscale",
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
const es = {
|
|
27
|
+
Tax: "Impuesto",
|
|
28
|
+
"No tax data": "Sin datos fiscales",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
const pt = {
|
|
32
|
+
Tax: "Imposto",
|
|
33
|
+
"No tax data": "Sem dados fiscais",
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
const nl = {
|
|
37
|
+
Tax: "Belasting",
|
|
38
|
+
"No tax data": "Geen belastinggegevens",
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
const pl = {
|
|
42
|
+
Tax: "Podatek",
|
|
43
|
+
"No tax data": "Brak danych podatkowych",
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
const hr = {
|
|
47
|
+
Tax: "Porez",
|
|
48
|
+
"No tax data": "Nema poreznih podataka",
|
|
49
|
+
} as const;
|
|
50
|
+
|
|
51
|
+
const bg = {
|
|
52
|
+
Tax: "Данък",
|
|
53
|
+
"No tax data": "Няма данъчни данни",
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
const cs = {
|
|
57
|
+
Tax: "Daň",
|
|
58
|
+
"No tax data": "Žádná daňová data",
|
|
59
|
+
} as const;
|
|
60
|
+
|
|
61
|
+
const et = {
|
|
62
|
+
Tax: "Maks",
|
|
63
|
+
"No tax data": "Maksuandmed puuduvad",
|
|
64
|
+
} as const;
|
|
65
|
+
|
|
66
|
+
const fi = {
|
|
67
|
+
Tax: "Tax",
|
|
68
|
+
"No tax data": "No tax data",
|
|
69
|
+
} as const;
|
|
70
|
+
|
|
71
|
+
const is = {
|
|
72
|
+
Tax: "Skattur",
|
|
73
|
+
"No tax data": "Engin skattagögn tiltæk",
|
|
74
|
+
} as const;
|
|
75
|
+
|
|
76
|
+
const nb = {
|
|
77
|
+
Tax: "Avgift",
|
|
78
|
+
"No tax data": "Ingen avgiftsdata",
|
|
79
|
+
} as const;
|
|
80
|
+
|
|
81
|
+
const sk = {
|
|
82
|
+
Tax: "Daň",
|
|
83
|
+
"No tax data": "Žiadne daňové údaje",
|
|
84
|
+
} as const;
|
|
85
|
+
|
|
86
|
+
const sv = {
|
|
87
|
+
Tax: "Skatt",
|
|
88
|
+
"No tax data": "Inga skatteuppgifter",
|
|
89
|
+
} as const;
|
|
90
|
+
|
|
91
|
+
export default {
|
|
92
|
+
en,
|
|
93
|
+
bg,
|
|
94
|
+
cs,
|
|
95
|
+
et,
|
|
96
|
+
fi,
|
|
97
|
+
is,
|
|
98
|
+
nb,
|
|
99
|
+
sk,
|
|
100
|
+
sl,
|
|
101
|
+
sv,
|
|
102
|
+
de,
|
|
103
|
+
it,
|
|
104
|
+
fr,
|
|
105
|
+
es,
|
|
106
|
+
pt,
|
|
107
|
+
nl,
|
|
108
|
+
pl,
|
|
109
|
+
hr,
|
|
110
|
+
} as const;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { Card, CardContent, CardHeader, CardTitle } from "@/ui/components/ui/card";
|
|
4
|
+
import { createTranslation } from "@/ui/lib/translation";
|
|
4
5
|
import { Skeleton } from "@/ui/components/ui/skeleton";
|
|
6
|
+
import translations from "./locales";
|
|
5
7
|
import type { TaxByRate } from "./use-tax-collected";
|
|
6
8
|
|
|
7
9
|
export type TaxCollectedCardProps = {
|
|
@@ -12,6 +14,7 @@ export type TaxCollectedCardProps = {
|
|
|
12
14
|
currency: string;
|
|
13
15
|
isLoading?: boolean;
|
|
14
16
|
locale?: string;
|
|
17
|
+
t?: (key: string) => string;
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
function formatCurrency(value: number, currency: string, locale?: string): string {
|
|
@@ -30,7 +33,10 @@ export function TaxCollectedCard({
|
|
|
30
33
|
currency,
|
|
31
34
|
isLoading,
|
|
32
35
|
locale,
|
|
36
|
+
t: externalT,
|
|
33
37
|
}: TaxCollectedCardProps) {
|
|
38
|
+
const t = createTranslation({ t: externalT, locale, translations });
|
|
39
|
+
|
|
34
40
|
if (isLoading) {
|
|
35
41
|
return (
|
|
36
42
|
<Card>
|
|
@@ -62,14 +68,14 @@ export function TaxCollectedCard({
|
|
|
62
68
|
{taxes.map((tax) => (
|
|
63
69
|
<div key={`${tax.name}-${tax.rate}`} className="flex items-center justify-between text-sm">
|
|
64
70
|
<span className="text-muted-foreground">
|
|
65
|
-
{tax.name} {tax.rate}%
|
|
71
|
+
{t(tax.name)} {tax.rate}%
|
|
66
72
|
</span>
|
|
67
73
|
<span className="font-medium">{formatCurrency(tax.amount, currency, locale)}</span>
|
|
68
74
|
</div>
|
|
69
75
|
))}
|
|
70
76
|
</div>
|
|
71
77
|
) : (
|
|
72
|
-
<p className="text-muted-foreground text-sm">No tax data</p>
|
|
78
|
+
<p className="text-muted-foreground text-sm">{t("No tax data")}</p>
|
|
73
79
|
)}
|
|
74
80
|
</CardContent>
|
|
75
81
|
</Card>
|
|
@@ -8,14 +8,14 @@ import { useStatsBatchQuery } from "../shared/use-stats-query";
|
|
|
8
8
|
|
|
9
9
|
export const TAX_COLLECTED_CACHE_KEY = "dashboard-tax-collected";
|
|
10
10
|
|
|
11
|
-
function getPreviousMonthDateRange() {
|
|
11
|
+
function getPreviousMonthDateRange(locale?: string) {
|
|
12
12
|
const now = new Date();
|
|
13
13
|
const firstDay = new Date(now.getFullYear(), now.getMonth() - 1, 1);
|
|
14
14
|
const lastDay = new Date(now.getFullYear(), now.getMonth(), 0);
|
|
15
15
|
return {
|
|
16
16
|
from: firstDay.toISOString().split("T")[0],
|
|
17
17
|
to: lastDay.toISOString().split("T")[0],
|
|
18
|
-
label: firstDay.toLocaleDateString(
|
|
18
|
+
label: firstDay.toLocaleDateString(locale, { month: "short", year: "numeric" }),
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -62,8 +62,8 @@ function transformTaxData(data: StatsQueryDataItem[]): TaxByRate[] {
|
|
|
62
62
|
.sort((a, b) => b.rate - a.rate);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export function useTaxCollectedData(entityId: string | undefined) {
|
|
66
|
-
const prevMonthRange = getPreviousMonthDateRange();
|
|
65
|
+
export function useTaxCollectedData(entityId: string | undefined, locale?: string) {
|
|
66
|
+
const prevMonthRange = getPreviousMonthDateRange(locale);
|
|
67
67
|
const yearRange = getYearDateRange();
|
|
68
68
|
|
|
69
69
|
const queries: StatsQueryRequest[] = [
|