@appcorp/stellar-solutions-invoice-module 0.1.59 → 0.1.61

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.
@@ -1,8 +1,8 @@
1
- import { ProductTypeBE } from '@appcorp/stellar-solutions-product-module/base-modules/product/types';
2
- import { DISCOUNT_UNIT, INVOICE_DRAWER, InvoiceState, QuoteInvoiceTypeBE, Product, Service, INVOICE_MODAL } from './types';
3
- import { TaxTypeBE } from '@appcorp/stellar-solutions-modules/global-modules/preferences/types';
4
- import { CompanyTypeBE } from '@appcorp/stellar-solutions-company-module/base-modules/company/types';
5
- import { CustomerTypeBE } from '@appcorp/stellar-solutions-company-module/base-modules/customer/types';
1
+ import { ProductTypeBE } from "@appcorp/stellar-solutions-product-module/base-modules/product/types";
2
+ import { DISCOUNT_UNIT, INVOICE_DRAWER, InvoiceState, QuoteInvoiceTypeBE, Product, Service, INVOICE_MODAL } from "./types";
3
+ import { TaxTypeBE } from "@appcorp/stellar-solutions-modules/global-modules/preferences/types";
4
+ import { CompanyTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/company/types";
5
+ import { CustomerTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/customer/types";
6
6
  export declare enum INVOICE_ACTION_TYPES {
7
7
  ADD_ITEM_PRODUCT = "ADD_ITEM_PRODUCT",
8
8
  ADD_ITEM_SERVICE = "ADD_ITEM_SERVICE",
@@ -40,7 +40,7 @@ export declare enum INVOICE_ACTION_TYPES {
40
40
  export type InvoiceUpdateFieldAction = {
41
41
  type: INVOICE_ACTION_TYPES.SET_INPUT_FIELD;
42
42
  payload: {
43
- key: keyof QuoteInvoiceTypeBE | 'servicesList' | 'productsList';
43
+ key: keyof QuoteInvoiceTypeBE | "servicesList" | "productsList" | "taxQuery" | "productQuery" | "companyQuery";
44
44
  value: string | string[] | boolean | number | number[] | Service[] | Product[];
45
45
  };
46
46
  };
@@ -16,16 +16,16 @@ var lucide_react_1 = require("lucide-react");
16
16
  var button_1 = require("@appcorp/shadcn/components/button");
17
17
  var context_1 = require("./context");
18
18
  var AddServiceProductSection = function () {
19
- var t = (0, next_intl_1.useTranslations)("invoicePage");
19
+ var t = (0, next_intl_1.useTranslations)("invoice");
20
20
  var _a = (0, context_1.useInvoiceStateContext)(), handleAddItemProduct = _a.handleAddItemProduct, handleAddItemService = _a.handleAddItemService;
21
21
  return (react_1.default.createElement("div", { className: "flex items-center justify-center gap-3 rounded-lg border-2 border-dashed border-muted-foreground/25 p-6 hover:border-muted-foreground/50 transition-colors" },
22
- react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, t("addItemPrompt")),
22
+ react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, t("addItem")),
23
23
  react_1.default.createElement(button_1.Button, { onClick: handleAddItemService, size: "sm", type: "button", variant: "outline" },
24
24
  react_1.default.createElement(lucide_react_1.Plus, { className: "h-4 w-4 mr-2" }),
25
- t("buttonAddService")),
25
+ t("addItemService")),
26
26
  react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, t("addItemOr")),
27
27
  react_1.default.createElement(button_1.Button, { onClick: handleAddItemProduct, size: "sm", type: "button", variant: "outline" },
28
28
  react_1.default.createElement(lucide_react_1.Plus, { className: "h-4 w-4 mr-2" }),
29
- t("buttonAddProduct"))));
29
+ t("addItemProduct"))));
30
30
  };
31
31
  exports.AddServiceProductSection = AddServiceProductSection;
@@ -50,7 +50,7 @@ var context_1 = require("@appcorp/stellar-solutions-modules/global-modules/prefe
50
50
  var actions_1 = require("./actions");
51
51
  var context_2 = require("./context");
52
52
  var CompanySection = function () {
53
- var t = (0, next_intl_1.useTranslations)("invoicePage");
53
+ var t = (0, next_intl_1.useTranslations)("invoice");
54
54
  var currencies = (0, context_1.usePreferenceStateContext)().currencies;
55
55
  var _a = (0, context_2.useInvoiceStateContext)(), companiesList = _a.companiesList, companyId = _a.companyId, currency = _a.currency, date = _a.date, dispatch = _a.dispatch, errors = _a.errors, expiryDate = _a.expiryDate, note = _a.note, ref = _a.ref;
56
56
  var handleInputChange = (0, react_1.useCallback)(function (key, value) {
@@ -107,19 +107,19 @@ var CompanySection = function () {
107
107
  name: curr.code,
108
108
  }); });
109
109
  return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
110
- react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("companySectionTitle")),
110
+ react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("companyFormSectionTitle")),
111
111
  react_1.default.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" },
