@mseva/digit-ui-module-engagement 1.1.23 → 1.1.24

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.
@@ -21321,7 +21321,8 @@ const FillQuestions = props => {
21321
21321
  value: city,
21322
21322
  onChange: e => {
21323
21323
  handleCityChange(e);
21324
- }
21324
+ },
21325
+ disabled: localStorage.getItem("CITIZEN.CITY") === "pb.punjab" ? false : true
21325
21326
  }, /*#__PURE__*/React.createElement("option", {
21326
21327
  value: ""
21327
21328
  }, "--Please choose a city--"), cities.map((option, index) => /*#__PURE__*/React.createElement("option", {
@@ -26324,6 +26325,7 @@ const NEXT_STEP = "NEXT_STEP";
26324
26325
  const PREVIOUS_STEP = "PREVIOUS_STEP";
26325
26326
  const SET_STEP_DATA = "SET_STEP_DATA";
26326
26327
  const AUTO_CALCULATE_CATEGORY = "AUTO_CALCULATE_CATEGORY";
26328
+ const RESET_FORM = "RESET_FORM";
26327
26329
 
26328
26330
  const updateSurveyForm = (key, value) => ({
26329
26331
  type: UPDATE_SURVEY_FORM,
@@ -26392,6 +26394,9 @@ const autoCalculateCategoriesWeight = categoryWeight => ({
26392
26394
  type: AUTO_CALCULATE_CATEGORY,
26393
26395
  categoryWeight
26394
26396
  });
26397
+ const resetForm = () => ({
26398
+ type: RESET_FORM
26399
+ });
26395
26400
 
26396
26401
  const surveyConfig = [{
26397
26402
  head: "SURVEY_DETAILS",
@@ -26497,7 +26502,16 @@ const CitizenDetails = ({
26497
26502
  const {
26498
26503
  t
26499
26504
  } = useTranslation();
26505
+ const tenantId = Digit.ULBService.getCurrentTenantId();
26506
+ const defaultCity = cities === null || cities === void 0 ? void 0 : cities.filter(ulb => tenantId === (ulb === null || ulb === void 0 ? void 0 : ulb.code));
26500
26507
  console.log("cities", cities);
26508
+ useEffect(() => {
26509
+ console.log("defaultCity", defaultCity);
26510
+ setFormData(prevData => ({
26511
+ ...prevData,
26512
+ ["city"]: defaultCity === null || defaultCity === void 0 ? void 0 : defaultCity[0]
26513
+ }));
26514
+ }, []);
26501
26515
  let menu = [];
26502
26516
  const {
26503
26517
  data: Menu
@@ -26580,6 +26594,7 @@ const CitizenDetails = ({
26580
26594
  }
26581
26595
  };
26582
26596
  const handleFetchDetails = () => {
26597
+ console.log("formData", formData);
26583
26598
  let newErrors = {};
26584
26599
  if (!formData.mobile) newErrors.mobile = "Mobile number is required";else if (!/^\d{10}$/.test(formData.mobile)) newErrors.mobile = "Mobile number is invalid";
26585
26600
  if (!formData.city) newErrors.city = "City is required";
@@ -26599,24 +26614,24 @@ const CitizenDetails = ({
26599
26614
  console.log("response", (_response$user$ = response.user[0]) === null || _response$user$ === void 0 ? void 0 : _response$user$.emailId);
26600
26615
  if (((response === null || response === void 0 ? void 0 : (_response$responseInf = response.responseInfo) === null || _response$responseInf === void 0 ? void 0 : _response$responseInf.status) === "200" || (response === null || response === void 0 ? void 0 : (_response$responseInf2 = response.responseInfo) === null || _response$responseInf2 === void 0 ? void 0 : _response$responseInf2.status) === "201") && (response === null || response === void 0 ? void 0 : response.user.length) > 0) {
26601
26616
  var _response$user$2;
26602
- const formattedDate = format(parseISO((_response$user$2 = response.user[0]) === null || _response$user$2 === void 0 ? void 0 : _response$user$2.dob), 'dd/MM/yyyy');
26617
+ const formattedDate = format(parseISO((_response$user$2 = response.user[0]) === null || _response$user$2 === void 0 ? void 0 : _response$user$2.dob), "dd/MM/yyyy");
26603
26618
  setFormData(prevData => {
26604
26619
  var _response$user$3, _response$user$4, _response$user$5, _response$user$6;
26605
26620
  return {
26606
26621
  ...prevData,
26607
- "citizenFound": true,
26608
- "name": (_response$user$3 = response.user[0]) === null || _response$user$3 === void 0 ? void 0 : _response$user$3.name,
26622
+ citizenFound: true,
26623
+ name: (_response$user$3 = response.user[0]) === null || _response$user$3 === void 0 ? void 0 : _response$user$3.name,
26609
26624
  ["email"]: (_response$user$4 = response.user[0]) === null || _response$user$4 === void 0 ? void 0 : _response$user$4.emailId,
26610
26625
  ["gender"]: (_response$user$5 = response.user[0]) === null || _response$user$5 === void 0 ? void 0 : _response$user$5.gender,
26611
26626
  ["dob"]: (_response$user$6 = response.user[0]) === null || _response$user$6 === void 0 ? void 0 : _response$user$6.dob,
26612
- "register": false,
26613
- "user": response.user[0]
26627
+ register: false,
26628
+ user: response.user[0]
26614
26629
  };
26615
26630
  });
26616
26631
  } else {
26617
26632
  setFormData(prevData => ({
26618
26633
  ...prevData,
26619
- "citizenFound": false
26634
+ citizenFound: false
26620
26635
  }));
26621
26636
  setShowToast({
26622
26637
  key: true,
@@ -26664,7 +26679,8 @@ const CitizenDetails = ({
26664
26679
  placeholder: "Select City",
26665
26680
  optionKey: "i18nKey",
26666
26681
  t: t,
26667
- selected: formData.city || null
26682
+ disable: tenantId === "pb.punjab" ? false : true,
26683
+ selected: tenantId === "pb.punjab" ? formData === null || formData === void 0 ? void 0 : formData.city : defaultCity === null || defaultCity === void 0 ? void 0 : defaultCity[0]
26668
26684
  }), errors.city && /*#__PURE__*/React.createElement("span", {
26669
26685
  className: "error"
26670
26686
  }, errors.city), /*#__PURE__*/React.createElement("label", {
@@ -26673,7 +26689,7 @@ const CitizenDetails = ({
26673
26689
  style: {
26674
26690
  display: "flex",
26675
26691
  flexDirection: "row",
26676
- columnGap: '10px'
26692
+ columnGap: "10px"
26677
26693
  }
26678
26694
  }, /*#__PURE__*/React.createElement("h3", null, "Do you want to register?"), /*#__PURE__*/React.createElement("label", {
26679
26695
  style: {
@@ -26682,7 +26698,7 @@ const CitizenDetails = ({
26682
26698
  onClick: () => {
26683
26699
  setFormData(prevData => ({
26684
26700
  ...prevData,
26685
- "register": true
26701
+ register: true
26686
26702
  }));
26687
26703
  }
26688
26704
  }, "Yes"), /*#__PURE__*/React.createElement("label", {
@@ -26738,7 +26754,7 @@ const CitizenDetails = ({
26738
26754
  onClick: () => getOtp()
26739
26755
  }, "Get OTP")), Otp === true ? /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement("h3", {
26740
26756
  style: {
26741
- marginTop: '20px'
26757
+ marginTop: "20px"
26742
26758
  }
26743
26759
  }, "OTP"), /*#__PURE__*/React.createElement("input", {
26744
26760
  type: "text",
@@ -29629,6 +29645,8 @@ const surveyFormReducer = (state = initialState, action) => {
29629
29645
  ...action.data
29630
29646
  } : survey)
29631
29647
  };
29648
+ case RESET_FORM:
29649
+ return initialState;
29632
29650
  default:
29633
29651
  return state;
29634
29652
  }
@@ -31442,6 +31460,7 @@ const SurveryFormSummary = ({
31442
31460
  try {
31443
31461
  Digit.Surveys.createSurvey(filters).then(response => {
31444
31462
  var _response$Surveys;
31463
+ dispatch(resetForm());
31445
31464
  if ((response === null || response === void 0 ? void 0 : (_response$Surveys = response.Surveys) === null || _response$Surveys === void 0 ? void 0 : _response$Surveys.length) > 0) {
31446
31465
  history.push("/digit-ui/employee/engagement/surveys/create-response", {
31447
31466
  message: "SURVEY_FORM_CREATED",