@mseva/digit-ui-module-challangeneration 1.0.4 → 1.0.6

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 CHANGED
@@ -13463,9 +13463,7 @@ const ChallanStepperForm = () => {
13463
13463
  React.useEffect(() => {
13464
13464
  dispatch(RESET_ChallanAPPLICATION_FORM());
13465
13465
  }, []);
13466
- const handleSubmit = dataGet => {
13467
- console.log("dataGet===", dataGet);
13468
- };
13466
+ const handleSubmit = dataGet => {};
13469
13467
  return /*#__PURE__*/React__default.createElement("div", {
13470
13468
  className: "pageCard"
13471
13469
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardHeader, {
@@ -13490,63 +13488,14 @@ const ChallanStepperForm = () => {
13490
13488
  }));
13491
13489
  };
13492
13490
 
13493
- const Loader = _ref => {
13494
- let {
13495
- page = false
13496
- } = _ref;
13497
- const baseStyle = {
13498
- display: "flex",
13499
- justifyContent: "center",
13500
- alignItems: "center"
13501
- };
13502
- const pageStyle = _extends({}, baseStyle, {
13503
- position: "fixed",
13504
- top: 0,
13505
- left: 0,
13506
- width: "100vw",
13507
- height: "100vh",
13508
- background: "rgba(255,255,255,0.6)",
13509
- backdropFilter: "blur(4px)",
13510
- zIndex: 9999
13511
- });
13512
- const moduleStyle = _extends({}, baseStyle, {
13513
- minHeight: "100px",
13514
- width: "100%",
13515
- position: "relative"
13516
- });
13517
- const spinnerStyle = {
13518
- width: "64px",
13519
- height: "64px",
13520
- border: "8px solid #1976d2",
13521
- borderTop: "8px solid transparent",
13522
- borderRadius: "50%",
13523
- animation: "spin 1.2s linear infinite"
13524
- };
13525
- return /*#__PURE__*/React__default.createElement("div", {
13526
- style: page ? pageStyle : moduleStyle
13527
- }, /*#__PURE__*/React__default.createElement("div", {
13528
- style: spinnerStyle
13529
- }), /*#__PURE__*/React__default.createElement("style", null, "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "));
13530
- };
13531
- Loader.propTypes = {
13532
- page: propTypes.bool
13533
- };
13534
- Loader.defaultProps = {
13535
- page: false
13536
- };
13537
-
13538
13491
  const OffenderDetails = _ref => {
13539
13492
  var _user$info, _user$info2, _user$info3;
13540
13493
  let {
13541
13494
  t,
13542
13495
  goNext,
13543
- currentStepData,
13544
- onGoBack
13496
+ currentStepData
13545
13497
  } = _ref;
13546
- const tenantId = Digit.ULBService.getCurrentTenantId();
13547
- const stateId = Digit.ULBService.getStateId();
13548
13498
  const user = Digit.UserService.getUser();
13549
- const [loader, setLoader] = React.useState(false);
13550
13499
  const {
13551
13500
  control,
13552
13501
  handleSubmit,
@@ -13564,6 +13513,7 @@ const OffenderDetails = _ref => {
13564
13513
  });
13565
13514
  const onSubmit = function (data) {
13566
13515
  try {
13516
+ console.log("data", data);
13567
13517
  goNext(data);
13568
13518
  return Promise.resolve();
13569
13519
  } catch (e) {
@@ -13571,11 +13521,21 @@ const OffenderDetails = _ref => {
13571
13521
  }
13572
13522
  };
13573
13523
  React.useEffect(() => {
13574
- console.log("currentStepData", currentStepData);
13524
+ if (currentStepData !== null && currentStepData !== void 0 && currentStepData.offenderDetails) {
13525
+ var _Object$entries;
13526
+ (_Object$entries = Object.entries(currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.offenderDetails)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.forEach(_ref2 => {
13527
+ let [key, value] = _ref2;
13528
+ setValue(key, value);
13529
+ });
13530
+ }
13575
13531
  }, [currentStepData, setValue]);
13576
13532
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("form", {
13577
13533
  onSubmit: handleSubmit(onSubmit)
13578
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
13534
+ }, /*#__PURE__*/React__default.createElement("div", {
13535
+ style: {
13536
+ width: "50%"
13537
+ }
13538
+ }, /*#__PURE__*/React__default.createElement("div", {
13579
13539
  style: {
13580
13540
  marginBottom: "20px"
13581
13541
  }
@@ -13717,20 +13677,9 @@ const OffenderDetails = _ref => {
13717
13677
  color: "red"
13718
13678
  }
13719
13679
  }, errors.address.message))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
13720
- style: {
13721
- background: " white",
13722
- color: "black",
13723
- border: "1px solid",
13724
- marginRight: "10px"
13725
- },
13726
- label: "Back",
13727
- onSubmit: onGoBack
13728
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
13729
13680
  label: "Next",
13730
13681
  submit: "submit"
13731
- }))), loader && /*#__PURE__*/React__default.createElement(Loader, {
13732
- page: true
13733
- }));
13682
+ }))));
13734
13683
  };
13735
13684
 
13736
13685
  const ChallanStepFormOne = _ref => {
@@ -13749,7 +13698,6 @@ const ChallanStepFormOne = _ref => {
13749
13698
  return state.challan.ChallanApplicationFormReducer.formData;
13750
13699
  });
13751
13700
  function goNext(data) {
13752
- console.log("data aa rea", data);
13753
13701
  dispatch(UPDATE_ChallanApplication_FORM(config.key, data));
13754
13702
  onGoNext();
13755
13703
  }
@@ -13773,6 +13721,51 @@ const ChallanStepFormOne = _ref => {
13773
13721
  }));
13774
13722
  };
13775
13723
 
