@djb25/digit-ui-module-wt 1.0.57 → 1.0.59

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.
@@ -16988,7 +16988,7 @@ const TableConfig = t => ({
16988
16988
  return GetMobCell(original === null || original === void 0 ? void 0 : (_original$searchData = original.searchData) === null || _original$searchData === void 0 ? void 0 : _original$searchData["bookingNo"]);
16989
16989
  }
16990
16990
  }, {
16991
- Header: t("WT_APPLICANT_NAME"),
16991
+ Header: window.location.href.includes("fixed-point") ? t("WT_FIXED_POINT_NAME") : t("WT_APPLICANT_NAME"),
16992
16992
  id: "applicantName",
16993
16993
  accessor: row => {
16994
16994
  var _row$searchData3, _row$searchData3$appl;
@@ -27844,6 +27844,27 @@ const EmergencyFixedPointRequestDetails = ({
27844
27844
  }
27845
27845
  })();
27846
27846
  }, [file]);
27847
+ useEffect(() => {
27848
+ if (!waterType && WaterTypeData !== null && WaterTypeData !== void 0 && WaterTypeData.length) {
27849
+ const drinkableOption = WaterTypeData.find(data => {
27850
+ var _data$code, _data$code2;
27851
+ return data.code === "Drinkable" || ((_data$code = data.code) === null || _data$code === void 0 ? void 0 : _data$code.toUpperCase()) === "DRINKABLE" || ((_data$code2 = data.code) === null || _data$code2 === void 0 ? void 0 : _data$code2.toUpperCase()) === "DRINKING_WATER";
27852
+ });
27853
+ if (drinkableOption) {
27854
+ setWaterType({
27855
+ i18nKey: `${drinkableOption.code}`,
27856
+ code: `${drinkableOption.code}`,
27857
+ value: `${drinkableOption.code}`
27858
+ });
27859
+ } else {
27860
+ setWaterType({
27861
+ i18nKey: `${WaterTypeData[0].code}`,
27862
+ code: `${WaterTypeData[0].code}`,
27863
+ value: `${WaterTypeData[0].code}`
27864
+ });
27865
+ }
27866
+ }
27867
+ }, [WaterTypeData, waterType]);
27847
27868
  const goNext = () => {
27848
27869
  let requestDetails = formData.requestDetails;
27849
27870
  let request = {
@@ -28739,9 +28760,13 @@ const WTEmergencyFixedPointCreate = () => {
28739
28760
  paramsRef.current = newParams;
28740
28761
  }
28741
28762
  } else {
28763
+ const {
28764
+ silent,
28765
+ ...restData
28766
+ } = data;
28742
28767
  const updatedValue = {
28743
28768
  ...currentParams[key],
28744
- ...data
28769
+ ...restData
28745
28770
  };
28746
28771
  let isDifferent = true;
28747
28772
  try {
@@ -28796,10 +28821,7 @@ const WTEmergencyFixedPointCreate = () => {
28796
28821
  const WTAcknowledgement = (_Digit2 = Digit) === null || _Digit2 === void 0 ? void 0 : (_Digit2$ComponentRegi = _Digit2.ComponentRegistryService) === null || _Digit2$ComponentRegi === void 0 ? void 0 : _Digit2$ComponentRegi.getComponent("WTEmergencyFixedPointAcknowledgement");
28797
28822
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
28798
28823
  className: "employee-form-section-wrapper"
28799
- }, !pathname.includes("/fp-info") && /*#__PURE__*/React.createElement(VerticalTimeline, {
28800
- config: config,
28801
- showFinalStep: true
28802
- }), /*#__PURE__*/React.createElement("div", {
28824
+ }, /*#__PURE__*/React.createElement("div", {
28803
28825
  className: "employee-form-section"
28804
28826
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
28805
28827
  path: `${match.path}/fp-check`
@@ -29015,24 +29037,18 @@ const EmergencyFixedPointApplicantDetails = ({
29015
29037
  i18nKey: "COMMON_FATHER"
29016
29038
  }];
29017
29039
  const goNext = () => {
29018
- let owner = formData.owner;
29019
- let finalApplicantName = "";
29020
- if ((isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES") {
29021
- var _fixedPoint$applicant;
29022
- finalApplicantName = (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant = fixedPoint.applicantDetail) === null || _fixedPoint$applicant === void 0 ? void 0 : _fixedPoint$applicant.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29023
- } else {
29024
- finalApplicantName = typeof fixedPoint === "string" ? fixedPoint : (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29025
- }
29040
+ var _fixedPoint$applicant, _fixedPoint$applicant2, _fixedPoint$applicant3, _fixedPoint$applicant4;
29041
+ let owner = formData.owner || {};
29026
29042
  let applicantDetails = {
29027
29043
  ...owner,
29028
- applicantName: finalApplicantName,
29029
- mobileNumber,
29044
+ applicantName: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant = fixedPoint.applicantDetail) === null || _fixedPoint$applicant === void 0 ? void 0 : _fixedPoint$applicant.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "" : typeof fixedPoint === "string" ? fixedPoint : (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "",
29045
+ mobileNumber: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant2 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant2 === void 0 ? void 0 : _fixedPoint$applicant2.mobileNumber) || mobileNumber || "" : mobileNumber || "",
29046
+ alternateNumber: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant3 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant3 === void 0 ? void 0 : _fixedPoint$applicant3.alternateNumber) || alternateNumber || "" : alternateNumber || "",
29047
+ emailId: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant4 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant4 === void 0 ? void 0 : _fixedPoint$applicant4.emailId) || emailId || "" : emailId || "",
29030
29048
  gender,
29031
29049
  dateOfBirth,
29032
- alternateNumber,
29033
29050
  relationShipType,
29034
29051
  guardianName,
29035
- emailId,
29036
29052
  fixedPoint,
29037
29053
  isExistingFixedPoint
29038
29054
  };
@@ -29046,12 +29062,30 @@ const EmergencyFixedPointApplicantDetails = ({
29046
29062
  onSelect(config.key, applicantDetails, false);
29047
29063
  }
29048
29064
  };
29065
+ const normalizeForCompare = val => {
29066
+ if (val === null || val === undefined || val === "") return "";
29067
+ if (typeof val === "object") {
29068
+ if (val.code !== undefined) return val.code;
29069
+ if (val.uuid !== undefined) return val.uuid;
29070
+ if (val.id !== undefined) return val.id;
29071
+ try {
29072
+ return JSON.stringify(val);
29073
+ } catch (e) {
29074
+ return String(val);
29075
+ }
29076
+ }
29077
+ return String(val);
29078
+ };
29049
29079
  const lastSentValue = React.useRef(null);
29050
29080
  React.useEffect(() => {
29081
+ const hasUserData = fixedPoint || mobileNumber || emailId || alternateNumber;
29082
+ if (!hasUserData) {
29083
+ return;
29084
+ }
29051
29085
  let finalApplicantName = "";
29052
29086
  if ((isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES") {
29053
- var _fixedPoint$applicant2;
29054
- finalApplicantName = (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant2 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant2 === void 0 ? void 0 : _fixedPoint$applicant2.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29087
+ var _fixedPoint$applicant5;
29088
+ finalApplicantName = (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant5 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant5 === void 0 ? void 0 : _fixedPoint$applicant5.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29055
29089
  } else {
29056
29090
  finalApplicantName = typeof fixedPoint === "string" ? fixedPoint : (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29057
29091
  }
@@ -29067,23 +29101,37 @@ const EmergencyFixedPointApplicantDetails = ({
29067
29101
  fixedPoint,
29068
29102
  isExistingFixedPoint
29069
29103
  };
29070
- let isDifferent = true;
29071
- try {
29072
- isDifferent = JSON.stringify(lastSentValue.current) !== JSON.stringify(applicantDetails);
29073
- } catch (e) {
29074
- isDifferent = Object.keys(applicantDetails).some(k => {
29075
- var _lastSentValue$curren;
29076
- return ((_lastSentValue$curren = lastSentValue.current) === null || _lastSentValue$curren === void 0 ? void 0 : _lastSentValue$curren[k]) !== applicantDetails[k];
29077
- });
29104
+ let isDifferent = false;
29105
+ if (!lastSentValue.current) {
29106
+ isDifferent = true;
29107
+ } else {
29108
+ for (const key of Object.keys(applicantDetails)) {
29109
+ if (normalizeForCompare(lastSentValue.current[key]) !== normalizeForCompare(applicantDetails[key])) {
29110
+ isDifferent = true;
29111
+ break;
29112
+ }
29113
+ }
29078
29114
  }
29079
- if (isDifferent) {
29115
+ const parentOwner = (formData === null || formData === void 0 ? void 0 : formData.owner) || {};
29116
+ let isDifferentFromParent = false;
29117
+ for (const key of Object.keys(applicantDetails)) {
29118
+ const localVal = normalizeForCompare(applicantDetails[key]);
29119
+ const parentVal = normalizeForCompare(parentOwner[key]);
29120
+ if (localVal !== parentVal) {
29121
+ if (!localVal && parentVal) {
29122
+ continue;
29123
+ }
29124
+ isDifferentFromParent = true;
29125
+ }
29126
+ }
29127
+ if (isDifferent || isDifferentFromParent) {
29080
29128
  lastSentValue.current = applicantDetails;
29081
29129
  onSelect(config.key, {
29082
29130
  ...applicantDetails,
29083
29131
  silent: true
29084
29132
  }, false);
29085
29133
  }
29086
- }, [fixedPoint, isExistingFixedPoint, mobileNumber, gender, dateOfBirth, alternateNumber, relationShipType, guardianName, emailId, onSelect, config.key]);
29134
+ }, [fixedPoint, isExistingFixedPoint, mobileNumber, gender, dateOfBirth, alternateNumber, relationShipType, guardianName, emailId, onSelect, config.key, formData === null || formData === void 0 ? void 0 : formData.owner]);
29087
29135
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
29088
29136
  config: config,
29089
29137
  onSelect: goNext,