oa-componentbook 1.0.1-stage.44 → 1.0.1-stage.440
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.
- package/build/components/oa-component-accordion/Accordion.js +123 -43
- package/build/components/oa-component-accordion/styles.js +2 -2
- package/build/components/oa-component-button/CustomButton.js +24 -19
- package/build/components/oa-component-button/styles.js +1 -1
- package/build/components/oa-component-checkbox/CustomCheckBox.js +20 -17
- package/build/components/oa-component-checkbox/styles.js +1 -1
- package/build/components/oa-component-datepicker/CustomDatePicker.js +37 -26
- package/build/components/oa-component-drawer/CustomDrawer.js +2 -0
- package/build/components/oa-component-dropdown/CustomDropdown.js +16 -4
- package/build/components/oa-component-icons/MaterialIcon.js +1 -1
- package/build/components/oa-component-modal/CustomModal.js +59 -48
- package/build/components/oa-component-modal/styles.js +3 -2
- package/build/components/oa-component-pagination/CustomPagination.js +111 -0
- package/build/components/oa-component-pagination/styles.js +12 -0
- package/build/components/oa-component-progress-bar/CustomProgressBar.js +8 -4
- package/build/components/oa-component-select/CustomSelect.js +130 -56
- package/build/components/oa-component-steps/CustomSteps.js +117 -0
- package/build/components/oa-component-steps/styles.js +12 -0
- package/build/components/oa-component-table/CustomTable.js +28 -5
- package/build/components/oa-component-table/CustomTableV1.js +613 -0
- package/build/components/oa-component-table/styles.js +1 -1
- package/build/components/oa-component-table/stylesV1.js +19 -0
- package/build/components/oa-component-tabs/CustomTabs.js +1 -1
- package/build/components/oa-component-tag/CustomTag.js +29 -11
- package/build/components/oa-component-tag/styles.js +30 -3
- package/build/components/oa-component-textarea/CustomTextArea.js +161 -0
- package/build/components/oa-component-textarea/constants.js +39 -0
- package/build/components/oa-component-textarea/styles.js +12 -3
- package/build/components/oa-component-tooltip/CustomTooltip.js +8 -4
- package/build/components/oa-component-upload/CustomUpload.js +129 -42
- package/build/components/oa-component-viewer/CustomViewer.js +17 -11
- package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +367 -0
- package/build/dev/oa-component-document-viewer/styles.js +12 -0
- package/build/dev/oa-component-upload/CustomUpload.js +116 -29
- package/build/dev/oa-component-upload/styles.js +2 -2
- package/build/dev/oa-widget-document-modal/DocumentSideModal.js +166 -0
- package/build/dev/oa-widget-document-modal/styles.js +12 -0
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +196 -0
- package/build/dev/oa-widget-document-side-drawer/styles.js +12 -0
- package/build/global-css/GlobalCss.js +2 -1
- package/build/global-css/GridLayout.js +1 -1
- package/build/global-css/commonStyles.js +11 -0
- package/build/images/Car.png +0 -0
- package/build/images/TwoWheeler.png +0 -0
- package/build/images/astronaut_emptystate.png +0 -0
- package/build/images/exportGrp01.png +0 -0
- package/build/images/exportGrp02.png +0 -0
- package/build/images/exportGrp03.png +0 -0
- package/build/images/outOfStock.png +0 -0
- package/build/index.js +114 -2
- package/build/layout/DetailDataLayout/DetailDataLayout.js +20 -0
- package/build/layout/DetailDataLayout/components/Form.js +22 -0
- package/build/layout/DetailDataLayout/components/Header.js +32 -0
- package/build/layout/DetailDataLayout/style.css +9 -0
- package/build/layout/DetailDataLayout/styles.js +12 -0
- package/build/layout/EntityOverviewLayout/EntityOverviewLayout.js +403 -0
- package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +85 -0
- package/build/layout/EntityOverviewLayout/styles.js +13 -0
- package/build/layout/GenricLayOut/GenricLayOut.js +2421 -0
- package/build/layout/GenricLayOut/components/AppliedFilters.js +90 -0
- package/build/layout/GenricLayOut/components/CardList.js +34 -0
- package/build/layout/GenricLayOut/components/DropdownSearch.js +48 -0
- package/build/layout/GenricLayOut/components/Header.js +74 -0
- package/build/layout/GenricLayOut/components/Modal.js +96 -0
- package/build/layout/GenricLayOut/components/ProfileSection.js +219 -0
- package/build/layout/GenricLayOut/components/Search.js +51 -0
- package/build/layout/GenricLayOut/components/StaticFilter.css +73 -0
- package/build/layout/GenricLayOut/components/StaticFilter.js +37 -0
- package/build/layout/GenricLayOut/reducer/layoutReducer.js +310 -0
- package/build/layout/GenricLayOut/resolver/staticConfigResolver.js +98 -0
- package/build/layout/GenricLayOut/styles.js +42 -0
- package/build/utils/download-file.js +23 -0
- package/build/widgets/oa-form-widget/FormWidget.js +577 -0
- package/build/widgets/oa-form-widget/FormWidgetStyle.js +18 -0
- package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +80 -16
- package/build/widgets/oa-widget-add-spare-part/AddSparePartWidget.js +50 -7
- package/build/widgets/oa-widget-address/AddressWidget.js +12 -17
- package/build/widgets/oa-widget-approval/ApprovalWidget.js +19 -11
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +492 -0
- package/build/widgets/oa-widget-approval/styles.js +2 -2
- package/build/widgets/oa-widget-chat/ChatWidget.js +5 -5
- package/build/widgets/oa-widget-close-claim/CloseClaimWidget.js +17 -5
- package/build/widgets/oa-widget-collapsible-key-value/CollapsibleKeyValueWidget.js +396 -0
- package/build/widgets/oa-widget-collapsible-key-value/styles.js +16 -0
- package/build/widgets/oa-widget-content-panel/ContentPanel.js +82 -0
- package/build/widgets/oa-widget-content-panel/styles.js +12 -0
- package/build/widgets/oa-widget-customer-rating-card/CustomerRatingCard.js +5 -5
- package/build/widgets/oa-widget-detailcard/styles.js +1 -1
- package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +6 -9
- package/build/widgets/oa-widget-dropdown-search-input/DropdownSearchInput.js +53 -19
- package/build/widgets/oa-widget-dropdown-search-input/styles.js +1 -1
- package/build/widgets/oa-widget-guide/GuideWidget.js +70 -0
- package/build/widgets/oa-widget-guide/GuideWidgetStyle.js +12 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationDeleteBiker.js +24 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModal.js +34 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModalStyle.js +13 -0
- package/build/widgets/oa-widget-image-carousel/ImageCarouselWidget.js +256 -0
- package/build/widgets/oa-widget-image-carousel/styles.js +23 -0
- package/build/widgets/oa-widget-image-gallery/FullscreenViewer.js +169 -0
- package/build/widgets/oa-widget-image-gallery/ImageGallery.js +87 -0
- package/build/widgets/oa-widget-image-gallery/ThumbnailGrid.js +146 -0
- package/build/widgets/oa-widget-image-gallery/imageCache.js +15 -0
- package/build/widgets/oa-widget-image-gallery/imageGalleryStyle.js +16 -0
- package/build/widgets/oa-widget-item-info-card/InfoCardListWidget.js +60 -0
- package/build/widgets/oa-widget-item-info-card/ItemInfoCardWidget.js +83 -0
- package/build/widgets/oa-widget-item-info-card/styles.css +50 -0
- package/build/widgets/oa-widget-item-info-card/styles.js +14 -0
- package/build/widgets/oa-widget-key-value/KeyValueWidget.js +46 -12
- package/build/widgets/oa-widget-key-value/styles.js +1 -1
- package/build/widgets/oa-widget-kpi/KPICardWidget.js +86 -0
- package/build/widgets/oa-widget-kpi/styles.js +12 -0
- package/build/widgets/oa-widget-map-base-location/AddressDetails.js +21 -7
- package/build/widgets/oa-widget-map-base-location/AddressForm.js +32 -5
- package/build/widgets/oa-widget-map-base-location/MapBaseLocation.js +9 -3
- package/build/widgets/oa-widget-map-base-location/MapComponent.js +17 -2
- package/build/widgets/oa-widget-membershipcard/MembershipCard.js +14 -3
- package/build/widgets/oa-widget-membershipcard/styles.js +1 -1
- package/build/widgets/oa-widget-notes/NotesWidget.js +32 -30
- package/build/widgets/oa-widget-notes/styles.js +4 -3
- package/build/widgets/oa-widget-profile-data/ProfileDataWidget.js +165 -0
- package/build/widgets/oa-widget-profile-data/styles.js +13 -0
- package/build/widgets/oa-widget-progressive-steps/ProgressiveStepsWidget.js +362 -0
- package/build/widgets/oa-widget-progressive-steps/styles.js +12 -0
- package/build/widgets/oa-widget-reimbursement-breakup/ReimbursementBreakupWidget.js +18 -9
- package/build/widgets/oa-widget-reimbursement-breakup/styles.js +1 -1
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +164 -0
- package/build/widgets/oa-widget-select-list-item-modal/SelectListItemModal.js +91 -0
- package/build/widgets/oa-widget-sidebar/SidebarWidget.js +175 -0
- package/build/widgets/oa-widget-sidebar/components/Header.js +33 -0
- package/build/widgets/oa-widget-sidebar/styles.js +13 -0
- package/build/widgets/oa-widget-spare-part/SparePartsWidget.js +63 -35
- package/build/widgets/oa-widget-track-shipment-list/fn.js +16 -4
- package/build/widgets/oa-widget-user-management/UserManagementWidget.js +407 -0
- package/build/widgets/oa-widget-user-management/styles.js +15 -0
- package/package.json +4 -2
- package/build/components/oa-component-textarea/TextArea.js +0 -74
|
@@ -11,7 +11,10 @@ require("core-js/modules/es.array.includes.js");
|
|
|
11
11
|
require("core-js/modules/es.string.includes.js");
|
|
12
12
|
require("core-js/modules/es.regexp.exec.js");
|
|
13
13
|
require("core-js/modules/es.regexp.test.js");
|
|
14
|
+
require("core-js/modules/es.parse-int.js");
|
|
15
|
+
require("core-js/modules/es.string.trim.js");
|
|
14
16
|
require("core-js/modules/es.array.reduce.js");
|
|
17
|
+
require("core-js/modules/es.parse-float.js");
|
|
15
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
19
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
20
|
var _antd = require("antd");
|
|
@@ -53,7 +56,8 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
53
56
|
open,
|
|
54
57
|
selectedItems,
|
|
55
58
|
disableDiscount,
|
|
56
|
-
disableHsn
|
|
59
|
+
disableHsn,
|
|
60
|
+
isHsnOptional
|
|
57
61
|
} = _ref;
|
|
58
62
|
const [filteredItems, setFilteredItems] = (0, _react.useState)([]);
|
|
59
63
|
const [selectedItemIds, setSelectedItemIds] = (0, _react.useState)(new Set());
|
|
@@ -82,7 +86,8 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
82
86
|
setActiveKey(Array.from(initialSelectedItems).map(String)); // Set initially selected items as active keys
|
|
83
87
|
}, [selectedItems]);
|
|
84
88
|
(0, _react.useEffect)(() => {
|
|
85
|
-
|
|
89
|
+
var _selectedItems$map$fi, _items$filter;
|
|
90
|
+
const sortedItems = [...((_selectedItems$map$fi = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => items && items.find(i => i.id === item.scopeId)).filter(Boolean)) !== null && _selectedItems$map$fi !== void 0 ? _selectedItems$map$fi : []), ...((_items$filter = items === null || items === void 0 ? void 0 : items.filter(item => !selectedItems.some(selected => selected.scopeId === item.id))) !== null && _items$filter !== void 0 ? _items$filter : [])];
|
|
86
91
|
setFilteredItems(sortedItems);
|
|
87
92
|
}, [items, selectedItems]);
|
|
88
93
|
|
|
@@ -141,7 +146,22 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
141
146
|
}
|
|
142
147
|
}, 0);
|
|
143
148
|
};
|
|
144
|
-
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Checks if a given value is numeric.
|
|
152
|
+
*
|
|
153
|
+
* This function verifies if the provided value is a numeric string,
|
|
154
|
+
* optionally allowing two decimal places. An empty string is also
|
|
155
|
+
* considered valid, allowing for clearing inputs.
|
|
156
|
+
*
|
|
157
|
+
* @param {string} value - The value to check.
|
|
158
|
+
* @returns {boolean} - Returns true if the value is numeric or empty, otherwise false.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
const isNumeric = value => {
|
|
162
|
+
if (value === '') return true;
|
|
163
|
+
return /^\d+(\.\d{0,2})?$/.test(value);
|
|
164
|
+
};
|
|
145
165
|
|
|
146
166
|
/**
|
|
147
167
|
* Handles changes in the fields of the items.
|
|
@@ -154,8 +174,18 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
154
174
|
* @param {string|number} value - The new value of the field.
|
|
155
175
|
*/
|
|
156
176
|
const onFieldChange = (itemId, field, value) => {
|
|
157
|
-
if (field === 'hsnId' || isNumeric(value)) {
|
|
158
|
-
|
|
177
|
+
if (field === 'hsnId' || (field === 'discount' || field === 'cost') && isNumeric(value)) {
|
|
178
|
+
if (field === 'discount') {
|
|
179
|
+
var _formValues$itemId;
|
|
180
|
+
if (parseInt((_formValues$itemId = formValues[itemId]) === null || _formValues$itemId === void 0 ? void 0 : _formValues$itemId.cost, 10) < parseInt(value, 10)) {
|
|
181
|
+
openNotification({
|
|
182
|
+
title: 'Error',
|
|
183
|
+
description: 'Discount cannot be greater than Cost.',
|
|
184
|
+
type: 'failure'
|
|
185
|
+
});
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
159
189
|
const updatedFormValues = _objectSpread(_objectSpread({}, formValues), {}, {
|
|
160
190
|
[itemId]: _objectSpread(_objectSpread({}, formValues[itemId]), {}, {
|
|
161
191
|
[field]: value
|
|
@@ -163,11 +193,11 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
163
193
|
});
|
|
164
194
|
setFormValues(updatedFormValues);
|
|
165
195
|
} else {
|
|
166
|
-
openNotification({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
196
|
+
// openNotification({
|
|
197
|
+
// title: 'Error',
|
|
198
|
+
// description: 'Please enter only numeric values 146.',
|
|
199
|
+
// type: 'failure',
|
|
200
|
+
// });
|
|
171
201
|
}
|
|
172
202
|
};
|
|
173
203
|
|
|
@@ -179,7 +209,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
179
209
|
* @param {React.KeyboardEvent} event - The event triggered by the key press.
|
|
180
210
|
*/
|
|
181
211
|
const handleKeyPress = event => {
|
|
182
|
-
if (!/[
|
|
212
|
+
if (!/[\d.]/.test(event.key) || event.key === '.' && event.target.value.includes('.')) {
|
|
183
213
|
event.preventDefault();
|
|
184
214
|
openNotification({
|
|
185
215
|
title: 'Error',
|
|
@@ -188,6 +218,21 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
188
218
|
});
|
|
189
219
|
}
|
|
190
220
|
};
|
|
221
|
+
const handlePaste = e => {
|
|
222
|
+
var _e$clipboardData$getD, _e$clipboardData;
|
|
223
|
+
const pastedData = (_e$clipboardData$getD = e === null || e === void 0 || (_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 || (_e$clipboardData = _e$clipboardData.getData('Text')) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.trim()) !== null && _e$clipboardData$getD !== void 0 ? _e$clipboardData$getD : '';
|
|
224
|
+
|
|
225
|
+
// Allow only numbers with optional decimal part (up to 2 digits after .)
|
|
226
|
+
const validDecimalPattern = /^\d+(\.\d{0,2})?$/;
|
|
227
|
+
if (!validDecimalPattern.test(pastedData)) {
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
openNotification({
|
|
230
|
+
title: 'Invalid Paste',
|
|
231
|
+
description: 'Only numeric values with up to 2 decimal places are allowed.',
|
|
232
|
+
type: 'failure'
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
191
236
|
|
|
192
237
|
/**
|
|
193
238
|
* Handles the submission of the spare parts information.
|
|
@@ -215,7 +260,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
215
260
|
const allFieldsFilled = toSubmit.every(item => {
|
|
216
261
|
const mandatoryFields = ['cost', 'discount', 'hsnId'].filter(field => {
|
|
217
262
|
if (disableDiscount && field === 'discount') return false;
|
|
218
|
-
if (disableHsn && field === 'hsnId') return false;
|
|
263
|
+
if ((disableHsn || isHsnOptional) && field === 'hsnId') return false;
|
|
219
264
|
return true;
|
|
220
265
|
});
|
|
221
266
|
return mandatoryFields.every(field => item[field] !== '' && item[field] !== null && item[field] !== undefined);
|
|
@@ -228,7 +273,22 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
228
273
|
});
|
|
229
274
|
return;
|
|
230
275
|
}
|
|
231
|
-
|
|
276
|
+
toSubmit.every(item => {
|
|
277
|
+
const cost = parseFloat(item.cost);
|
|
278
|
+
const discount = parseFloat(item.discount);
|
|
279
|
+
const field = items.find(f => f.id === item.scopeId);
|
|
280
|
+
const fieldName = field ? field.name : "ScopeId ".concat(item.scopeId);
|
|
281
|
+
if (discount > cost) {
|
|
282
|
+
openNotification({
|
|
283
|
+
title: 'Error',
|
|
284
|
+
description: "Discount cannot be greater than cost for ".concat(fieldName),
|
|
285
|
+
type: 'failure'
|
|
286
|
+
});
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
return true;
|
|
290
|
+
});
|
|
291
|
+
onSubmit(toSubmit);
|
|
232
292
|
};
|
|
233
293
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
234
294
|
buttonConfig: [{
|
|
@@ -313,8 +373,9 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
313
373
|
placeholder: "Enter price without GST",
|
|
314
374
|
onChange: e => onFieldChange(item.id, 'cost', e.target.value),
|
|
315
375
|
onKeyPress: handleKeyPress,
|
|
376
|
+
onPaste: handlePaste,
|
|
316
377
|
inputMode: "numeric",
|
|
317
|
-
pattern: "[0-9]
|
|
378
|
+
pattern: "[0-9]+(\\.[0-9]{0,2})?",
|
|
318
379
|
value: ((_formValues$item$id = formValues[item.id]) === null || _formValues$item$id === void 0 ? void 0 : _formValues$item$id.cost) !== null && ((_formValues$item$id2 = formValues[item.id]) === null || _formValues$item$id2 === void 0 ? void 0 : _formValues$item$id2.cost) !== undefined ? (_formValues$item$id3 = formValues[item.id]) === null || _formValues$item$id3 === void 0 ? void 0 : _formValues$item$id3.cost : '',
|
|
319
380
|
disabled: isItemDisabled
|
|
320
381
|
})), !disableDiscount && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -337,6 +398,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
337
398
|
placeholder: "Enter discount",
|
|
338
399
|
onChange: e => onFieldChange(item.id, 'discount', e.target.value),
|
|
339
400
|
onKeyPress: handleKeyPress,
|
|
401
|
+
onPaste: handlePaste,
|
|
340
402
|
inputMode: "numeric",
|
|
341
403
|
pattern: "[0-9]*",
|
|
342
404
|
value: ((_formValues$item$id4 = formValues[item.id]) === null || _formValues$item$id4 === void 0 ? void 0 : _formValues$item$id4.discount) !== null && ((_formValues$item$id5 = formValues[item.id]) === null || _formValues$item$id5 === void 0 ? void 0 : _formValues$item$id5.discount) !== undefined ? (_formValues$item$id6 = formValues[item.id]) === null || _formValues$item$id6 === void 0 ? void 0 : _formValues$item$id6.discount : '',
|
|
@@ -377,7 +439,8 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
377
439
|
}
|
|
378
440
|
AddSparePartCollapseWidget.defaultProps = {
|
|
379
441
|
disableDiscount: false,
|
|
380
|
-
disableHsn: false
|
|
442
|
+
disableHsn: false,
|
|
443
|
+
isHsnOptional: false
|
|
381
444
|
};
|
|
382
445
|
AddSparePartCollapseWidget.propTypes = {
|
|
383
446
|
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -395,6 +458,7 @@ AddSparePartCollapseWidget.propTypes = {
|
|
|
395
458
|
disableSelected: _propTypes.default.bool
|
|
396
459
|
})).isRequired,
|
|
397
460
|
disableDiscount: _propTypes.default.bool,
|
|
398
|
-
disableHsn: _propTypes.default.bool
|
|
461
|
+
disableHsn: _propTypes.default.bool,
|
|
462
|
+
isHsnOptional: _propTypes.default.bool
|
|
399
463
|
};
|
|
400
464
|
var _default = exports.default = AddSparePartCollapseWidget;
|
|
@@ -10,6 +10,9 @@ exports.default = void 0;
|
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
require("core-js/modules/es.array.includes.js");
|
|
12
12
|
require("core-js/modules/es.string.includes.js");
|
|
13
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
14
|
+
require("core-js/modules/es.regexp.test.js");
|
|
15
|
+
require("core-js/modules/es.promise.js");
|
|
13
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
18
|
var _antd = require("antd");
|
|
@@ -165,23 +168,63 @@ function AddSparePartWidget(_ref) {
|
|
|
165
168
|
// This field is enabled only if the corresponding part is selected
|
|
166
169
|
,
|
|
167
170
|
disabled: !selectedParts.includes(spare.scopeId),
|
|
168
|
-
prefix: "\u20B9"
|
|
171
|
+
prefix: "\u20B9",
|
|
172
|
+
onPaste: e => {
|
|
173
|
+
var _e$clipboardData$getD, _e$clipboardData;
|
|
174
|
+
const pasted = (_e$clipboardData$getD = e === null || e === void 0 || (_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.getData('Text')) !== null && _e$clipboardData$getD !== void 0 ? _e$clipboardData$getD : '';
|
|
175
|
+
const validDecimalPattern = /^\d+(\.\d*)?$/;
|
|
176
|
+
if (!validDecimalPattern.test(pasted)) {
|
|
177
|
+
e.preventDefault(); // Block invalid paste
|
|
178
|
+
}
|
|
179
|
+
}
|
|
169
180
|
})),
|
|
170
181
|
discount: /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
171
182
|
name: "discount-".concat(spare.scopeId),
|
|
172
183
|
rules: [{
|
|
173
|
-
// This field is required only if the corresponding part is selected
|
|
174
184
|
required: selectedParts.includes(spare.scopeId),
|
|
175
185
|
message: 'Required field'
|
|
176
|
-
|
|
186
|
+
}, {
|
|
187
|
+
validator: (_, value) => {
|
|
188
|
+
const maxDiscount = form.getFieldValue("cost-".concat(spare.scopeId)) || 0;
|
|
189
|
+
if (value > maxDiscount) {
|
|
190
|
+
return Promise.reject(new Error('Discount cannot exceed the Part Price!'));
|
|
191
|
+
}
|
|
192
|
+
return Promise.resolve();
|
|
193
|
+
}
|
|
177
194
|
}],
|
|
178
195
|
initialValue: ""
|
|
179
196
|
}, /*#__PURE__*/_react.default.createElement(_CustomInputNumber.default, {
|
|
180
|
-
size: "small"
|
|
181
|
-
// This field is enabled only if the corresponding part is selected
|
|
182
|
-
,
|
|
197
|
+
size: "small",
|
|
183
198
|
disabled: !selectedParts.includes(spare.scopeId),
|
|
184
|
-
prefix: "\u20B9"
|
|
199
|
+
prefix: "\u20B9",
|
|
200
|
+
max: form.getFieldValue("cost-".concat(spare.scopeId)),
|
|
201
|
+
value: form.getFieldValue("discount-".concat(spare.scopeId)),
|
|
202
|
+
onPaste: e => {
|
|
203
|
+
var _e$clipboardData$getD2, _e$clipboardData2;
|
|
204
|
+
const pasted = (_e$clipboardData$getD2 = (_e$clipboardData2 = e.clipboardData) === null || _e$clipboardData2 === void 0 ? void 0 : _e$clipboardData2.getData('Text')) !== null && _e$clipboardData$getD2 !== void 0 ? _e$clipboardData$getD2 : '';
|
|
205
|
+
const validDecimalPattern = /^\d+(\.\d*)?$/;
|
|
206
|
+
if (!validDecimalPattern.test(pasted)) {
|
|
207
|
+
e.preventDefault(); // Block invalid paste
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
onChange: value => {
|
|
211
|
+
const maxDiscount = form.getFieldValue("discount-".concat(spare.scopeId)) || 0;
|
|
212
|
+
if (value > maxDiscount) {
|
|
213
|
+
form.setFieldValue("discount-".concat(spare.scopeId), maxDiscount);
|
|
214
|
+
} else {
|
|
215
|
+
form.setFieldValue("discount-".concat(spare.scopeId), value);
|
|
216
|
+
}
|
|
217
|
+
form.validateFields(["discount-".concat(spare.scopeId)]);
|
|
218
|
+
},
|
|
219
|
+
onBlur: () => {
|
|
220
|
+
// Ensure field is corrected after losing focus
|
|
221
|
+
const value = form.getFieldValue("discount-".concat(spare.scopeId));
|
|
222
|
+
const maxDiscount = form.getFieldValue("cost-".concat(spare.scopeId));
|
|
223
|
+
if (value > maxDiscount) {
|
|
224
|
+
form.setFieldValue("discount-".concat(spare.scopeId), maxDiscount);
|
|
225
|
+
form.validateFields(["discount-".concat(spare.scopeId)]);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
185
228
|
})),
|
|
186
229
|
hsnId: /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
187
230
|
name: "hsnId-".concat(spare.scopeId),
|
|
@@ -15,31 +15,26 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* @param {object} address - The address object containing address details.
|
|
16
16
|
*/
|
|
17
17
|
function AddressWidget(_ref) {
|
|
18
|
-
var _address$additional_i, _address$additional_i2;
|
|
19
18
|
let {
|
|
20
19
|
address
|
|
21
20
|
} = _ref;
|
|
22
|
-
|
|
21
|
+
const {
|
|
22
|
+
heading,
|
|
23
|
+
addressLine1,
|
|
24
|
+
addressLine2,
|
|
25
|
+
landmark,
|
|
26
|
+
city,
|
|
27
|
+
pincode
|
|
28
|
+
} = address !== null && address !== void 0 ? address : {};
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_styles.AddressContainer, null, heading && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
23
30
|
typography: "type-b2-400"
|
|
24
|
-
},
|
|
31
|
+
}, heading), /*#__PURE__*/_react.default.createElement(_styles.AddressLines, null, addressLine1 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
25
32
|
color: "secondary-content",
|
|
26
33
|
typography: "type-b2-400"
|
|
27
|
-
}, address.addressLine1),
|
|
34
|
+
}, address.addressLine1, ","), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
28
35
|
color: "secondary-content",
|
|
29
36
|
typography: "type-b2-400"
|
|
30
|
-
},
|
|
31
|
-
color: "secondary-content",
|
|
32
|
-
typography: "type-b2-400"
|
|
33
|
-
}, address.addressLine3), address.landmark && /*#__PURE__*/_react.default.createElement("i", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
34
|
-
color: "secondary-content",
|
|
35
|
-
typography: "type-b2-400"
|
|
36
|
-
}, "Near", ' ', address.landmark)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
37
|
-
color: "secondary-content",
|
|
38
|
-
typography: "type-b2-400"
|
|
39
|
-
}, address.city, ', ', address.state, address.pincode), (address === null || address === void 0 || (_address$additional_i = address.additional_info) === null || _address$additional_i === void 0 ? void 0 : _address$additional_i.lat) && (address === null || address === void 0 || (_address$additional_i2 = address.additional_info) === null || _address$additional_i2 === void 0 ? void 0 : _address$additional_i2.long) && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
40
|
-
color: "secondary-content",
|
|
41
|
-
typography: "type-b2-400"
|
|
42
|
-
}, "Location:", ' ', address.additional_info.lat, ",", address.additional_info.long)));
|
|
37
|
+
}, addressLine2 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, addressLine2, ",", ' ') : null, landmark ? "".concat(landmark, ", ") : null, city ? "".concat(city, ", ") : null, pincode || null)));
|
|
43
38
|
}
|
|
44
39
|
AddressWidget.propTypes = {
|
|
45
40
|
address: _propTypes.default.shape({
|
|
@@ -16,7 +16,8 @@ var _styles = require("./styles");
|
|
|
16
16
|
var _CustomRadio = _interopRequireDefault(require("../../components/oa-component-radio/CustomRadio"));
|
|
17
17
|
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
18
18
|
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
19
|
-
const _excluded = ["children", "description", "docDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "data-test"];
|
|
19
|
+
const _excluded = ["children", "description", "docDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "data-test", "maxLength"];
|
|
20
|
+
/* eslint-disable */
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -59,9 +60,11 @@ function ApprovalWidget(_ref) {
|
|
|
59
60
|
questionId,
|
|
60
61
|
title,
|
|
61
62
|
viewOnClick,
|
|
62
|
-
|
|
63
|
+
"data-test": dataTest,
|
|
64
|
+
maxLength
|
|
63
65
|
} = _ref,
|
|
64
66
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
67
|
+
console.log(maxLength, "maxLength2");
|
|
65
68
|
const getInitialValue = isApproved => {
|
|
66
69
|
switch (isApproved) {
|
|
67
70
|
case true:
|
|
@@ -77,11 +80,11 @@ function ApprovalWidget(_ref) {
|
|
|
77
80
|
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
81
|
className: "row"
|
|
79
82
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
className: approvalForm.hidden ?
|
|
83
|
+
className: approvalForm.hidden ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-7 col-lg-7 gutter"
|
|
81
84
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
82
85
|
className: "row"
|
|
83
86
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
-
className: isQuestionStyleWidget ?
|
|
87
|
+
className: isQuestionStyleWidget ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-8 col-lg-8 gutter"
|
|
85
88
|
}, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
|
|
86
89
|
className: "type-b2-400"
|
|
87
90
|
}, title, isMandatory && /*#__PURE__*/_react.default.createElement(_styles.RedText, null, "*"))), description && /*#__PURE__*/_react.default.createElement(_styles.Styledescription, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
@@ -92,7 +95,7 @@ function ApprovalWidget(_ref) {
|
|
|
92
95
|
"data-test": dataTest ? "".concat(dataTest, "--view-button") : undefined,
|
|
93
96
|
onClick: () => viewOnClick(questionId),
|
|
94
97
|
type: "text-only",
|
|
95
|
-
label: isQuestionStyleWidget ?
|
|
98
|
+
label: isQuestionStyleWidget ? "View Previous Description" : "View History"
|
|
96
99
|
}), children)), !isQuestionStyleWidget && /*#__PURE__*/_react.default.createElement("div", {
|
|
97
100
|
className: "col-sm-12 col-md-4 col-lg-4"
|
|
98
101
|
}, /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
|
|
@@ -112,7 +115,7 @@ function ApprovalWidget(_ref) {
|
|
|
112
115
|
required: true,
|
|
113
116
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
114
117
|
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
115
|
-
}, "Approval status needs to be selected.") :
|
|
118
|
+
}, "Approval status needs to be selected.") : "Approval status needs to be selected."
|
|
116
119
|
}]
|
|
117
120
|
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
118
121
|
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
|
|
@@ -132,12 +135,17 @@ function ApprovalWidget(_ref) {
|
|
|
132
135
|
className: "type-b2-400"
|
|
133
136
|
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
134
137
|
name: "remarks-".concat(questionId),
|
|
135
|
-
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks :
|
|
138
|
+
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : "",
|
|
136
139
|
rules: [{
|
|
137
140
|
required: true,
|
|
138
141
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
139
142
|
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
140
|
-
}, "Remarks cannot be empty.") :
|
|
143
|
+
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
144
|
+
}, maxLength && {
|
|
145
|
+
max: maxLength,
|
|
146
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
147
|
+
"data-test": "".concat(dataTest, "--remarks-maxlength-validation-message")
|
|
148
|
+
}, "Remarks cannot exceed ".concat(maxLength, " characters.")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Remarks cannot exceed ".concat(maxLength, " characters."))
|
|
141
149
|
}]
|
|
142
150
|
}, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
143
151
|
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
@@ -146,7 +154,7 @@ function ApprovalWidget(_ref) {
|
|
|
146
154
|
}
|
|
147
155
|
ApprovalWidget.propTypes = {
|
|
148
156
|
children: _propTypes.default.node,
|
|
149
|
-
|
|
157
|
+
"data-test": _propTypes.default.string,
|
|
150
158
|
description: _propTypes.default.string,
|
|
151
159
|
// Leave description optional
|
|
152
160
|
docDetails: _propTypes.default.shape({
|
|
@@ -176,8 +184,8 @@ ApprovalWidget.propTypes = {
|
|
|
176
184
|
};
|
|
177
185
|
ApprovalWidget.defaultProps = {
|
|
178
186
|
children: null,
|
|
179
|
-
|
|
180
|
-
description:
|
|
187
|
+
"data-test": null,
|
|
188
|
+
description: "",
|
|
181
189
|
docDetails: {},
|
|
182
190
|
approvalForm: {
|
|
183
191
|
disabled: false,
|