112
112
  react_1.default.createElement("div", { className: "space-y-2" },
113
- react_1.default.createElement(combobox_1.CompanyCombobox, { companies: companiesList || [], error: errors.companyId, id: "companyId", label: t("formLabelCompany"), onSearchChange: handleCompanySearch, onValueChange: handleCompanyChange, placeholder: t("formPlaceholderCompany"), required: true, value: companyId || "" })),
113
+ react_1.default.createElement(combobox_1.CompanyCombobox, { companies: companiesList || [], error: errors.companyId, id: "companyId", info: t("companyFormInfoCompany"), label: t("companyFormLabelCompany"), onSearchChange: handleCompanySearch, onValueChange: handleCompanyChange, placeholder: t("companyFormPlaceholderCompany"), required: true, value: companyId || "" })),
114
114
  react_1.default.createElement("div", { className: "space-y-2" },
115
- react_1.default.createElement(input_1.Input, { error: errors.date, id: "date", label: t("formLabelDate"), onChange: function (e) { return handleInputChange("date", e.target.value); }, required: true, type: "date", value: date ? (0, date_fns_1.format)(new Date(date), "yyyy-MM-dd") : "" })),
115
+ react_1.default.createElement(input_1.Input, { error: errors.date, id: "date", info: t("companyFormInfoDate"), label: t("companyFormLabelDate"), onChange: function (e) { return handleInputChange("date", e.target.value); }, placeholder: t("companyFormPlaceholderDate"), required: true, type: "date", value: date ? (0, date_fns_1.format)(new Date(date), "yyyy-MM-dd") : "" })),
116
116
  react_1.default.createElement("div", { className: "space-y-2" },
117
- react_1.default.createElement(input_1.Input, { error: errors.expiryDate, id: "expiryDate", label: t("formLabelExpiryDate"), onChange: function (e) { return handleInputChange("expiryDate", e.target.value); }, required: true, type: "date", value: expiryDate ? (0, date_fns_1.format)(new Date(expiryDate), "yyyy-MM-dd") : "" })),
117
+ react_1.default.createElement(input_1.Input, { error: errors.expiryDate, id: "expiryDate", info: t("companyFormInfoExpiryDate"), label: t("companyFormLabelExpiryDate"), onChange: function (e) { return handleInputChange("expiryDate", e.target.value); }, placeholder: t("companyFormPlaceholderExpiryDate"), required: true, type: "date", value: expiryDate ? (0, date_fns_1.format)(new Date(expiryDate), "yyyy-MM-dd") : "" })),
118
118
  react_1.default.createElement("div", { className: "space-y-2" },
119
- react_1.default.createElement(combobox_1.CompanyCombobox, { companies: currencyOptions, error: errors.currency, id: "currency", label: t("formLabelCurrency"), onSearchChange: function () { }, onValueChange: handleCurrencyChange, placeholder: t("formPlaceholderCurrency"), required: true, value: currency || "" })),
119
+ react_1.default.createElement(combobox_1.CompanyCombobox, { companies: currencyOptions, error: errors.currency, id: "currency", info: t("companyFormInfoCurrency"), label: t("companyFormLabelCurrency"), onSearchChange: function () { }, onValueChange: handleCurrencyChange, placeholder: t("companyFormPlaceholderCurrency"), required: true, value: currency || "" })),
120
120
  react_1.default.createElement("div", { className: "space-y-2" },
121
- react_1.default.createElement(textarea_1.Textarea, { error: errors.note, id: "note", label: t("formLabelNote"), onChange: function (e) { return handleInputChange("note", e.target.value); }, placeholder: t("formPlaceholderNote"), rows: 3, value: note || "" })),
121
+ react_1.default.createElement(textarea_1.Textarea, { error: errors.note, id: "note", info: t("companyFormInfoNote"), label: t("companyFormLabelNote"), onChange: function (e) { return handleInputChange("note", e.target.value); }, placeholder: t("companyFormPlaceholderNote"), rows: 3, value: note || "" })),
122
122
  react_1.default.createElement("div", { className: "space-y-2" },
123
- react_1.default.createElement(input_1.Input, { error: errors.ref, id: "ref", label: t("formLabelRef"), onChange: function (e) { return handleInputChange("ref", e.target.value); }, readOnly: true, required: true, type: "text", value: ref || "" })))));
123
+ react_1.default.createElement(input_1.Input, { error: errors.ref, id: "ref", info: t("companyFormInfoReference"), label: t("companyFormLabelReference"), onChange: function (e) { return handleInputChange("ref", e.target.value); }, placeholder: t("companyFormPlaceholderReference"), readOnly: true, required: true, type: "text", value: ref || "" })))));
124
124
  };
125
125
  exports.CompanySection = CompanySection;
@@ -155,7 +155,8 @@ var useInvoiceState = function () {
155
155
  // State & Core Hooks
156
156
  // ---------------------------------------------------------------------------
157
157
  var _b = (0, react_1.useReducer)(reducer_1.invoiceReducer, reducer_1.initialInvoiceState), state = _b[0], dispatch = _b[1];
158
- var t = (0, next_intl_1.useTranslations)("toastMessages");
158
+ var t = (0, next_intl_1.useTranslations)("invoice");
159
+ var tCommon = (0, next_intl_1.useTranslations)("common");
159
160
  var theme = (0, next_themes_1.useTheme)().theme;
160
161
  var taxes = (0, context_1.useTaxStateContext)().taxes;
161
162
  var currencies = (0, context_2.usePreferenceStateContext)().currencies;
@@ -201,16 +202,16 @@ var useInvoiceState = function () {
201
202
  })[0];
202
203
  }, [currencies]);
203
204
  // ---------------------------------------------------------------------------
204
- // API Parameters (Memoized)
205
+ // API PARAMETERS
205
206
  // ---------------------------------------------------------------------------