13724
+ const Loader = _ref => {
13725
+ let {
13726
+ page = false
13727
+ } = _ref;
13728
+ const baseStyle = {
13729
+ display: "flex",
13730
+ justifyContent: "center",
13731
+ alignItems: "center"
13732
+ };
13733
+ const pageStyle = _extends({}, baseStyle, {
13734
+ position: "fixed",
13735
+ top: 0,
13736
+ left: 0,
13737
+ width: "100vw",
13738
+ height: "100vh",
13739
+ background: "rgba(255,255,255,0.6)",
13740
+ backdropFilter: "blur(4px)",
13741
+ zIndex: 9999
13742
+ });
13743
+ const moduleStyle = _extends({}, baseStyle, {
13744
+ minHeight: "100px",
13745
+ width: "100%",
13746
+ position: "relative"
13747
+ });
13748
+ const spinnerStyle = {
13749
+ width: "64px",
13750
+ height: "64px",
13751
+ border: "8px solid #1976d2",
13752
+ borderTop: "8px solid transparent",
13753
+ borderRadius: "50%",
13754
+ animation: "spin 1.2s linear infinite"
13755
+ };
13756
+ return /*#__PURE__*/React__default.createElement("div", {
13757
+ style: page ? pageStyle : moduleStyle
13758
+ }, /*#__PURE__*/React__default.createElement("div", {
13759
+ style: spinnerStyle
13760
+ }), /*#__PURE__*/React__default.createElement("style", null, "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "));
13761
+ };
13762
+ Loader.propTypes = {
13763
+ page: propTypes.bool
13764
+ };
13765
+ Loader.defaultProps = {
13766
+ page: false
13767
+ };
13768
+
13776
13769
  const OffenceDetails = _ref => {
13777
13770
  let {
13778
13771
  onGoBack,
@@ -13799,45 +13792,236 @@ const OffenceDetails = _ref => {
13799
13792
  const onSubmit = data => {
13800
13793
  goNext(data);
13801
13794
  };
13795
+ React.useEffect(() => {
13796
+ if (currentStepData !== null && currentStepData !== void 0 && currentStepData.offenceDetails) {
13797
+ var _Object$entries;
13798
+ (_Object$entries = Object.entries(currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.offenceDetails)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.forEach(_ref2 => {
13799
+ let [key, value] = _ref2;
13800
+ setValue(key, value);
13801
+ });
13802
+ }
13803
+ }, [currentStepData, setValue]);
13802
13804
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("form", {
13803
13805
  onSubmit: handleSubmit(onSubmit)
13804
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
13805
- className: "card-label-smaller"
13806
- }, t("CHB_PURPOSE_DESCRIPTION"), " ", /*#__PURE__*/React__default.createElement("span", {
13806
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_TYPE_OFFENCE"), " ", /*#__PURE__*/React__default.createElement("span", {
13807
13807
  style: {
13808
13808
  color: "red"
13809
13809
  }
13810
- }, "*")), /*#__PURE__*/React__default.createElement("div", {
13811
- className: "field"
13812
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13810
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13813
13811
  control: control,
13814
- name: "purposeDescription",
13815
- defaultValue: "",
13816
- rules: {
13817
- required: t("CHB_PURPOSE_DESCRIPTION_REQUIRED"),
13818
- minLength: {
13819
- value: 5,
13820
- message: t("CHB_PURPOSE_DESCRIPTION_REQUIRED_MIN")
13821
- }
13822
- },
13823
- render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextArea, {
13812
+ name: "offenceType",
13813
+ defaultValue: null,
13814
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
13824
13815
  style: {
13825
13816
  marginBottom: 0
13826
13817
  },
13827
- type: "textarea",
13828
- value: props.value,
13829
- onChange: e => {
13830
- props.onChange(e.target.value);
13818
+ className: "form-field",
13819
+ select: props.onChange,
13820
+ selected: props.value,
13821
+ option: [],
13822
+ optionKey: "name",
13823
+ t: t
13824
+ })
13825
+ }), errors.offenceType && /*#__PURE__*/React__default.createElement("p", {
13826
+ style: {
13827
+ color: "red"
13828
+ }
13829
+ }, errors.offenceType.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
13830
+ style: {
13831
+ marginTop: "20px"
13832
+ }
13833
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
13834
+ style: {
13835
+ color: "red"
13836
+ }
13837
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13838
+ control: control,
13839
+ name: "offenceCategory",
13840
+ defaultValue: null,
13841
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
13842
+ style: {
13843
+ marginBottom: 0
13831
13844
  },
13832
- onBlur: e => {
13833
- props.onBlur(e);
13834
- }
13845
+ className: "form-field",
13846
+ select: props.onChange,
13847
+ selected: props.value,
13848
+ option: [],
13849
+ optionKey: "name",
13850
+ t: t
13851
+ })
13852
+ }), errors.offenceCategory && /*#__PURE__*/React__default.createElement("p", {
13853
+ style: {
13854
+ color: "red"
13855
+ }
13856
+ }, errors.offenceCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
13857
+ style: {
13858
+ marginTop: "20px"
13859
+ }
13860
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_SUB_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
13861
+ style: {
13862
+ color: "red"
13863
+ }
13864
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13865
+ control: control,
13866
+ name: "offenceSubCategory",
13867
+ defaultValue: null,
13868
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
13869
+ style: {
13870
+ marginBottom: 0
13871
+ },
13872
+ className: "form-field",
13873
+ select: props.onChange,
13874
+ selected: props.value,
13875
+ option: [],
13876
+ optionKey: "name",
13877
+ t: t
13835
13878
  })
