oa-componentbook 1.0.1-stage.4 → 1.0.1-stage.5
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/index.js +0 -7
- package/build/widgets/oa-widget-track-shipment/TrackShipmentWidget.js +26 -6
- package/build/widgets/oa-widget-track-shipment-list/TrackShipmentWidgetList.js +105 -0
- package/build/widgets/oa-widget-track-shipment-list/fn.js +41 -0
- package/package.json +1 -1
- package/build/dev/oa-widget-track-shipment/TrackShipmentWidget.js +0 -195
- /package/build/{dev/oa-widget-track-shipment → widgets/oa-widget-track-shipment-list}/styles.js +0 -0
package/build/index.js
CHANGED
|
@@ -485,12 +485,6 @@ Object.defineProperty(exports, "TrackShipmentWidget", {
|
|
|
485
485
|
return _TrackShipmentWidget.default;
|
|
486
486
|
}
|
|
487
487
|
});
|
|
488
|
-
Object.defineProperty(exports, "TrackShipmentWidgetDev", {
|
|
489
|
-
enumerable: true,
|
|
490
|
-
get: function get() {
|
|
491
|
-
return _TrackShipmentWidget2.default;
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
488
|
Object.defineProperty(exports, "Typographies", {
|
|
495
489
|
enumerable: true,
|
|
496
490
|
get: function get() {
|
|
@@ -629,7 +623,6 @@ var _Preview = _interopRequireDefault(require("./widgets/oa-widget-preview/Previ
|
|
|
629
623
|
var _PincodeBaseLocation = _interopRequireDefault(require("./widgets/oa-widget-pincode-base-location/PincodeBaseLocation"));
|
|
630
624
|
var _MapBaseLocation = _interopRequireDefault(require("./widgets/oa-widget-map-base-location/MapBaseLocation"));
|
|
631
625
|
var _CustomTimeline2 = _interopRequireDefault(require("./dev/oa-component-timeline/CustomTimeline"));
|
|
632
|
-
var _TrackShipmentWidget2 = _interopRequireDefault(require("./dev/oa-widget-track-shipment/TrackShipmentWidget"));
|
|
633
626
|
var _DocUploadCardWidget2 = _interopRequireDefault(require("./dev/oa-widget-document-upload-card/DocUploadCardWidget"));
|
|
634
627
|
var _CustomUpload2 = _interopRequireDefault(require("./dev/oa-component-upload/CustomUpload"));
|
|
635
628
|
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); }
|
|
@@ -9,12 +9,14 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _FileCopyOutlined = _interopRequireDefault(require("@material-ui/icons/FileCopyOutlined"));
|
|
12
|
+
var _InfoOutlined = _interopRequireDefault(require("@material-ui/icons/InfoOutlined"));
|
|
12
13
|
var _AddressWidget = _interopRequireDefault(require("../oa-widget-address/AddressWidget"));
|
|
13
14
|
var _CustomTable = _interopRequireDefault(require("../../components/oa-component-table/CustomTable"));
|
|
14
15
|
var _CustomTimeline = _interopRequireDefault(require("../../components/oa-component-timeline/CustomTimeline"));
|
|
15
16
|
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
16
17
|
var _styles = require("./styles");
|
|
17
18
|
var _CustomNotification = _interopRequireDefault(require("../../components/oa-component-notification/CustomNotification"));
|
|
19
|
+
var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
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); }
|
|
20
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; }
|
|
@@ -41,7 +43,9 @@ function TrackShipmentWidget(_ref) {
|
|
|
41
43
|
tableData,
|
|
42
44
|
title,
|
|
43
45
|
toAddress,
|
|
44
|
-
heading
|
|
46
|
+
heading,
|
|
47
|
+
partnerName,
|
|
48
|
+
errorReason
|
|
45
49
|
} = _ref;
|
|
46
50
|
// local variables
|
|
47
51
|
const deilveryStageText = 'SHIPMENT DELIVERED to Customer';
|
|
@@ -81,7 +85,7 @@ function TrackShipmentWidget(_ref) {
|
|
|
81
85
|
const isOnDeliveryStage = Array.isArray(tableData) && tableData.length > 0 && ((_tableData = tableData[tableData.length - 1]) === null || _tableData === void 0 ? void 0 : _tableData.oneassistDisplayStatus) === deilveryStageText && ((_tableData2 = tableData[tableData.length - 1]) === null || _tableData2 === void 0 ? void 0 : _tableData2.toDate) === null;
|
|
82
86
|
|
|
83
87
|
// remove duplicate consicutive objects only show single unique objects
|
|
84
|
-
const stepsData = tableData.map(item => ({
|
|
88
|
+
const stepsData = tableData === null || tableData === void 0 ? void 0 : tableData.map(item => ({
|
|
85
89
|
title: item.oneassistDisplayStatus,
|
|
86
90
|
status: getCircleClass(item, true)
|
|
87
91
|
})).filter((item, index) => {
|
|
@@ -96,7 +100,7 @@ function TrackShipmentWidget(_ref) {
|
|
|
96
100
|
className: "type-t1-500"
|
|
97
101
|
}, title) : null, /*#__PURE__*/_react.default.createElement("h3", {
|
|
98
102
|
className: "type-t1-500"
|
|
99
|
-
}, heading), /*#__PURE__*/_react.default.createElement("p", {
|
|
103
|
+
}, heading), awbNumber && /*#__PURE__*/_react.default.createElement("p", {
|
|
100
104
|
className: "type-b2-400 disFlex"
|
|
101
105
|
}, "AWB Number:", awbNumber, awbNumber && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
102
106
|
icon: _FileCopyOutlined.default,
|
|
@@ -106,16 +110,28 @@ function TrackShipmentWidget(_ref) {
|
|
|
106
110
|
cursor: 'pointer',
|
|
107
111
|
color: '014FC5'
|
|
108
112
|
}
|
|
109
|
-
})),
|
|
113
|
+
})), partnerName && /*#__PURE__*/_react.default.createElement("p", {
|
|
114
|
+
className: "type-b2-400 disFlex"
|
|
115
|
+
}, "Partner:", partnerName), fromAddress && toAddress && /*#__PURE__*/_react.default.createElement(_styles.AddressesContainer, null, /*#__PURE__*/_react.default.createElement(_AddressWidget.default, {
|
|
110
116
|
address: fromAddress
|
|
111
117
|
}), /*#__PURE__*/_react.default.createElement(_AddressWidget.default, {
|
|
112
118
|
address: toAddress
|
|
113
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
+
})), (stepsData === null || stepsData === void 0 ? void 0 : stepsData.length) > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
114
120
|
className: "cstScroll"
|
|
115
121
|
}, /*#__PURE__*/_react.default.createElement(_CustomTimeline.default, {
|
|
116
122
|
currentStep: isOnDeliveryStage ? stepsData.length : stepsData.length - 1,
|
|
117
123
|
stepsData: stepsData
|
|
118
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
124
|
+
})), errorReason && /*#__PURE__*/_react.default.createElement(_CustomInfo.default, {
|
|
125
|
+
iconConfig: {
|
|
126
|
+
icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
127
|
+
color: "warning",
|
|
128
|
+
size: 24,
|
|
129
|
+
icon: _InfoOutlined.default
|
|
130
|
+
}),
|
|
131
|
+
position: 'left'
|
|
132
|
+
},
|
|
133
|
+
description: errorReason
|
|
134
|
+
}), (tableData === null || tableData === void 0 ? void 0 : tableData.length) > 0 && /*#__PURE__*/_react.default.createElement(_CustomTable.default, {
|
|
119
135
|
bordered: true,
|
|
120
136
|
rowKey: "key",
|
|
121
137
|
columns: [{
|
|
@@ -158,6 +174,8 @@ function TrackShipmentWidget(_ref) {
|
|
|
158
174
|
}
|
|
159
175
|
TrackShipmentWidget.propTypes = {
|
|
160
176
|
awbNumber: _propTypes.default.string.isRequired,
|
|
177
|
+
errorReason: _propTypes.default.string,
|
|
178
|
+
partnerName: _propTypes.default.string,
|
|
161
179
|
fromAddress: _propTypes.default.shape({
|
|
162
180
|
heading: _propTypes.default.string,
|
|
163
181
|
addressLine1: _propTypes.default.string,
|
|
@@ -198,6 +216,8 @@ TrackShipmentWidget.propTypes = {
|
|
|
198
216
|
})
|
|
199
217
|
};
|
|
200
218
|
TrackShipmentWidget.defaultProps = {
|
|
219
|
+
errorReason: '',
|
|
220
|
+
partnerName: '',
|
|
201
221
|
fromAddress: {
|
|
202
222
|
heading: ''
|
|
203
223
|
},
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/es.promise.js");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _fn = require("./fn");
|
|
14
|
+
var _TrackShipmentWidget = _interopRequireDefault(require("../oa-widget-track-shipment/TrackShipmentWidget"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function TrackShipmentWidgetList(_ref) {
|
|
19
|
+
var _shipmentData$map;
|
|
20
|
+
let {
|
|
21
|
+
shipmentData
|
|
22
|
+
} = _ref;
|
|
23
|
+
const [historyData, setHistoryData] = (0, _react.useState)({});
|
|
24
|
+
const [loading, setLoading] = (0, _react.useState)({});
|
|
25
|
+
const fetchStatusXData = async reassignmentId => {};
|
|
26
|
+
const getSingleShipmentHistory = item => {
|
|
27
|
+
var _item$stages;
|
|
28
|
+
return {
|
|
29
|
+
awbNumber: item === null || item === void 0 ? void 0 : item.awb,
|
|
30
|
+
partnerName: item === null || item === void 0 ? void 0 : item.partnerName,
|
|
31
|
+
fromAddress: {
|
|
32
|
+
heading: 'From Address:',
|
|
33
|
+
addressLine1: item === null || item === void 0 ? void 0 : item.origAddressFullName,
|
|
34
|
+
addressLine2: item === null || item === void 0 ? void 0 : item.originAddressLine1,
|
|
35
|
+
pincode: item === null || item === void 0 ? void 0 : item.originPincode,
|
|
36
|
+
city: item === null || item === void 0 ? void 0 : item.originDistrict
|
|
37
|
+
},
|
|
38
|
+
toAddress: {
|
|
39
|
+
heading: 'To Address:',
|
|
40
|
+
addressLine1: item === null || item === void 0 ? void 0 : item.destAddressFullName,
|
|
41
|
+
addressLine2: item === null || item === void 0 ? void 0 : item.destAddressLine1,
|
|
42
|
+
pincode: item === null || item === void 0 ? void 0 : item.destPincode,
|
|
43
|
+
city: item === null || item === void 0 ? void 0 : item.destDistrict
|
|
44
|
+
},
|
|
45
|
+
tableData: (_item$stages = item === null || item === void 0 ? void 0 : item.stages) !== null && _item$stages !== void 0 ? _item$stages : []
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
if (!shipmentData || shipmentData.length === 0) {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement("p", null, "No shipment data available.");
|
|
50
|
+
}
|
|
51
|
+
if (shipmentData.length === 1) {
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, getSingleShipmentHistory(shipmentData[0]));
|
|
53
|
+
}
|
|
54
|
+
return shipmentData === null || shipmentData === void 0 || (_shipmentData$map = shipmentData.map) === null || _shipmentData$map === void 0 ? void 0 : _shipmentData$map.call(shipmentData, (item, index) => {
|
|
55
|
+
if ((item === null || item === void 0 ? void 0 : item.status) === 'X') {
|
|
56
|
+
var _historyData$reassign;
|
|
57
|
+
const reassignmentId = item === null || item === void 0 ? void 0 : item.reassignmentId;
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Collapse, {
|
|
59
|
+
key: reassignmentId,
|
|
60
|
+
onChange: keys => {
|
|
61
|
+
console.log('keys:', keys);
|
|
62
|
+
if (keys.length > 0) {
|
|
63
|
+
fetchStatusXData(reassignmentId);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
items: [{
|
|
67
|
+
key: reassignmentId,
|
|
68
|
+
label: "".concat((0, _fn.getCurrentShipmentLabel)(index + 1), " | ").concat((0, _fn.getDateString)(item === null || item === void 0 ? void 0 : item.reassignmentTime, item === null || item === void 0 ? void 0 : item.modifiedTime)),
|
|
69
|
+
children: loading[reassignmentId] ? /*#__PURE__*/_react.default.createElement(_antd.Spin, null) : /*#__PURE__*/_react.default.createElement("p", null, ((_historyData$reassign = historyData[reassignmentId]) === null || _historyData$reassign === void 0 ? void 0 : _historyData$reassign.details) || 'No details available')
|
|
70
|
+
}]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if ((item === null || item === void 0 ? void 0 : item.status) === 'A') {
|
|
74
|
+
console.log('item:', item);
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Collapse, {
|
|
76
|
+
key: item === null || item === void 0 ? void 0 : item.reassignmentId,
|
|
77
|
+
items: [{
|
|
78
|
+
key: item === null || item === void 0 ? void 0 : item.reassignmentId,
|
|
79
|
+
label: "".concat((0, _fn.getCurrentShipmentLabel)(index + 1), " | ").concat((0, _fn.getDateString)(item === null || item === void 0 ? void 0 : item.reassignmentTime, item === null || item === void 0 ? void 0 : item.modifiedTime), "-Present"),
|
|
80
|
+
children: /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, getSingleShipmentHistory(item))
|
|
81
|
+
}]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
TrackShipmentWidgetList.propTypes = {
|
|
88
|
+
shipmentData: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
89
|
+
reassignmentId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
90
|
+
status: _propTypes.default.string.isRequired,
|
|
91
|
+
awb: _propTypes.default.string,
|
|
92
|
+
origAddressFullName: _propTypes.default.string,
|
|
93
|
+
originAddressLine1: _propTypes.default.string,
|
|
94
|
+
originPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
95
|
+
originDistrict: _propTypes.default.string,
|
|
96
|
+
destAddressFullName: _propTypes.default.string,
|
|
97
|
+
destAddressLine1: _propTypes.default.string,
|
|
98
|
+
destPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
99
|
+
destDistrict: _propTypes.default.string,
|
|
100
|
+
reassignmentTime: _propTypes.default.string,
|
|
101
|
+
modifiedTime: _propTypes.default.string,
|
|
102
|
+
stages: _propTypes.default.array
|
|
103
|
+
})).isRequired
|
|
104
|
+
};
|
|
105
|
+
var _default = exports.default = TrackShipmentWidgetList;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDateString = exports.getCurrentShipmentLabel = void 0;
|
|
7
|
+
function numberToOrdinal(number) {
|
|
8
|
+
const suffixes = ['th', 'st', 'nd', 'rd'];
|
|
9
|
+
const value = number % 100;
|
|
10
|
+
const suffix = value >= 11 && value <= 13 ? suffixes[0] // 11th, 12th, 13th
|
|
11
|
+
: suffixes[number % 10] || suffixes[0]; // 1st, 2nd, 3rd, others
|
|
12
|
+
return "".concat(number).concat(suffix); // Use template literal correctly
|
|
13
|
+
}
|
|
14
|
+
const getDateFromEpoch = date => {
|
|
15
|
+
if (!date) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
const dateObj = new Date(date * 1000);
|
|
19
|
+
const day = dateObj.getDate();
|
|
20
|
+
const month = dateObj.getMonth();
|
|
21
|
+
const year = dateObj.getFullYear();
|
|
22
|
+
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
|
+
return "".concat(day, " ").concat(months[month], " ").concat(year);
|
|
24
|
+
};
|
|
25
|
+
const getDateString = (startTime, endTime) => {
|
|
26
|
+
const startDate = getDateFromEpoch(startTime);
|
|
27
|
+
const endDate = getDateFromEpoch(endTime);
|
|
28
|
+
if (startDate === '' && endDate === '') {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
if (endDate === '') {
|
|
32
|
+
return startDate;
|
|
33
|
+
}
|
|
34
|
+
return "".concat(startDate, " - ").concat(endDate);
|
|
35
|
+
};
|
|
36
|
+
exports.getDateString = getDateString;
|
|
37
|
+
const getCurrentShipmentLabel = number => {
|
|
38
|
+
const ordinalNumber = numberToOrdinal(number);
|
|
39
|
+
return "Shipment ".concat(ordinalNumber);
|
|
40
|
+
};
|
|
41
|
+
exports.getCurrentShipmentLabel = getCurrentShipmentLabel;
|
package/package.json
CHANGED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.weak-map.js");
|
|
4
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _FileCopyOutlined = _interopRequireDefault(require("@material-ui/icons/FileCopyOutlined"));
|
|
12
|
-
var _AddressWidget = _interopRequireDefault(require("../../widgets/oa-widget-address/AddressWidget"));
|
|
13
|
-
var _CustomTable = _interopRequireDefault(require("../../components/oa-component-table/CustomTable"));
|
|
14
|
-
var _CustomTimeline = _interopRequireDefault(require("../oa-component-timeline/CustomTimeline"));
|
|
15
|
-
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
16
|
-
var _styles = require("./styles");
|
|
17
|
-
var _CustomNotification = _interopRequireDefault(require("../../components/oa-component-notification/CustomNotification"));
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
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); }
|
|
20
|
-
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; }
|
|
21
|
-
function TrackShipmentWidget(_ref) {
|
|
22
|
-
var _tableData, _tableData2;
|
|
23
|
-
let {
|
|
24
|
-
awbNumber,
|
|
25
|
-
fromAddress,
|
|
26
|
-
tableData,
|
|
27
|
-
title,
|
|
28
|
-
toAddress,
|
|
29
|
-
heading
|
|
30
|
-
} = _ref;
|
|
31
|
-
// local variables
|
|
32
|
-
const deilveryStageText = 'SHIPMENT DELIVERED to Customer';
|
|
33
|
-
|
|
34
|
-
// show notification when user click on clipboard
|
|
35
|
-
const notificationRef = (0, _react.useRef)(null);
|
|
36
|
-
const openNotification = parameters => {
|
|
37
|
-
var _notificationRef$curr;
|
|
38
|
-
return notificationRef === null || notificationRef === void 0 || (_notificationRef$curr = notificationRef.current) === null || _notificationRef$curr === void 0 ? void 0 : _notificationRef$curr.openNotification(parameters);
|
|
39
|
-
};
|
|
40
|
-
const handleCopyToClipboard = () => {
|
|
41
|
-
navigator.clipboard.writeText(awbNumber).then(() => {
|
|
42
|
-
openNotification({
|
|
43
|
-
description: 'Copy to clipboard',
|
|
44
|
-
type: 'success'
|
|
45
|
-
});
|
|
46
|
-
}).catch(err => {
|
|
47
|
-
openNotification({
|
|
48
|
-
description: 'Failed to copy text',
|
|
49
|
-
type: 'failure'
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// return circle color depands on stageConsistent key coming from backend
|
|
55
|
-
const getCircleClass = (row, isTimeLineStep) => {
|
|
56
|
-
if (row.stageConsistent) {
|
|
57
|
-
return isTimeLineStep ? 'finish' : 'greenBg';
|
|
58
|
-
}
|
|
59
|
-
if (row.toDate === null && row.oneassistDisplayStatus === deilveryStageText) {
|
|
60
|
-
return isTimeLineStep ? 'process' : 'greenBr';
|
|
61
|
-
}
|
|
62
|
-
return isTimeLineStep ? 'error' : 'redBg';
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// check if current stage is delivery stage or not
|
|
66
|
-
const isOnDeliveryStage = Array.isArray(tableData) && tableData.length > 0 && ((_tableData = tableData[tableData.length - 1]) === null || _tableData === void 0 ? void 0 : _tableData.oneassistDisplayStatus) === deilveryStageText && ((_tableData2 = tableData[tableData.length - 1]) === null || _tableData2 === void 0 ? void 0 : _tableData2.toDate) === null;
|
|
67
|
-
|
|
68
|
-
// remove duplicate consicutive objects only show single unique objects
|
|
69
|
-
const stepsData = tableData.map(item => ({
|
|
70
|
-
title: item.oneassistDisplayStatus,
|
|
71
|
-
status: getCircleClass(item, true)
|
|
72
|
-
})).filter((item, index) => {
|
|
73
|
-
var _tableData3;
|
|
74
|
-
return item.title !== ((_tableData3 = tableData[index - 1]) === null || _tableData3 === void 0 ? void 0 : _tableData3.oneassistDisplayStatus);
|
|
75
|
-
});
|
|
76
|
-
return /*#__PURE__*/_react.default.createElement(_styles.StyleTrackShipment, {
|
|
77
|
-
className: "trackingDetails"
|
|
78
|
-
}, /*#__PURE__*/_react.default.createElement(_CustomNotification.default, {
|
|
79
|
-
ref: notificationRef
|
|
80
|
-
}), title ? /*#__PURE__*/_react.default.createElement("h1", {
|
|
81
|
-
className: "type-t1-500"
|
|
82
|
-
}, title) : null, /*#__PURE__*/_react.default.createElement("h3", {
|
|
83
|
-
className: "type-t1-500"
|
|
84
|
-
}, heading), /*#__PURE__*/_react.default.createElement("p", {
|
|
85
|
-
className: "type-b2-400 disFlex"
|
|
86
|
-
}, "AWB Number:", awbNumber, awbNumber && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
87
|
-
icon: _FileCopyOutlined.default,
|
|
88
|
-
size: 20,
|
|
89
|
-
onClick: handleCopyToClipboard,
|
|
90
|
-
style: {
|
|
91
|
-
cursor: 'pointer',
|
|
92
|
-
color: '014FC5'
|
|
93
|
-
}
|
|
94
|
-
})), /*#__PURE__*/_react.default.createElement(_styles.AddressesContainer, null, /*#__PURE__*/_react.default.createElement(_AddressWidget.default, {
|
|
95
|
-
address: fromAddress
|
|
96
|
-
}), /*#__PURE__*/_react.default.createElement(_AddressWidget.default, {
|
|
97
|
-
address: toAddress
|
|
98
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
-
className: "cstScroll"
|
|
100
|
-
}, /*#__PURE__*/_react.default.createElement(_CustomTimeline.default, {
|
|
101
|
-
currentStep: isOnDeliveryStage ? stepsData.length : stepsData.length - 1,
|
|
102
|
-
stepsData: stepsData
|
|
103
|
-
})), /*#__PURE__*/_react.default.createElement(_CustomTable.default, {
|
|
104
|
-
bordered: true,
|
|
105
|
-
rowKey: "key",
|
|
106
|
-
columns: [{
|
|
107
|
-
title: 'Stage',
|
|
108
|
-
dataIndex: 'oneassistDisplayStatus',
|
|
109
|
-
key: 'oneassistDisplayStatus',
|
|
110
|
-
render: (text, row, index) => {
|
|
111
|
-
const obj = {
|
|
112
|
-
children: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("em", {
|
|
113
|
-
className: "comIcon ".concat(getCircleClass(row))
|
|
114
|
-
}), text),
|
|
115
|
-
props: {}
|
|
116
|
-
};
|
|
117
|
-
if (index === 0 || tableData[index - 1].oneassistDisplayStatus !== text) {
|
|
118
|
-
let rowSpanCount = 1;
|
|
119
|
-
for (let i = index + 1; i < tableData.length; i += 1) {
|
|
120
|
-
if (tableData[i].oneassistDisplayStatus === text) {
|
|
121
|
-
rowSpanCount += 1;
|
|
122
|
-
} else {
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
obj.props.rowSpan = rowSpanCount;
|
|
127
|
-
} else {
|
|
128
|
-
obj.props.rowSpan = 0;
|
|
129
|
-
}
|
|
130
|
-
return obj;
|
|
131
|
-
}
|
|
132
|
-
}, {
|
|
133
|
-
title: 'description from partner',
|
|
134
|
-
dataIndex: 'partnerStatus',
|
|
135
|
-
key: 'partnerStatus'
|
|
136
|
-
}, {
|
|
137
|
-
title: 'Time',
|
|
138
|
-
dataIndex: 'toDate',
|
|
139
|
-
key: 'toDate'
|
|
140
|
-
}],
|
|
141
|
-
dataSource: tableData
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
TrackShipmentWidget.propTypes = {
|
|
145
|
-
awbNumber: _propTypes.default.string.isRequired,
|
|
146
|
-
fromAddress: _propTypes.default.shape({
|
|
147
|
-
heading: _propTypes.default.string,
|
|
148
|
-
addressLine1: _propTypes.default.string,
|
|
149
|
-
addressLine2: _propTypes.default.string,
|
|
150
|
-
addressLine3: _propTypes.default.string,
|
|
151
|
-
landmark: _propTypes.default.string,
|
|
152
|
-
pincode: _propTypes.default.string || _propTypes.default.number,
|
|
153
|
-
city: _propTypes.default.string,
|
|
154
|
-
state: _propTypes.default.string,
|
|
155
|
-
type: _propTypes.default.oneOf(['permanent', 'temporary']),
|
|
156
|
-
additional_info: _propTypes.default.shape({
|
|
157
|
-
lat: _propTypes.default.string,
|
|
158
|
-
long: _propTypes.default.string
|
|
159
|
-
})
|
|
160
|
-
}),
|
|
161
|
-
tableData: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
162
|
-
key: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
163
|
-
oneassistDisplayStatus: _propTypes.default.string,
|
|
164
|
-
partnerStatus: _propTypes.default.string,
|
|
165
|
-
toDate: _propTypes.default.string
|
|
166
|
-
})).isRequired,
|
|
167
|
-
title: _propTypes.default.string,
|
|
168
|
-
heading: _propTypes.default.string,
|
|
169
|
-
toAddress: _propTypes.default.shape({
|
|
170
|
-
heading: _propTypes.default.string,
|
|
171
|
-
addressLine1: _propTypes.default.string,
|
|
172
|
-
addressLine2: _propTypes.default.string,
|
|
173
|
-
addressLine3: _propTypes.default.string,
|
|
174
|
-
landmark: _propTypes.default.string,
|
|
175
|
-
pincode: _propTypes.default.string || _propTypes.default.number,
|
|
176
|
-
city: _propTypes.default.string,
|
|
177
|
-
state: _propTypes.default.string,
|
|
178
|
-
type: _propTypes.default.oneOf(['permanent', 'temporary']),
|
|
179
|
-
additional_info: _propTypes.default.shape({
|
|
180
|
-
lat: _propTypes.default.string,
|
|
181
|
-
long: _propTypes.default.string
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
};
|
|
185
|
-
TrackShipmentWidget.defaultProps = {
|
|
186
|
-
fromAddress: {
|
|
187
|
-
heading: ''
|
|
188
|
-
},
|
|
189
|
-
title: '',
|
|
190
|
-
heading: 'Shipment tracking details',
|
|
191
|
-
toAddress: {
|
|
192
|
-
heading: ''
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
var _default = exports.default = TrackShipmentWidget;
|
/package/build/{dev/oa-widget-track-shipment → widgets/oa-widget-track-shipment-list}/styles.js
RENAMED
|
File without changes
|