206
- var listParams = {
207
+ var listParams = (0, react_1.useMemo)(function () { return ({
207
208
  category: types_1.QUOTE_INVOICE_CATEGORY.INVOICE,
208
209
  currentPage: state.currentPage,
210
+ includeCompany: true,
211
+ includeCustomer: true,
209
212
  pageLimit: state.pageLimit,
210
213
  searchQuery: state.searchQuery,
211
- includeCustomer: true,
212
- includeCompany: true,
213
- };
214
+ }); }, [state.currentPage, state.pageLimit, state.searchQuery]);
214
215
  var updateParams = (0, react_1.useMemo)(function () {
215
216
  var _a, _b, _c, _d, _e, _f, _g, _h;
216
217
  return ({
@@ -249,19 +250,16 @@ var useInvoiceState = function () {
249
250
  country: (_h = state.customer) === null || _h === void 0 ? void 0 : _h.country,
250
251
  });
251
252
  }, [state]);
252
- var byIdParams = {
253
- id: state.id,
254
- };
255
- var deleteParams = {
256
- id: state.id,
257
- };
253
+ var byIdParams = (0, react_1.useMemo)(function () { return ({ id: state.id }); }, [state.id]);
254
+ var deleteParams = (0, react_1.useMemo)(function () { return ({ id: state.id }); }, [state.id]);
258
255
  // ---------------------------------------------------------------------------
259
- // API Callbacks
256
+ // API CALLBACKS
260
257
  // ---------------------------------------------------------------------------
261
258
  var listCallback = (0, react_1.useCallback)(function (_a) {
262
259
  var data = _a.data, error = _a.error;
263
260
  if (error) {
264
- showErrorToast(t("networkError"));
261
+ showErrorToast(tCommon("messagesNetworkError"));
262
+ return;
265
263
  }
266
264
  if (data === null || data === void 0 ? void 0 : data.items) {
267
265
  dispatch({
@@ -273,20 +271,21 @@ var useInvoiceState = function () {
273
271
  payload: { count: data === null || data === void 0 ? void 0 : data.count },
274
272
  });
275
273
  }
276
- }, [t, showErrorToast]);
274
+ },
275
+ // eslint-disable-next-line react-hooks/exhaustive-deps
276
+ [showErrorToast]);
277
277
  var updateCallback = (0, react_1.useCallback)(function (_a) {
278
278
  var data = _a.data, error = _a.error;
279
279
  if (error) {
280
- showErrorToast(t("networkError"));
280
+ showErrorToast(tCommon("messagesNetworkError"));
281
+ return;
281
282
  }
282
283
  if (data) {
283
- showSuccessToast(state.mode === "Edit" ? t("invoiceUpdated") : t("invoiceCreated"));
284
- dispatch({
285
- type: actions_1.INVOICE_ACTION_TYPES.RESET_FORM,
286
- });
287
- dispatch({
288
- type: actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS,
289
- });
284
+ showSuccessToast(state.mode === "Edit"
285
+ ? t("messagesInvoiceUpdated")
286
+ : t("messagesInvoiceCreated"));
287
+ dispatch({ type: actions_1.INVOICE_ACTION_TYPES.RESET_FORM });
288
+ dispatch({ type: actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS });
290
289
  listFetchNow();
291
290
  dispatch({
292
291
  type: actions_1.INVOICE_ACTION_TYPES.SET_DRAWER,
@@ -295,12 +294,13 @@ var useInvoiceState = function () {
295
294
  }
296
295
  },
297
296
  // eslint-disable-next-line react-hooks/exhaustive-deps
298
- [t, state.mode, showErrorToast, showSuccessToast]);
297
+ [t, tCommon, state.mode, showErrorToast, showSuccessToast]);
299
298
  var byIdCallback = (0, react_1.useCallback)(function (_a) {
300
299
  var _b, _c, _d, _e, _f;
301
300
  var data = _a.data, error = _a.error;
302
301
  if (error) {
303
- showErrorToast(t("invoiceFetchError"));
302
+ showErrorToast(t("messagesInvoiceFetchError"));
303
+ return;
304
304
  }
305
305
  if (data) {
306
306
  var updatedServices = __spreadArray([], data === null || data === void 0 ? void 0 : data.services, true).map(function (item) {
@@ -347,18 +347,17 @@ var useInvoiceState = function () {
347
347
  var deleteCallback = (0, react_1.useCallback)(function (_a) {
348
348
  var data = _a.data, error = _a.error;
349
349
  if (error) {
350
- showErrorToast(t("networkError"));
350
+ showErrorToast(tCommon("messagesNetworkError"));
351
+ return;
351
352
  }
352
353
  if (data) {
353
- showSuccessToast(t("invoiceUpdated"));
354
- dispatch({
355
- type: actions_1.INVOICE_ACTION_TYPES.RESET_FORM,
356
- });
354
+ showSuccessToast(t("messagesInvoiceDeleted"));
355
+ dispatch({ type: actions_1.INVOICE_ACTION_TYPES.RESET_FORM });
357
356
  listFetchNow();
358
357
  }
359
358
  },
360
359
  // eslint-disable-next-line react-hooks/exhaustive-deps
361
- [t, showErrorToast, showSuccessToast]);
360
+ [t, tCommon, showErrorToast, showSuccessToast]);
362
361
  // ---------------------------------------------------------------------------
363
362
  // Module Entity Hook
364
363
  // ---------------------------------------------------------------------------
@@ -719,50 +718,69 @@ var useInvoiceState = function () {
719
718
  payload: { key: "productsList", value: updatedItems },
720
719
  });
721
720
  }, [state.servicesList, state.productsList, state.getProducts]);
722
- var handleNextClick = function () {
721
+ // ---------------------------------------------------------------------------
722
+ // PAGINATION HANDLERS
723
+ // ---------------------------------------------------------------------------
724
+ var handleNextClick = (0, react_1.useCallback)(function () {
723
725
  dispatch({
724
726
  type: actions_1.INVOICE_ACTION_TYPES.SET_CURRENT_PAGE,
725
727
  payload: { currentPage: state.currentPage + 1 },
726
728
  });
727
- };
728
- var handlePreviousClick = function () {
729
+ }, [state.currentPage]);
730
+ var handlePreviousClick = (0, react_1.useCallback)(function () {
729
731
  dispatch({
730
732
  type: actions_1.INVOICE_ACTION_TYPES.SET_CURRENT_PAGE,
731
733
  payload: { currentPage: state.currentPage - 1 },
732
734
  });
733
- };
734
- var handlePageLimit = function (k, value) {
735
+ }, [state.currentPage]);
736
+ var handlePageLimit = (0, react_1.useCallback)(function (k, value) {
735
737
  var val = __assign({}, value);
736
738
  dispatch({
737
739
  type: actions_1.INVOICE_ACTION_TYPES.SET_PAGE_LIMIT,
738
740
  payload: { pageLimit: Number(val.option) },
739
741
  });
740
- };
741
- var searchOnChange = function (k, v) {
742
+ // Reset to page 1 when page limit changes
743
+ dispatch({
744
+ type: actions_1.INVOICE_ACTION_TYPES.SET_CURRENT_PAGE,
745
+ payload: { currentPage: 1 },
746
+ });
747
+ }, []);
748
+ var searchOnChange = (0, react_1.useCallback)(function (k, v) {
742
749
  dispatch({
743
750
  type: actions_1.INVOICE_ACTION_TYPES.SET_SEARCH_QUERY,
744
751
  payload: { searchQuery: v },
745
752
  });
746
- };
747
- var clearSearch = function () {
753
+ }, []);
754
+ var clearSearch = (0, react_1.useCallback)(function () {
748
755
  dispatch({
749
756
  type: actions_1.INVOICE_ACTION_TYPES.SET_SEARCH_QUERY,
750
757
  payload: { searchQuery: "" },
751
758
  });
752
- };
753
- var closeDrawer = function () {
754
- dispatch({
755
- type: actions_1.INVOICE_ACTION_TYPES.SET_DRAWER,
756
- payload: { drawer: null },
757
- });
759
+ }, []);
760
+ // ---------------------------------------------------------------------------
761
+ // SEARCH HANDLERS
762
+ // ---------------------------------------------------------------------------
763
+ var handleTaxSearch = (0, react_1.useCallback)(function (searchQuery) {
758
764
  dispatch({
759
- type: actions_1.INVOICE_ACTION_TYPES.RESET_FORM,
765
+ type: actions_1.INVOICE_ACTION_TYPES.SET_INPUT_FIELD,
766
+ payload: { key: "taxQuery", value: searchQuery },
760
767
  });
768
+ }, []);
769
+ // ---------------------------------------------------------------------------
770
+ // DRAWER & MODAL HANDLERS
771
+ // ---------------------------------------------------------------------------
772
+ var closeDrawer = (0, react_1.useCallback)(function () {
761
773
  dispatch({
762
- type: actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS,
774
+ type: actions_1.INVOICE_ACTION_TYPES.SET_DRAWER,
775
+ payload: { drawer: null },
763
776
  });
764
- };
765
- var handleDeleteServiceRow = function (i) {
777
+ dispatch({ type: actions_1.INVOICE_ACTION_TYPES.RESET_FORM });
778
+ dispatch({ type: actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS });
779
+ }, []);
780
+ // ---------------------------------------------------------------------------
781
+ // FORM HANDLERS
782
+ // ---------------------------------------------------------------------------
783
+ var handleDeleteServiceRow = (0, react_1.useCallback)(function (i) {
766
784
  if (state.servicesList.length > 1) {
767
785
  var res = state.servicesList.splice(i, 1);
768
786
  dispatch({
@@ -770,8 +788,8 @@ var useInvoiceState = function () {
770
788
  payload: { servicesList: __spreadArray([], res, true) },
771
789
  });
772
790
  }
773
- };
774
- var handleDeleteProductRow = function (i) {
791
+ }, [state.servicesList]);
792
+ var handleDeleteProductRow = (0, react_1.useCallback)(function (i) {
775
793
  if (state.productsList.length > 1) {
776
794
  var res = state.productsList.splice(i, 1);
777
795
  dispatch({
@@ -779,8 +797,11 @@ var useInvoiceState = function () {
779
797
  payload: { productsList: __spreadArray([], res, true) },
780
798
  });
781
799
  }
782
- };
783
- var headerActions = [
800
+ }, [state.productsList]);
801
+ // ---------------------------------------------------------------------------
802
+ // TABLE ACTIONS
803
+ // ---------------------------------------------------------------------------
804
+ var headerActions = (0, react_1.useMemo)(function () { return [
784
805
  {
785
806
  enabled: true,
786
807
  handleOnClick: function () { return handleCreate("company"); },
@@ -793,8 +814,8 @@ var useInvoiceState = function () {
793
814
  label: "Invoice for Customer",
794
815
  order: 2,
795
816
  },
796
- ];
797
- var rowActions = [
817
+ ]; }, [handleCreate]);
818
+ var rowActions = (0, react_1.useMemo)(function () { return [
798
819
  {
799
820
  enabled: true,
800
821
  handleAction: function (id) { return handleEdit(id); },
@@ -813,10 +834,13 @@ var useInvoiceState = function () {
813
834
  label: "Delete",
814
835
  order: 3,
815
836
  },
816
- ];
817
- return __assign(__assign({}, state), { byIdError: byIdError, byIdLoading: byIdLoading, clearSearch: clearSearch, closeDrawer: closeDrawer, deleteError: deleteError, deleteLoading: deleteLoading, dispatch: dispatch, handleAddItemProduct: handleAddItemProduct, handleAddItemService: handleAddItemService, handleChange: handleChange, handleDeleteProductRow: handleDeleteProductRow, handleDeleteServiceRow: handleDeleteServiceRow, handleItemChangeProducts: handleItemChangeProducts, handleItemChangeServices: handleItemChangeServices, handleNextClick: handleNextClick, handlePageLimit: handlePageLimit, handlePreviousClick: handlePreviousClick, handleSubmit: handleSubmit, headerActions: headerActions, listError: listError, listFetchNow: listFetchNow, listLoading: listLoading, rowActions: rowActions, searchOnChange: searchOnChange, updateError: updateError, updateLoading: updateLoading });
837
+ ]; }, [handleEdit, handleRecordPayment, handleDelete]);
838
+ // ---------------------------------------------------------------------------
839
+ // RETURN STATE
840
+ // ---------------------------------------------------------------------------
841
+ return __assign(__assign({}, state), { byIdError: byIdError, byIdLoading: byIdLoading, clearSearch: clearSearch, closeDrawer: closeDrawer, deleteError: deleteError, deleteLoading: deleteLoading, dispatch: dispatch, handleAddItemProduct: handleAddItemProduct, handleAddItemService: handleAddItemService, handleChange: handleChange, handleDeleteProductRow: handleDeleteProductRow, handleDeleteServiceRow: handleDeleteServiceRow, handleItemChangeProducts: handleItemChangeProducts, handleItemChangeServices: handleItemChangeServices, handleNextClick: handleNextClick, handlePageLimit: handlePageLimit, handlePreviousClick: handlePreviousClick, handleSubmit: handleSubmit, headerActions: headerActions, listError: listError, listFetchNow: listFetchNow, listLoading: listLoading, rowActions: rowActions, searchOnChange: searchOnChange, handleTaxSearch: handleTaxSearch, updateError: updateError, updateLoading: updateLoading });
818
842
  };
819
- exports.InvoiceStateContext = (0, react_1.createContext)(__assign(__assign({}, reducer_1.initialInvoiceState), { byIdError: undefined, byIdLoading: false, clearSearch: function () { return void 0; }, closeDrawer: function () { return void 0; }, deleteError: undefined, deleteLoading: false, dispatch: function () { return void 0; }, handleAddItemProduct: function () { return void 0; }, handleAddItemService: function () { return void 0; }, handleChange: function () { return void 0; }, handleDeleteProductRow: function () { return void 0; }, handleDeleteServiceRow: function () { return void 0; }, handleItemChangeProducts: function () { return void 0; }, handleItemChangeServices: function () { return void 0; }, handleNextClick: function () { return void 0; }, handlePageLimit: function () { return void 0; }, handlePreviousClick: function () { return void 0; }, handleSubmit: function () { return void 0; }, headerActions: [], listError: undefined, listFetchNow: function () { return void 0; }, listLoading: false, rowActions: [], searchOnChange: function () { return void 0; }, updateError: undefined, updateLoading: false }));
843
+ exports.InvoiceStateContext = (0, react_1.createContext)(__assign(__assign({}, reducer_1.initialInvoiceState), { byIdError: undefined, byIdLoading: false, clearSearch: function () { return void 0; }, closeDrawer: function () { return void 0; }, deleteError: undefined, deleteLoading: false, dispatch: function () { return void 0; }, handleAddItemProduct: function () { return void 0; }, handleAddItemService: function () { return void 0; }, handleChange: function () { return void 0; }, handleDeleteProductRow: function () { return void 0; }, handleDeleteServiceRow: function () { return void 0; }, handleItemChangeProducts: function () { return void 0; }, handleItemChangeServices: function () { return void 0; }, handleNextClick: function () { return void 0; }, handlePageLimit: function () { return void 0; }, handlePreviousClick: function () { return void 0; }, handleSubmit: function () { return void 0; }, headerActions: [], listError: undefined, listFetchNow: function () { return void 0; }, listLoading: false, rowActions: [], searchOnChange: function () { return void 0; }, handleTaxSearch: function () { return void 0; }, updateError: undefined, updateLoading: false }));
820
844
  var InvoiceStateContextProvider = function (_a) {
821
845
  var children = _a.children;
822
846
  var state = useInvoiceState();
@@ -48,7 +48,7 @@ var input_1 = require("@appcorp/shadcn/components/input");
48
48
  var context_1 = require("./context");
49
49
  var actions_1 = require("./actions");
50
50
  var CustomerSection = function () {
51
- var t = (0, next_intl_1.useTranslations)("invoicePage");
51
+ var t = (0, next_intl_1.useTranslations)("invoice");
52
52
  var _a = (0, context_1.useInvoiceStateContext)(), customer = _a.customer, errors = _a.errors, dispatch = _a.dispatch;
53
53
  var handleCustomerChange = (0, react_1.useCallback)(function (key, value) {
54
54
  if (key === "phone") {
@@ -79,21 +79,21 @@ var CustomerSection = function () {
79
79
  handleCustomerChange("country", country);
80
80
  };
81
81
  return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
82
- react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("customerSectionTitle")),
82
+ react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("customerFormSectionTitle")),
83
83
  react_1.default.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4" },
84
84
  react_1.default.createElement("div", { className: "space-y-2" },
85
- react_1.default.createElement(input_1.Input, { id: "phone", type: "tel", label: t("formLabelPhone"), value: (customer === null || customer === void 0 ? void 0 : customer.phone) || "", onChange: function (e) { return handleCustomerChange("phone", e.target.value); }, placeholder: "+92 300 0000000", error: errors.phone, required: true })),
85
+ react_1.default.createElement(input_1.Input, { error: errors.phone, id: "phone", info: t("customerFormInfoPhone"), label: t("customerFormLabelPhone"), onChange: function (e) { return handleCustomerChange("phone", e.target.value); }, placeholder: t("customerFormPlaceholderPhone"), required: true, type: "tel", value: (customer === null || customer === void 0 ? void 0 : customer.phone) || "" })),
86
86
  react_1.default.createElement("div", { className: "space-y-2" },
87
- react_1.default.createElement(input_1.Input, { id: "firstName", type: "text", label: t("formLabelFirstName"), value: (customer === null || customer === void 0 ? void 0 : customer.firstName) || "", onChange: function (e) { return handleInputChange("firstName", e.target.value); }, placeholder: "John", error: errors.firstName, required: true })),
87
+ react_1.default.createElement(input_1.Input, { error: errors.firstName, id: "firstName", info: t("customerFormInfoFirstName"), label: t("customerFormLabelFirstName"), onChange: function (e) { return handleInputChange("firstName", e.target.value); }, placeholder: t("customerFormPlaceholderFirstName"), required: true, type: "text", value: (customer === null || customer === void 0 ? void 0 : customer.firstName) || "" })),
88
88
  react_1.default.createElement("div", { className: "space-y-2" },
89
- react_1.default.createElement(input_1.Input, { id: "lastName", type: "text", label: t("formLabelLastName"), value: (customer === null || customer === void 0 ? void 0 : customer.lastName) || "", onChange: function (e) { return handleInputChange("lastName", e.target.value); }, placeholder: "Doe", error: errors.lastName, required: true })),
89
+ react_1.default.createElement(input_1.Input, { error: errors.lastName, id: "lastName", info: t("customerFormInfoLastName"), label: t("customerFormLabelLastName"), onChange: function (e) { return handleInputChange("lastName", e.target.value); }, placeholder: t("customerFormPlaceholderLastName"), required: true, type: "text", value: (customer === null || customer === void 0 ? void 0 : customer.lastName) || "" })),
90
90
  react_1.default.createElement("div", { className: "space-y-2" },
91
- react_1.default.createElement(input_1.Input, { id: "email", type: "email", label: t("formLabelEmail"), value: (customer === null || customer === void 0 ? void 0 : customer.email) || "", onChange: function (e) { return handleInputChange("email", e.target.value); }, placeholder: "name@company.com", error: errors.email })),
91
+ react_1.default.createElement(input_1.Input, { error: errors.email, id: "email", info: t("customerFormInfoEmail"), label: t("customerFormLabelEmail"), onChange: function (e) { return handleInputChange("email", e.target.value); }, placeholder: t("customerFormPlaceholderEmail"), type: "email", value: (customer === null || customer === void 0 ? void 0 : customer.email) || "" })),
92
92
  react_1.default.createElement("div", { className: "space-y-2" },
93
- react_1.default.createElement(input_1.Input, { id: "address", type: "text", label: t("formLabelAddress"), value: (customer === null || customer === void 0 ? void 0 : customer.address) || "", onChange: function (e) { return handleInputChange("address", e.target.value); }, placeholder: "123 Street", error: errors.address })),
93
+ react_1.default.createElement(input_1.Input, { error: errors.address, id: "address", info: t("customerFormInfoAddress"), label: t("customerFormLabelAddress"), onChange: function (e) { return handleInputChange("address", e.target.value); }, placeholder: t("customerFormPlaceholderAddress"), type: "text", value: (customer === null || customer === void 0 ? void 0 : customer.address) || "" })),
94
94
  react_1.default.createElement("div", { className: "space-y-2" },
95
- react_1.default.createElement(input_1.Input, { id: "city", type: "text", label: t("formLabelCity"), value: (customer === null || customer === void 0 ? void 0 : customer.city) || "", onChange: function (e) { return handleInputChange("city", e.target.value); }, placeholder: "New York", error: errors.city, required: true })),
95
+ react_1.default.createElement(input_1.Input, { error: errors.city, id: "city", info: t("customerFormInfoCity"), label: t("customerFormLabelCity"), onChange: function (e) { return handleInputChange("city", e.target.value); }, placeholder: t("customerFormPlaceholderCity"), required: true, type: "text", value: (customer === null || customer === void 0 ? void 0 : customer.city) || "" })),
96
96
  react_1.default.createElement("div", { className: "space-y-2" },
97
- react_1.default.createElement(combobox_1.CountryCombobox, { countries: util_functions_1.countriesTimeZones, id: "country", label: t("formLabelCountry"), value: (customer === null || customer === void 0 ? void 0 : customer.country) || "", onValueChange: handleCountryChange, placeholder: t("formPlaceholderCountry"), error: errors.country, required: true })))));
97
+ react_1.default.createElement(combobox_1.CountryCombobox, { countries: util_functions_1.countriesTimeZones, error: errors.country, id: "country", info: t("customerFormInfoCountry"), label: t("customerFormLabelCountry"), onValueChange: handleCountryChange, placeholder: t("customerFormPlaceholderCountry"), required: true, value: (customer === null || customer === void 0 ? void 0 : customer.country) || "" })))));
98
98
  };
