@djb25/digit-ui-module-ws 1.0.51 → 1.0.53

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.
@@ -9673,7 +9673,8 @@ const WSCalculation = _ref => {
9673
9673
  register = _useForm.register,
9674
9674
  errors = _useForm.formState.errors,
9675
9675
  watch = _useForm.watch,
9676
- setValue = _useForm.setValue;
9676
+ setValue = _useForm.setValue,
9677
+ reset = _useForm.reset;
9677
9678
  const tenantId = Digit.ULBService.getCurrentTenantId();
9678
9679
  const _useTranslation = useTranslation(),
9679
9680
  t = _useTranslation.t;
@@ -9709,6 +9710,8 @@ const WSCalculation = _ref => {
9709
9710
  const watchPropertyType = watch("useDetails.propertyType");
9710
9711
  const watchPropertyCategory = watch("useDetails.propertyCategory");
9711
9712
  const watchWaterConnectionUsageType = watch("useDetails.WaterConnectionUsageType");
9713
+ const watchColonyName = watch("useDetails.colonyName");
9714
+ const isCalculateButtonEnabled = watchCategoryType && watchPropertyCategory && watchPropertyType && watchWaterConnectionUsageType && watchColonyName;
9712
9715
  const isHospitalProperty = (watchPropertyType === null || watchPropertyType === void 0 ? void 0 : watchPropertyType.code) === "HOSPITAL_NURSING_HOME" || (watchPropertyType === null || watchPropertyType === void 0 ? void 0 : watchPropertyType.code) === "HospitalNursingHome";
9713
9716
  const isHotelRestaurantProperty = (watchPropertyType === null || watchPropertyType === void 0 ? void 0 : watchPropertyType.code) === "HOTEL_OR_RESTAURANT" || (watchPropertyType === null || watchPropertyType === void 0 ? void 0 : watchPropertyType.code) === "HotelOrRestaurant";
9714
9717
  const isSchoolCollegeProperty = (watchPropertyType === null || watchPropertyType === void 0 ? void 0 : watchPropertyType.code) === "School" || (watchPropertyType === null || watchPropertyType === void 0 ? void 0 : watchPropertyType.code) === "College";
@@ -9864,7 +9867,7 @@ const WSCalculation = _ref => {
9864
9867
  });
9865
9868
  };
9866
9869
  const RenderCalculationDetails = _ref2 => {
9867
- var _data$Calculation, _calc$calculationDeta, _calc$calculationDeta2, _calc$calculationDeta3, _waterDemandDetail$co, _infraDetail$waterCom, _infraDetail$sewerCom, _infraDetail$grossIFC, _infraDetail$rebateAm, _infraDetail$netIFC;
9870
+ var _data$Calculation, _calc$calculationDeta, _calc$calculationDeta2, _calc$calculationDeta3, _waterDemandDetail$co, _waterDemandDetail$co2, _waterDemandDetail$co3, _waterDemandDetail$co4, _waterDemandDetail$co5, _waterDemandDetail$co6, _waterDemandDetail$co7, _waterDemandDetail$co8, _waterDemandDetail$co9, _waterDemandDetail$co0, _waterDemandDetail$co1, _waterDemandDetail$co10, _waterDemandDetail$co11, _waterDemandDetail$co12, _waterDemandDetail$co13, _waterDemandDetail$co14, _waterDemandDetail$co15, _waterDemandDetail$co16, _infraDetail$waterCom, _infraDetail$sewerCom, _infraDetail$grossIFC, _infraDetail$rebateAm, _infraDetail$netIFC;
9868
9871
  let data = _ref2.data;
9869
9872
  if (!data) return null;
9870
9873
  const calc = (_data$Calculation = data.Calculation) === null || _data$Calculation === void 0 ? void 0 : _data$Calculation[0];
@@ -9887,7 +9890,7 @@ const WSCalculation = _ref => {
9887
9890
  }, t("WS_PROPERTY_DETAILS"))), /*#__PURE__*/React.createElement("div", {
9888
9891
  className: "ws-calc-property-box"
9889
9892
  }, /*#__PURE__*/React.createElement("div", {
9890
- className: "ws-calc-grid-3"
9893
+ className: "ws-calc-grid-4"
9891
9894
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9892
9895
  className: "ws-calc-label"
9893
9896
  }, t("WS_PROPERTY_TYPE")), /*#__PURE__*/React.createElement("div", {
@@ -9900,7 +9903,7 @@ const WSCalculation = _ref => {
9900
9903
  className: "ws-calc-label"
9901
9904
  }, t("WS_WATER_CONNECTION_USAGE_TYPE")), /*#__PURE__*/React.createElement("div", {
9902
9905
  className: "ws-calc-value"
9903
- }, propertyDetail.usageCategory || "-")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9906
+ }, propertyDetail.waterConnectionUsageType || "-")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9904
9907
  className: "ws-calc-label"
