@djb25/digit-ui-module-wt 1.0.44 → 1.0.45
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +95 -110
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TickMark, ArrowDown, ViewsIcon, MobileNumber, CardLabelError,
|
|
1
|
+
import { TickMark, ArrowDown, ViewsIcon, TextInput, MobileNumber, CardLabelError, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Modal, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, CitizenHomeCard, CHBIcon, PropertyHouse, HomeIcon, KeyNote, CardHeader, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, CustomNameDropdown, MultiSelectDropdown, CollapsibleCardPage as CollapsibleCardPage$1, LabelFieldPair, AddIcon, Menu, CheckSvg, LayoutWrapper, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, Localities, RemoveableTag, FormComposer, PDFSvg, MultiUploadWrapper, Close as Close$h, BreakLine, InfoBannerIcon, ButtonSelector, LocationIcon, PTIcon, ApplicantDetails, AddressDetails } from '@djb25/digit-ui-react-components';
|
|
2
2
|
import React, { useRef, useEffect, useState, useCallback, useMemo, Fragment, useReducer } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
|
|
@@ -816,77 +816,33 @@ const WTSearchApplication = ({
|
|
|
816
816
|
moduleCode,
|
|
817
817
|
isFixedPoint
|
|
818
818
|
}) => {
|
|
819
|
-
var _tripReportsData$driv;
|
|
820
819
|
const isMobile = window.Digit.Utils.browser.isMobile();
|
|
821
820
|
const user = Digit.UserService.getUser().info;
|
|
822
|
-
const [
|
|
823
|
-
const [
|
|
821
|
+
const [showImageModal, setShowImageModal] = useState(false);
|
|
822
|
+
const [selectedImage, setSelectedImage] = useState(null);
|
|
823
|
+
const [isImageLoading, setIsImageLoading] = useState(false);
|
|
824
824
|
const handleViewDocument = useCallback(async fileStoreId => {
|
|
825
825
|
if (!fileStoreId) return;
|
|
826
|
+
setIsImageLoading(true);
|
|
827
|
+
setShowImageModal(true);
|
|
826
828
|
try {
|
|
827
829
|
const response = await Digit.UploadServices.FileFetchbyid(fileStoreId, tenantId);
|
|
828
|
-
if (response && response.data) {
|
|
830
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 200 && response !== null && response !== void 0 && response.data) {
|
|
831
|
+
var _response$headers;
|
|
829
832
|
const file = new Blob([response.data], {
|
|
830
|
-
type: response.headers["content-type"]
|
|
833
|
+
type: ((_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers["content-type"]) || "image/jpeg"
|
|
831
834
|
});
|
|
832
835
|
const fileUrl = URL.createObjectURL(file);
|
|
833
|
-
|
|
836
|
+
setSelectedImage(fileUrl);
|
|
837
|
+
} else {
|
|
838
|
+
throw new Error("Failed to fetch image");
|
|
834
839
|
}
|
|
835
840
|
} catch (e) {
|
|
836
841
|
console.error(e);
|
|
842
|
+
} finally {
|
|
843
|
+
setIsImageLoading(false);
|
|
837
844
|
}
|
|
838
|
-
}, []);
|
|
839
|
-
const DriverReportColumns = useMemo(() => [{
|
|
840
|
-
Header: t("S.No"),
|
|
841
|
-
accessor: (row, index) => index + 1
|
|
842
|
-
}, {
|
|
843
|
-
Header: t("WT_BOOKING_NO"),
|
|
844
|
-
accessor: "bookingNo"
|
|
845
|
-
}, {
|
|
846
|
-
Header: t("WT_VEHICLE_NO"),
|
|
847
|
-
accessor: "vehicleRegistrationNo"
|
|
848
|
-
}, {
|
|
849
|
-
Header: t("WT_DRIVER_NAME"),
|
|
850
|
-
accessor: "driverName"
|
|
851
|
-
}, {
|
|
852
|
-
Header: t("WT_TANK_CAPACITY"),
|
|
853
|
-
accessor: "tankCapicity"
|
|
854
|
-
}, {
|
|
855
|
-
Header: t("WT_STATUS"),
|
|
856
|
-
accessor: "currentStatus"
|
|
857
|
-
}, {
|
|
858
|
-
Header: t("WT_START_PHOTO"),
|
|
859
|
-
Cell: ({
|
|
860
|
-
row
|
|
861
|
-
}) => row.original.startFileStoreId ? /*#__PURE__*/React.createElement("div", {
|
|
862
|
-
style: {
|
|
863
|
-
color: "#f47738",
|
|
864
|
-
cursor: "pointer",
|
|
865
|
-
display: "inline-block"
|
|
866
|
-
},
|
|
867
|
-
onClick: () => handleViewDocument(row.original.startFileStoreId)
|
|
868
|
-
}, /*#__PURE__*/React.createElement(ViewsIcon, null)) : t("CS_NA")
|
|
869
|
-
}, {
|
|
870
|
-
Header: t("WT_END_PHOTO"),
|
|
871
|
-
Cell: ({
|
|
872
|
-
row
|
|
873
|
-
}) => row.original.endFileStoreId ? /*#__PURE__*/React.createElement("div", {
|
|
874
|
-
style: {
|
|
875
|
-
color: "#f47738",
|
|
876
|
-
cursor: "pointer",
|
|
877
|
-
display: "inline-block"
|
|
878
|
-
},
|
|
879
|
-
onClick: () => handleViewDocument(row.original.endFileStoreId)
|
|
880
|
-
}, /*#__PURE__*/React.createElement(ViewsIcon, null)) : t("CS_NA")
|
|
881
|
-
}], [t, handleViewDocument]);
|
|
882
|
-
const openWorkOrderModal = vendorDetails => {
|
|
883
|
-
setSelectedVendorForWorkOrder(vendorDetails);
|
|
884
|
-
setShowWorkOrderModal(true);
|
|
885
|
-
};
|
|
886
|
-
const closeWorkOrderModal = () => {
|
|
887
|
-
setSelectedVendorForWorkOrder(null);
|
|
888
|
-
setShowWorkOrderModal(false);
|
|
889
|
-
};
|
|
845
|
+
}, [tenantId]);
|
|
890
846
|
const defaultValues = {
|
|
891
847
|
offset: 0,
|
|
892
848
|
limit: 10,
|
|
@@ -924,20 +880,34 @@ const WTSearchApplication = ({
|
|
|
924
880
|
});
|
|
925
881
|
const fillingPoints = (fillingPointsData === null || fillingPointsData === void 0 ? void 0 : fillingPointsData.fillingPoints) || [];
|
|
926
882
|
const {
|
|
927
|
-
data:
|
|
928
|
-
isLoading:
|
|
883
|
+
data: allReportsData,
|
|
884
|
+
isLoading: isAllReportsLoading
|
|
929
885
|
} = Digit.Hooks.wt.useDriverTripReportSearch({
|
|
930
886
|
tenantId,
|
|
931
887
|
filters: {
|
|
932
|
-
bookingNo:
|
|
888
|
+
bookingNo: Array.isArray(data) ? data.map(d => d.bookingNo).join(",") : null
|
|
933
889
|
}
|
|
934
890
|
}, {
|
|
935
|
-
enabled: !!
|
|
891
|
+
enabled: !!data && Array.isArray(data) && data.length > 0 && moduleCode === "WT"
|
|
936
892
|
});
|
|
893
|
+
const mergedData = useMemo(() => {
|
|
894
|
+
if (!data || !Array.isArray(data)) return data;
|
|
895
|
+
if (moduleCode !== "WT" || !(allReportsData !== null && allReportsData !== void 0 && allReportsData.driverTripReports)) return data;
|
|
896
|
+
return data.map(booking => {
|
|
897
|
+
const report = allReportsData.driverTripReports.find(r => r.bookingNo === booking.bookingNo);
|
|
898
|
+
return {
|
|
899
|
+
...booking,
|
|
900
|
+
...report
|
|
901
|
+
};
|
|
902
|
+
});
|
|
903
|
+
}, [data, allReportsData, moduleCode]);
|
|
937
904
|
const GetCell = value => /*#__PURE__*/React.createElement("span", {
|
|
938
905
|
className: "cell-text"
|
|
939
906
|
}, value);
|
|
940
907
|
const columns = useMemo(() => [{
|
|
908
|
+
Header: t("S.No"),
|
|
909
|
+
accessor: (row, index) => index + 1
|
|
910
|
+
}, {
|
|
941
911
|
Header: t("WT_BOOKING_NO"),
|
|
942
912
|
accessor: "bookingNo",
|
|
943
913
|
disableSortBy: true,
|
|
@@ -977,20 +947,41 @@ const WTSearchApplication = ({
|
|
|
977
947
|
row
|
|
978
948
|
}) => GetCell(t(row.original["bookingStatus"]))
|
|
979
949
|
}, {
|
|
980
|
-
Header: t("
|
|
981
|
-
|
|
950
|
+
Header: t("WT_VEHICLE_NO"),
|
|
951
|
+
accessor: "vehicleRegistrationNo"
|
|
952
|
+
}, {
|
|
953
|
+
Header: t("WT_DRIVER_NAME"),
|
|
954
|
+
accessor: "driverName"
|
|
955
|
+
}, {
|
|
956
|
+
Header: t("WT_TANK_CAPACITY"),
|
|
957
|
+
accessor: "tankCapicity"
|
|
958
|
+
}, {
|
|
959
|
+
Header: t("WT_STATUS"),
|
|
960
|
+
accessor: "currentStatus"
|
|
961
|
+
}, {
|
|
962
|
+
Header: t("WT_START_PHOTO"),
|
|
982
963
|
Cell: ({
|
|
983
964
|
row
|
|
984
|
-
}) => {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
965
|
+
}) => row.original.startFileStoreId ? /*#__PURE__*/React.createElement("div", {
|
|
966
|
+
style: {
|
|
967
|
+
color: "#f47738",
|
|
968
|
+
cursor: "pointer",
|
|
969
|
+
display: "inline-block"
|
|
970
|
+
},
|
|
971
|
+
onClick: () => handleViewDocument(row.original.startFileStoreId)
|
|
972
|
+
}, /*#__PURE__*/React.createElement(ViewsIcon, null)) : t("CS_NA")
|
|
973
|
+
}, {
|
|
974
|
+
Header: t("WT_END_PHOTO"),
|
|
975
|
+
Cell: ({
|
|
976
|
+
row
|
|
977
|
+
}) => row.original.endFileStoreId ? /*#__PURE__*/React.createElement("div", {
|
|
978
|
+
style: {
|
|
979
|
+
color: "#f47738",
|
|
980
|
+
cursor: "pointer",
|
|
981
|
+
display: "inline-block"
|
|
982
|
+
},
|
|
983
|
+
onClick: () => handleViewDocument(row.original.endFileStoreId)
|
|
984
|
+
}, /*#__PURE__*/React.createElement(ViewsIcon, null)) : t("CS_NA")
|
|
994
985
|
}], [t, user.type]);
|
|
995
986
|
const statusOptions = moduleCode === "TP" ? [{
|
|
996
987
|
i18nKey: "TP_BOOKING_CREATED",
|
|
@@ -1075,14 +1066,14 @@ const WTSearchApplication = ({
|
|
|
1075
1066
|
return /*#__PURE__*/React.createElement("form", {
|
|
1076
1067
|
onSubmit: handleSubmit(onSubmit)
|
|
1077
1068
|
}, activeTab === t("WT_SMART_SEARCH") && /*#__PURE__*/React.createElement("div", {
|
|
1078
|
-
className: "
|
|
1079
|
-
style: {
|
|
1080
|
-
display: "grid",
|
|
1081
|
-
gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
|
|
1082
|
-
gap: "24px"
|
|
1083
|
-
}
|
|
1069
|
+
className: "formcomposer-section-grid"
|
|
1084
1070
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1085
1071
|
className: "search-field-wrapper"
|
|
1072
|
+
}, /*#__PURE__*/React.createElement("label", null, t("WT_BOOKING_NO")), /*#__PURE__*/React.createElement(TextInput, {
|
|
1073
|
+
name: "bookingNo",
|
|
1074
|
+
inputRef: register({})
|
|
1075
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1076
|
+
className: "search-field-wrapper"
|
|
1086
1077
|
}, /*#__PURE__*/React.createElement("label", null, t("WT_MOBILE_NUMBER")), /*#__PURE__*/React.createElement(MobileNumber, {
|
|
1087
1078
|
name: "mobileNumber",
|
|
1088
1079
|
inputRef: register({
|
|
@@ -1214,7 +1205,7 @@ const WTSearchApplication = ({
|
|
|
1214
1205
|
}
|
|
1215
1206
|
}, text))) : !isLoading && data !== "" ? /*#__PURE__*/React.createElement(Table, {
|
|
1216
1207
|
t: t,
|
|
1217
|
-
data:
|
|
1208
|
+
data: mergedData,
|
|
1218
1209
|
totalRecords: count,
|
|
1219
1210
|
columns: columns,
|
|
1220
1211
|
getCellProps: cellInfo => ({
|
|
@@ -1235,16 +1226,16 @@ const WTSearchApplication = ({
|
|
|
1235
1226
|
id: getValues("sortBy"),
|
|
1236
1227
|
desc: getValues("sortOrder") === "DESC"
|
|
1237
1228
|
}]
|
|
1238
|
-
}) : (data !== "" || isLoading) && /*#__PURE__*/React.createElement(Loader, null)),
|
|
1229
|
+
}) : (data !== "" || isLoading) && /*#__PURE__*/React.createElement(Loader, null)), showImageModal && /*#__PURE__*/React.createElement(Modal, {
|
|
1239
1230
|
headerBarMain: /*#__PURE__*/React.createElement("h1", {
|
|
1240
|
-
className: "heading-m"
|
|
1241
|
-
|
|
1242
|
-
margin: 0
|
|
1243
|
-
}
|
|
1244
|
-
}, t("VIEW_DRIVER_TRIP_REPORTS")),
|
|
1231
|
+
className: "heading-m"
|
|
1232
|
+
}, t("WT_VIEW_PHOTO")),
|
|
1245
1233
|
headerBarEnd: /*#__PURE__*/React.createElement("div", {
|
|
1246
1234
|
className: "icon-bg-secondary",
|
|
1247
|
-
onClick:
|
|
1235
|
+
onClick: () => {
|
|
1236
|
+
setShowImageModal(false);
|
|
1237
|
+
setSelectedImage(null);
|
|
1238
|
+
},
|
|
1248
1239
|
style: {
|
|
1249
1240
|
cursor: "pointer"
|
|
1250
1241
|
}
|
|
@@ -1260,33 +1251,27 @@ const WTSearchApplication = ({
|
|
|
1260
1251
|
}), /*#__PURE__*/React.createElement("path", {
|
|
1261
1252
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
1262
1253
|
}))),
|
|
1263
|
-
actionCancelLabel: t("CS_COMMON_CLOSE"),
|
|
1264
|
-
actionCancelOnSubmit: closeWorkOrderModal,
|
|
1265
1254
|
hideSubmit: true,
|
|
1266
|
-
|
|
1255
|
+
actionCancelLabel: t("CS_COMMON_CLOSE"),
|
|
1256
|
+
actionCancelOnSubmit: () => {
|
|
1257
|
+
setShowImageModal(false);
|
|
1258
|
+
setSelectedImage(null);
|
|
1259
|
+
}
|
|
1267
1260
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1268
1261
|
style: {
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
data: tripReportsData.driverTripReports,
|
|
1274
|
-
columns: DriverReportColumns,
|
|
1275
|
-
getCellProps: cellInfo => {
|
|
1276
|
-
return {
|
|
1277
|
-
style: {
|
|
1278
|
-
minWidth: "150px",
|
|
1279
|
-
padding: "8px 12px",
|
|
1280
|
-
fontSize: "13.5px"
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1262
|
+
display: "flex",
|
|
1263
|
+
justifyContent: "center",
|
|
1264
|
+
alignItems: "center",
|
|
1265
|
+
minHeight: "200px"
|
|
1283
1266
|
}
|
|
1284
|
-
}) : /*#__PURE__*/React.createElement("
|
|
1267
|
+
}, isImageLoading ? /*#__PURE__*/React.createElement(Loader, null) : selectedImage ? /*#__PURE__*/React.createElement("img", {
|
|
1268
|
+
src: selectedImage,
|
|
1269
|
+
alt: "View",
|
|
1285
1270
|
style: {
|
|
1286
|
-
|
|
1287
|
-
|
|
1271
|
+
maxWidth: "100%",
|
|
1272
|
+
maxHeight: "500px"
|
|
1288
1273
|
}
|
|
1289
|
-
}, t("
|
|
1274
|
+
}) : /*#__PURE__*/React.createElement("p", null, t("CS_COMMON_NO_DATA")))));
|
|
1290
1275
|
};
|
|
1291
1276
|
|
|
1292
1277
|
const SearchApp = ({
|