99
99
  exports.CustomerSection = CustomerSection;
@@ -21,7 +21,7 @@ var form_1 = require("./form");
21
21
  var types_1 = require("./types");
22
22
  var Drawer = function (_a) {
23
23
  var isRTL = _a.isRTL;
24
- var t = (0, next_intl_1.useTranslations)("invoicePage");
24
+ var t = (0, next_intl_1.useTranslations)("invoice");
25
25
  var _b = (0, context_1.useInvoiceStateContext)(), closeDrawer = _b.closeDrawer, disableSaveButton = _b.disableSaveButton, drawer = _b.drawer, handleSubmit = _b.handleSubmit;
26
26
  var isFormDrawer = drawer === types_1.INVOICE_DRAWER.INVOICE_COMPANY_FORM_DRAWER ||
27
27
  drawer === types_1.INVOICE_DRAWER.INVOICE_CUSTOMER_FORM_DRAWER;
@@ -17,7 +17,7 @@ var drawer_1 = require("./drawer");
17
17
  var InvoicePage = function () {
18
18
  var _a = (0, context_1.useInvoiceStateContext)(), count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, invoices = _a.invoices, listLoading = _a.listLoading, pageLimit = _a.pageLimit, rowActions = _a.rowActions, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
19
19
  var isRTL = (0, use_rtl_1.useRTL)();
20
- var t = (0, next_intl_1.useTranslations)("invoicePage");
20
+ var t = (0, next_intl_1.useTranslations)("invoice");
21
21
  var tableHeadItems = [
22
22
  {
23
23
  label: t("tableColumnHeaderId"),
@@ -62,7 +62,7 @@ var InvoicePage = function () {
62
62
  ];
63
63
  var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
64
64
  return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
65
- react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "invoice-search", searchPlaceholder: "Enter ID or Name...", searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: invoices, tableDescription: t("subTitle"), tableHeadItems: tableHeadItems, tableHeading: t("title"), totalPages: totalPages }),
65
+ react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "invoice-search", searchPlaceholder: t("tableSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: invoices, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: totalPages }),
66
66
  react_1.default.createElement(drawer_1.Drawer, { isRTL: isRTL }),
67
67
  react_1.default.createElement(sonner_1.Toaster, null)));
68
68
  };