13836
- }), errors.purposeDescription && /*#__PURE__*/React__default.createElement("p", {
13879
+ }), errors.offenceSubCategory && /*#__PURE__*/React__default.createElement("p", {
13880
+ style: {
13881
+ color: "red"
13882
+ }
13883
+ }, errors.offenceSubCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
13884
+ style: {
13885
+ width: "50%",
13886
+ marginTop: "20px"
13887
+ }
13888
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CHALLAN_NUMBER"), " ", /*#__PURE__*/React__default.createElement("span", {
13837
13889
  style: {
13838
13890
  color: "red"
13839
13891
  }
13840
- }, errors.purposeDescription.message)))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
13892
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13893
+ control: control,
13894
+ name: "challanNumber",
13895
+ render: props => {
13896
+ var _errors$name;
13897
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
13898
+ style: {
13899
+ marginBottom: 0
13900
+ },
13901
+ value: props.value,
13902
+ error: errors === null || errors === void 0 ? void 0 : (_errors$name = errors.name) === null || _errors$name === void 0 ? void 0 : _errors$name.message,
13903
+ onChange: e => {
13904
+ props.onChange(e.target.value);
13905
+ },
13906
+ onBlur: e => {
13907
+ props.onBlur(e);
13908
+ },
13909
+ t: t
13910
+ });
13911
+ }
13912
+ }), (errors === null || errors === void 0 ? void 0 : errors.challanNumber) && /*#__PURE__*/React__default.createElement("p", {
13913
+ style: {
13914
+ color: "red"
13915
+ }
13916
+ }, errors.challanNumber.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
13917
+ style: {
13918
+ width: "50%",
13919
+ marginTop: "20px"
13920
+ }
13921
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CHALLAN_NAME"), " ", /*#__PURE__*/React__default.createElement("span", {
13922
+ style: {
13923
+ color: "red"
13924
+ }
13925
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13926
+ control: control,
13927
+ name: "challanName",
13928
+ render: props => {
13929
+ var _errors$name2;
13930
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
13931
+ style: {
13932
+ marginBottom: 0
13933
+ },
13934
+ value: props.value,
13935
+ error: errors === null || errors === void 0 ? void 0 : (_errors$name2 = errors.name) === null || _errors$name2 === void 0 ? void 0 : _errors$name2.message,
13936
+ onChange: e => {
13937
+ props.onChange(e.target.value);
13938
+ },
13939
+ onBlur: e => {
13940
+ props.onBlur(e);
13941
+ },
13942
+ t: t
13943
+ });
13944
+ }
13945
+ }), (errors === null || errors === void 0 ? void 0 : errors.challanName) && /*#__PURE__*/React__default.createElement("p", {
13946
+ style: {
13947
+ color: "red"
13948
+ }
13949
+ }, errors.challanName.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
13950
+ style: {
13951
+ width: "50%",
13952
+ marginTop: "20px"
13953
+ }
13954
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CHALLAN_AMOUNT"), " ", /*#__PURE__*/React__default.createElement("span", {
13955
+ style: {
13956
+ color: "red"
13957
+ }
13958
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13959
+ control: control,
13960
+ name: "challanAmount",
13961
+ render: props => {
13962
+ var _errors$name3;
13963
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
13964
+ style: {
13965
+ marginBottom: 0
13966
+ },
13967
+ value: props.value,
13968
+ error: errors === null || errors === void 0 ? void 0 : (_errors$name3 = errors.name) === null || _errors$name3 === void 0 ? void 0 : _errors$name3.message,
13969
+ onChange: e => {
13970
+ props.onChange(e.target.value);
13971
+ },
13972
+ onBlur: e => {
13973
+ props.onBlur(e);
13974
+ },
13975
+ t: t
13976
+ });
13977
+ }
13978
+ }), (errors === null || errors === void 0 ? void 0 : errors.challanAmount) && /*#__PURE__*/React__default.createElement("p", {
13979
+ style: {
13980
+ color: "red"
13981
+ }
13982
+ }, errors.challanAmount.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
13983
+ style: {
13984
+ width: "50%",
13985
+ marginTop: "20px"
13986
+ }
13987
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CHALLAN_DAYS"), " ", /*#__PURE__*/React__default.createElement("span", {
13988
+ style: {
13989
+ color: "red"
13990
+ }
13991
+ }, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
13992
+ control: control,
13993
+ name: "challanDaysToClearPayment",
13994
+ render: props => {
13995
+ var _errors$name4;
13996
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
13997
+ style: {
13998
+ marginBottom: 0
13999
+ },
14000
+ value: props.value,
14001
+ error: errors === null || errors === void 0 ? void 0 : (_errors$name4 = errors.name) === null || _errors$name4 === void 0 ? void 0 : _errors$name4.message,
14002
+ onChange: e => {
14003
+ props.onChange(e.target.value);
14004
+ },
14005
+ onBlur: e => {
14006
+ props.onBlur(e);
14007
+ },
14008
+ t: t
14009
+ });
14010
+ }
14011
+ }), (errors === null || errors === void 0 ? void 0 : errors.challanDaysToClearPayment) && /*#__PURE__*/React__default.createElement("p", {
14012
+ style: {
14013
+ color: "red"
14014
+ }
14015
+ }, errors.challanDaysToClearPayment.message))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
14016
+ style: {
14017
+ background: " white",
14018
+ color: "black",
14019
+ border: "1px solid",
14020
+ marginRight: "10px"
14021
+ },
14022
+ label: "Back",
14023
+ onSubmit: onGoBack
14024
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
13841
14025
  label: "Next",
13842
14026
  submit: "submit"
