@appcorp/stellar-solutions-invoice-module 0.1.5 → 0.1.6
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.
|
@@ -50,7 +50,7 @@ exports.staticCompanySection = (_a = {},
|
|
|
50
50
|
label: 'Date',
|
|
51
51
|
order: 2,
|
|
52
52
|
placeholder: '',
|
|
53
|
-
required:
|
|
53
|
+
required: true,
|
|
54
54
|
type: 'date',
|
|
55
55
|
value: '',
|
|
56
56
|
},
|
|
@@ -62,7 +62,7 @@ exports.staticCompanySection = (_a = {},
|
|
|
62
62
|
label: 'Expire Date',
|
|
63
63
|
order: 3,
|
|
64
64
|
placeholder: '',
|
|
65
|
-
required:
|
|
65
|
+
required: true,
|
|
66
66
|
type: 'date',
|
|
67
67
|
value: '',
|
|
68
68
|
},
|
|
@@ -79,29 +79,35 @@ exports.staticCompanySection = (_a = {},
|
|
|
79
79
|
value: '',
|
|
80
80
|
},
|
|
81
81
|
],
|
|
82
|
-
_a[form_schema_1.VISTA_FORM_ELEMENTS.
|
|
82
|
+
_a[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1] = [
|
|
83
83
|
{
|
|
84
84
|
enabled: true,
|
|
85
|
+
handleInputOnChange: function () { return void 0; },
|
|
86
|
+
handleOnBlur: function () { return void 0; },
|
|
85
87
|
handleOnChange: function () { return void 0; },
|
|
86
88
|
label: 'Company',
|
|
87
89
|
listItems: [],
|
|
90
|
+
nodeQueryKey: '',
|
|
88
91
|
nodeSelectKey: 'companyId',
|
|
89
92
|
order: 1,
|
|
90
|
-
|
|
93
|
+
query: '',
|
|
94
|
+
required: true,
|
|
91
95
|
selectKey1: 'name',
|
|
92
|
-
selectKey2: '',
|
|
93
96
|
selectedItem: { name: '' },
|
|
94
97
|
},
|
|
95
98
|
{
|
|
96
99
|
enabled: true,
|
|
100
|
+
handleInputOnChange: function () { return void 0; },
|
|
101
|
+
handleOnBlur: function () { return void 0; },
|
|
97
102
|
handleOnChange: function () { return void 0; },
|
|
98
103
|
label: 'Currency',
|
|
99
104
|
listItems: [],
|
|
105
|
+
nodeQueryKey: '',
|
|
100
106
|
nodeSelectKey: 'currency',
|
|
101
107
|
order: 4,
|
|
102
|
-
|
|
108
|
+
query: '',
|
|
109
|
+
required: true,
|
|
103
110
|
selectKey1: 'label',
|
|
104
|
-
selectKey2: '',
|
|
105
111
|
selectedItem: { label: '' },
|
|
106
112
|
},
|
|
107
113
|
// {
|
|
@@ -103,10 +103,12 @@ var validate_1 = require("./validate");
|
|
|
103
103
|
var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
|
|
104
104
|
var calculate_subtotal_1 = require("./calculate-subtotal");
|
|
105
105
|
var context_1 = require("@appcorp/stellar-solutions-product-module/base-modules/product/context");
|
|
106
|
+
var context_2 = require("@appcorp/stellar-solutions-company-module/base-modules/company/context");
|
|
106
107
|
var date_fns_1 = require("date-fns");
|
|
107
108
|
var useInvoiceState = function () {
|
|
108
109
|
var _a = (0, react_1.useReducer)(reducer_1.invoiceReducer, reducer_1.initialInvoiceState), state = _a[0], dispatch = _a[1];
|
|
109
110
|
var products = (0, context_1.useProductStateContext)().products;
|
|
111
|
+
var companies = (0, context_2.useCompanyStateContext)().companies;
|
|
110
112
|
var debouncedQuery = (0, util_functions_1.useDebounce)(state.searchQuery, 800);
|
|
111
113
|
var listParams = {
|
|
112
114
|
currentPage: state.currentPage,
|
|
@@ -354,7 +356,6 @@ var useInvoiceState = function () {
|
|
|
354
356
|
}, []);
|
|
355
357
|
var handleDateChange = function (key, date) {
|
|
356
358
|
var _a, _b;
|
|
357
|
-
console.log('_???', key, date);
|
|
358
359
|
var selectedDate = (_a = new Date(date)) === null || _a === void 0 ? void 0 : _a.toISOString();
|
|
359
360
|
var expireDate = (_b = (0, date_fns_1.addDays)(selectedDate, 7)) === null || _b === void 0 ? void 0 : _b.toISOString();
|
|
360
361
|
if (key === 'expiryDate') {
|
|
@@ -518,7 +519,7 @@ var useInvoiceState = function () {
|
|
|
518
519
|
});
|
|
519
520
|
};
|
|
520
521
|
var dynamicCompanyFormElements = (0, react_1.useMemo)(function () {
|
|
521
|
-
var _a, _b, _c, _d, _e;
|
|
522
|
+
var _a, _b, _c, _d, _e, _f;
|
|
522
523
|
var elements = __assign({}, constants_1.staticCompanySection);
|
|
523
524
|
var textInputElements = (_a = elements[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
|
|
524
525
|
if (textInputElements) {
|
|
@@ -531,12 +532,15 @@ var useInvoiceState = function () {
|
|
|
531
532
|
textInputElements[2].value = state.note;
|
|
532
533
|
textInputElements[2].handleOnChange = handleChange;
|
|
533
534
|
textInputElements[2].error = state.errors.note;
|
|
534
|
-
textInputElements[3].value = state.ref;
|
|
535
|
-
|
|
536
|
-
|
|
535
|
+
textInputElements[3].value = state.ref || (0, util_functions_1.generateRef)({ refLength: 5 });
|
|
536
|
+
var comboboxElements_1 = (_b = elements[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1]) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return a.order - b.order; });
|
|
537
|
+
if (comboboxElements_1) {
|
|
538
|
+
comboboxElements_1[0].selectedItem = {};
|
|
539
|
+
comboboxElements_1[0].listItems = companies;
|
|
540
|
+
}
|
|
537
541
|
return elements;
|
|
538
542
|
}
|
|
539
|
-
var textAreaElements = (
|
|
543
|
+
var textAreaElements = (_c = elements[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_AREA_V1]) === null || _c === void 0 ? void 0 : _c.sort(function (a, b) { return a.order - b.order; });
|
|
540
544
|
if (textAreaElements) {
|
|
541
545
|
textAreaElements === null || textAreaElements === void 0 ? void 0 : textAreaElements.forEach(function (_a, i) {
|
|
542
546
|
var id = _a.id;
|
|
@@ -545,7 +549,7 @@ var useInvoiceState = function () {
|
|
|
545
549
|
textAreaElements[i].error = state.errors.description;
|
|
546
550
|
});
|
|
547
551
|
}
|
|
548
|
-
var selectElements = (
|
|
552
|
+
var selectElements = (_d = elements[form_schema_1.VISTA_FORM_ELEMENTS.SELECT_V1]) === null || _d === void 0 ? void 0 : _d.sort(function (a, b) { return a.order - b.order; });
|
|
549
553
|
if (selectElements) {
|
|
550
554
|
selectElements === null || selectElements === void 0 ? void 0 : selectElements.forEach(function (_a, i) {
|
|
551
555
|
var nodeSelectKey = _a.nodeSelectKey;
|
|
@@ -553,7 +557,7 @@ var useInvoiceState = function () {
|
|
|
553
557
|
selectElements[i].selectedItem = { option: state[nodeSelectKey] };
|
|
554
558
|
});
|
|
555
559
|
}
|
|
556
|
-
var comboboxElements = (
|
|
560
|
+
var comboboxElements = (_e = elements[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1]) === null || _e === void 0 ? void 0 : _e.sort(function (a, b) { return a.order - b.order; });
|
|
557
561
|
if (comboboxElements) {
|
|
558
562
|
// comboboxElements?.forEach(({ nodeSelectKey }, i) => {
|
|
559
563
|
// comboboxElements[i].handleOnChange = handleSelectChange;
|
|
@@ -564,7 +568,7 @@ var useInvoiceState = function () {
|
|
|
564
568
|
// comboboxElements[i].handleOnBlur = handleSelectInputChange;
|
|
565
569
|
// });
|
|
566
570
|
}
|
|
567
|
-
var uploadElements = (
|
|
571
|
+
var uploadElements = (_f = elements[form_schema_1.VISTA_FORM_ELEMENTS.UPLOAD_V1]) === null || _f === void 0 ? void 0 : _f.sort(function (a, b) { return a.order - b.order; });
|
|
568
572
|
if (uploadElements) {
|
|
569
573
|
// uploadElements?.forEach((_, i) => {
|
|
570
574
|
// uploadElements[i].imageUrls = state.images;
|
|
@@ -576,7 +580,7 @@ var useInvoiceState = function () {
|
|
|
576
580
|
// });
|
|
577
581
|
}
|
|
578
582
|
return elements;
|
|
579
|
-
}, [state, handleChange]);
|
|
583
|
+
}, [state, handleChange, companies]);
|
|
580
584
|
var dynamicPricingFormElements = (0, react_1.useMemo)(function () {
|
|
581
585
|
var elements = __assign({}, constants_1.staticPricingSection);
|
|
582
586
|
return elements;
|
|
@@ -640,7 +644,7 @@ var useInvoiceState = function () {
|
|
|
640
644
|
var comboboxElements = (_c = elements[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1]) === null || _c === void 0 ? void 0 : _c.sort(function (a, b) { return a.order - b.order; });
|
|
641
645
|
if (comboboxElements) {
|
|
642
646
|
(_d = state.products) === null || _d === void 0 ? void 0 : _d.forEach(function (product, i) {
|
|
643
|
-
comboboxElements[0].listItems =
|
|
647
|
+
comboboxElements[0].listItems = products;
|
|
644
648
|
comboboxElements[0].handleOnChange = function (k, v) {
|
|
645
649
|
var val = __assign({}, v);
|
|
646
650
|
handleItemChangeProducts({
|
|
@@ -652,7 +656,7 @@ var useInvoiceState = function () {
|
|
|
652
656
|
});
|
|
653
657
|
}
|
|
654
658
|
return elements;
|
|
655
|
-
}, [state, handleItemChangeProducts]);
|
|
659
|
+
}, [state, handleItemChangeProducts, products]);
|
|
656
660
|
var headerActions = [
|
|
657
661
|
{
|
|
658
662
|
enabled: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/stellar-solutions-invoice-module",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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",
|
|
@@ -16,19 +16,17 @@
|
|
|
16
16
|
"start": "next start",
|
|
17
17
|
"upgrade": "ncu -u"
|
|
18
18
|
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@appcorp/stellar-solutions-company-module": "^0.1.16",
|
|
21
|
-
"@appcorp/stellar-solutions-product-module": "^0.1.84",
|
|
22
|
-
"date-fns": "^4.1.0"
|
|
23
|
-
},
|
|
19
|
+
"dependencies": {},
|
|
24
20
|
"devDependencies": {
|
|
25
21
|
"@appcorp/app-corp-designs": "^0.4.79",
|
|
26
|
-
"@appcorp/app-corp-vista": "^0.
|
|
22
|
+
"@appcorp/app-corp-vista": "^0.2.20",
|
|
23
|
+
"@appcorp/stellar-solutions-company-module": "^0.1.16",
|
|
27
24
|
"@appcorp/stellar-solutions-modules": "^0.1.5",
|
|
25
|
+
"@appcorp/stellar-solutions-product-module": "^0.1.87",
|
|
28
26
|
"@eslint/eslintrc": "^3",
|
|
29
27
|
"@headlessui/react": "^2.2.0",
|
|
30
28
|
"@heroicons/react": "^2.2.0",
|
|
31
|
-
"@react-pakistan/util-functions": "^1.24.
|
|
29
|
+
"@react-pakistan/util-functions": "^1.24.16",
|
|
32
30
|
"@supabase/supabase-js": "^2.50.0",
|
|
33
31
|
"@tailwindcss/forms": "^0.5.10",
|
|
34
32
|
"@tailwindcss/postcss": "^4",
|
|
@@ -36,6 +34,7 @@
|
|
|
36
34
|
"@types/react": "^19",
|
|
37
35
|
"@types/react-dom": "^19",
|
|
38
36
|
"@types/react-slick": "^0",
|
|
37
|
+
"date-fns": "^4.1.0",
|
|
39
38
|
"dayjs": "^1.11.13",
|
|
40
39
|
"eslint": "^9",
|
|
41
40
|
"eslint-config-next": "15",
|