9905
9908
  }, t("WS_COLONY_CATEGORY")), /*#__PURE__*/React.createElement("div", {
9906
9909
  className: "ws-calc-pill"
@@ -9920,7 +9923,43 @@ const WSCalculation = _ref => {
9920
9923
  className: "ws-calc-label"
9921
9924
  }, t("WS_BUILT_UP_AREA")), /*#__PURE__*/React.createElement("div", {
9922
9925
  className: "ws-calc-value"
9923
- }, ((_waterDemandDetail$co = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co === void 0 ? void 0 : _waterDemandDetail$co.built_up_area) || 0, " sq. m."))))), /*#__PURE__*/React.createElement("div", {
9926
+ }, ((_waterDemandDetail$co = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co === void 0 ? void 0 : _waterDemandDetail$co.built_up_area) || 0, " sq. m.")), (propertyDetail.coveredArea > 0 || ((_waterDemandDetail$co2 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co2 === void 0 ? void 0 : _waterDemandDetail$co2.covered_area) > 0) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9927
+ className: "ws-calc-label"
9928
+ }, t("WS_COVERED_AREA")), /*#__PURE__*/React.createElement("div", {
9929
+ className: "ws-calc-value"
9930
+ }, propertyDetail.coveredArea || ((_waterDemandDetail$co3 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co3 === void 0 ? void 0 : _waterDemandDetail$co3.covered_area), " sq. m.")), (propertyDetail.numberOfDwellingUnits > 0 || ((_waterDemandDetail$co4 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co4 === void 0 ? void 0 : _waterDemandDetail$co4.dwelling_units) > 0 || ((_waterDemandDetail$co5 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co5 === void 0 ? void 0 : _waterDemandDetail$co5.total_du) > 0) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9931
+ className: "ws-calc-label"
9932
+ }, t("WS_NUMBER_OF_DWELLING_UNITS")), /*#__PURE__*/React.createElement("div", {
9933
+ className: "ws-calc-value"
9934
+ }, propertyDetail.numberOfDwellingUnits || ((_waterDemandDetail$co6 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co6 === void 0 ? void 0 : _waterDemandDetail$co6.dwelling_units) || ((_waterDemandDetail$co7 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co7 === void 0 ? void 0 : _waterDemandDetail$co7.total_du))), (propertyDetail.numberOfBeds > 0 || ((_waterDemandDetail$co8 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co8 === void 0 ? void 0 : _waterDemandDetail$co8.total_beds) > 0) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9935
+ className: "ws-calc-label"
9936
+ }, t("WS_NUMBER_OF_BEDS")), /*#__PURE__*/React.createElement("div", {
9937
+ className: "ws-calc-value"
9938
+ }, propertyDetail.numberOfBeds || ((_waterDemandDetail$co9 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co9 === void 0 ? void 0 : _waterDemandDetail$co9.total_beds))), (propertyDetail.numberOfRooms > 0 || ((_waterDemandDetail$co0 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co0 === void 0 ? void 0 : _waterDemandDetail$co0.total_rooms) > 0) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9939
+ className: "ws-calc-label"
9940
+ }, t("WS_NUMBER_OF_ROOMS")), /*#__PURE__*/React.createElement("div", {
9941
+ className: "ws-calc-value"
9942
+ }, propertyDetail.numberOfRooms || ((_waterDemandDetail$co1 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co1 === void 0 ? void 0 : _waterDemandDetail$co1.total_rooms))), (propertyDetail.numberOfStudents > 0 || ((_waterDemandDetail$co10 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co10 === void 0 ? void 0 : _waterDemandDetail$co10.total_students) > 0) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9943
+ className: "ws-calc-label"
9944
+ }, t("WS_NUMBER_OF_STUDENTS")), /*#__PURE__*/React.createElement("div", {
9945
+ className: "ws-calc-value"
9946
+ }, propertyDetail.numberOfStudents || ((_waterDemandDetail$co11 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co11 === void 0 ? void 0 : _waterDemandDetail$co11.total_students))), (propertyDetail.numberOfStaff > 0 || ((_waterDemandDetail$co12 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co12 === void 0 ? void 0 : _waterDemandDetail$co12.total_staff) > 0) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9947
+ className: "ws-calc-label"
9948
+ }, t("WS_NUMBER_OF_STAFF")), /*#__PURE__*/React.createElement("div", {
9949
+ className: "ws-calc-value"
9950
+ }, propertyDetail.numberOfStaff || ((_waterDemandDetail$co13 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co13 === void 0 ? void 0 : _waterDemandDetail$co13.total_staff))), ((_waterDemandDetail$co14 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co14 === void 0 ? void 0 : _waterDemandDetail$co14.total_seats) > 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9951
+ className: "ws-calc-label"
9952
+ }, t("WS_NUMBER_OF_SEATS")), /*#__PURE__*/React.createElement("div", {
9953
+ className: "ws-calc-value"
9954
+ }, waterDemandDetail.contextVariables.total_seats)), ((_waterDemandDetail$co15 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co15 === void 0 ? void 0 : _waterDemandDetail$co15.highest_shift_strength) > 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9955
+ className: "ws-calc-label"
9956
+ }, t("WS_HIGHEST_SHIFT_STRENGTH")), /*#__PURE__*/React.createElement("div", {
9957
+ className: "ws-calc-value"
9958
+ }, waterDemandDetail.contextVariables.highest_shift_strength)), ((_waterDemandDetail$co16 = waterDemandDetail.contextVariables) === null || _waterDemandDetail$co16 === void 0 ? void 0 : _waterDemandDetail$co16.sanctioned_beds) > 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9959
+ className: "ws-calc-label"
9960
+ }, t("WS_SANCTIONED_BEDS")), /*#__PURE__*/React.createElement("div", {
9961
+ className: "ws-calc-value"
9962
+ }, waterDemandDetail.contextVariables.sanctioned_beds))))), /*#__PURE__*/React.createElement("div", {
9924
9963
  className: "ws-calc-detail-card"
9925
9964
  }, /*#__PURE__*/React.createElement("div", {
9926
9965
  className: "ws-calc-detail-card-header"
@@ -10321,11 +10360,23 @@ const WSCalculation = _ref => {
10321
10360
  display: "flex",
10322
10361
  marginTop: "24px",
10323
10362
  marginBottom: "32px",
10324
- justifyContent: isMobile ? "center" : "flex-end"
10363
+ justifyContent: isMobile ? "center" : "flex-end",
10364
+ alignItems: "center"
10325
10365
  }
10326
- }, /*#__PURE__*/React.createElement(SubmitBar, {
10366
+ }, /*#__PURE__*/React.createElement("button", {
10367
+ type: "button",
10368
+ className: "clear-search generic-button",
10369
+ style: {
10370
+ marginRight: "24px"
10371
+ },
10372
+ onClick: () => {
10373
+ reset();
10374
+ setCalculationData(null);
10375
+ }
10376
+ }, t("CS_COMMON_CLEAR_SEARCH")), /*#__PURE__*/React.createElement(SubmitBar, {
10327
10377
  label: t("ES_COMMON_CALCULATE"),
10328
- onSubmit: handleSubmit
10378
+ onSubmit: handleSubmit,
10379
+ disabled: !isCalculateButtonEnabled
10329
10380
  })), calculationData && /*#__PURE__*/React.createElement(RenderCalculationDetails, {
10330
10381
  data: calculationData
10331
10382
  })));