oa-componentbook 1.0.1-stage.38 → 1.0.1-stage.381
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 +118 -42
- package/build/components/oa-component-accordion/styles.js +2 -2
- package/build/components/oa-component-button/CustomButton.js +6 -4
- 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/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-select/CustomSelect.js +116 -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 +531 -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/{TextArea.js → CustomTextArea.js} +4 -4
- package/build/components/oa-component-tooltip/CustomTooltip.js +8 -4
- package/build/components/oa-component-upload/CustomUpload.js +120 -40
- package/build/components/oa-component-viewer/CustomViewer.js +3 -1
- 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 +3 -0
- 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 +235 -0
- package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +63 -0
- package/build/layout/EntityOverviewLayout/styles.js +13 -0
- package/build/layout/GenricLayOut/GenricLayOut.js +2293 -0
- package/build/layout/GenricLayOut/components/AppliedFilters.js +84 -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 +85 -0
- package/build/layout/GenricLayOut/components/ProfileSection.js +87 -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 +294 -0
- package/build/layout/GenricLayOut/resolver/staticConfigResolver.js +98 -0
- package/build/layout/GenricLayOut/styles.js +25 -0
- package/build/utils/download-file.js +23 -0
- package/build/widgets/oa-form-widget/FormWidget.js +544 -0
- package/build/widgets/oa-form-widget/FormWidgetStyle.js +18 -0
- package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +73 -12
- 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 +18 -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 +395 -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 +77 -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 +40 -10
- 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 +2 -1
- package/build/widgets/oa-widget-profile-data/ProfileDataWidget.js +117 -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-sidebar/SidebarWidget.js +105 -0
- package/build/widgets/oa-widget-sidebar/components/Header.js +33 -0
- package/build/widgets/oa-widget-sidebar/sidebar.css +0 -0
- package/build/widgets/oa-widget-sidebar/styles.js +13 -0
- package/build/widgets/oa-widget-spare-part/SparePartsWidget.js +57 -29
- package/build/widgets/oa-widget-track-shipment-list/fn.js +16 -4
- package/build/widgets/oa-widget-user-management/UserManagementWidget.js +351 -0
- package/build/widgets/oa-widget-user-management/styles.js +15 -0
- package/package.json +4 -2
|
@@ -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");
|
|
@@ -82,7 +85,8 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
82
85
|
setActiveKey(Array.from(initialSelectedItems).map(String)); // Set initially selected items as active keys
|
|
83
86
|
}, [selectedItems]);
|
|
84
87
|
(0, _react.useEffect)(() => {
|
|
85
|
-
|
|
88
|
+
var _selectedItems$map$fi, _items$filter;
|
|
89
|
+
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
90
|
setFilteredItems(sortedItems);
|
|
87
91
|
}, [items, selectedItems]);
|
|
88
92
|
|
|
@@ -141,7 +145,22 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
141
145
|
}
|
|
142
146
|
}, 0);
|
|
143
147
|
};
|
|
144
|
-
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Checks if a given value is numeric.
|
|
151
|
+
*
|
|
152
|
+
* This function verifies if the provided value is a numeric string,
|
|
153
|
+
* optionally allowing two decimal places. An empty string is also
|
|
154
|
+
* considered valid, allowing for clearing inputs.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} value - The value to check.
|
|
157
|
+
* @returns {boolean} - Returns true if the value is numeric or empty, otherwise false.
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
const isNumeric = value => {
|
|
161
|
+
if (value === '') return true;
|
|
162
|
+
return /^\d+(\.\d{0,2})?$/.test(value);
|
|
163
|
+
};
|
|
145
164
|
|
|
146
165
|
/**
|
|
147
166
|
* Handles changes in the fields of the items.
|
|
@@ -154,8 +173,18 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
154
173
|
* @param {string|number} value - The new value of the field.
|
|
155
174
|
*/
|
|
156
175
|
const onFieldChange = (itemId, field, value) => {
|
|
157
|
-
if (field === 'hsnId' || isNumeric(value)) {
|
|
158
|
-
|
|
176
|
+
if (field === 'hsnId' || (field === 'discount' || field === 'cost') && isNumeric(value)) {
|
|
177
|
+
if (field === 'discount') {
|
|
178
|
+
var _formValues$itemId;
|
|
179
|
+
if (parseInt((_formValues$itemId = formValues[itemId]) === null || _formValues$itemId === void 0 ? void 0 : _formValues$itemId.cost, 10) < parseInt(value, 10)) {
|
|
180
|
+
openNotification({
|
|
181
|
+
title: 'Error',
|
|
182
|
+
description: 'Discount cannot be greater than Cost.',
|
|
183
|
+
type: 'failure'
|
|
184
|
+
});
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
159
188
|
const updatedFormValues = _objectSpread(_objectSpread({}, formValues), {}, {
|
|
160
189
|
[itemId]: _objectSpread(_objectSpread({}, formValues[itemId]), {}, {
|
|
161
190
|
[field]: value
|
|
@@ -163,11 +192,11 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
163
192
|
});
|
|
164
193
|
setFormValues(updatedFormValues);
|
|
165
194
|
} else {
|
|
166
|
-
openNotification({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
195
|
+
// openNotification({
|
|
196
|
+
// title: 'Error',
|
|
197
|
+
// description: 'Please enter only numeric values 146.',
|
|
198
|
+
// type: 'failure',
|
|
199
|
+
// });
|
|
171
200
|
}
|
|
172
201
|
};
|
|
173
202
|
|
|
@@ -179,7 +208,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
179
208
|
* @param {React.KeyboardEvent} event - The event triggered by the key press.
|
|
180
209
|
*/
|
|
181
210
|
const handleKeyPress = event => {
|
|
182
|
-
if (!/[
|
|
211
|
+
if (!/[\d.]/.test(event.key) || event.key === '.' && event.target.value.includes('.')) {
|
|
183
212
|
event.preventDefault();
|
|
184
213
|
openNotification({
|
|
185
214
|
title: 'Error',
|
|
@@ -188,6 +217,21 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
188
217
|
});
|
|
189
218
|
}
|
|
190
219
|
};
|
|
220
|
+
const handlePaste = e => {
|
|
221
|
+
var _e$clipboardData$getD, _e$clipboardData;
|
|
222
|
+
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 : '';
|
|
223
|
+
|
|
224
|
+
// Allow only numbers with optional decimal part (up to 2 digits after .)
|
|
225
|
+
const validDecimalPattern = /^\d+(\.\d{0,2})?$/;
|
|
226
|
+
if (!validDecimalPattern.test(pastedData)) {
|
|
227
|
+
e.preventDefault();
|
|
228
|
+
openNotification({
|
|
229
|
+
title: 'Invalid Paste',
|
|
230
|
+
description: 'Only numeric values with up to 2 decimal places are allowed.',
|
|
231
|
+
type: 'failure'
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
};
|
|
191
235
|
|
|
192
236
|
/**
|
|
193
237
|
* Handles the submission of the spare parts information.
|
|
@@ -228,7 +272,22 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
228
272
|
});
|
|
229
273
|
return;
|
|
230
274
|
}
|
|
231
|
-
|
|
275
|
+
toSubmit.every(item => {
|
|
276
|
+
const cost = parseFloat(item.cost);
|
|
277
|
+
const discount = parseFloat(item.discount);
|
|
278
|
+
const field = items.find(f => f.id === item.scopeId);
|
|
279
|
+
const fieldName = field ? field.name : "ScopeId ".concat(item.scopeId);
|
|
280
|
+
if (discount > cost) {
|
|
281
|
+
openNotification({
|
|
282
|
+
title: 'Error',
|
|
283
|
+
description: "Discount cannot be greater than cost for ".concat(fieldName),
|
|
284
|
+
type: 'failure'
|
|
285
|
+
});
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
return true;
|
|
289
|
+
});
|
|
290
|
+
onSubmit(toSubmit);
|
|
232
291
|
};
|
|
233
292
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
234
293
|
buttonConfig: [{
|
|
@@ -313,8 +372,9 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
313
372
|
placeholder: "Enter price without GST",
|
|
314
373
|
onChange: e => onFieldChange(item.id, 'cost', e.target.value),
|
|
315
374
|
onKeyPress: handleKeyPress,
|
|
375
|
+
onPaste: handlePaste,
|
|
316
376
|
inputMode: "numeric",
|
|
317
|
-
pattern: "[0-9]
|
|
377
|
+
pattern: "[0-9]+(\\.[0-9]{0,2})?",
|
|
318
378
|
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
379
|
disabled: isItemDisabled
|
|
320
380
|
})), !disableDiscount && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -337,6 +397,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
337
397
|
placeholder: "Enter discount",
|
|
338
398
|
onChange: e => onFieldChange(item.id, 'discount', e.target.value),
|
|
339
399
|
onKeyPress: handleKeyPress,
|
|
400
|
+
onPaste: handlePaste,
|
|
340
401
|
inputMode: "numeric",
|
|
341
402
|
pattern: "[0-9]*",
|
|
342
403
|
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 : '',
|
|
@@ -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,7 @@ 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
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
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
22
|
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 +59,11 @@ function ApprovalWidget(_ref) {
|
|
|
59
59
|
questionId,
|
|
60
60
|
title,
|
|
61
61
|
viewOnClick,
|
|
62
|
-
|
|
62
|
+
"data-test": dataTest,
|
|
63
|
+
maxLength
|
|
63
64
|
} = _ref,
|
|
64
65
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
66
|
+
console.log(maxLength, "maxLength2");
|
|
65
67
|
const getInitialValue = isApproved => {
|
|
66
68
|
switch (isApproved) {
|
|
67
69
|
case true:
|
|
@@ -77,11 +79,11 @@ function ApprovalWidget(_ref) {
|
|
|
77
79
|
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
80
|
className: "row"
|
|
79
81
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
className: approvalForm.hidden ?
|
|
82
|
+
className: approvalForm.hidden ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-7 col-lg-7 gutter"
|
|
81
83
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
82
84
|
className: "row"
|
|
83
85
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
-
className: isQuestionStyleWidget ?
|
|
86
|
+
className: isQuestionStyleWidget ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-8 col-lg-8 gutter"
|
|
85
87
|
}, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
|
|
86
88
|
className: "type-b2-400"
|
|
87
89
|
}, 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 +94,7 @@ function ApprovalWidget(_ref) {
|
|
|
92
94
|
"data-test": dataTest ? "".concat(dataTest, "--view-button") : undefined,
|
|
93
95
|
onClick: () => viewOnClick(questionId),
|
|
94
96
|
type: "text-only",
|
|
95
|
-
label: isQuestionStyleWidget ?
|
|
97
|
+
label: isQuestionStyleWidget ? "View Previous Description" : "View History"
|
|
96
98
|
}), children)), !isQuestionStyleWidget && /*#__PURE__*/_react.default.createElement("div", {
|
|
97
99
|
className: "col-sm-12 col-md-4 col-lg-4"
|
|
98
100
|
}, /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
|
|
@@ -112,7 +114,7 @@ function ApprovalWidget(_ref) {
|
|
|
112
114
|
required: true,
|
|
113
115
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
114
116
|
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
115
|
-
}, "Approval status needs to be selected.") :
|
|
117
|
+
}, "Approval status needs to be selected.") : "Approval status needs to be selected."
|
|
116
118
|
}]
|
|
117
119
|
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
118
120
|
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
|
|
@@ -132,12 +134,17 @@ function ApprovalWidget(_ref) {
|
|
|
132
134
|
className: "type-b2-400"
|
|
133
135
|
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
134
136
|
name: "remarks-".concat(questionId),
|
|
135
|
-
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks :
|
|
137
|
+
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : "",
|
|
136
138
|
rules: [{
|
|
137
139
|
required: true,
|
|
138
140
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
139
141
|
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
140
|
-
}, "Remarks cannot be empty.") :
|
|
142
|
+
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
143
|
+
}, maxLength && {
|
|
144
|
+
max: maxLength,
|
|
145
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
146
|
+
"data-test": "".concat(dataTest, "--remarks-maxlength-validation-message")
|
|
147
|
+
}, "Remarks cannot exceed ".concat(maxLength, " characters.")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Remarks cannot exceed ".concat(maxLength, " characters."))
|
|
141
148
|
}]
|
|
142
149
|
}, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
143
150
|
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
@@ -146,7 +153,7 @@ function ApprovalWidget(_ref) {
|
|
|
146
153
|
}
|
|
147
154
|
ApprovalWidget.propTypes = {
|
|
148
155
|
children: _propTypes.default.node,
|
|
149
|
-
|
|
156
|
+
"data-test": _propTypes.default.string,
|
|
150
157
|
description: _propTypes.default.string,
|
|
151
158
|
// Leave description optional
|
|
152
159
|
docDetails: _propTypes.default.shape({
|
|
@@ -176,8 +183,8 @@ ApprovalWidget.propTypes = {
|
|
|
176
183
|
};
|
|
177
184
|
ApprovalWidget.defaultProps = {
|
|
178
185
|
children: null,
|
|
179
|
-
|
|
180
|
-
description:
|
|
186
|
+
"data-test": null,
|
|
187
|
+
description: "",
|
|
181
188
|
docDetails: {},
|
|
182
189
|
approvalForm: {
|
|
183
190
|
disabled: false,
|