@spaceinvoices/react-ui 0.4.3 → 0.4.4
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 +0 -1
- package/src/components/advance-invoices/create/locales/de.ts +2 -0
- package/src/components/advance-invoices/create/locales/es.ts +2 -0
- package/src/components/advance-invoices/create/locales/fr.ts +2 -0
- package/src/components/advance-invoices/create/locales/hr.ts +1 -0
- package/src/components/advance-invoices/create/locales/it.ts +2 -0
- package/src/components/advance-invoices/create/locales/nl.ts +2 -0
- package/src/components/advance-invoices/create/locales/pl.ts +1 -0
- package/src/components/advance-invoices/create/locales/pt.ts +1 -0
- package/src/components/advance-invoices/create/locales/sl.ts +1 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +0 -1
- package/src/components/advance-invoices/list/list-table.tsx +80 -50
- package/src/components/advance-invoices/list/locales/de.ts +5 -0
- package/src/components/advance-invoices/list/locales/en.ts +4 -0
- package/src/components/advance-invoices/list/locales/es.ts +5 -0
- package/src/components/advance-invoices/list/locales/fr.ts +5 -0
- package/src/components/advance-invoices/list/locales/hr.ts +5 -0
- package/src/components/advance-invoices/list/locales/it.ts +5 -0
- package/src/components/advance-invoices/list/locales/nl.ts +5 -0
- package/src/components/advance-invoices/list/locales/pl.ts +5 -0
- package/src/components/advance-invoices/list/locales/pt.ts +5 -0
- package/src/components/advance-invoices/list/locales/sl.ts +5 -0
- package/src/components/credit-notes/create/create-credit-note-form.tsx +114 -3
- package/src/components/credit-notes/create/locales/de.ts +2 -0
- package/src/components/credit-notes/create/locales/es.ts +2 -0
- package/src/components/credit-notes/create/locales/fr.ts +2 -0
- package/src/components/credit-notes/create/locales/hr.ts +1 -0
- package/src/components/credit-notes/create/locales/it.ts +2 -0
- package/src/components/credit-notes/create/locales/nl.ts +2 -0
- package/src/components/credit-notes/create/locales/pl.ts +1 -0
- package/src/components/credit-notes/create/locales/pt.ts +1 -0
- package/src/components/credit-notes/create/locales/sl.ts +1 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +30 -0
- package/src/components/credit-notes/list/list-table.tsx +77 -30
- package/src/components/credit-notes/list/locales/de.ts +5 -0
- package/src/components/credit-notes/list/locales/en.ts +4 -0
- package/src/components/credit-notes/list/locales/es.ts +5 -0
- package/src/components/credit-notes/list/locales/fr.ts +5 -0
- package/src/components/credit-notes/list/locales/hr.ts +5 -0
- package/src/components/credit-notes/list/locales/it.ts +5 -0
- package/src/components/credit-notes/list/locales/nl.ts +5 -0
- package/src/components/credit-notes/list/locales/pl.ts +5 -0
- package/src/components/credit-notes/list/locales/pt.ts +5 -0
- package/src/components/credit-notes/list/locales/sl.ts +5 -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/delivery-notes/list/list-row-actions.tsx +20 -1
- package/src/components/delivery-notes/list/list-table.tsx +41 -8
- package/src/components/delivery-notes/list/locales/de.ts +4 -0
- package/src/components/delivery-notes/list/locales/en.ts +2 -0
- package/src/components/delivery-notes/list/locales/es.ts +4 -0
- package/src/components/delivery-notes/list/locales/fr.ts +4 -0
- package/src/components/delivery-notes/list/locales/hr.ts +4 -0
- package/src/components/delivery-notes/list/locales/it.ts +4 -0
- package/src/components/delivery-notes/list/locales/nl.ts +4 -0
- package/src/components/delivery-notes/list/locales/pl.ts +4 -0
- package/src/components/delivery-notes/list/locales/pt.ts +4 -0
- package/src/components/delivery-notes/list/locales/sl.ts +4 -0
- package/src/components/documents/create/document-details-section.tsx +41 -27
- package/src/components/documents/create/linked-documents-info.tsx +82 -0
- package/src/components/documents/create/live-preview.tsx +1 -1
- package/src/components/documents/types.ts +2 -2
- package/src/components/documents/view/document-activities-list.tsx +65 -47
- package/src/components/documents/view/document-details-card.tsx +99 -74
- 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 +2 -0
- package/src/components/documents/view/locales/es.ts +2 -0
- package/src/components/documents/view/locales/fr.ts +2 -0
- package/src/components/documents/view/locales/hr.ts +2 -0
- package/src/components/documents/view/locales/it.ts +2 -0
- package/src/components/documents/view/locales/nl.ts +2 -0
- package/src/components/documents/view/locales/pl.ts +2 -0
- package/src/components/documents/view/locales/pt.ts +2 -0
- package/src/components/documents/view/locales/sl.ts +2 -0
- package/src/components/documents/view/use-document-download.ts +3 -2
- package/src/components/entities/create-entity-form.tsx +165 -13
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +101 -1
- package/src/components/entities/entity-settings-form/locales/de.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +9 -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/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 +29 -2
- package/src/components/estimates/list/list-table.tsx +3 -6
- package/src/components/estimates/list/locales/de.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/export/document-export-form.tsx +9 -2
- 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 +48 -1
- package/src/components/invoices/create/locales/de.ts +11 -0
- package/src/components/invoices/create/locales/es.ts +11 -0
- package/src/components/invoices/create/locales/fr.ts +11 -0
- package/src/components/invoices/create/locales/hr.ts +10 -0
- package/src/components/invoices/create/locales/it.ts +11 -0
- package/src/components/invoices/create/locales/nl.ts +11 -0
- package/src/components/invoices/create/locales/pl.ts +10 -0
- package/src/components/invoices/create/locales/pt.ts +10 -0
- package/src/components/invoices/create/locales/sl.ts +10 -0
- 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 +42 -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/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/index.ts +1 -1
- package/src/hooks/use-duplicate-document.ts +40 -5
- 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
|
@@ -97,6 +97,17 @@ export default {
|
|
|
97
97
|
"Net price": "Prix net",
|
|
98
98
|
"Gross price (tax included)": "Prix brut (taxes incluses)",
|
|
99
99
|
"Net price (before tax)": "Prix net (avant taxes)",
|
|
100
|
+
// Linked documents
|
|
101
|
+
"Linked documents": "Documents liés",
|
|
102
|
+
Type: "Type",
|
|
103
|
+
Total: "Total",
|
|
104
|
+
"Delivery note": "Bon de livraison",
|
|
105
|
+
Invoice: "Facture",
|
|
106
|
+
Estimate: "Devis",
|
|
107
|
+
"Credit note": "Avoir",
|
|
108
|
+
"Advance invoice": "Facture d'acompte",
|
|
109
|
+
"FINA fiscalized invoices always use the current date":
|
|
110
|
+
"Les factures fiscalisées FINA utilisent toujours la date actuelle",
|
|
100
111
|
"Service Date": "Date de service",
|
|
101
112
|
"Single Date": "Date unique",
|
|
102
113
|
"Date Range": "Plage de dates",
|
|
@@ -95,6 +95,16 @@ export default {
|
|
|
95
95
|
"Net price": "Neto cijena",
|
|
96
96
|
"Gross price (tax included)": "Bruto cijena (s porezom)",
|
|
97
97
|
"Net price (before tax)": "Neto cijena (prije poreza)",
|
|
98
|
+
// Linked documents
|
|
99
|
+
"Linked documents": "Povezani dokumenti",
|
|
100
|
+
Type: "Vrsta",
|
|
101
|
+
Total: "Ukupno",
|
|
102
|
+
"Delivery note": "Otpremnica",
|
|
103
|
+
Invoice: "Račun",
|
|
104
|
+
Estimate: "Ponuda",
|
|
105
|
+
"Credit note": "Odobrenje",
|
|
106
|
+
"Advance invoice": "Avansni račun",
|
|
107
|
+
"FINA fiscalized invoices always use the current date": "FINA fiskalizirani računi uvijek koriste trenutni datum",
|
|
98
108
|
"Service Date": "Datum usluge",
|
|
99
109
|
"Single Date": "Datum",
|
|
100
110
|
"Date Range": "Raspon datuma",
|
|
@@ -97,6 +97,17 @@ export default {
|
|
|
97
97
|
"Net price": "Prezzo netto",
|
|
98
98
|
"Gross price (tax included)": "Prezzo lordo (imposte incluse)",
|
|
99
99
|
"Net price (before tax)": "Prezzo netto (prima delle imposte)",
|
|
100
|
+
// Linked documents
|
|
101
|
+
"Linked documents": "Documenti collegati",
|
|
102
|
+
Type: "Tipo",
|
|
103
|
+
Total: "Totale",
|
|
104
|
+
"Delivery note": "Bolla di consegna",
|
|
105
|
+
Invoice: "Fattura",
|
|
106
|
+
Estimate: "Preventivo",
|
|
107
|
+
"Credit note": "Nota di credito",
|
|
108
|
+
"Advance invoice": "Fattura di acconto",
|
|
109
|
+
"FINA fiscalized invoices always use the current date":
|
|
110
|
+
"Le fatture fiscalizzate FINA utilizzano sempre la data corrente",
|
|
100
111
|
"Service Date": "Data del servizio",
|
|
101
112
|
"Single Date": "Data singola",
|
|
102
113
|
"Date Range": "Intervallo di date",
|
|
@@ -96,6 +96,17 @@ export default {
|
|
|
96
96
|
"Net price": "Nettoprijs",
|
|
97
97
|
"Gross price (tax included)": "Brutoprijs (inclusief belasting)",
|
|
98
98
|
"Net price (before tax)": "Nettoprijs (exclusief belasting)",
|
|
99
|
+
// Linked documents
|
|
100
|
+
"Linked documents": "Gekoppelde documenten",
|
|
101
|
+
Type: "Type",
|
|
102
|
+
Total: "Totaal",
|
|
103
|
+
"Delivery note": "Pakbon",
|
|
104
|
+
Invoice: "Factuur",
|
|
105
|
+
Estimate: "Offerte",
|
|
106
|
+
"Credit note": "Creditnota",
|
|
107
|
+
"Advance invoice": "Voorschotfactuur",
|
|
108
|
+
"FINA fiscalized invoices always use the current date":
|
|
109
|
+
"FINA-gefiscaliseerde facturen gebruiken altijd de huidige datum",
|
|
99
110
|
"Service Date": "Servicedatum",
|
|
100
111
|
"Single Date": "Enkele datum",
|
|
101
112
|
"Date Range": "Datumbereik",
|
|
@@ -96,6 +96,16 @@ export default {
|
|
|
96
96
|
"Net price": "Cena netto",
|
|
97
97
|
"Gross price (tax included)": "Cena brutto (z podatkiem)",
|
|
98
98
|
"Net price (before tax)": "Cena netto (przed podatkiem)",
|
|
99
|
+
// Linked documents
|
|
100
|
+
"Linked documents": "Powiązane dokumenty",
|
|
101
|
+
Type: "Typ",
|
|
102
|
+
Total: "Razem",
|
|
103
|
+
"Delivery note": "Dowód dostawy",
|
|
104
|
+
Invoice: "Faktura",
|
|
105
|
+
Estimate: "Wycena",
|
|
106
|
+
"Credit note": "Nota kredytowa",
|
|
107
|
+
"Advance invoice": "Faktura zaliczkowa",
|
|
108
|
+
"FINA fiscalized invoices always use the current date": "Faktury fiskalizowane FINA zawsze używają bieżącej daty",
|
|
99
109
|
"Service Date": "Data usługi",
|
|
100
110
|
"Single Date": "Pojedyncza data",
|
|
101
111
|
"Date Range": "Zakres dat",
|
|
@@ -97,6 +97,16 @@ export default {
|
|
|
97
97
|
"Net price": "Preço líquido",
|
|
98
98
|
"Gross price (tax included)": "Preço bruto (impostos incluídos)",
|
|
99
99
|
"Net price (before tax)": "Preço líquido (antes de impostos)",
|
|
100
|
+
// Linked documents
|
|
101
|
+
"Linked documents": "Documentos associados",
|
|
102
|
+
Type: "Tipo",
|
|
103
|
+
Total: "Total",
|
|
104
|
+
"Delivery note": "Guia de remessa",
|
|
105
|
+
Invoice: "Fatura",
|
|
106
|
+
Estimate: "Orçamento",
|
|
107
|
+
"Credit note": "Nota de crédito",
|
|
108
|
+
"Advance invoice": "Fatura antecipada",
|
|
109
|
+
"FINA fiscalized invoices always use the current date": "As faturas fiscalizadas FINA usam sempre a data atual",
|
|
100
110
|
"Service Date": "Data do serviço",
|
|
101
111
|
"Single Date": "Data única",
|
|
102
112
|
"Date Range": "Intervalo de datas",
|
|
@@ -105,6 +105,16 @@ export default {
|
|
|
105
105
|
"Net price": "Neto cena",
|
|
106
106
|
"Gross price (tax included)": "Bruto cena (z davkom)",
|
|
107
107
|
"Net price (before tax)": "Neto cena (brez davka)",
|
|
108
|
+
// Linked documents
|
|
109
|
+
"Linked documents": "Povezani dokumenti",
|
|
110
|
+
Type: "Vrsta",
|
|
111
|
+
Total: "Skupaj",
|
|
112
|
+
"Delivery note": "Dobavnica",
|
|
113
|
+
Invoice: "Račun",
|
|
114
|
+
Estimate: "Predračun",
|
|
115
|
+
"Credit note": "Dobropis",
|
|
116
|
+
"Advance invoice": "Avansni račun",
|
|
117
|
+
"FINA fiscalized invoices always use the current date": "FINA fiskalizirani računi vedno uporabijo trenutni datum",
|
|
108
118
|
// Service date
|
|
109
119
|
"Service Date": "Datum storitve",
|
|
110
120
|
"Single Date": "Datum",
|
|
@@ -3,7 +3,7 @@ import { useSDK } from "@/ui/providers/sdk-provider";
|
|
|
3
3
|
|
|
4
4
|
interface VoidDocumentParams {
|
|
5
5
|
documentId: string;
|
|
6
|
-
documentType: "invoice" | "credit_note" | "advance_invoice";
|
|
6
|
+
documentType: "invoice" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
7
7
|
entityId: string;
|
|
8
8
|
reason?: string;
|
|
9
9
|
}
|
|
@@ -28,12 +28,15 @@ export function useVoidDocument() {
|
|
|
28
28
|
return sdk.creditNotes.void(documentId, body, opts);
|
|
29
29
|
case "advance_invoice":
|
|
30
30
|
return sdk.advanceInvoices.void(documentId, body, opts);
|
|
31
|
+
case "delivery_note":
|
|
32
|
+
return sdk.deliveryNotes.void(documentId, body, opts);
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
onSuccess: (_, variables) => {
|
|
34
36
|
queryClient.invalidateQueries({ queryKey: ["invoices"] });
|
|
35
37
|
queryClient.invalidateQueries({ queryKey: ["credit-notes"] });
|
|
36
38
|
queryClient.invalidateQueries({ queryKey: ["advance-invoices"] });
|
|
39
|
+
queryClient.invalidateQueries({ queryKey: ["delivery-notes"] });
|
|
37
40
|
queryClient.invalidateQueries({ queryKey: ["documents", variables.documentType, variables.documentId] });
|
|
38
41
|
},
|
|
39
42
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Invoice } from "@spaceinvoices/js-sdk";
|
|
2
|
+
import { AlertTriangle } from "lucide-react";
|
|
2
3
|
import { useCallback, useMemo, useState } from "react";
|
|
3
4
|
import { DataTable } from "@/ui/components/table/data-table";
|
|
4
5
|
import { FormattedDate } from "@/ui/components/table/date-cell";
|
|
@@ -13,6 +14,8 @@ import type {
|
|
|
13
14
|
} from "@/ui/components/table/types";
|
|
14
15
|
import { Badge } from "@/ui/components/ui/badge";
|
|
15
16
|
import { Button } from "@/ui/components/ui/button";
|
|
17
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@/ui/components/ui/tooltip";
|
|
18
|
+
import { getFiscalizationFailureType } from "@/ui/lib/fiscalization";
|
|
16
19
|
import { createTranslation } from "@/ui/lib/translation";
|
|
17
20
|
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
18
21
|
|
|
@@ -53,8 +56,11 @@ type InvoiceListTableProps = {
|
|
|
53
56
|
onDownloadSuccess?: (fileName: string) => void;
|
|
54
57
|
onDownloadError?: (error: string) => void;
|
|
55
58
|
onExportSelected?: (documentIds: string[]) => void;
|
|
59
|
+
onRetryFiscalization?: (documentIds: string[]) => void;
|
|
60
|
+
fiscalizationFeatures?: ("furs" | "fina")[];
|
|
56
61
|
onVoid?: (invoice: Invoice) => void;
|
|
57
62
|
isVoiding?: boolean;
|
|
63
|
+
onCreateNew?: () => void;
|
|
58
64
|
} & ListTableProps<Invoice>;
|
|
59
65
|
|
|
60
66
|
export default function InvoiceListTable({
|
|
@@ -70,8 +76,11 @@ export default function InvoiceListTable({
|
|
|
70
76
|
onDownloadSuccess,
|
|
71
77
|
onDownloadError,
|
|
72
78
|
onExportSelected,
|
|
79
|
+
onRetryFiscalization,
|
|
80
|
+
fiscalizationFeatures,
|
|
73
81
|
onVoid,
|
|
74
82
|
isVoiding,
|
|
83
|
+
onCreateNew,
|
|
75
84
|
...i18nProps
|
|
76
85
|
}: InvoiceListTableProps) {
|
|
77
86
|
const t = createTranslation({
|
|
@@ -91,7 +100,6 @@ export default function InvoiceListTable({
|
|
|
91
100
|
limit: params.limit,
|
|
92
101
|
next_cursor: params.next_cursor,
|
|
93
102
|
prev_cursor: params.prev_cursor,
|
|
94
|
-
order_by: params.order_by,
|
|
95
103
|
search: params.search,
|
|
96
104
|
query: params.query,
|
|
97
105
|
});
|
|
@@ -121,15 +129,42 @@ export default function InvoiceListTable({
|
|
|
121
129
|
}, []);
|
|
122
130
|
|
|
123
131
|
const selectionToolbar = useCallback(
|
|
124
|
-
(count: number) =>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
(count: number, data: Invoice[]) => {
|
|
133
|
+
const selectedDocs = data.filter((d) => selectedIds.has(d.id));
|
|
134
|
+
const failedDocs = selectedDocs.filter((d) => {
|
|
135
|
+
const failureType = getFiscalizationFailureType(d as any);
|
|
136
|
+
return failureType && fiscalizationFeatures?.includes(failureType);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const hasRetry = onRetryFiscalization && fiscalizationFeatures?.length;
|
|
140
|
+
const failedCount = failedDocs.length;
|
|
141
|
+
const allFailed = failedCount > 0 && failedCount === selectedDocs.length;
|
|
142
|
+
const someFailed = failedCount > 0 && failedCount < selectedDocs.length;
|
|
143
|
+
const showRetry = hasRetry && failedCount > 0;
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<SelectionToolbar
|
|
147
|
+
selectedCount={count}
|
|
148
|
+
onExportPdfs={onExportSelected ? handleExportPdfs : undefined}
|
|
149
|
+
onRetryFiscalization={showRetry ? () => onRetryFiscalization(failedDocs.map((d) => d.id)) : undefined}
|
|
150
|
+
retryFiscalizationDisabled={someFailed && !allFailed}
|
|
151
|
+
retryFiscalizationTooltip={
|
|
152
|
+
someFailed ? t("Some selected documents don't have failed fiscalization") : undefined
|
|
153
|
+
}
|
|
154
|
+
onDeselectAll={handleDeselectAll}
|
|
155
|
+
t={t}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
},
|
|
159
|
+
[
|
|
160
|
+
handleExportPdfs,
|
|
161
|
+
handleDeselectAll,
|
|
162
|
+
onExportSelected,
|
|
163
|
+
onRetryFiscalization,
|
|
164
|
+
fiscalizationFeatures,
|
|
165
|
+
selectedIds,
|
|
166
|
+
t,
|
|
167
|
+
],
|
|
133
168
|
);
|
|
134
169
|
|
|
135
170
|
const columns: Column<Invoice>[] = useMemo(
|
|
@@ -137,22 +172,35 @@ export default function InvoiceListTable({
|
|
|
137
172
|
{
|
|
138
173
|
id: "number",
|
|
139
174
|
header: t("Number"),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
175
|
+
cell: (invoice) => {
|
|
176
|
+
const failureType = getFiscalizationFailureType(invoice as any);
|
|
177
|
+
const showWarning = failureType && fiscalizationFeatures?.includes(failureType);
|
|
178
|
+
return (
|
|
179
|
+
<div className="flex items-center gap-2">
|
|
180
|
+
<Button variant="link" className="cursor-pointer py-0 underline" onClick={() => onRowClick?.(invoice)}>
|
|
181
|
+
{invoice.number}
|
|
182
|
+
</Button>
|
|
183
|
+
{(invoice as any).is_draft && (
|
|
184
|
+
<Badge
|
|
185
|
+
variant="outline"
|
|
186
|
+
className="border-amber-500 bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-400"
|
|
187
|
+
>
|
|
188
|
+
{t("Draft")}
|
|
189
|
+
</Badge>
|
|
190
|
+
)}
|
|
191
|
+
{showWarning && (
|
|
192
|
+
<Tooltip>
|
|
193
|
+
<TooltipTrigger>
|
|
194
|
+
<AlertTriangle className="size-4 text-orange-500" />
|
|
195
|
+
</TooltipTrigger>
|
|
196
|
+
<TooltipContent>
|
|
197
|
+
{t(failureType === "furs" ? "FURS fiscalization failed" : "FINA fiscalization failed")}
|
|
198
|
+
</TooltipContent>
|
|
199
|
+
</Tooltip>
|
|
200
|
+
)}
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
},
|
|
156
204
|
},
|
|
157
205
|
{
|
|
158
206
|
id: "customer",
|
|
@@ -162,26 +210,22 @@ export default function InvoiceListTable({
|
|
|
162
210
|
{
|
|
163
211
|
id: "date",
|
|
164
212
|
header: t("Date"),
|
|
165
|
-
sortable: true,
|
|
166
213
|
cell: (invoice) => <FormattedDate date={invoice.date} />,
|
|
167
214
|
},
|
|
168
215
|
{
|
|
169
216
|
id: "date_due",
|
|
170
217
|
header: t("Date Due"),
|
|
171
|
-
sortable: true,
|
|
172
218
|
cell: (invoice) => <FormattedDate date={invoice.date_due} />,
|
|
173
219
|
},
|
|
174
220
|
{
|
|
175
221
|
id: "total",
|
|
176
222
|
header: t("Total"),
|
|
177
|
-
sortable: true,
|
|
178
223
|
align: "right",
|
|
179
224
|
cell: (invoice) => invoice.total,
|
|
180
225
|
},
|
|
181
226
|
{
|
|
182
227
|
id: "total_with_tax",
|
|
183
228
|
header: t("Total with Tax"),
|
|
184
|
-
sortable: true,
|
|
185
229
|
align: "right",
|
|
186
230
|
cell: (invoice) => invoice.total_with_tax,
|
|
187
231
|
},
|
|
@@ -223,6 +267,7 @@ export default function InvoiceListTable({
|
|
|
223
267
|
onVoid,
|
|
224
268
|
isVoiding,
|
|
225
269
|
i18nProps.locale,
|
|
270
|
+
fiscalizationFeatures,
|
|
226
271
|
],
|
|
227
272
|
);
|
|
228
273
|
|
|
@@ -233,6 +278,7 @@ export default function InvoiceListTable({
|
|
|
233
278
|
resourceName="invoice"
|
|
234
279
|
cacheKey="invoices"
|
|
235
280
|
createNewLink={entityId ? `/app/${entityId}/documents/add/invoice` : undefined}
|
|
281
|
+
onCreateNew={onCreateNew}
|
|
236
282
|
onFetch={handleFetch}
|
|
237
283
|
onChangeParams={onChangeParams}
|
|
238
284
|
disableUrlSync={disableUrlSync}
|
|
@@ -240,7 +286,7 @@ export default function InvoiceListTable({
|
|
|
240
286
|
filterConfig={filterConfig}
|
|
241
287
|
t={t}
|
|
242
288
|
locale={i18nProps.locale}
|
|
243
|
-
selectable={!!onExportSelected}
|
|
289
|
+
selectable={!!(onExportSelected || onRetryFiscalization)}
|
|
244
290
|
selectedIds={selectedIds}
|
|
245
291
|
onSelectionChange={setSelectedIds}
|
|
246
292
|
selectionToolbar={selectionToolbar}
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Keine Rechnungen gefunden",
|
|
40
40
|
"Try adjusting your search criteria": "Versuchen Sie, Ihre Suchkriterien anzupassen",
|
|
41
41
|
"Clear search": "Suche zurücksetzen",
|
|
42
|
+
"Clear all": "Alles zurücksetzen",
|
|
42
43
|
selected: "ausgewählt",
|
|
43
44
|
"Export PDFs": "PDFs exportieren",
|
|
44
45
|
"Deselect all": "Auswahl aufheben",
|
|
45
46
|
Void: "Stornieren",
|
|
46
47
|
"Partially Paid": "Teilweise bezahlt",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -10,4 +10,8 @@ export default {
|
|
|
10
10
|
"Deselect all": "Deselect all",
|
|
11
11
|
Void: "Void",
|
|
12
12
|
"Partially Paid": "Partially Paid",
|
|
13
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
14
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
15
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
16
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
13
17
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "No se encontraron facturas",
|
|
40
40
|
"Try adjusting your search criteria": "Intente ajustar sus criterios de búsqueda",
|
|
41
41
|
"Clear search": "Limpiar búsqueda",
|
|
42
|
+
"Clear all": "Borrar todo",
|
|
42
43
|
selected: "seleccionados",
|
|
43
44
|
"Export PDFs": "Exportar PDFs",
|
|
44
45
|
"Deselect all": "Deseleccionar todo",
|
|
45
46
|
Void: "Anular",
|
|
46
47
|
"Partially Paid": "Parcialmente pagado",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Aucune facture trouvée",
|
|
40
40
|
"Try adjusting your search criteria": "Essayez de modifier vos critères de recherche",
|
|
41
41
|
"Clear search": "Effacer la recherche",
|
|
42
|
+
"Clear all": "Tout effacer",
|
|
42
43
|
selected: "sélectionnés",
|
|
43
44
|
"Export PDFs": "Exporter les PDF",
|
|
44
45
|
"Deselect all": "Tout désélectionner",
|
|
45
46
|
Void: "Annuler",
|
|
46
47
|
"Partially Paid": "Partiellement payé",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Nisu pronađeni računi",
|
|
40
40
|
"Try adjusting your search criteria": "Pokušajte prilagoditi kriterije pretrage",
|
|
41
41
|
"Clear search": "Očisti pretragu",
|
|
42
|
+
"Clear all": "Očisti sve",
|
|
42
43
|
selected: "odabranih",
|
|
43
44
|
"Export PDFs": "Izvezi PDF-ove",
|
|
44
45
|
"Deselect all": "Poništi odabir",
|
|
45
46
|
Void: "Storniraj",
|
|
46
47
|
"Partially Paid": "Djelomično plaćeno",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiskalizacija nije uspjela",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiskalizacija nije uspjela",
|
|
50
|
+
"Retry Fiscalization": "Ponovi fiskalizaciju",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Neki odabrani dokumenti nemaju neuspjelu fiskalizaciju",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Nessuna fattura trovata",
|
|
40
40
|
"Try adjusting your search criteria": "Prova a modificare i criteri di ricerca",
|
|
41
41
|
"Clear search": "Cancella ricerca",
|
|
42
|
+
"Clear all": "Cancella tutto",
|
|
42
43
|
selected: "selezionati",
|
|
43
44
|
"Export PDFs": "Esporta PDF",
|
|
44
45
|
"Deselect all": "Deseleziona tutto",
|
|
45
46
|
Void: "Annulla",
|
|
46
47
|
"Partially Paid": "Parzialmente pagato",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Geen facturen gevonden",
|
|
40
40
|
"Try adjusting your search criteria": "Probeer uw zoekcriteria aan te passen",
|
|
41
41
|
"Clear search": "Zoekopdracht wissen",
|
|
42
|
+
"Clear all": "Alles wissen",
|
|
42
43
|
selected: "geselecteerd",
|
|
43
44
|
"Export PDFs": "PDFs exporteren",
|
|
44
45
|
"Deselect all": "Alles deselecteren",
|
|
45
46
|
Void: "Nietig verklaren",
|
|
46
47
|
"Partially Paid": "Gedeeltelijk betaald",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Nie znaleziono faktur",
|
|
40
40
|
"Try adjusting your search criteria": "Spróbuj dostosować kryteria wyszukiwania",
|
|
41
41
|
"Clear search": "Wyczyść wyszukiwanie",
|
|
42
|
+
"Clear all": "Wyczyść wszystko",
|
|
42
43
|
selected: "wybranych",
|
|
43
44
|
"Export PDFs": "Eksportuj PDF-y",
|
|
44
45
|
"Deselect all": "Odznacz wszystko",
|
|
45
46
|
Void: "Anuluj",
|
|
46
47
|
"Partially Paid": "Częściowo opłacona",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Nenhuma fatura encontrada",
|
|
40
40
|
"Try adjusting your search criteria": "Tente ajustar os seus critérios de pesquisa",
|
|
41
41
|
"Clear search": "Limpar pesquisa",
|
|
42
|
+
"Clear all": "Limpar tudo",
|
|
42
43
|
selected: "selecionados",
|
|
43
44
|
"Export PDFs": "Exportar PDFs",
|
|
44
45
|
"Deselect all": "Desselecionar tudo",
|
|
45
46
|
Void: "Anular",
|
|
46
47
|
"Partially Paid": "Parcialmente pago",
|
|
48
|
+
"FURS fiscalization failed": "FURS fiscalization failed",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiscalization failed",
|
|
50
|
+
"Retry Fiscalization": "Retry Fiscalization",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Some selected documents don't have failed fiscalization",
|
|
47
52
|
} as const;
|
|
@@ -39,9 +39,14 @@ export default {
|
|
|
39
39
|
"No results found": "Ni najdenih računov",
|
|
40
40
|
"Try adjusting your search criteria": "Poskusite prilagoditi iskalne kriterije",
|
|
41
41
|
"Clear search": "Počisti iskanje",
|
|
42
|
+
"Clear all": "Počisti vse",
|
|
42
43
|
selected: "izbranih",
|
|
43
44
|
"Export PDFs": "Izvozi PDF-je",
|
|
44
45
|
"Deselect all": "Počisti izbiro",
|
|
45
46
|
Void: "Storniraj",
|
|
46
47
|
"Partially Paid": "Delno plačano",
|
|
48
|
+
"FURS fiscalization failed": "FURS davčno potrjevanje ni uspelo",
|
|
49
|
+
"FINA fiscalization failed": "FINA fiskalizacija ni uspela",
|
|
50
|
+
"Retry Fiscalization": "Ponovi fiskalizacijo",
|
|
51
|
+
"Some selected documents don't have failed fiscalization": "Nekateri izbrani dokumenti nimajo neuspele fiskalizacije",
|
|
47
52
|
} as const;
|
|
@@ -28,6 +28,7 @@ interface FiscalizationStatusCardProps extends ComponentTranslationProps {
|
|
|
28
28
|
fiscalizationData: FiscalizationData | null | undefined;
|
|
29
29
|
onRetry?: () => void;
|
|
30
30
|
isRetrying?: boolean;
|
|
31
|
+
variant?: "card" | "inline";
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export function FiscalizationStatusCard({
|
|
@@ -35,6 +36,7 @@ export function FiscalizationStatusCard({
|
|
|
35
36
|
fiscalizationData,
|
|
36
37
|
onRetry,
|
|
37
38
|
isRetrying,
|
|
39
|
+
variant = "card",
|
|
38
40
|
t: translateFn,
|
|
39
41
|
namespace,
|
|
40
42
|
locale,
|
|
@@ -87,6 +89,45 @@ export function FiscalizationStatusCard({
|
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
|
|
92
|
+
const bodyContent = (
|
|
93
|
+
<>
|
|
94
|
+
<div className="text-muted-foreground text-sm">
|
|
95
|
+
{label} ·{" "}
|
|
96
|
+
{fiscalizationData.fiscalized_at && new Date(fiscalizationData.fiscalized_at).toLocaleString(locale)}
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
{fiscalizationData.status === "failed" && fiscalizationData.error && (
|
|
100
|
+
<Alert variant="destructive">
|
|
101
|
+
<AlertCircle className="h-4 w-4" />
|
|
102
|
+
<AlertDescription className="text-sm">{fiscalizationData.error}</AlertDescription>
|
|
103
|
+
</Alert>
|
|
104
|
+
)}
|
|
105
|
+
|
|
106
|
+
{fiscalizationData.status === "skipped" && (fiscalizationData as any).data?.reason && (
|
|
107
|
+
<div className="text-muted-foreground text-sm">{(fiscalizationData as any).data.reason}</div>
|
|
108
|
+
)}
|
|
109
|
+
|
|
110
|
+
{fiscalizationData.status === "failed" && onRetry && (
|
|
111
|
+
<Button variant="outline" size="sm" onClick={onRetry} disabled={isRetrying}>
|
|
112
|
+
{isRetrying ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : <RefreshCw className="mr-2 h-4 w-4" />}
|
|
113
|
+
{t("Retry fiscalization")}
|
|
114
|
+
</Button>
|
|
115
|
+
)}
|
|
116
|
+
</>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
if (variant === "inline") {
|
|
120
|
+
return (
|
|
121
|
+
<div className="space-y-3">
|
|
122
|
+
<div className="flex items-center justify-between font-medium text-sm">
|
|
123
|
+
<span>{t("Fiscalization")}</span>
|
|
124
|
+
{getStatusBadge()}
|
|
125
|
+
</div>
|
|
126
|
+
{bodyContent}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
90
131
|
return (
|
|
91
132
|
<Card>
|
|
92
133
|
<CardHeader className="pb-3">
|
|
@@ -95,30 +136,7 @@ export function FiscalizationStatusCard({
|
|
|
95
136
|
{getStatusBadge()}
|
|
96
137
|
</CardTitle>
|
|
97
138
|
</CardHeader>
|
|
98
|
-
<CardContent className="space-y-3">
|
|
99
|
-
<div className="text-muted-foreground text-sm">
|
|
100
|
-
{label} ·{" "}
|
|
101
|
-
{fiscalizationData.fiscalized_at && new Date(fiscalizationData.fiscalized_at).toLocaleString(locale)}
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
{fiscalizationData.status === "failed" && fiscalizationData.error && (
|
|
105
|
-
<Alert variant="destructive">
|
|
106
|
-
<AlertCircle className="h-4 w-4" />
|
|
107
|
-
<AlertDescription className="text-sm">{fiscalizationData.error}</AlertDescription>
|
|
108
|
-
</Alert>
|
|
109
|
-
)}
|
|
110
|
-
|
|
111
|
-
{fiscalizationData.status === "skipped" && (fiscalizationData as any).data?.reason && (
|
|
112
|
-
<div className="text-muted-foreground text-sm">{(fiscalizationData as any).data.reason}</div>
|
|
113
|
-
)}
|
|
114
|
-
|
|
115
|
-
{fiscalizationData.status === "failed" && onRetry && (
|
|
116
|
-
<Button variant="outline" size="sm" onClick={onRetry} disabled={isRetrying}>
|
|
117
|
-
{isRetrying ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : <RefreshCw className="mr-2 h-4 w-4" />}
|
|
118
|
-
{t("Retry fiscalization")}
|
|
119
|
-
</Button>
|
|
120
|
-
)}
|
|
121
|
-
</CardContent>
|
|
139
|
+
<CardContent className="space-y-3">{bodyContent}</CardContent>
|
|
122
140
|
</Card>
|
|
123
141
|
);
|
|
124
142
|
}
|
|
@@ -30,7 +30,7 @@ export function ItemCombobox({
|
|
|
30
30
|
disabled,
|
|
31
31
|
}: ItemComboboxProps) {
|
|
32
32
|
const [search, setSearch] = useState("");
|
|
33
|
-
const [displayValue, setDisplayValue] = useState("");
|
|
33
|
+
const [displayValue, setDisplayValue] = useState(value || "");
|
|
34
34
|
const debouncedSearch = useDebounce(search, 300);
|
|
35
35
|
|
|
36
36
|
// Fetch recent items (non-blocking, cached)
|
|
@@ -120,9 +120,11 @@ export function ItemCombobox({
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
//
|
|
123
|
+
// Sync when value changes externally (e.g., duplication, form reset)
|
|
124
124
|
useEffect(() => {
|
|
125
|
-
if (
|
|
125
|
+
if (value) {
|
|
126
|
+
setDisplayValue(value);
|
|
127
|
+
} else {
|
|
126
128
|
setSearch("");
|
|
127
129
|
setDisplayValue("");
|
|
128
130
|
}
|