@appcorp/stellar-solutions-invoice-module 0.1.5 → 0.1.7
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,30 +79,36 @@ 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: 'companyQuery',
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
selectedItem: {
|
|
108
|
+
query: '',
|
|
109
|
+
required: true,
|
|
110
|
+
selectKey1: 'option',
|
|
111
|
+
selectedItem: { option: 'PKR' },
|
|
106
112
|
},
|
|
107
113
|
// {
|
|
108
114
|
// enabled: false,
|
|
@@ -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
|
|
522
|
+
var _a, _b;
|
|
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,52 +532,21 @@ 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
|
-
textInputElements[3].handleOnChange = handleChange;
|
|
536
|
-
textInputElements[3].error = state.errors.ref;
|
|
537
|
-
return elements;
|
|
538
|
-
}
|
|
539
|
-
var textAreaElements = (_b = elements[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_AREA_V1]) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return a.order - b.order; });
|
|
540
|
-
if (textAreaElements) {
|
|
541
|
-
textAreaElements === null || textAreaElements === void 0 ? void 0 : textAreaElements.forEach(function (_a, i) {
|
|
542
|
-
var id = _a.id;
|
|
543
|
-
textAreaElements[i].value = state[id];
|
|
544
|
-
textAreaElements[i].handleOnChange = handleChange;
|
|
545
|
-
textAreaElements[i].error = state.errors.description;
|
|
546
|
-
});
|
|
535
|
+
textInputElements[3].value = state.ref || (0, util_functions_1.generateRef)({ refLength: 5 });
|
|
547
536
|
}
|
|
548
|
-
var
|
|
549
|
-
if (selectElements) {
|
|
550
|
-
selectElements === null || selectElements === void 0 ? void 0 : selectElements.forEach(function (_a, i) {
|
|
551
|
-
var nodeSelectKey = _a.nodeSelectKey;
|
|
552
|
-
selectElements[i].handleOnChange = handleSelectChange;
|
|
553
|
-
selectElements[i].selectedItem = { option: state[nodeSelectKey] };
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
var comboboxElements = (_d = elements[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1]) === null || _d === void 0 ? void 0 : _d.sort(function (a, b) { return a.order - b.order; });
|
|
537
|
+
var comboboxElements = (_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; });
|
|
557
538
|
if (comboboxElements) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
var uploadElements = (_e = elements[form_schema_1.VISTA_FORM_ELEMENTS.UPLOAD_V1]) === null || _e === void 0 ? void 0 : _e.sort(function (a, b) { return a.order - b.order; });
|
|
568
|
-
if (uploadElements) {
|
|
569
|
-
// uploadElements?.forEach((_, i) => {
|
|
570
|
-
// uploadElements[i].imageUrls = state.images;
|
|
571
|
-
// uploadElements[i].handleOnChange = handleFileChange;
|
|
572
|
-
// uploadElements[i].handleClearImage = () => dispatch({
|
|
573
|
-
// type: INVOICE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
574
|
-
// payload: { key: 'images', value: [] },
|
|
575
|
-
// });
|
|
576
|
-
// });
|
|
539
|
+
comboboxElements[0].selectedItem = { id: state.companyId };
|
|
540
|
+
comboboxElements[0].listItems = companies;
|
|
541
|
+
comboboxElements[0].query = state.companyQuery;
|
|
542
|
+
comboboxElements[0].handleOnChange = handleSelectChange;
|
|
543
|
+
comboboxElements[0].handleInputOnChange = handleChange;
|
|
544
|
+
comboboxElements[0].handleOnBlur = handleChange;
|
|
545
|
+
comboboxElements[1].selectedItem = { option: state.currency };
|
|
546
|
+
comboboxElements[1].listItems = [];
|
|
577
547
|
}
|
|
578
548
|
return elements;
|
|
579
|
-
}, [state, handleChange]);
|
|
549
|
+
}, [state, handleChange, companies]);
|
|
580
550
|
var dynamicPricingFormElements = (0, react_1.useMemo)(function () {
|
|
581
551
|
var elements = __assign({}, constants_1.staticPricingSection);
|
|
582
552
|
return elements;
|
|
@@ -640,7 +610,7 @@ var useInvoiceState = function () {
|
|
|
640
610
|
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
611
|
if (comboboxElements) {
|
|
642
612
|
(_d = state.products) === null || _d === void 0 ? void 0 : _d.forEach(function (product, i) {
|
|
643
|
-
comboboxElements[0].listItems =
|
|
613
|
+
comboboxElements[0].listItems = products;
|
|
644
614
|
comboboxElements[0].handleOnChange = function (k, v) {
|
|
645
615
|
var val = __assign({}, v);
|
|
646
616
|
handleItemChangeProducts({
|
|
@@ -652,7 +622,7 @@ var useInvoiceState = function () {
|
|
|
652
622
|
});
|
|
653
623
|
}
|
|
654
624
|
return elements;
|
|
655
|
-
}, [state, handleItemChangeProducts]);
|
|
625
|
+
}, [state, handleItemChangeProducts, products]);
|
|
656
626
|
var headerActions = [
|
|
657
627
|
{
|
|
658
628
|
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.7",
|
|
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",
|