@appcorp/stellar-solutions-invoice-module 0.1.21 → 0.1.24

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.
@@ -321,18 +321,22 @@ exports.staticServiceSection = (_c = {},
321
321
  ],
322
322
  _c);
323
323
  exports.staticProductSection = (_d = {},
324
- _d[form_schema_1.VISTA_FORM_ELEMENTS.SELECT_V1] = [
324
+ _d[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1] = [
325
325
  {
326
- className: 'col-span-2',
326
+ // className: 'col-span-2',
327
+ // selectKey2: '',
327
328
  enabled: true,
329
+ handleInputOnChange: function () { return void 0; },
330
+ handleOnBlur: function () { return void 0; },
328
331
  handleOnChange: function () { return void 0; },
329
332
  label: 'Product',
330
333
  listItems: [],
334
+ nodeQueryKey: 'productQuery',
331
335
  nodeSelectKey: 'productId',
332
336
  order: 1,
337
+ query: '',
333
338
  required: false,
334
339
  selectKey1: 'name',
335
- selectKey2: '',
336
340
  selectedItem: { name: '' },
337
341
  },
338
342
  ],
@@ -752,7 +752,11 @@ var useInvoiceState = function () {
752
752
  if (comboboxElements) {
753
753
  (_d = state.products) === null || _d === void 0 ? void 0 : _d.forEach(function (product, i) {
754
754
  comboboxElements[0].listItems = products;
755
+ comboboxElements[0].query = state.productQuery;
756
+ comboboxElements[0].handleInputOnChange = handleChange;
757
+ comboboxElements[0].handleOnBlur = handleChange;
755
758
  comboboxElements[0].handleOnChange = function (k, v) {
759
+ console.log('_>>>>>>>>>', k, v);
756
760
  var val = __assign({}, v);
757
761
  handleItemChangeProducts({
758
762
  index: i,
@@ -777,7 +781,7 @@ var useInvoiceState = function () {
777
781
  });
778
782
  }
779
783
  return elements;
780
- }, [state, handleItemChangeProducts, products]);
784
+ }, [state, handleItemChangeProducts, products, handleChange]);
781
785
  var headerActions = [
782
786
  {
783
787
  enabled: true,
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -14,17 +25,20 @@ var vista_button_type_1 = require("@appcorp/app-corp-vista/type/vista-button-typ
14
25
  var vista_combobox_v1_1 = require("@appcorp/app-corp-vista/molecules/vista-combobox-v1/vista-combobox-v1");
15
26
  var context_2 = require("@appcorp/stellar-solutions-product-module/base-modules/product/context");
16
27
  var ProductsSection = function () {
17
- var _a = (0, context_1.useInvoiceStateContext)(), products = _a.products, handleItemChangeProducts = _a.handleItemChangeProducts, handleDeleteServiceRow = _a.handleDeleteServiceRow;
28
+ var _a = (0, context_1.useInvoiceStateContext)(), products = _a.products, handleItemChangeProducts = _a.handleItemChangeProducts, handleDeleteServiceRow = _a.handleDeleteServiceRow, handleChange = _a.handleChange;
18
29
  var productList = (0, context_2.useProductStateContext)().products;
19
30
  return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
20
31
  react_1.default.createElement(vista_vertical_divider_v4_1.VistaVerticalDividerV4, { label: "Products" }),
21
32
  products.map(function (row, index) { return (react_1.default.createElement("div", { key: index, className: 'grid grid-cols-[17.5%_17.5%_17.5%_17.5%_17.5%_auto] items-end justify-between gap-4' },
22
33
  react_1.default.createElement("div", { className: 'col-span-2' },
23
- react_1.default.createElement(vista_combobox_v1_1.VistaComboboxV1, { handleInputOnChange: function (k, v) { return handleItemChangeProducts({
24
- index: index,
25
- key: k,
26
- value: v
27
- }); }, handleOnBlur: function () { return void 0; }, handleOnChange: function () { return void 0; }, label: "Product", listItems: productList, nodeQueryKey: '', nodeSelectKey: 'productId', query: '', selectKey1: 'name', selectedItem: { id: products[index].productId } })),
34
+ react_1.default.createElement(vista_combobox_v1_1.VistaComboboxV1, { handleOnChange: function (k, v) {
35
+ var val = __assign({}, v);
36
+ handleItemChangeProducts({
37
+ index: index,
38
+ key: k,
39
+ value: val.id,
40
+ });
41
+ }, handleOnBlur: handleChange, handleInputOnChange: handleChange, label: "Product", listItems: productList, nodeQueryKey: 'productQuery', nodeSelectKey: 'productId', query: '', selectKey1: 'name', selectedItem: { id: products[index].productId } })),
28
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' }),
29
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' }),
30
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 }),
@@ -32,6 +32,7 @@ exports.initialInvoiceState = {
32
32
  city: '',
33
33
  companyId: '',
34
34
  companyQuery: '',
35
+ productQuery: '',
35
36
  count: 0,
36
37
  country: '',
37
38
  currency: 'PKR',
@@ -122,6 +122,7 @@ export interface InvoiceState extends Omit<InvoiceTypeBE, 'createdAt' | 'updated
122
122
  address: string;
123
123
  city: string;
124
124
  companyQuery: string;
125
+ productQuery: string;
125
126
  count: number;
126
127
  country: string;
127
128
  currentPage: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-invoice-module",
3
- "version": "0.1.21",
3
+ "version": "0.1.24",
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",