@appcorp/stellar-solutions-invoice-module 0.1.34 → 0.1.35

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.
@@ -307,10 +307,10 @@ var useInvoiceState = function () {
307
307
  };
308
308
  var handleAddItemProduct = function () {
309
309
  var newItem = {
310
+ id: '',
310
311
  mode: 'Create',
311
- productId: '',
312
- quantity: '1',
313
312
  price: '',
313
+ quantity: '1',
314
314
  rowTotal: '',
315
315
  };
316
316
  dispatch({
@@ -465,11 +465,11 @@ var useInvoiceState = function () {
465
465
  var _b, _c, _d;
466
466
  var index = _a.index, key = _a.key, value = _a.value;
467
467
  var updatedItems = __spreadArray([], state.products, true);
468
- if (key === 'productId' && typeof value === 'string') {
468
+ if (key === 'id' && typeof value === 'string') {
469
469
  var matchingProduct = products === null || products === void 0 ? void 0 : products.find(function (product) { return product.id === value; });
470
470
  if (matchingProduct) {
471
471
  var quantity = parseFloat(String(updatedItems[index].quantity)) || 0;
472
- var rowTotal = (quantity * Number(matchingProduct.salePrice)).toFixed(2);
472
+ var rowTotal = (quantity * parseFloat(matchingProduct.salePrice)).toFixed(2);
473
473
  updatedItems[index] = __assign(__assign({}, updatedItems[index]), (_b = {}, _b[key] = value, _b.price = matchingProduct.salePrice, _b.mode = updatedItems[index].mode === 'Create' ? 'Create' : 'Edit', _b.rowTotal = rowTotal, _b));
474
474
  var allServices = state.services;
475
475
  var subtotal = (0, calculate_subtotal_1.calculateSubtotal)(allServices, updatedItems);
@@ -38,7 +38,7 @@ var ProductsSection = function () {
38
38
  key: k,
39
39
  value: val.id,
40
40
  });
41
- }, handleOnBlur: handleChange, handleInputOnChange: handleChange, label: "Product", listItems: productList, nodeQueryKey: 'productQuery', nodeSelectKey: 'productId', query: '', selectKey1: 'name', selectedItem: { id: products[index].productId } })),
41
+ }, handleOnBlur: handleChange, handleInputOnChange: handleChange, label: "Product", listItems: productList, nodeQueryKey: 'productQuery', nodeSelectKey: 'id', query: '', selectKey1: 'name', selectedItem: { id: products[index].id } })),
42
42
  react_1.default.createElement(vista_text_input_v1_1.VistaTextInputV1, { handleOnChange: function (k, v) { return handleItemChangeProducts({ index: index, key: k, value: v }); }, id: 'quantity', label: 'Quantity', placeholder: '1', value: String(products[index].quantity), type: 'text' }),
43
43
  react_1.default.createElement(vista_text_input_v1_1.VistaTextInputV1, { handleOnChange: function (k, v) { return handleItemChangeProducts({ index: index, key: k, value: v }); }, id: 'price', label: 'Price', placeholder: '0.00', value: products[index].price, type: 'number' }),
44
44
  react_1.default.createElement(vista_text_input_v1_1.VistaTextInputV1, { handleOnChange: function (k, v) { return handleItemChangeProducts({ index: index, key: k, value: v }); }, id: 'rowTotal', label: 'Row Total', placeholder: '0.00', value: products[index].rowTotal, type: 'number', readOnly: true }),
@@ -93,7 +93,7 @@ exports.initialInvoiceState = {
93
93
  {
94
94
  mode: 'Create',
95
95
  price: '',
96
- productId: '',
96
+ id: '',
97
97
  quantity: '1',
98
98
  rowTotal: '',
99
99
  },
@@ -44,10 +44,10 @@ export interface InvoiceContextType {
44
44
  updateLoading: boolean;
45
45
  }
46
46
  export interface Product {
47
- productId: string;
48
- quantity: string;
49
- price: string;
47
+ id: string;
50
48
  mode: 'Create' | 'Edit' | '';
49
+ price: string;
50
+ quantity: string;
51
51
  rowTotal: string;
52
52
  }
53
53
  export interface Service {
@@ -16,14 +16,14 @@ export declare const formValidation: z.ZodObject<{
16
16
  price: z.ZodOptional<z.ZodString>;
17
17
  total: z.ZodOptional<z.ZodString>;
18
18
  }, "strip", z.ZodTypeAny, {
19
- quantity?: string | undefined;
20
19
  price?: string | undefined;
20
+ quantity?: string | undefined;
21
21
  name?: string | undefined;
22
22
  description?: string | undefined;
23
23
  total?: string | undefined;
24
24
  }, {
25
- quantity?: string | undefined;
26
25
  price?: string | undefined;
26
+ quantity?: string | undefined;
27
27
  name?: string | undefined;
28
28
  description?: string | undefined;
29
29
  total?: string | undefined;
@@ -32,24 +32,24 @@ export declare const formValidation: z.ZodObject<{
32
32
  productId: z.ZodOptional<z.ZodString>;
33
33
  quantity: z.ZodOptional<z.ZodString>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- productId?: string | undefined;
36
35
  quantity?: string | undefined;
37
- }, {
38
36
  productId?: string | undefined;
37
+ }, {
39
38
  quantity?: string | undefined;
39
+ productId?: string | undefined;
40
40
  }>, "many">;
41
41
  }, "strip", z.ZodTypeAny, {
42
42
  currency: string;
43
43
  date: string;
44
44
  expiryDate: string;
45
45
  products: {
46
- productId?: string | undefined;
47
46
  quantity?: string | undefined;
47
+ productId?: string | undefined;
48
48
  }[];
49
49
  ref: string;
50
50
  services: {
51
- quantity?: string | undefined;
52
51
  price?: string | undefined;
52
+ quantity?: string | undefined;
53
53
  name?: string | undefined;
54
54
  description?: string | undefined;
55
55
  total?: string | undefined;
@@ -64,13 +64,13 @@ export declare const formValidation: z.ZodObject<{
64
64
  date: string;
65
65
  expiryDate: string;
66
66
  products: {
67
- productId?: string | undefined;
68
67
  quantity?: string | undefined;
68
+ productId?: string | undefined;
69
69
  }[];
70
70
  ref: string;
71
71
  services: {
72
- quantity?: string | undefined;
73
72
  price?: string | undefined;
73
+ quantity?: string | undefined;
74
74
  name?: string | undefined;
75
75
  description?: string | undefined;
76
76
  total?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-invoice-module",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "scripts": {
5
5
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib",
6
6
  "build:next": "next build",