oa-componentbook 1.0.1-stage.9 → 1.0.1-stage.90
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 +9 -4
- package/build/components/oa-component-feedback-form/FeedbackForm.js +75 -0
- package/build/components/oa-component-feedback-tooltip/FeedbackTooltip.js +69 -0
- package/build/components/oa-component-modal/styles.js +1 -1
- package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +281 -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-side-drawer/DocumentSideDrawer.js +130 -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/oaChat.svg +5 -0
- package/build/index.js +56 -0
- package/build/layout/paymentAndConsent/CancelScreen.js +46 -0
- package/build/layout/paymentAndConsent/ConsentCard.js +68 -0
- package/build/layout/paymentAndConsent/DetailsCard.js +75 -0
- package/build/layout/paymentAndConsent/DetailsList.js +38 -0
- package/build/layout/paymentAndConsent/Header.js +33 -0
- package/build/layout/paymentAndConsent/InProgressScreen.js +46 -0
- package/build/layout/paymentAndConsent/Loader.js +21 -0
- package/build/layout/paymentAndConsent/Modal.js +28 -0
- package/build/layout/paymentAndConsent/PaymentAndConsent.js +22 -0
- package/build/layout/paymentAndConsent/PaymentCard.js +83 -0
- package/build/layout/paymentAndConsent/Section.js +34 -0
- package/build/layout/paymentAndConsent/SuccessScreen.js +46 -0
- package/build/layout/paymentAndConsent/TimeLineCard.js +28 -0
- package/build/layout/paymentAndConsent/TncList.js +32 -0
- package/build/layout/paymentAndConsent/style.js +12 -0
- package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +17 -11
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +373 -0
- package/build/widgets/oa-widget-approval/styles.js +2 -2
- package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +6 -6
- package/build/widgets/oa-widget-feedback/FeedbackWidget.js +83 -0
- package/build/widgets/oa-widget-feedback/styles.js +13 -0
- package/build/widgets/oa-widget-image-carousel/ImageCarouselWidget.js +257 -0
- package/build/widgets/oa-widget-image-carousel/styles.js +23 -0
- package/build/widgets/oa-widget-map-base-location/AddressDetails.js +6 -4
- package/build/widgets/oa-widget-map-base-location/AddressForm.js +26 -3
- package/build/widgets/oa-widget-map-base-location/MapBaseLocation.js +5 -3
- package/build/widgets/oa-widget-membershipcard/MembershipCard.js +5 -7
- package/build/widgets/oa-widget-notes/NotesWidget.js +2 -1
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +164 -0
- package/build/widgets/oa-widget-track-shipment/TrackShipmentWidget.js +4 -2
- package/build/widgets/oa-widget-track-shipment-list/TrackShipmentWidgetList.js +71 -30
- package/build/widgets/oa-widget-track-shipment-list/fn.js +8 -8
- package/package.json +6 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.symbol.description.js");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
10
|
+
var _CustomCheckBox = _interopRequireDefault(require("../../components/oa-component-checkbox/CustomCheckBox"));
|
|
11
|
+
var _CustomTag = _interopRequireDefault(require("../../components/oa-component-tag/CustomTag"));
|
|
12
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
13
|
+
var _TncList = _interopRequireDefault(require("./TncList"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function PaymentCard(props) {
|
|
16
|
+
const {
|
|
17
|
+
paymentCard
|
|
18
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
19
|
+
const {
|
|
20
|
+
title = '',
|
|
21
|
+
description = '',
|
|
22
|
+
image = {},
|
|
23
|
+
checkBox,
|
|
24
|
+
tag = {},
|
|
25
|
+
action1,
|
|
26
|
+
action3
|
|
27
|
+
} = paymentCard;
|
|
28
|
+
const {
|
|
29
|
+
type,
|
|
30
|
+
label
|
|
31
|
+
} = tag !== null && tag !== void 0 ? tag : {};
|
|
32
|
+
const {
|
|
33
|
+
src,
|
|
34
|
+
alt
|
|
35
|
+
} = image !== null && image !== void 0 ? image : {};
|
|
36
|
+
if (!(paymentCard !== null && paymentCard !== void 0 && paymentCard.showPaymentCard)) return null;
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
className: "cromaCardHeader"
|
|
39
|
+
}, src && /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: "iconBox"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
42
|
+
src: src,
|
|
43
|
+
alt: alt
|
|
44
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
className: "textAreaSecBox"
|
|
46
|
+
}, title && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
47
|
+
color: "primary-content",
|
|
48
|
+
className: "type-t2-700"
|
|
49
|
+
}, title), label && /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
+
className: "margin-top-8 margin-bottom-8"
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomTag.default, {
|
|
52
|
+
label: label,
|
|
53
|
+
type: type
|
|
54
|
+
})), description && /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: "margin-bottom-8"
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
57
|
+
color: "secondary-content",
|
|
58
|
+
className: "type-b2-400"
|
|
59
|
+
}, description)), action1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
+
className: "margin-bottom-16"
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
62
|
+
"data-test": "button",
|
|
63
|
+
label: action1 === null || action1 === void 0 ? void 0 : action1.label,
|
|
64
|
+
onClick: action1 === null || action1 === void 0 ? void 0 : action1.onClick,
|
|
65
|
+
type: "text-only"
|
|
66
|
+
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "grayBoxSec"
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement(_TncList.default, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: "checkBoxSec"
|
|
70
|
+
}, checkBox && /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default, {
|
|
71
|
+
label: /*#__PURE__*/_react.default.createElement("p", null, checkBox === null || checkBox === void 0 ? void 0 : checkBox.label),
|
|
72
|
+
onChange: checkBox === null || checkBox === void 0 ? void 0 : checkBox.onChange,
|
|
73
|
+
size: "large"
|
|
74
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: "margin-top-32 makePayment"
|
|
76
|
+
}, (action3 === null || action3 === void 0 ? void 0 : action3.label) && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
77
|
+
"data-test": "button",
|
|
78
|
+
disabled: action3 === null || action3 === void 0 ? void 0 : action3.isDisabled,
|
|
79
|
+
label: action3 === null || action3 === void 0 ? void 0 : action3.label,
|
|
80
|
+
onClick: action3 === null || action3 === void 0 ? void 0 : action3.onClick
|
|
81
|
+
}))));
|
|
82
|
+
}
|
|
83
|
+
var _default = exports.default = PaymentCard;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _TimeLineCard = _interopRequireDefault(require("./TimeLineCard"));
|
|
9
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function Section(props) {
|
|
12
|
+
const {
|
|
13
|
+
section
|
|
14
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
15
|
+
if (!(section !== null && section !== void 0 && section.showSection)) return null;
|
|
16
|
+
const {
|
|
17
|
+
title,
|
|
18
|
+
subTitle
|
|
19
|
+
} = section !== null && section !== void 0 ? section : {};
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
21
|
+
className: "cromaOuterContainer"
|
|
22
|
+
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
className: "margin-top-24"
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
25
|
+
color: "primary-content",
|
|
26
|
+
className: "type-h2-500"
|
|
27
|
+
}, title)), subTitle && /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
className: "margin-top-4 margin-bottom-16"
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
30
|
+
color: "secondary-content",
|
|
31
|
+
className: "type-b1-400"
|
|
32
|
+
}, subTitle)), /*#__PURE__*/_react.default.createElement(_TimeLineCard.default, props));
|
|
33
|
+
}
|
|
34
|
+
var _default = exports.default = Section;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.symbol.description.js");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function SuccessScreen(props) {
|
|
12
|
+
const {
|
|
13
|
+
successScreen
|
|
14
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
15
|
+
const {
|
|
16
|
+
image,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
subDescription
|
|
20
|
+
} = successScreen !== null && successScreen !== void 0 ? successScreen : {};
|
|
21
|
+
const {
|
|
22
|
+
src,
|
|
23
|
+
alt
|
|
24
|
+
} = image !== null && image !== void 0 ? image : {};
|
|
25
|
+
if (!(successScreen !== null && successScreen !== void 0 && successScreen.showSuccessScreen)) return null;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
className: "icRepairBox"
|
|
28
|
+
}, src && /*#__PURE__*/_react.default.createElement("img", {
|
|
29
|
+
src: src,
|
|
30
|
+
alt: alt
|
|
31
|
+
}), title && /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: "margin-top-16 margin-bottom-16"
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
34
|
+
color: "primary-content",
|
|
35
|
+
className: "type-t1-500"
|
|
36
|
+
}, title)), description && /*#__PURE__*/_react.default.createElement("div", {
|
|
37
|
+
className: "margin-bottom-16"
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
39
|
+
color: "primary-content",
|
|
40
|
+
className: "type-b2-400"
|
|
41
|
+
}, description)), subDescription && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
42
|
+
color: "primary-content",
|
|
43
|
+
className: "type-b2-400"
|
|
44
|
+
}, subDescription));
|
|
45
|
+
}
|
|
46
|
+
var _default = exports.default = SuccessScreen;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _PaymentCard = _interopRequireDefault(require("./PaymentCard"));
|
|
9
|
+
var _DetailsCard = _interopRequireDefault(require("./DetailsCard"));
|
|
10
|
+
var _ConsentCard = _interopRequireDefault(require("./ConsentCard"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function TimelineCard(props) {
|
|
13
|
+
const {
|
|
14
|
+
detailsCard,
|
|
15
|
+
paymentCard,
|
|
16
|
+
consentCard
|
|
17
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
+
className: "cromaContainer"
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
21
|
+
className: "cromaInnerContainer"
|
|
22
|
+
}, (detailsCard === null || detailsCard === void 0 ? void 0 : detailsCard.showDetailsCard) && /*#__PURE__*/_react.default.createElement(_DetailsCard.default, props), (paymentCard === null || paymentCard === void 0 ? void 0 : paymentCard.showPaymentCard) && /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
className: "cromaCard"
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement(_PaymentCard.default, props)), (consentCard === null || consentCard === void 0 ? void 0 : consentCard.showConsentCard) && /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: "cromaCard"
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement(_ConsentCard.default, props))));
|
|
27
|
+
}
|
|
28
|
+
var _default = exports.default = TimelineCard;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
9
|
+
var _utils = require("../../utils");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function TncList(props) {
|
|
12
|
+
const {
|
|
13
|
+
tncList
|
|
14
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
15
|
+
const {
|
|
16
|
+
heading,
|
|
17
|
+
list
|
|
18
|
+
} = tncList !== null && tncList !== void 0 ? tncList : {};
|
|
19
|
+
if (!(tncList !== null && tncList !== void 0 && tncList.showTncList)) return null;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement("div", null, heading && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
21
|
+
className: "type-b2-400",
|
|
22
|
+
color: "primary-content"
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement("b", null, heading)), list && /*#__PURE__*/_react.default.createElement("ul", {
|
|
24
|
+
className: "oa-tncList"
|
|
25
|
+
}, list.map(item => /*#__PURE__*/_react.default.createElement("li", {
|
|
26
|
+
key: (0, _utils.getUUID)()
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
28
|
+
className: "type-b2-400",
|
|
29
|
+
color: "primary-content"
|
|
30
|
+
}, item)))));
|
|
31
|
+
}
|
|
32
|
+
var _default = exports.default = TncList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.StylePaymentAndConsent = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var _default = exports.default = {};
|
|
12
|
+
const StylePaymentAndConsent = exports.StylePaymentAndConsent = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .header {\n width: 100%;\n padding: 18px 0;\n background: #fff;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n }\n .oa-tncList {\n padding: 0;\n list-style: disc;\n margin: 0 0 24px 16px !important;\n }\n .oa-tncList li {\n margin: 16px 0 0 0;\n }\n .container {\n max-width: 1100px;\n margin: 0 auto;\n width: 100%;\n }\n body {\n background: #f1f2f3;\n }\n .cromaOuterContainer {\n max-width: 736px;\n width: 100%;\n margin: 0 auto;\n }\n .cromaContainer {\n border-radius: 12px;\n border: 1px solid #e0e0e0;\n background: #fff;\n width: 100%;\n padding: 56px 96px;\n }\n\n .cromaInnerContainer {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n .cromaInnerContainer .cromaCard {\n overflow: hidden;\n border-radius: 12px;\n display: flex;\n flex-direction: column;\n width: 100%;\n padding-top: 32px;\n border: 1px solid #e0e0e0;\n background: #fff;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n }\n .cromaInnerContainer .cromaCard .grayBoxSec {\n border-radius: 12px 12px 0px 0px;\n padding: 16px 16px 24px 16px;\n background: #f6f6f6;\n }\n .cromaInnerContainer .cromaCard .checkBoxSec {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n .cromaInnerContainer .cromaCard .checkBoxSec .ant-checkbox + span {\n padding-inline-end: 6px;\n }\n .makePayment {\n width: 100%;\n }\n .makePayment button {\n width: 100%;\n }\n .cromaCardHeader {\n display: flex;\n flex-direction: row;\n gap: 8px;\n padding: 0 16px 0 16px;\n }\n .serviceRequestBoxHeader {\n display: flex;\n flex-direction: row;\n gap: 8px;\n margin: 0 0 0 16px;\n align-items: center;\n }\n .serviceRequestBoxHeader img {\n width: 24px;\n }\n .serviceRequestBoxBody {\n border-left: solid 1px #00875a;\n padding: 0 0 32px 20px;\n margin: 0 0 0 26px;\n }\n .grayBoxList {\n border-radius: 8px;\n padding: 12px;\n margin: 12px 0 0 0;\n background: #f6f6f6;\n }\n .listofDetails {\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n }\n .listofDetails li {\n display: flex;\n flex-direction: row;\n margin: 8px 0 0 0;\n padding: 0;\n }\n .listofDetails li p {\n color: #000;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 120px;\n }\n .listofDetails li span {\n color: #71777d;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: calc(100% - 120px);\n }\n .hideDetails {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n .hideDetails button {\n margin-right: 4px;\n }\n .icRepairBox {\n padding: 0 16px;\n display: flex;\n margin: 130px 0 0 0;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n text-align: center;\n }\n\n .loader-container-dashboard {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgba(255, 255, 255, 0.5);\n z-index: 1000;\n }\n\n .bar-ddm {\n display: inline-flex;\n color: var(--color-primary);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-items: center;\n gap: 4px;\n margin: 4px 0;\n cursor: pointer;\n }\n\n .textAlign {\n display: flex;\n }\n @media screen and (max-width: 600px) {\n .container {\n padding: 0 16px;\n }\n\n .cromaOuterContainer {\n padding: 0 16px;\n }\n .cromaContainer {\n border-radius: 0;\n border: none;\n background: #fff;\n padding: 24px 0;\n }\n .cromaInnerContainer .cromaCard .checkBoxSec {\n flex-direction: column;\n align-items: flex-start;\n }\n .cromaInnerContainer .cromaCard .checkBoxSec button {\n margin: 0 0 0 28px;\n }\n .service-request-page {\n background: #fff;\n min-height: 100vh;\n height: 100%;\n }\n }\n"])));
|
|
@@ -11,6 +11,7 @@ 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");
|
|
14
15
|
require("core-js/modules/es.array.reduce.js");
|
|
15
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -82,7 +83,8 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
82
83
|
setActiveKey(Array.from(initialSelectedItems).map(String)); // Set initially selected items as active keys
|
|
83
84
|
}, [selectedItems]);
|
|
84
85
|
(0, _react.useEffect)(() => {
|
|
85
|
-
|
|
86
|
+
var _selectedItems$map$fi, _items$filter;
|
|
87
|
+
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
88
|
setFilteredItems(sortedItems);
|
|
87
89
|
}, [items, selectedItems]);
|
|
88
90
|
|
|
@@ -141,7 +143,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
141
143
|
}
|
|
142
144
|
}, 0);
|
|
143
145
|
};
|
|
144
|
-
const isNumeric = value => /^\d
|
|
146
|
+
const isNumeric = value => /^\d+(\.\d{0,2})?$/.test(value); // Regular expression to check if the value is numeric
|
|
145
147
|
|
|
146
148
|
/**
|
|
147
149
|
* Handles changes in the fields of the items.
|
|
@@ -155,19 +157,23 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
155
157
|
*/
|
|
156
158
|
const onFieldChange = (itemId, field, value) => {
|
|
157
159
|
if (field === 'hsnId' || isNumeric(value)) {
|
|
158
|
-
|
|
160
|
+
if (field === 'discount') {
|
|
161
|
+
var _formValues$itemId;
|
|
162
|
+
if (parseInt((_formValues$itemId = formValues[itemId]) === null || _formValues$itemId === void 0 ? void 0 : _formValues$itemId.cost, 10) < parseInt(value, 10)) {
|
|
163
|
+
openNotification({
|
|
164
|
+
title: 'Error',
|
|
165
|
+
description: 'Discount cannot be greater than Cost.',
|
|
166
|
+
type: 'failure'
|
|
167
|
+
});
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
159
171
|
const updatedFormValues = _objectSpread(_objectSpread({}, formValues), {}, {
|
|
160
172
|
[itemId]: _objectSpread(_objectSpread({}, formValues[itemId]), {}, {
|
|
161
173
|
[field]: value
|
|
162
174
|
})
|
|
163
175
|
});
|
|
164
176
|
setFormValues(updatedFormValues);
|
|
165
|
-
} else {
|
|
166
|
-
openNotification({
|
|
167
|
-
title: 'Error',
|
|
168
|
-
description: 'Please enter only numeric values.',
|
|
169
|
-
type: 'failure'
|
|
170
|
-
});
|
|
171
177
|
}
|
|
172
178
|
};
|
|
173
179
|
|
|
@@ -179,7 +185,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
179
185
|
* @param {React.KeyboardEvent} event - The event triggered by the key press.
|
|
180
186
|
*/
|
|
181
187
|
const handleKeyPress = event => {
|
|
182
|
-
if (!/[
|
|
188
|
+
if (!/[\d.]/.test(event.key) || event.key === '.' && event.target.value.includes('.')) {
|
|
183
189
|
event.preventDefault();
|
|
184
190
|
openNotification({
|
|
185
191
|
title: 'Error',
|
|
@@ -314,7 +320,7 @@ function AddSparePartCollapseWidget(_ref) {
|
|
|
314
320
|
onChange: e => onFieldChange(item.id, 'cost', e.target.value),
|
|
315
321
|
onKeyPress: handleKeyPress,
|
|
316
322
|
inputMode: "numeric",
|
|
317
|
-
pattern: "[0-9]
|
|
323
|
+
pattern: "[0-9]+(\\.[0-9]{0,2})?",
|
|
318
324
|
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
325
|
disabled: isItemDisabled
|
|
320
326
|
})), !disableDiscount && /*#__PURE__*/_react.default.createElement("div", {
|