@@ -5,72 +5,95 @@
5
5
  * Totals calculation section for invoice pricing including tax and discount.
6
6
  * Uses Shadcn UI components with RTL support and i18n.
7
7
  */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
11
41
  Object.defineProperty(exports, "__esModule", { value: true });
12
42
  exports.PricingSection = void 0;
13
- var react_1 = __importDefault(require("react"));
43
+ var react_1 = __importStar(require("react"));
14
44
  var next_intl_1 = require("next-intl");
15
45
  var combobox_1 = require("@appcorp/shadcn/components/combobox");
16
46
  var input_1 = require("@appcorp/shadcn/components/input");
17
47
  var label_1 = require("@appcorp/shadcn/components/label");
18
48
  var button_1 = require("@appcorp/shadcn/components/button");
19
- var context_1 = require("./context");
49
+ var context_1 = require("@appcorp/stellar-solutions-modules/global-modules/tax/context");
50
+ var context_2 = require("./context");
20
51
  var types_1 = require("./types");
21
52
  var PricingSection = function () {
22
- var t = (0, next_intl_1.useTranslations)("invoicePage");
23
- var _a = (0, context_1.useInvoiceStateContext)(), afterDiscount = _a.afterDiscount, discount = _a.discount, discountUnit = _a.discountUnit, errors = _a.errors, handleChange = _a.handleChange, subTotal = _a.subTotal, tax = _a.tax, taxes = _a.taxes, total = _a.total;
24
- var handleTaxChange = function (selectedTaxId) {
25
- var selectedTax = taxes === null || taxes === void 0 ? void 0 : taxes.find(function (t) { return t.id === selectedTaxId; });
26
- if (selectedTax) {
27
- handleChange("taxRate", selectedTax.taxRate);
28
- }
29
- };
30
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
- var handleTaxSearch = function (_searchQuery) {
32
- // Tax search functionality placeholder
33
- };
34
- var handleDiscountUnitChange = function (unit) {
35
- handleChange("discountUnit", unit);
36
- };
37
- // Map taxes to have consistent structure for CompanyCombobox
38
- var taxOptions = (taxes || []).map(function (tax) { return ({
39
- id: tax.id,
40
- name: "".concat(tax.taxName, " (").concat(tax.taxRate, "%)"),
41
- }); });
42
- var currentTax = taxes === null || taxes === void 0 ? void 0 : taxes.find(function (t) { return String(t.taxRate) === String(tax); });
53
+ var t = (0, next_intl_1.useTranslations)("invoice");
54
+ var _a = (0, context_1.useTaxStateContext)(), taxesFromTaxContext = _a.taxes, taxesLoading = _a.listLoading;
55
+ var _b = (0, context_2.useInvoiceStateContext)(), afterDiscount = _b.afterDiscount, discount = _b.discount, discountUnit = _b.discountUnit, errors = _b.errors, handleChange = _b.handleChange, handleTaxSearch = _b.handleTaxSearch, subTotal = _b.subTotal, tax = _b.tax, taxRate = _b.taxRate, total = _b.total;
56
+ // Find the current tax based on taxRate value
57
+ var currentTax = (0, react_1.useMemo)(function () {
58
+ return taxesFromTaxContext === null || taxesFromTaxContext === void 0 ? void 0 : taxesFromTaxContext.find(function (t) { return String(t.taxRate) === String(taxRate); });
59
+ }, [taxesFromTaxContext, taxRate]);
43
60
  return (react_1.default.createElement("div", { className: "flex flex-col gap-6" },
44
- react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("pricingSectionTitle")),
61
+ react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("pricingFormSectionTitle")),
45
62
  react_1.default.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" },
46
63
  react_1.default.createElement("div", { className: "hidden lg:block" }),
47
64
  react_1.default.createElement("div", { className: "hidden lg:block" }),
48
65
  react_1.default.createElement("div", { className: "flex flex-col gap-4" },
49
66
  react_1.default.createElement("div", { className: "space-y-2" },
50
- react_1.default.createElement(input_1.Input, { error: errors.subTotal, id: "subTotal", label: t("formLabelSubTotal"), onChange: function (e) { return handleChange("subTotal", e.target.value); }, placeholder: "0.00", readOnly: true, type: "text", value: subTotal || "0" })),
67
+ react_1.default.createElement(input_1.Input, { error: errors.subTotal, id: "subTotal", label: t("pricingFormLabelSubTotal"), onChange: function (e) { return handleChange("subTotal", e.target.value); }, placeholder: t("pricingFormPlaceholderSubTotal"), readOnly: true, type: "text", value: subTotal || "0", info: t("pricingFormInfoSubTotal") })),
51
68
  react_1.default.createElement("div", { className: "space-y-3" },
52
- react_1.default.createElement(label_1.Label, null, t("formLabelDiscountUnit")),
53
- react_1.default.createElement("p", { className: "text-sm text-muted-foreground" }, t("discountUnitDescription")),
69
+ react_1.default.createElement(label_1.Label, null, t("pricingFormLabelDiscountUnit")),
70
+ react_1.default.createElement("p", { className: "text-sm text-muted-foreground" }, t("pricingFormDescriptionDiscountUnit")),
54
71
  react_1.default.createElement("div", { className: "flex gap-2" },
55
72
  react_1.default.createElement(button_1.Button, { onClick: function () {
56
- return handleDiscountUnitChange(types_1.DISCOUNT_UNIT.FIXED_VALUE);
73
+ return handleChange("discountUnit", types_1.DISCOUNT_UNIT.FIXED_VALUE);
57
74
  }, size: "sm", type: "button", variant: discountUnit === types_1.DISCOUNT_UNIT.FIXED_VALUE
58
75
  ? "default"
59
- : "outline" }, t("discountUnitFixedValue")),
76
+ : "outline" }, t("pricingFormDiscountFixedValue")),
60
77
  react_1.default.createElement(button_1.Button, { onClick: function () {
61
- return handleDiscountUnitChange(types_1.DISCOUNT_UNIT.PERCENTAGE_VALUE);
78
+ return handleChange("discountUnit", types_1.DISCOUNT_UNIT.PERCENTAGE_VALUE);
62
79
  }, size: "sm", type: "button", variant: discountUnit === types_1.DISCOUNT_UNIT.PERCENTAGE_VALUE
63
80
  ? "default"
64
- : "outline" }, t("discountUnitPercentageValue")))),
81
+ : "outline" }, t("pricingFormDiscountPercentageValue")))),
65
82
  react_1.default.createElement("div", { className: "space-y-2" },
66
- react_1.default.createElement(input_1.Input, { error: errors.discount, id: "discount", label: t("formLabelDiscount"), onChange: function (e) { return handleChange("discount", e.target.value); }, placeholder: "0.00", type: "number", value: discount || "0" })),
83
+ react_1.default.createElement(input_1.Input, { error: errors.discount, id: "discount", info: t("pricingFormInfoDiscount"), label: t("pricingFormLabelDiscount"), onChange: function (e) { return handleChange("discount", e.target.value); }, placeholder: t("pricingFormPlaceholderDiscount"), type: "number", value: discount || "0" })),
67
84
  react_1.default.createElement("div", { className: "space-y-2" },
68
- react_1.default.createElement(input_1.Input, { id: "afterDiscount", label: t("formLabelAfterDiscount"), onChange: function (e) { return handleChange("afterDiscount", e.target.value); }, placeholder: "0.00", readOnly: true, type: "text", value: afterDiscount || "0" })),
85
+ react_1.default.createElement(input_1.Input, { id: "afterDiscount", label: t("pricingFormLabelAfterDiscount"), onChange: function (e) { return handleChange("afterDiscount", e.target.value); }, placeholder: t("pricingFormPlaceholderAfterDiscount"), readOnly: true, type: "text", value: afterDiscount || "0", info: t("pricingFormInfoAfterDiscount") })),
69
86
  react_1.default.createElement("div", { className: "space-y-2" },
70
- react_1.default.createElement(combobox_1.CompanyCombobox, { companies: taxOptions, id: "taxRate", label: t("formLabelTax"), onSearchChange: handleTaxSearch, onValueChange: handleTaxChange, placeholder: t("formPlaceholderTax"), value: (currentTax === null || currentTax === void 0 ? void 0 : currentTax.id) || "" })),
87
+ react_1.default.createElement(combobox_1.Combobox, { id: "taxRate", label: t("pricingFormLabelTax"), value: (currentTax === null || currentTax === void 0 ? void 0 : currentTax.taxRate) || "", onValueChange: function (v) { return handleChange("taxRate", v); }, onSearchChange: handleTaxSearch, loading: taxesLoading, options: (taxesFromTaxContext || [])
88
+ .slice()
89
+ .sort(function (a, b) { return a.taxName.localeCompare(b.taxName); })
90
+ .map(function (tax) { return ({
91
+ label: "".concat(tax.taxName, " (").concat(tax.taxRate, "%)"),
92
+ value: tax.taxRate.toString(),
93
+ }); }), placeholder: t("pricingFormPlaceholderTax"), searchPlaceholder: t("pricingFormLabelSearchPlaceholder"), info: t("pricingFormInfoTax"), error: errors.taxRate, required: true })),
71
94
  react_1.default.createElement("div", { className: "space-y-2" },
72
- react_1.default.createElement(input_1.Input, { id: "afterTax", label: t("formLabelAfterTax"), placeholder: "0.00", readOnly: true, type: "text", value: isNaN(Number(tax)) ? "0" : tax || "0" })),
95
+ react_1.default.createElement(input_1.Input, { id: "afterTax", label: t("pricingFormLabelAfterTax"), placeholder: t("pricingFormPlaceholderAfterTax"), readOnly: true, type: "text", value: isNaN(Number(tax)) ? "0" : tax || "0", info: t("pricingFormInfoAfterTax") })),
73
96
  react_1.default.createElement("div", { className: "space-y-2" },
74
- react_1.default.createElement(input_1.Input, { error: errors.total, id: "total", label: t("formLabelTotal"), onChange: function (e) { return handleChange("total", e.target.value); }, placeholder: "0.00", readOnly: true, required: true, type: "text", value: isNaN(Number(total)) ? "0" : String(total || "0") }))))));
97
+ react_1.default.createElement(input_1.Input, { error: errors.total, id: "total", label: t("pricingFormLabelTotal"), onChange: function (e) { return handleChange("total", e.target.value); }, placeholder: t("pricingFormPlaceholderTotal"), readOnly: true, required: true, type: "text", value: isNaN(Number(total)) ? "0" : String(total || "0"), info: t("pricingFormInfoTotal") }))))));
75
98
  };
76
99
  exports.PricingSection = PricingSection;