13843
14027
  }))), loader && /*#__PURE__*/React__default.createElement(Loader, {
@@ -13860,7 +14044,6 @@ const ChallanStepFormTwo = _ref => {
13860
14044
  const currentStepData = reactRedux.useSelector(function (state) {
13861
14045
  return state.challan.ChallanApplicationFormReducer.formData;
13862
14046
  });
13863
- console.log("currentStepData", currentStepData);
13864
14047
  function goNext(data) {
13865
14048
  dispatch(UPDATE_ChallanApplication_FORM(config.key, data));
13866
14049
  onGoNext();
@@ -13898,7 +14081,7 @@ const ChallanStepFormThree = _ref => {
13898
14081
  const {
13899
14082
  data: docData,
13900
14083
  isLoading
13901
- } = Digit.Hooks.useCustomMDMS("pb", "CHB", [{
14084
+ } = Digit.Hooks.useCustomMDMS("pb", "Challan", [{
13902
14085
  name: "Documents"
13903
14086
  }]);
13904
14087
  const checkFormData = reactRedux.useSelector(state => state.challan.ChallanApplicationFormReducer.formData || {});
@@ -13908,12 +14091,12 @@ const ChallanStepFormThree = _ref => {
13908
14091
  console.log("currentStepData===", currentStepData);
13909
14092
  console.log("checkFormData===", checkFormData);
13910
14093
  function goNext(finalData) {
13911
- var _docData$CHB;
14094
+ var _docData$Challan;
13912
14095
  console.log("Current Data", finalData);
13913
- console.log("data?????....=====", docData === null || docData === void 0 ? void 0 : (_docData$CHB = docData.CHB) === null || _docData$CHB === void 0 ? void 0 : _docData$CHB.Documents);
14096
+ console.log("data?????....=====", docData === null || docData === void 0 ? void 0 : (_docData$Challan = docData.Challan) === null || _docData$Challan === void 0 ? void 0 : _docData$Challan.Documents);
13914
14097
  const missingFields = validation(finalData);
13915
14098
  if (missingFields.length > 0) {
13916
- setError("" + t("CHB_MESSAGE_" + missingFields[0].replace(".", "_").toUpperCase()));
14099
+ setError("" + t("CHALLAN_MESSAGE_" + missingFields[0].replace(".", "_").toUpperCase()));
13917
14100
  setShowToast(true);
13918
14101
  setTimeout(() => setShowToast(false), 3000);
13919
14102
  return;
@@ -13922,8 +14105,8 @@ const ChallanStepFormThree = _ref => {
13922
14105
  }
13923
14106
  function validation(formData) {
13924
14107
  if (!isLoading) {
13925
- var _docData$CHB2, _formData$documents;
13926
- const chbDocumentsType = (docData === null || docData === void 0 ? void 0 : (_docData$CHB2 = docData.CHB) === null || _docData$CHB2 === void 0 ? void 0 : _docData$CHB2.Documents) || [];
14108
+ var _docData$Challan2, _formData$documents;
14109
+ const chbDocumentsType = (docData === null || docData === void 0 ? void 0 : (_docData$Challan2 = docData.Challan) === null || _docData$Challan2 === void 0 ? void 0 : _docData$Challan2.Documents) || [];
13927
14110
  const uploadedDocs = (formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || [];
13928
14111
  console.log("chbDocumentsType", chbDocumentsType);
13929
14112
  console.log("uploadedDocs", uploadedDocs);
@@ -14039,44 +14222,21 @@ function ChallanDocument(_ref2) {
14039
14222
  }
14040
14223
 
14041
14224
  function ChallanSummary(_ref) {
14042
- var _formData$documents, _formData$documents$d, _formData$apiData, _formData$apiData$App, _formData$apiData$App2, _formData$venueDetail, _formData$venueDetail2, _user$info, _user$info$roles, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5, _formData$venueDetail3, _formData$venueDetail4, _formData$venueDetail5, _formData$venueDetail0, _formData$venueDetail1, _formData$venueDetail10, _formData$venueDetail11, _formData$venueDetail12, _formData$venueDetail13, _formData$venueDetail14, _formData$venueDetail15, _formData$venueDetail16, _formData$venueDetail17, _formData$venueDetail18, _formData$venueDetail19, _formData$venueDetail20, _formData$venueDetail21, _formData$venueDetail22, _formData$venueDetail23, _formData$venueDetail24, _formData$venueDetail25, _formData$venueDetail26, _formData$venueDetail27, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8;
14225
+ var _formData$documents, _formData$documents$d, _formData$apiData, _formData$apiData$App, _formData$apiData$App2, _formData$venueDetail, _formData$venueDetail2, _user$info, _user$info$roles, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5, _formData$offenderDet, _formData$offenderDet2, _formData$offenderDet3, _formData$offenderDet4, _formData$offenceDeta, _formData$offenceDeta2, _formData$offenceDeta3, _formData$offenceDeta4, _formData$offenceDeta5, _formData$offenceDeta6, _formData$offenceDeta7, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8;
14043
14226
  let {
14044
14227
  formData,
14045
14228
  goNext,
14046
14229
  onGoBack
14047
14230
  } = _ref;
14048
- const {
14049
- pathname: url
14050
- } = reactRouterDom.useLocation();
14051
14231
  const {
14052
14232
  t
14053
14233
  } = reactI18next.useTranslation();
14054
- const history = reactRouterDom.useHistory();
14055
14234
  const menuRef = React.useRef();
14056
- const dispatch = reactRedux.useDispatch();
14057
- const mutateScreen = url.includes("/property-mutate/");
14058
14235
  let user = Digit.UserService.getUser();
14059
- const columns = [{
14060
- Header: "" + t("CHB_HALL_NUMBER"),
14061
- accessor: "communityHallCode"
14062
- }, {
14063
- Header: "" + t("CHB_COMMUNITY_HALL_NAME"),
14064
- accessor: "hallName"
14065
- }, {
14066
- Header: "" + t("CHB_HALL_CODE"),
14067
- accessor: "hallCode"
14068
- }, {
14069
- Header: "" + t("CHB_BOOKING_DATE"),
14070
- accessor: "bookingDate"
14071
- }, {
14072
- Header: "" + t("PT_COMMON_TABLE_COL_STATUS_LABEL"),
14073
- accessor: "bookingStatus"
14074
- }];
14236
+ console.log("formData====", formData);
14075
14237
  let docs = formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : (_formData$documents$d = _formData$documents.documents) === null || _formData$documents$d === void 0 ? void 0 : _formData$documents$d.documents;
14076
14238
  const appId = (formData === null || formData === void 0 ? void 0 : (_formData$apiData = formData.apiData) === null || _formData$apiData === void 0 ? void 0 : (_formData$apiData$App = _formData$apiData.Applications) === null || _formData$apiData$App === void 0 ? void 0 : (_formData$apiData$App2 = _formData$apiData$App[0]) === null || _formData$apiData$App2 === void 0 ? void 0 : _formData$apiData$App2.uuid) || (formData === null || formData === void 0 ? void 0 : (_formData$venueDetail = formData.venueDetails) === null || _formData$venueDetail === void 0 ? void 0 : (_formData$venueDetail2 = _formData$venueDetail[0]) === null || _formData$venueDetail2 === void 0 ? void 0 : _formData$venueDetail2.bookingNo);
14077
14239
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
14078
- const isCitizen = window.location.href.includes("citizen");
14079
- const [getData, setData] = React.useState();
14080
14240
  const [displayMenu, setDisplayMenu] = React.useState(false);
14081
14241
  const closeMenu = () => {
14082
14242
  setDisplayMenu(false);
@@ -14139,16 +14299,6 @@ function ChallanSummary(_ref) {
14139
14299
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
14140
14300
  style: boldLabelStyle
14141
14301
  }, label), /*#__PURE__*/React__default.createElement("div", null, t(value) || "NA"));
14142
- const slotlistRows = (formData === null || formData === void 0 ? void 0 : (_formData$venueDetail3 = formData.venueDetails) === null || _formData$venueDetail3 === void 0 ? void 0 : (_formData$venueDetail4 = _formData$venueDetail3[0]) === null || _formData$venueDetail4 === void 0 ? void 0 : (_formData$venueDetail5 = _formData$venueDetail4.bookingSlotDetails) === null || _formData$venueDetail5 === void 0 ? void 0 : _formData$venueDetail5.map(slot => {
14143
- var _formData$venueDetail6, _formData$venueDetail7, _formData$venueDetail8, _formData$venueDetail9;
14144
- return {
14145
- communityHallCode: "" + t(formData === null || formData === void 0 ? void 0 : (_formData$venueDetail6 = formData.venueDetails) === null || _formData$venueDetail6 === void 0 ? void 0 : (_formData$venueDetail7 = _formData$venueDetail6[0]) === null || _formData$venueDetail7 === void 0 ? void 0 : _formData$venueDetail7.communityHallCode),
14146
- hallName: formData === null || formData === void 0 ? void 0 : (_formData$venueDetail8 = formData.venueDetails) === null || _formData$venueDetail8 === void 0 ? void 0 : (_formData$venueDetail9 = _formData$venueDetail8[0]) === null || _formData$venueDetail9 === void 0 ? void 0 : _formData$venueDetail9.communityHallName,
14147
- hallCode: slot.hallCode + " - " + slot.capacity,
14148
- bookingDate: slot.bookingDate,
14149
- bookingStatus: "" + t(slot.status)
14150
- };
14151
- })) || [];
14152
14302
  return /*#__PURE__*/React__default.createElement("div", {
14153
14303
  style: pageStyle
14154
14304
  }, /*#__PURE__*/React__default.createElement("h2", {
@@ -14159,27 +14309,13 @@ function ChallanSummary(_ref) {
14159
14309
  style: {
14160
14310
  fontSize: "24px"
14161
14311
  }
14162
- }, t("CHB_APPLICANT_DETAILS")), renderLabel(t("BPA_BASIC_DETAILS_APPLICATION_NAME_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail0 = formData.venueDetails) === null || _formData$venueDetail0 === void 0 ? void 0 : (_formData$venueDetail1 = _formData$venueDetail0[0]) === null || _formData$venueDetail1 === void 0 ? void 0 : (_formData$venueDetail10 = _formData$venueDetail1.applicantDetail) === null || _formData$venueDetail10 === void 0 ? void 0 : _formData$venueDetail10.applicantName), renderLabel(t("NOC_APPLICANT_MOBILE_NO_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail11 = formData.venueDetails) === null || _formData$venueDetail11 === void 0 ? void 0 : (_formData$venueDetail12 = _formData$venueDetail11[0]) === null || _formData$venueDetail12 === void 0 ? void 0 : (_formData$venueDetail13 = _formData$venueDetail12.applicantDetail) === null || _formData$venueDetail13 === void 0 ? void 0 : _formData$venueDetail13.applicantMobileNo), renderLabel(t("NOC_APPLICANT_EMAIL_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail14 = formData.venueDetails) === null || _formData$venueDetail14 === void 0 ? void 0 : (_formData$venueDetail15 = _formData$venueDetail14[0]) === null || _formData$venueDetail15 === void 0 ? void 0 : (_formData$venueDetail16 = _formData$venueDetail15.applicantDetail) === null || _formData$venueDetail16 === void 0 ? void 0 : _formData$venueDetail16.applicantEmailId), renderLabel(t("PT_COMMON_COL_ADDRESS"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail17 = formData.venueDetails) === null || _formData$venueDetail17 === void 0 ? void 0 : (_formData$venueDetail18 = _formData$venueDetail17[0]) === null || _formData$venueDetail18 === void 0 ? void 0 : (_formData$venueDetail19 = _formData$venueDetail18.address) === null || _formData$venueDetail19 === void 0 ? void 0 : _formData$venueDetail19.addressLine1)), /*#__PURE__*/React__default.createElement("div", {
14312
+ }, t("CHALLAN_OFFENDER_DETAILS")), renderLabel(t("BPA_BASIC_DETAILS_APPLICATION_NAME_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$offenderDet = formData.offenderDetails) === null || _formData$offenderDet === void 0 ? void 0 : _formData$offenderDet.name), renderLabel(t("NOC_APPLICANT_MOBILE_NO_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$offenderDet2 = formData.offenderDetails) === null || _formData$offenderDet2 === void 0 ? void 0 : _formData$offenderDet2.mobileNumber), renderLabel(t("NOC_APPLICANT_EMAIL_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$offenderDet3 = formData.offenderDetails) === null || _formData$offenderDet3 === void 0 ? void 0 : _formData$offenderDet3.emailId), renderLabel(t("PT_COMMON_COL_ADDRESS"), formData === null || formData === void 0 ? void 0 : (_formData$offenderDet4 = formData.offenderDetails) === null || _formData$offenderDet4 === void 0 ? void 0 : _formData$offenderDet4.address)), /*#__PURE__*/React__default.createElement("div", {
14163
14313
  style: sectionStyle
14164
14314
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
14165
14315
  style: {
14166
14316
  fontSize: "24px"
14167
14317
  }
14168
- }, t("CHB_EVENT_DETAILS")), renderLabel(t("CHB_SPECIAL_CATEGORY"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail20 = formData.venueDetails) === null || _formData$venueDetail20 === void 0 ? void 0 : (_formData$venueDetail21 = _formData$venueDetail20[0]) === null || _formData$venueDetail21 === void 0 ? void 0 : (_formData$venueDetail22 = _formData$venueDetail21.specialCategory) === null || _formData$venueDetail22 === void 0 ? void 0 : _formData$venueDetail22.category), renderLabel(t("CHB_PURPOSE"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail23 = formData.venueDetails) === null || _formData$venueDetail23 === void 0 ? void 0 : (_formData$venueDetail24 = _formData$venueDetail23[0]) === null || _formData$venueDetail24 === void 0 ? void 0 : (_formData$venueDetail25 = _formData$venueDetail24.purpose) === null || _formData$venueDetail25 === void 0 ? void 0 : _formData$venueDetail25.purpose), renderLabel(t("CHB_PURPOSE_DESCRIPTION"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail26 = formData.venueDetails) === null || _formData$venueDetail26 === void 0 ? void 0 : (_formData$venueDetail27 = _formData$venueDetail26[0]) === null || _formData$venueDetail27 === void 0 ? void 0 : _formData$venueDetail27.purposeDescription)), /*#__PURE__*/React__default.createElement(ApplicationTable, {
14169
- t: t,
14170
- data: slotlistRows,
14171
- columns: columns,
14172
- getCellProps: cellInfo => ({
14173
- style: {
14174
- minWidth: "150px",
14175
- padding: "10px",
14176
- fontSize: "16px",
14177
- paddingLeft: "20px"
14178
- }
14179
- }),
14180
- isPaginationRequired: false,
14181
- totalRecords: slotlistRows.length
14182
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
14318
+ }, t("CHALLAN_OFFENCE_DETAILS")), renderLabel(t("CHALLAN_TYPE_OFFENCE"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta = formData.offenceDetails) === null || _formData$offenceDeta === void 0 ? void 0 : _formData$offenceDeta.offenceType), renderLabel(t("CHALLAN_OFFENCE_CATEGORY"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta2 = formData.offenceDetails) === null || _formData$offenceDeta2 === void 0 ? void 0 : _formData$offenceDeta2.offenceCategory), renderLabel(t("CHALLAN_OFFENCE_SUB_CATEGORY"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta3 = formData.offenceDetails) === null || _formData$offenceDeta3 === void 0 ? void 0 : _formData$offenceDeta3.offenceSubCategory), renderLabel(t("CHALLAN_NUMBER"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta4 = formData.offenceDetails) === null || _formData$offenceDeta4 === void 0 ? void 0 : _formData$offenceDeta4.challanNumber), renderLabel(t("CHALLAN_NAME"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta5 = formData.offenceDetails) === null || _formData$offenceDeta5 === void 0 ? void 0 : _formData$offenceDeta5.challanName), renderLabel(t("CHALLAN_AMOUNT"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta6 = formData.offenceDetails) === null || _formData$offenceDeta6 === void 0 ? void 0 : _formData$offenceDeta6.challanAmount), renderLabel(t("CHALLAN_DAYS"), formData === null || formData === void 0 ? void 0 : (_formData$offenceDeta7 = formData.offenceDetails) === null || _formData$offenceDeta7 === void 0 ? void 0 : _formData$offenceDeta7.challanDaysToClearPayment)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
14183
14319
  style: {
14184
14320
  fontSize: "24px",
14185
14321
  marginTop: "30px"
@@ -14189,7 +14325,8 @@ function ChallanSummary(_ref) {
14189
14325
  display: "flex",
14190
14326
  flexDirection: "row",
14191
14327
  gap: "30px"
14192
- }
14328
+ },
14329
+ className: "force-no-margin"
14193
14330
  }, docs === null || docs === void 0 ? void 0 : docs.map((doc, index) => /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(ChallanDocument, {
14194
14331
  value: docs,
14195
14332
  Code: doc === null || doc === void 0 ? void 0 : doc.documentType,
@@ -14237,16 +14374,12 @@ const ChallanStepFormFour = _ref => {
14237
14374
  const currentStepData = reactRedux.useSelector(function (state) {
14238
14375
  return state.challan.ChallanApplicationFormReducer.formData || {};
14239
14376
  });
14240
- console.log("currentStepData===", currentStepData);
14241
14377
  const goNext = function (data) {
14242
14378
  try {
14243
- console.log("data", data);
14244
- console.log("currentStepData", currentStepData);
14245
14379
  const actionStatus = data === null || data === void 0 ? void 0 : data.action;
14246
14380
  const _temp = _catch(function () {
14247
14381
  return Promise.resolve(onSubmit(currentStepData, actionStatus)).then(function (res) {
14248
14382
  var _res$response, _res$response$hallsBo, _res$response$hallsBo2;
14249
- console.log("res", res);
14250
14383
  const id = res === null || res === void 0 ? void 0 : (_res$response = res.response) === null || _res$response === void 0 ? void 0 : (_res$response$hallsBo = _res$response.hallsBookingApplication) === null || _res$response$hallsBo === void 0 ? void 0 : (_res$response$hallsBo2 = _res$response$hallsBo[0]) === null || _res$response$hallsBo2 === void 0 ? void 0 : _res$response$hallsBo2.bookingNo;
14251
14384
  if (res !== null && res !== void 0 && res.isSuccess) {
14252
14385
  if (isCitizen) {
@@ -14290,12 +14423,10 @@ const ChallanStepFormFour = _ref => {
14290
14423
  const onSubmit = function (data, actionStatus) {
14291
14424
  try {
14292
14425
  const finalPayload = mapToNDCPayload(data, actionStatus);
14293
- console.log("finalPayload", finalPayload);
14294
14426
  return Promise.resolve(Digit.CHBServices.update(_extends({
14295
14427
  tenantId
14296
14428
  }, finalPayload))).then(function (response) {
14297
14429
  var _response$responseInf;
14298
- console.log("response", response);
14299
14430
  dispatch(RESET_ChallanAPPLICATION_FORM());
14300
14431
  if ((response === null || response === void 0 ? void 0 : (_response$responseInf = response.responseInfo) === null || _response$responseInf === void 0 ? void 0 : _response$responseInf.status) == "SUCCESSFUL") {
14301
14432
  return {
@@ -14332,8 +14463,8 @@ const ChallanStepFormFour = _ref => {
14332
14463
  }));
14333
14464
  };
14334
14465
 
14335
- const ChallanDocuments = _ref => {
14336
- var _formData$documents, _data$CHB2, _data$CHB2$Documents;
14466
+ const SelectNDCDocuments = _ref => {
14467
+ var _formData$documents, _data$Challan;
14337
14468
  let {
14338
14469
  t,
14339
14470
  config,
@@ -14344,177 +14475,120 @@ const ChallanDocuments = _ref => {
14344
14475
  clearErrors: clearFormErrors,
14345
14476
  formState
14346
14477
  } = _ref;
14347
- const [documents, setDocuments] = React.useState(formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents);
14348
- const [error, setError] = React.useState(null);
14349
- const [enableSubmit, setEnableSubmit] = React.useState(true);
14350
- const [checkRequiredFields, setCheckRequiredFields] = React.useState(false);
14351
14478
  const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
14479
+ const [documents, setDocuments] = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || []);
14480
+ const [error, setError] = React.useState(null);
14352
14481
  const {
14353
14482
  data,
14354
14483
  isLoading
14355
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
14484
+ } = Digit.Hooks.useCustomMDMS("pb", "Challan", [{
14356
14485
  name: "Documents"
14357
14486
  }]);
14358
- const handleSubmit = () => {
14359
- let document = formData.documents;
14360
- let documentStep;
14361
- documentStep = _extends({}, document, {
14362
- documents: documents
14487
+ console.log("data===????", data);
14488
+ console.log("formData", formData);
14489
+ const {
14490
+ action = "create"
14491
+ } = Digit.Hooks.useQueryParams();
14492
+ const ndcDocuments = data === null || data === void 0 ? void 0 : (_data$Challan = data.Challan) === null || _data$Challan === void 0 ? void 0 : _data$Challan.Documents;
14493
+ const goNext = () => {
14494
+ onSelect(config.key, {
14495
+ documents,
14496
+ ndcDocumentsLength: ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.length
14363
14497
  });
14364
- console.log("documentStep config.key", documentStep);
14365
- onSelect(config.key, documentStep);
14366
14498
  };
14367
- const onSkip = () => onSelect();
14368
- function onAdd() {}
14369
14499
  React.useEffect(() => {
14370
- var _data$CHB, _data$CHB$Documents;
14371
- let count = 0;
14372
- data === null || data === void 0 ? void 0 : (_data$CHB = data.CHB) === null || _data$CHB === void 0 ? void 0 : (_data$CHB$Documents = _data$CHB.Documents) === null || _data$CHB$Documents === void 0 ? void 0 : _data$CHB$Documents.map(doc => {
14373
- doc.hasDropdown = true;
14374
- let isRequired = false;
14375
- documents === null || documents === void 0 ? void 0 : documents.map(data => {
14376
- if (doc.required && data !== null && data !== void 0 && data.documentType.includes(doc.code)) isRequired = true;
14377
- });
14378
- if (!isRequired && doc.required) count = count + 1;
14379
- });
14380
- if ((count == "0" || count == 0) && (documents === null || documents === void 0 ? void 0 : documents.length) > 0) setEnableSubmit(false);else setEnableSubmit(true);
14381
- }, [documents, checkRequiredFields]);
14382
- return /*#__PURE__*/React__default.createElement("div", null, !isLoading ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormStep, {
14383
- t: t,
14384
- config: config,
14385
- onSelect: handleSubmit,
14386
- onSkip: onSkip,
14387
- isDisabled: enableSubmit,
14388
- onAdd: onAdd
14389
- }, data === null || data === void 0 ? void 0 : (_data$CHB2 = data.CHB) === null || _data$CHB2 === void 0 ? void 0 : (_data$CHB2$Documents = _data$CHB2.Documents) === null || _data$CHB2$Documents === void 0 ? void 0 : _data$CHB2$Documents.map((document, index) => {
14390
- return /*#__PURE__*/React__default.createElement(PTRSelectDocument, {
14500
+ goNext();
14501
+ }, [documents]);
14502
+ if (isLoading) {
14503
+ return /*#__PURE__*/React__default.createElement(Loader, null);
14504
+ }
14505
+ return /*#__PURE__*/React__default.createElement("div", null, ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.map((document, index) => {
14506
+ return /*#__PURE__*/React__default.createElement(SelectDocument, {
14391
14507
  key: index,
14392
14508
  document: document,
14509
+ action: action,
14393
14510
  t: t,
14394
14511
  error: error,
14395
14512
  setError: setError,
14396
14513
  setDocuments: setDocuments,
14397
14514
  documents: documents,
14398
- setCheckRequiredFields: setCheckRequiredFields,
14399
- handleSubmit: handleSubmit
14515
+ setFormError: setFormError,
14516
+ clearFormErrors: clearFormErrors,
14517
+ config: config,
14518
+ formState: formState
14400
14519
  });
14401
14520
  }), error && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
14521
+ isDleteBtn: true,
14402
14522
  label: error,
14403
14523
  onClose: () => setError(null),
14404
14524
  error: true
14405
- })) : /*#__PURE__*/React__default.createElement(Loader, null));
14525
+ }));
14406
14526
  };
14407
- function PTRSelectDocument(_ref2) {
14527
+ function SelectDocument(_ref2) {
14408
14528
  let {
14409
14529
  t,
14410
14530
  document: doc,
14411
14531
  setDocuments,
14412
14532
  setError,
14413
14533
  documents,
14414
- action,
14415
- formData,
14416
- handleSubmit,
14417
- id
14534
+ setFormError,
14535
+ config,
14536
+ formState
14418
14537
  } = _ref2;
14419
14538
  const filteredDocument = documents === null || documents === void 0 ? void 0 : documents.filter(item => {
14420
14539
  var _item$documentType;
14421
14540
  return item === null || item === void 0 ? void 0 : (_item$documentType = item.documentType) === null || _item$documentType === void 0 ? void 0 : _item$documentType.includes(doc === null || doc === void 0 ? void 0 : doc.code);
14422
14541
  })[0];
14423
14542
  const tenantId = Digit.ULBService.getCurrentTenantId();
14424
- const [selectedDocument, setSelectedDocument] = React.useState(() => {
14425
- var _doc$dropdownData2;
14426
- if (filteredDocument) {
14427
- var _doc$dropdownData, _match$code;
14428
- const match = doc === null || doc === void 0 ? void 0 : (_doc$dropdownData = doc.dropdownData) === null || _doc$dropdownData === void 0 ? void 0 : _doc$dropdownData.find(e => e.code === filteredDocument.documentType);
14429
- return match ? _extends({}, match, {
14430
- i18nKey: (_match$code = match.code) === null || _match$code === void 0 ? void 0 : _match$code.replaceAll(".", "_")
14431
- }) : {};
14432
- }
14433
- if ((doc === null || doc === void 0 ? void 0 : (_doc$dropdownData2 = doc.dropdownData) === null || _doc$dropdownData2 === void 0 ? void 0 : _doc$dropdownData2.length) === 1) {
14434
- var _onlyOption$code;
14435
- const onlyOption = doc.dropdownData[0];
14436
- return _extends({}, onlyOption, {
14437
- i18nKey: (_onlyOption$code = onlyOption.code) === null || _onlyOption$code === void 0 ? void 0 : _onlyOption$code.replaceAll(".", "_")
14438
- });
14439
- }
14440
- return {};
14441
- });
14543
+ const [getLoader, setLoader] = React.useState(false);
14442
14544
  const [file, setFile] = React.useState(null);
14443
- const [uploadedFile, setUploadedFile] = React.useState(() => (filteredDocument === null || filteredDocument === void 0 ? void 0 : filteredDocument.filestoreId) || null);
14444
- const handlePTRSelectDocument = value => setSelectedDocument(value);
14545
+ const [uploadedFile, setUploadedFile] = React.useState(() => (filteredDocument === null || filteredDocument === void 0 ? void 0 : filteredDocument.fileStoreId) || null);
14445
14546
  function selectfile(e) {
14446
14547
  setFile(e.target.files[0]);
14447
14548
  }
14448
- const {
14449
- dropdownData
14450
- } = doc;
14451
- var dropDownData = dropdownData;
14452
- const [isHidden, setHidden] = React.useState(false);
14453
- const [getLoading, setLoading] = React.useState(false);
14454
14549
  React.useEffect(() => {
14455
- if (selectedDocument !== null && selectedDocument !== void 0 && selectedDocument.code) {
14456
- console.log("selectedDocument", documents);
14550
+ if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
14551
+ setUploadedFile(filteredDocument.fileStoreId);
14552
+ }
14553
+ }, [filteredDocument]);
14554
+ React.useEffect(() => {
14555
+ if (uploadedFile) {
14457
14556
  setDocuments(prev => {
14458
- const filteredDocumentsByDocumentType = prev === null || prev === void 0 ? void 0 : prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code));
14557
+ const filteredDocumentsByDocumentType = prev === null || prev === void 0 ? void 0 : prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code));
14459
14558
  if ((uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.length) === 0 || uploadedFile === null) {
14460
14559
  return filteredDocumentsByDocumentType;
14461
14560
  }
14462
- const filteredDocumentsByFileStoreId = (filteredDocumentsByDocumentType === null || filteredDocumentsByDocumentType === void 0 ? void 0 : filteredDocumentsByDocumentType.filter(item => (item === null || item === void 0 ? void 0 : item.fileStoreId) !== uploadedFile)) || [];
14561
+ const filteredDocumentsByFileStoreId = filteredDocumentsByDocumentType === null || filteredDocumentsByDocumentType === void 0 ? void 0 : filteredDocumentsByDocumentType.filter(item => (item === null || item === void 0 ? void 0 : item.fileStoreId) !== uploadedFile);
14463
14562
  return [...filteredDocumentsByFileStoreId, {
14464
- documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code,
14465
- filestoreId: uploadedFile,
14563
+ documentType: doc === null || doc === void 0 ? void 0 : doc.code,
14564
+ fileStoreId: uploadedFile,
14466
14565
  documentUid: uploadedFile
14467
14566
  }];
14468
14567
  });
14568
+ } else if (uploadedFile === null) {
14569
+ setDocuments(prev => prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code)));
14469
14570
  }
14470
- }, [uploadedFile, selectedDocument]);
14471
- React.useEffect(() => {
14472
- if ((documents === null || documents === void 0 ? void 0 : documents.length) > 0) {
14473
- console.log("documents", documents);
14474
- handleSubmit();
14475
- }
14476
- }, [documents]);
14477
- React.useEffect(() => {
14478
- if (action === "update") {
14479
- var _formData$originalDat, _formData$originalDat2;
14480
- const originalDoc = formData === null || formData === void 0 ? void 0 : (_formData$originalDat = formData.originalData) === null || _formData$originalDat === void 0 ? void 0 : (_formData$originalDat2 = _formData$originalDat.documents) === null || _formData$originalDat2 === void 0 ? void 0 : _formData$originalDat2.filter(e => e.documentType.includes(doc === null || doc === void 0 ? void 0 : doc.code))[0];
14481
- const docType = dropDownData.filter(e => e.code === (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.documentType)).map(e => {
14482
- var _e$code;
14483
- return _extends({}, e, {
14484
- i18nKey: e === null || e === void 0 ? void 0 : (_e$code = e.code) === null || _e$code === void 0 ? void 0 : _e$code.replaceAll(".", "_")
14485
- });
14486
- })[0];
14487
- if (!docType) setHidden(true);else {
14488
- setSelectedDocument(docType);
14489
- setUploadedFile(originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.fileStoreId);
14490
- }
14491
- }
14492
- }, []);
14493
- React.useEffect(() => {
14494
- if (!(doc !== null && doc !== void 0 && doc.hasDropdown)) {
14495
- var _doc$code;
14496
- setSelectedDocument({
14497
- code: doc === null || doc === void 0 ? void 0 : doc.code,
14498
- i18nKey: doc === null || doc === void 0 ? void 0 : (_doc$code = doc.code) === null || _doc$code === void 0 ? void 0 : _doc$code.replaceAll(".", "_")
14499
- });
14500
- }
14501
- }, []);
14571
+ }, [uploadedFile]);
14502
14572
  React.useEffect(() => {
14503
14573
  (function () {
14504
14574
  try {
14505
14575
  setError(null);
14506
14576
  const _temp3 = function () {
14507
14577
  if (file) {
14508
- setLoading(true);
14578
+ setLoader(true);
14509
14579
  const _temp2 = function () {
14510
14580
  if (file.size >= 5242880) {
14511
14581
  setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
14582
+ setLoader(false);
14583
+ if (!formState.errors[config.key]) setFormError(config.key, {
14584
+ type: doc === null || doc === void 0 ? void 0 : doc.code
14585
+ });
14512
14586
  } else {
14513
14587
  const _temp = _catch(function () {
14514
14588
  setUploadedFile(null);
14515
- return Promise.resolve(Digit.UploadServices.Filestorage("PTR", file, Digit.ULBService.getStateId())).then(function (response) {
14589
+ return Promise.resolve(Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId())).then(function (response) {
14516
14590
  var _response$data, _response$data$files;
14517
- setLoading(false);
14591
+ setLoader(false);
14518
14592
  if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
14519
14593
  var _response$data2, _response$data2$files;
14520
14594
  setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
@@ -14523,7 +14597,7 @@ function PTRSelectDocument(_ref2) {
14523
14597
  }
14524
14598
  });
14525
14599
  }, function () {
14526
- setLoading(false);
14600
+ setLoader(false);
14527
14601
  setError(t("CS_FILE_UPLOAD_ERROR"));
14528
14602
  });
14529
14603
  if (_temp && _temp.then) return _temp.then(function () {});
@@ -14538,67 +14612,33 @@ function PTRSelectDocument(_ref2) {
14538
14612
  }
14539
14613
  })();
14540
14614
  }, [file]);
14541
- React.useEffect(() => {
14542
- if (isHidden) setUploadedFile(null);
14543
- }, [isHidden]);
14544
14615
  return /*#__PURE__*/React__default.createElement("div", {
14545
14616
  style: {
14546
- marginBottom: "24px",
14547
- width: "50%"
14617
+ marginBottom: "40px"
14548
14618
  }
14549
- }, doc !== null && doc !== void 0 && doc.hasDropdown ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
14619
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
14550
14620
  style: {
14551
14621
  display: "inline"
14552
14622
  }
14553
14623
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
14554
14624
  style: {
14625
+ marginBottom: "8px",
14555
14626
  width: "auto"
14556
14627
  }
14557
- }, t(doc === null || doc === void 0 ? void 0 : doc.code), " ", (doc === null || doc === void 0 ? void 0 : doc.required) && " *"), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
14558
- className: "form-field",
14559
- selected: selectedDocument,
14560
- style: {
14561
- width: "100%"
14562
- },
14563
- option: doc === null || doc === void 0 ? void 0 : doc.dropdownData.map(e => {
14564
- var _e$code2;
14565
- return _extends({}, e, {
14566
- i18nKey: (_e$code2 = e.code) === null || _e$code2 === void 0 ? void 0 : _e$code2.replaceAll(".", "_")
14567
- });
14568
- }),
14569
- select: handlePTRSelectDocument,
14570
- optionKey: "i18nKey",
14571
- t: t
14572
- })) : null, !(doc !== null && doc !== void 0 && doc.hasDropdown) ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
14573
- className: "card-label-smaller"
14574
- }, t(doc === null || doc === void 0 ? void 0 : doc.code.replaceAll(".", "_")) + " *")) : null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
14575
- style: {
14576
- display: "inline"
14577
- }
14578
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
14579
- className: "card-label-smaller"
14580
- }), /*#__PURE__*/React__default.createElement("div", {
14581
- className: "field",
14582
- style: {
14583
- width: "100%"
14584
- }
14628
+ }, t(doc === null || doc === void 0 ? void 0 : doc.code), " ", (doc === null || doc === void 0 ? void 0 : doc.required) && " *"), /*#__PURE__*/React__default.createElement("div", {
14629
+ className: "field"
14585
14630
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
14631
+ id: "tl-doc",
14586
14632
  onUpload: selectfile,
14587
14633
  onDelete: () => {
14588
14634
  setUploadedFile(null);
14589
14635
  },
14590
- id: id,
14591
14636
  message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
14592
14637
  textStyles: {
14593
14638
  width: "100%"
14594
14639
  },
14595
- inputStyles: {
14596
- width: "280px"
14597
- },
14598
- accept: ".pdf, .jpeg, .jpg, .png",
14599
- buttonType: "button",
14600
- error: !uploadedFile
14601
- }))), getLoading && /*#__PURE__*/React__default.createElement(Loader, {
14640
+ accept: "image/*,.pdf"
14641
+ }))), getLoader && /*#__PURE__*/React__default.createElement(Loader, {
14602
14642
  page: true
14603
14643
  }));
14604
14644
  }
@@ -14721,7 +14761,7 @@ const componentsToRegister = {
14721
14761
  OffenderDetails,
14722
14762
  OffenceDetails,
14723
14763
  ChallanSummary,
14724
- ChallanDocuments
14764
+ ChallanDocuments: SelectNDCDocuments
14725
14765
  };
14726
14766
  const initChallanGenerationComponents = () => {
14727
14767
  Object.entries(componentsToRegister).forEach(_ref3 => {