@djb25/digit-ui-module-vendor 1.0.37 → 1.0.39

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.
@@ -26,8 +26,10 @@ const EmployeeApp = ({
26
26
  const VehicleDetails = Digit.ComponentRegistryService.getComponent("VehicleDetails");
27
27
  const AddSupervisor = Digit.ComponentRegistryService.getComponent("AddSupervisor");
28
28
  const SupervisorDetails = Digit.ComponentRegistryService.getComponent("SupervisorDetails");
29
+ const EditSupervisor = Digit.ComponentRegistryService.getComponent("EditSupervisor");
29
30
  const AddSurveyor = Digit.ComponentRegistryService.getComponent("AddSurveyor");
30
31
  const SurveyorDetails = Digit.ComponentRegistryService.getComponent("SurveyorDetails");
32
+ const EditSurveyor = Digit.ComponentRegistryService.getComponent("EditSurveyor");
31
33
  const EditDriver = Digit.ComponentRegistryService.getComponent("EditDriver");
32
34
  const EditVehicle = Digit.ComponentRegistryService.getComponent("EditVehicle");
33
35
  const getDynamicBreadcrumbs = () => {
@@ -192,6 +194,13 @@ const EmployeeApp = ({
192
194
  }, /*#__PURE__*/React.createElement(SupervisorDetails, Object.assign({}, props, {
193
195
  parentRoute: path
194
196
  })))
197
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
198
+ path: `${path}/registry/modify-supervisor/:id`,
199
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
200
+ layoutClass: "action"
201
+ }, /*#__PURE__*/React.createElement(EditSupervisor, Object.assign({}, props, {
202
+ parentRoute: path
203
+ })))
195
204
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
196
205
  path: `${path}/registry/new-surveyor`,
197
206
  component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
@@ -206,6 +215,13 @@ const EmployeeApp = ({
206
215
  }, /*#__PURE__*/React.createElement(SurveyorDetails, Object.assign({}, props, {
207
216
  parentRoute: path
208
217
  })))
218
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
219
+ path: `${path}/registry/modify-surveyor/:id`,
220
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
221
+ layoutClass: "action"
222
+ }, /*#__PURE__*/React.createElement(EditSurveyor, Object.assign({}, props, {
223
+ parentRoute: path
224
+ })))
209
225
  })))));
210
226
  };
211
227
 
@@ -215,7 +231,10 @@ const VENDORCard = () => {
215
231
  } = useTranslation();
216
232
  const history = useHistory();
217
233
  const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
218
- const hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
234
+ let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
235
+ if (isCitizen) {
236
+ hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
237
+ }
219
238
  if (!hasAccess) {
220
239
  return null;
221
240
  }
@@ -3415,7 +3434,6 @@ const VendorInbox = props => {
3415
3434
  ekyc: matchedEkycRoles,
3416
3435
  wt: matchedWtRoles
3417
3436
  };
3418
- console.log(matchedRoles);
3419
3437
  return /*#__PURE__*/React.createElement("div", {
3420
3438
  className: "inbox-container"
3421
3439
  }, props.userRole !== "FSM_EMP_FSTPO" && props.userRole !== "FSM_ADMIN" && !props.isSearch && /*#__PURE__*/React.createElement("div", {
@@ -5995,310 +6013,44 @@ const AddSupervisor = ({
5995
6013
  })));
5996
6014
  };
5997
6015
 
5998
- const {
5999
- Dropdown: Dropdown$2,
6000
- DatePicker: DatePicker$2
6001
- } = require("@djb25/digit-ui-react-components");
6002
- const SurveyorConfig = (t, agencies = [], reportingManagers = [], disabled = false) => {
6003
- return [{
6004
- head: "ES_VENDOR_SURVEYOR_BASIC_DETAILS",
6005
- body: [{
6006
- label: "ES_VENDOR_SURVEYOR_FULL_NAME",
6007
- isMandatory: true,
6008
- type: "text",
6009
- populators: {
6010
- name: "fullName",
6011
- validation: {
6012
- required: true,
6013
- pattern: /^[A-Za-z\s]+$/
6014
- },
6015
- error: t("ES_VENDOR_INVALID_NAME")
6016
- }
6017
- }, {
6018
- label: "ES_VENDOR_SURVEYOR_MOBILE_NUMBER",
6019
- isMandatory: true,
6020
- type: "mobileNumber",
6021
- populators: {
6022
- name: "mobileNumber",
6023
- validation: {
6024
- required: true,
6025
- pattern: /^[6-9]\d{9}$/
6026
- },
6027
- error: t("ES_VENDOR_INVALID_MOBILE")
6028
- }
6029
- }, {
6030
- label: "ES_VENDOR_SURVEYOR_EMAIL_ID",
6031
- isMandatory: true,
6032
- type: "text",
6033
- populators: {
6034
- name: "emailId",
6035
- validation: {
6036
- required: true,
6037
- pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
6038
- },
6039
- error: t("ES_VENDOR_INVALID_EMAIL")
6040
- }
6041
- }, {
6042
- label: "ES_VENDOR_SURVEYOR_STAFF_CODE",
6043
- isMandatory: true,
6044
- type: "text",
6045
- populators: {
6046
- name: "employeeId",
6047
- validation: {
6048
- required: true
6049
- }
6050
- }
6051
- }, {
6052
- label: t("ES_VENDOR_SURVEYOR_GENDER"),
6053
- isMandatory: true,
6054
- type: "component",
6055
- key: "gender",
6056
- component: "SelectGender"
6057
- }, {
6058
- label: t("ES_FSM_REGISTRY_NEW_FATHER_NAME"),
6059
- isMandatory: true,
6060
- type: "text",
6061
- populators: {
6062
- name: "fatherOrHusbandName",
6063
- validation: {
6064
- required: true
6065
- },
6066
- className: "payment-form-text-input-correction"
6067
- }
6068
- }, {
6069
- label: t("ES_FSM_REGISTRY_NEW_RELATIONSHIP"),
6070
- isMandatory: true,
6071
- type: "component",
6072
- key: "relationship",
6073
- component: "SelectEkycDropdown",
6074
- populators: {
6075
- name: "relationship",
6076
- options: [{
6077
- code: "FATHER",
6078
- name: "ES_COMMON_RELATION_FATHER"
6079
- }, {
6080
- code: "HUSBAND",
6081
- name: "ES_COMMON_RELATION_HUSBAND"
6082
- }, {
6083
- code: "OTHER",
6084
- name: "ES_COMMON_RELATION_OTHER"
6085
- }],
6086
- optionsKey: "name"
6087
- }
6088
- }, {
6089
- label: t("ES_FSM_REGISTRY_NEW_DOB"),
6090
- isMandatory: true,
6091
- type: "custom",
6092
- key: "dob",
6093
- populators: {
6094
- name: "dob",
6095
- validation: {
6096
- required: true
6097
- },
6098
- component: (props, customProps) => /*#__PURE__*/React.createElement(DatePicker$2, Object.assign({
6099
- onChange: props.onChange,
6100
- date: props.value
6101
- }, customProps))
6102
- }
6103
- }, {
6104
- label: t("ES_FSM_REGISTRY_NEW_CORRESPONDENCE_ADDRESS"),
6105
- isMandatory: true,
6106
- type: "text",
6107
- populators: {
6108
- name: "correspondenceAddress",
6109
- validation: {
6110
- required: true
6111
- },
6112
- className: "payment-form-text-input-correction"
6113
- }
6114
- }, {
6115
- label: t("ES_VENDOR_SURVEYOR_DESCRIPTION"),
6116
- isMandatory: false,
6117
- type: "text",
6118
- populators: {
6119
- name: "description",
6120
- className: "payment-form-text-input-correction"
6121
- }
6122
- }]
6123
- }];
6016
+ const Heading$1 = props => {
6017
+ return /*#__PURE__*/React.createElement("h1", {
6018
+ className: "heading-m"
6019
+ }, props.label);
6124
6020
  };
6125
-
6126
- const AddSurveyor = ({
6127
- parentUrl,
6128
- heading
6129
- }) => {
6130
- var _Digit$UserService$ge;
6021
+ const Close$1 = () => /*#__PURE__*/React.createElement("svg", {
6022
+ xmlns: "http://www.w3.org/2000/svg",
6023
+ viewBox: "0 0 24 24",
6024
+ fill: "#FFFFFF"
6025
+ }, /*#__PURE__*/React.createElement("path", {
6026
+ d: "M0 0h24v24H0V0z",
6027
+ fill: "none"
6028
+ }), /*#__PURE__*/React.createElement("path", {
6029
+ 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"
6030
+ }));
6031
+ const CloseBtn$1 = props => {
6032
+ return /*#__PURE__*/React.createElement("div", {
6033
+ className: "icon-bg-secondary",
6034
+ onClick: props.onClick
6035
+ }, /*#__PURE__*/React.createElement(Close$1, null));
6036
+ };
6037
+ const SupervisorDetails = props => {
6038
+ var _supervisorData$5, _supervisorData$5$emp;
6039
+ const tenantId = Digit.ULBService.getCurrentTenantId();
6131
6040
  const {
6132
6041
  t
6133
6042
  } = useTranslation();
6134
- const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
6135
- const rawTenantId = Digit.ULBService.getCurrentTenantId();
6136
- const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : `${rawTenantId}.djb`;
6137
- const [showToast, setShowToast] = useState(null);
6043
+ const history = useHistory();
6138
6044
  const queryClient = useQueryClient();
6139
- const [canSubmit, setCanSubmit] = useState(false);
6140
6045
  const {
6141
- mutate
6142
- } = Digit.Hooks.fsm.useSurveyorCreate(tenantId);
6143
- const {
6144
- search
6145
- } = useLocation();
6146
- const queryParams = new URLSearchParams(search);
6147
- const vendorIdParam = queryParams.get("vendorId");
6148
- const Config = SurveyorConfig(t);
6149
- const defaultValues = {
6150
- role: {
6151
- code: "SURVEYOR",
6152
- name: "Surveyor"
6153
- }
6154
- };
6155
- const onFormValueChange = (setValue, formData) => {
6156
- const isBasicDetailsFilled = (formData === null || formData === void 0 ? void 0 : formData.fullName) && (formData === null || formData === void 0 ? void 0 : formData.mobileNumber) && (formData === null || formData === void 0 ? void 0 : formData.emailId) && (formData === null || formData === void 0 ? void 0 : formData.employeeId) && (formData === null || formData === void 0 ? void 0 : formData.fatherOrHusbandName) && (formData === null || formData === void 0 ? void 0 : formData.relationship) && (formData === null || formData === void 0 ? void 0 : formData.dob) && (formData === null || formData === void 0 ? void 0 : formData.correspondenceAddress);
6157
- if (isBasicDetailsFilled) {
6158
- setCanSubmit(true);
6159
- } else {
6160
- setCanSubmit(false);
6161
- }
6162
- };
6163
- const closeToast = () => {
6164
- setShowToast(null);
6165
- };
6166
- const onSubmit = data => {
6167
- var _data$agencyName, _data$agencyName2, _data$reportingManage, _data$reportingManage2, _data$relationship, _data$gender;
6168
- const formData = {
6169
- RequestInfo: {
6170
- apiId: "Rainmaker",
6171
- ver: "1.0",
6172
- ts: null,
6173
- action: "_create",
6174
- msgId: `${Date.now()}|en_IN`,
6175
- authToken: userInfo === null || userInfo === void 0 ? void 0 : userInfo.authToken,
6176
- userInfo: {
6177
- id: userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
6178
- uuid: userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid,
6179
- userName: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userName,
6180
- name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
6181
- type: userInfo === null || userInfo === void 0 ? void 0 : userInfo.type,
6182
- tenantId: tenantId,
6183
- roles: userInfo === null || userInfo === void 0 ? void 0 : userInfo.roles
6184
- }
6185
- },
6186
- surveyor: {
6187
- tenantId: tenantId,
6188
- vendorId: vendorIdParam || (data === null || data === void 0 ? void 0 : (_data$agencyName = data.agencyName) === null || _data$agencyName === void 0 ? void 0 : _data$agencyName.code) || (data === null || data === void 0 ? void 0 : (_data$agencyName2 = data.agencyName) === null || _data$agencyName2 === void 0 ? void 0 : _data$agencyName2.id) || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid),
6189
- supervisorId: (data === null || data === void 0 ? void 0 : (_data$reportingManage = data.reportingManager) === null || _data$reportingManage === void 0 ? void 0 : _data$reportingManage.code) || (data === null || data === void 0 ? void 0 : (_data$reportingManage2 = data.reportingManager) === null || _data$reportingManage2 === void 0 ? void 0 : _data$reportingManage2.id) || null,
6190
- description: (data === null || data === void 0 ? void 0 : data.description) || "",
6191
- additionalDetails: {
6192
- serviceType: "ekyc"
6193
- },
6194
- owner: {
6195
- tenantId: tenantId,
6196
- name: data === null || data === void 0 ? void 0 : data.fullName,
6197
- fatherOrHusbandName: data === null || data === void 0 ? void 0 : data.fatherOrHusbandName,
6198
- relationship: data === null || data === void 0 ? void 0 : (_data$relationship = data.relationship) === null || _data$relationship === void 0 ? void 0 : _data$relationship.code,
6199
- gender: (data === null || data === void 0 ? void 0 : (_data$gender = data.gender) === null || _data$gender === void 0 ? void 0 : _data$gender.code) || "OTHERS",
6200
- dob: data !== null && data !== void 0 && data.dob ? new Date(data.dob).getTime() : null,
6201
- emailId: data === null || data === void 0 ? void 0 : data.emailId,
6202
- mobileNumber: data === null || data === void 0 ? void 0 : data.mobileNumber,
6203
- correspondenceAddress: data === null || data === void 0 ? void 0 : data.correspondenceAddress
6204
- }
6205
- }
6206
- };
6207
- mutate(formData, {
6208
- onError: error => {
6209
- setShowToast({
6210
- key: "error",
6211
- action: error
6212
- });
6213
- setTimeout(closeToast, 5000);
6214
- },
6215
- onSuccess: () => {
6216
- setShowToast({
6217
- key: "success",
6218
- action: "ADD_SURVEYOR"
6219
- });
6220
- queryClient.invalidateQueries("SURVEYOR_SEARCH");
6221
- setTimeout(closeToast, 5000);
6222
- }
6223
- });
6224
- };
6225
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
6226
- config: [{
6227
- route: "surveyor-details",
6228
- timeLine: [{
6229
- actions: t("ES_VENDOR_SURVEYOR_DETAILS"),
6230
- currentStep: 1
6231
- }]
6232
- }],
6233
- currentActiveIndex: 0,
6234
- showFinalStep: false
6235
- }), /*#__PURE__*/React.createElement("div", {
6236
- style: {
6237
- flex: "1",
6238
- overflowY: "auto"
6239
- }
6240
- }, /*#__PURE__*/React.createElement(FormComposer, {
6241
- isDisabled: !canSubmit,
6242
- label: t("ES_COMMON_APPLICATION_SUBMIT"),
6243
- config: Config.map(config => ({
6244
- ...config,
6245
- isCollapsible: true,
6246
- isDefaultOpen: true
6247
- })),
6248
- fieldStyle: {
6249
- marginRight: 0
6250
- },
6251
- onSubmit: onSubmit,
6252
- defaultValues: defaultValues,
6253
- onFormValueChange: onFormValueChange,
6254
- noBreakLine: true,
6255
- mode: "onChange",
6256
- noCard: true
6257
- }), showToast && /*#__PURE__*/React.createElement(Toast, {
6258
- error: showToast.key === "error",
6259
- label: t(showToast.key === "success" ? `ES_VENDOR_${showToast.action}_SUCCESS` : showToast.action),
6260
- onClose: closeToast
6261
- })));
6262
- };
6263
-
6264
- const Heading$1 = props => {
6265
- return /*#__PURE__*/React.createElement("h1", {
6266
- className: "heading-m"
6267
- }, props.label);
6268
- };
6269
- const Close$1 = () => /*#__PURE__*/React.createElement("svg", {
6270
- xmlns: "http://www.w3.org/2000/svg",
6271
- viewBox: "0 0 24 24",
6272
- fill: "#FFFFFF"
6273
- }, /*#__PURE__*/React.createElement("path", {
6274
- d: "M0 0h24v24H0V0z",
6275
- fill: "none"
6276
- }), /*#__PURE__*/React.createElement("path", {
6277
- 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"
6278
- }));
6279
- const CloseBtn$1 = props => {
6280
- return /*#__PURE__*/React.createElement("div", {
6281
- className: "icon-bg-secondary",
6282
- onClick: props.onClick
6283
- }, /*#__PURE__*/React.createElement(Close$1, null));
6284
- };
6285
- const SurveyorDetails = props => {
6286
- var _surveyorData$5, _surveyorData$5$emplo;
6287
- const tenantId = Digit.ULBService.getCurrentTenantId();
6288
- const {
6289
- t
6290
- } = useTranslation();
6291
- const history = useHistory();
6292
- const queryClient = useQueryClient();
6293
- const {
6294
- id: surveyorId
6295
- } = useParams();
6296
- const [displayMenu, setDisplayMenu] = useState(false);
6297
- const [selectedAction, setSelectedAction] = useState(null);
6298
- const [showModal, setShowModal] = useState(false);
6299
- const [showToast, setShowToast] = useState(null);
6300
- const [vendors, setVendors] = useState([]);
6301
- const [selectedOption, setSelectedOption] = useState({});
6046
+ id: supervisorId
6047
+ } = useParams();
6048
+ const [displayMenu, setDisplayMenu] = useState(false);
6049
+ const [selectedAction, setSelectedAction] = useState(null);
6050
+ const [showModal, setShowModal] = useState(false);
6051
+ const [showToast, setShowToast] = useState(null);
6052
+ const [vendors, setVendors] = useState([]);
6053
+ const [selectedOption, setSelectedOption] = useState({});
6302
6054
  const {
6303
6055
  data: vendorData
6304
6056
  } = Digit.Hooks.fsm.useDsoSearch(tenantId, {
@@ -6307,18 +6059,18 @@ const SurveyorDetails = props => {
6307
6059
  status: "ACTIVE"
6308
6060
  }, {});
6309
6061
  const {
6310
- data: surveyorSearchResponse,
6062
+ data: supervisorSearchResponse,
6311
6063
  isLoading,
6312
6064
  refetch
6313
- } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
6314
- ids: surveyorId
6065
+ } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6066
+ ids: supervisorId
6315
6067
  }, {
6316
6068
  staleTime: Infinity
6317
6069
  });
6318
- const surveyorData = React.useMemo(() => {
6319
- var _surveyorSearchRespon;
6320
- if (!(surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && (_surveyorSearchRespon = surveyorSearchResponse.surveyors) !== null && _surveyorSearchRespon !== void 0 && _surveyorSearchRespon.length)) return [];
6321
- return surveyorSearchResponse.surveyors.map(data => {
6070
+ const supervisorData = React.useMemo(() => {
6071
+ var _supervisorSearchResp;
6072
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && (_supervisorSearchResp = supervisorSearchResponse.supervisors) !== null && _supervisorSearchResp !== void 0 && _supervisorSearchResp.length)) return [];
6073
+ return supervisorSearchResponse.supervisors.map(data => {
6322
6074
  var _mappedVendor$dsoDeta, _data$owner, _data$owner2, _data$owner3;
6323
6075
  const mappedVendor = vendorData === null || vendorData === void 0 ? void 0 : vendorData.find(v => {
6324
6076
  var _v$dsoDetails, _v$dsoDetails2;
@@ -6326,39 +6078,43 @@ const SurveyorDetails = props => {
6326
6078
  });
6327
6079
  const vendorName = (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || data.vendorId || "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR";
6328
6080
  return {
6329
- surveyorData: data,
6081
+ supervisorData: data,
6330
6082
  vendorDetails: {
6331
6083
  vendor: mappedVendor ? [mappedVendor.dsoDetails] : []
6332
6084
  },
6333
6085
  employeeResponse: [{
6334
- title: "ES_VENDOR_SURVEYOR_BASIC_DETAILS",
6086
+ title: "ES_VENDOR_SUPERVISOR_BASIC_DETAILS",
6335
6087
  values: [{
6336
- title: "ES_VENDOR_SURVEYOR_FULL_NAME",
6088
+ title: "ES_VENDOR_SUPERVISOR_FULL_NAME",
6337
6089
  value: data === null || data === void 0 ? void 0 : data.name
6338
6090
  }, {
6339
- title: "ES_VENDOR_SURVEYOR_MOBILE_NUMBER",
6091
+ title: "ES_VENDOR_SUPERVISOR_MOBILE_NUMBER",
6340
6092
  value: (data === null || data === void 0 ? void 0 : (_data$owner = data.owner) === null || _data$owner === void 0 ? void 0 : _data$owner.mobileNumber) || (data === null || data === void 0 ? void 0 : data.mobileNo)
6341
6093
  }, {
6342
- title: "ES_VENDOR_SURVEYOR_EMAIL_ID",
6094
+ title: "ES_VENDOR_SUPERVISOR_EMAIL_ID",
6343
6095
  value: data === null || data === void 0 ? void 0 : (_data$owner2 = data.owner) === null || _data$owner2 === void 0 ? void 0 : _data$owner2.emailId
6344
6096
  }, {
6345
- title: "ES_VENDOR_SURVEYOR_STAFF_CODE",
6097
+ title: "ES_VENDOR_SUPERVISOR_STAFF_CODE",
6346
6098
  value: (data === null || data === void 0 ? void 0 : data.employeeId) || "N/A"
6347
6099
  }, {
6348
- title: "ES_VENDOR_SURVEYOR_GENDER",
6100
+ title: "ES_VENDOR_SUPERVISOR_GENDER",
6349
6101
  value: data === null || data === void 0 ? void 0 : (_data$owner3 = data.owner) === null || _data$owner3 === void 0 ? void 0 : _data$owner3.gender
6350
6102
  }, {
6351
- title: "ES_VENDOR_SURVEYOR_AGENCY_NAME",
6103
+ title: "ES_VENDOR_SUPERVISOR_AGENCY_NAME",
6352
6104
  value: vendorName,
6353
6105
  type: "custom"
6354
6106
  }]
6107
+ }, {
6108
+ title: "ES_VENDOR_SUPERVISOR_MAPPED_SURVEYORS",
6109
+ type: "ES_FSM_REGISTRY_DETAILS_TYPE_SURVEYOR",
6110
+ child: []
6355
6111
  }]
6356
6112
  };
6357
6113
  });
6358
- }, [surveyorSearchResponse, vendorData]);
6114
+ }, [supervisorSearchResponse, vendorData]);
6359
6115
  const {
6360
- mutate: mutateSurveyor
6361
- } = Digit.Hooks.fsm.useSurveyorUpdate(tenantId);
6116
+ mutate: mutateSupervisor
6117
+ } = Digit.Hooks.fsm.useSupervisorUpdate(tenantId);
6362
6118
  const {
6363
6119
  mutate: mutateVendor
6364
6120
  } = Digit.Hooks.fsm.useVendorUpdate(tenantId);
@@ -6379,9 +6135,9 @@ const SurveyorDetails = props => {
6379
6135
  case "DELETE_VENDOR":
6380
6136
  return setShowModal(true);
6381
6137
  case "EDIT":
6382
- return history.push("/digit-ui/employee/vendor/modify-surveyor/" + surveyorId);
6138
+ return history.push("/digit-ui/employee/vendor/registry/modify-supervisor/" + supervisorId);
6383
6139
  case "HOME":
6384
- return history.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SURVEYOR");
6140
+ return history.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SUPERVISOR");
6385
6141
  }
6386
6142
  }, [selectedAction]);
6387
6143
  const closeToast = () => {
@@ -6390,7 +6146,7 @@ const SurveyorDetails = props => {
6390
6146
  const handleModalAction = () => {
6391
6147
  switch (selectedAction) {
6392
6148
  case "DELETE":
6393
- return handleDeleteSurveyor();
6149
+ return handleDeleteSupervisor();
6394
6150
  case "DELETE_VENDOR":
6395
6151
  return handleDeleteVendor();
6396
6152
  case "ADD_VENDOR":
@@ -6399,16 +6155,16 @@ const SurveyorDetails = props => {
6399
6155
  return handleEditVendor();
6400
6156
  }
6401
6157
  };
6402
- const handleDeleteSurveyor = () => {
6403
- var _surveyorData$;
6404
- let details = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$ = surveyorData[0]) === null || _surveyorData$ === void 0 ? void 0 : _surveyorData$.surveyorData;
6158
+ const handleDeleteSupervisor = () => {
6159
+ var _supervisorData$;
6160
+ let details = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$ = supervisorData[0]) === null || _supervisorData$ === void 0 ? void 0 : _supervisorData$.supervisorData;
6405
6161
  const formData = {
6406
- surveyor: {
6162
+ supervisor: {
6407
6163
  ...details,
6408
6164
  status: "INACTIVE"
6409
6165
  }
6410
6166
  };
6411
- mutateSurveyor(formData, {
6167
+ mutateSupervisor(formData, {
6412
6168
  onError: error => {
6413
6169
  setShowToast({
6414
6170
  key: "error",
@@ -6419,9 +6175,9 @@ const SurveyorDetails = props => {
6419
6175
  onSuccess: () => {
6420
6176
  setShowToast({
6421
6177
  key: "success",
6422
- action: "DELETE_SURVEYOR"
6178
+ action: "DELETE_SUPERVISOR"
6423
6179
  });
6424
- queryClient.invalidateQueries("SURVEYOR_SEARCH");
6180
+ queryClient.invalidateQueries("SUPERVISOR_SEARCH");
6425
6181
  setTimeout(() => {
6426
6182
  closeToast();
6427
6183
  history.push(`/digit-ui/employee/vendor/search-vendor`);
@@ -6431,19 +6187,19 @@ const SurveyorDetails = props => {
6431
6187
  setShowModal(false);
6432
6188
  };
6433
6189
  const handleDeleteVendor = () => {
6434
- var _surveyorData$2, _surveyorData$2$vendo, _surveyorData$2$vendo2;
6435
- let dsoDetails = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$2 = surveyorData[0]) === null || _surveyorData$2 === void 0 ? void 0 : (_surveyorData$2$vendo = _surveyorData$2.vendorDetails) === null || _surveyorData$2$vendo === void 0 ? void 0 : (_surveyorData$2$vendo2 = _surveyorData$2$vendo.vendor) === null || _surveyorData$2$vendo2 === void 0 ? void 0 : _surveyorData$2$vendo2[0];
6436
- let getSurveyorVendorDetails = (dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.surveyors) || [];
6437
- getSurveyorVendorDetails = getSurveyorVendorDetails.map(data => {
6438
- if (data.id === surveyorId) {
6439
- data.vendorSurveyorStatus = "INACTIVE";
6190
+ var _supervisorData$2, _supervisorData$2$ven, _supervisorData$2$ven2;
6191
+ let dsoDetails = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$2 = supervisorData[0]) === null || _supervisorData$2 === void 0 ? void 0 : (_supervisorData$2$ven = _supervisorData$2.vendorDetails) === null || _supervisorData$2$ven === void 0 ? void 0 : (_supervisorData$2$ven2 = _supervisorData$2$ven.vendor) === null || _supervisorData$2$ven2 === void 0 ? void 0 : _supervisorData$2$ven2[0];
6192
+ let getSupervisorVendorDetails = (dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.supervisors) || [];
6193
+ getSupervisorVendorDetails = getSupervisorVendorDetails.map(data => {
6194
+ if (data.id === supervisorId) {
6195
+ data.vendorSupervisorStatus = "INACTIVE";
6440
6196
  }
6441
6197
  return data;
6442
6198
  });
6443
6199
  const formData = {
6444
6200
  vendor: {
6445
6201
  ...dsoDetails,
6446
- surveyors: getSurveyorVendorDetails
6202
+ supervisors: getSupervisorVendorDetails
6447
6203
  }
6448
6204
  };
6449
6205
  mutateVendor(formData, {
@@ -6467,14 +6223,14 @@ const SurveyorDetails = props => {
6467
6223
  setShowModal(false);
6468
6224
  };
6469
6225
  const handleAddVendor = () => {
6470
- var _surveyorData$3;
6226
+ var _supervisorData$3;
6471
6227
  let dsoDetails = selectedOption;
6472
- let details = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$3 = surveyorData[0]) === null || _surveyorData$3 === void 0 ? void 0 : _surveyorData$3.surveyorData;
6473
- details.vendorSurveyorStatus = "ACTIVE";
6228
+ let details = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$3 = supervisorData[0]) === null || _supervisorData$3 === void 0 ? void 0 : _supervisorData$3.supervisorData;
6229
+ details.vendorSupervisorStatus = "ACTIVE";
6474
6230
  const formData = {
6475
6231
  vendor: {
6476
6232
  ...dsoDetails,
6477
- surveyors: dsoDetails.surveyors ? [...dsoDetails.surveyors, details] : [details]
6233
+ supervisors: dsoDetails.supervisors ? [...dsoDetails.supervisors, details] : [details]
6478
6234
  }
6479
6235
  };
6480
6236
  mutateVendor(formData, {
@@ -6491,7 +6247,7 @@ const SurveyorDetails = props => {
6491
6247
  key: "success",
6492
6248
  action: "ADD_VENDOR"
6493
6249
  });
6494
- queryClient.invalidateQueries("SURVEYOR_SEARCH");
6250
+ queryClient.invalidateQueries("SUPERVISOR_SEARCH");
6495
6251
  refetch();
6496
6252
  setTimeout(closeToast, 5000);
6497
6253
  }
@@ -6500,14 +6256,14 @@ const SurveyorDetails = props => {
6500
6256
  setSelectedAction(null);
6501
6257
  };
6502
6258
  const handleEditVendor = () => {
6503
- var _surveyorData$4;
6259
+ var _supervisorData$4;
6504
6260
  let dsoDetails = selectedOption;
6505
- let details = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$4 = surveyorData[0]) === null || _surveyorData$4 === void 0 ? void 0 : _surveyorData$4.surveyorData;
6506
- details.vendorSurveyorStatus = "ACTIVE";
6261
+ let details = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$4 = supervisorData[0]) === null || _supervisorData$4 === void 0 ? void 0 : _supervisorData$4.supervisorData;
6262
+ details.vendorSupervisorStatus = "ACTIVE";
6507
6263
  const formData = {
6508
6264
  vendor: {
6509
6265
  ...dsoDetails,
6510
- surveyors: dsoDetails.surveyors ? [...dsoDetails.surveyors, details] : [details]
6266
+ supervisors: dsoDetails.supervisors ? [...dsoDetails.supervisors, details] : [details]
6511
6267
  }
6512
6268
  };
6513
6269
  mutateVendor(formData, {
@@ -6524,7 +6280,7 @@ const SurveyorDetails = props => {
6524
6280
  action: "EDIT_VENDOR"
6525
6281
  });
6526
6282
  refetch();
6527
- queryClient.invalidateQueries("SURVEYOR_SEARCH");
6283
+ queryClient.invalidateQueries("SUPERVISOR_SEARCH");
6528
6284
  setTimeout(closeToast, 5000);
6529
6285
  }
6530
6286
  });
@@ -6540,17 +6296,17 @@ const SurveyorDetails = props => {
6540
6296
  switch (selectedAction) {
6541
6297
  case "DELETE":
6542
6298
  case "DELETE_VENDOR":
6543
- return "ES_VENDOR_SURVEYOR_DELETE_POPUP_HEADER";
6299
+ return "ES_VENDOR_SUPERVISOR_DELETE_POPUP_HEADER";
6544
6300
  case "ADD_VENDOR":
6545
6301
  case "EDIT_VENDOR":
6546
- return "ES_VENDOR_SURVEYOR_ADD_VENDOR_POPUP_HEADER";
6302
+ return "ES_VENDOR_SUPERVISOR_ADD_VENDOR_POPUP_HEADER";
6547
6303
  }
6548
6304
  };
6549
6305
  const renderModalContent = () => {
6550
6306
  if (selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR") {
6551
6307
  return /*#__PURE__*/React.createElement(ConfirmationBox, {
6552
6308
  t: t,
6553
- title: "ES_VENDOR_SURVEYOR_DELETE_TEXT"
6309
+ title: "ES_VENDOR_SUPERVISOR_DELETE_TEXT"
6554
6310
  });
6555
6311
  }
6556
6312
  if (selectedAction === "ADD_VENDOR" || selectedAction === "EDIT_VENDOR") {
@@ -6574,8 +6330,8 @@ const SurveyorDetails = props => {
6574
6330
  position: "relative",
6575
6331
  backgroundColor: "#fff"
6576
6332
  }
6577
- }, surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$5 = surveyorData[0]) === null || _surveyorData$5 === void 0 ? void 0 : (_surveyorData$5$emplo = _surveyorData$5.employeeResponse) === null || _surveyorData$5$emplo === void 0 ? void 0 : _surveyorData$5$emplo.map((detail, index) => {
6578
- var _detail$values;
6333
+ }, supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$5 = supervisorData[0]) === null || _supervisorData$5 === void 0 ? void 0 : (_supervisorData$5$emp = _supervisorData$5.employeeResponse) === null || _supervisorData$5$emp === void 0 ? void 0 : _supervisorData$5$emp.map((detail, index) => {
6334
+ var _detail$values, _detail$child;
6579
6335
  return /*#__PURE__*/React.createElement(React.Fragment, {
6580
6336
  key: index
6581
6337
  }, index > 0 && /*#__PURE__*/React.createElement(CardSectionHeader, {
@@ -6633,7 +6389,64 @@ const SurveyorDetails = props => {
6633
6389
  }, t(value.title)), /*#__PURE__*/React.createElement("div", {
6634
6390
  className: "additional-value"
6635
6391
  }, t(value.value) || "N/A"));
6636
- }))));
6392
+ }))), detail === null || detail === void 0 ? void 0 : (_detail$child = detail.child) === null || _detail$child === void 0 ? void 0 : _detail$child.map((data, index) => {
6393
+ var _data$values;
6394
+ return /*#__PURE__*/React.createElement(Card, {
6395
+ className: "card-with-background",
6396
+ key: data.id || index,
6397
+ style: {
6398
+ margin: "10px 16px",
6399
+ padding: "20px"
6400
+ }
6401
+ }, /*#__PURE__*/React.createElement("div", {
6402
+ className: "card-head",
6403
+ style: {
6404
+ display: "flex",
6405
+ justifyContent: "space-between",
6406
+ alignItems: "center",
6407
+ marginBottom: "10px"
6408
+ }
6409
+ }, /*#__PURE__*/React.createElement("h2", {
6410
+ style: {
6411
+ fontSize: "18px",
6412
+ fontWeight: "bold"
6413
+ }
6414
+ }, t(detail.type), " ", index + 1), /*#__PURE__*/React.createElement("div", {
6415
+ style: {
6416
+ display: "flex",
6417
+ gap: "15px"
6418
+ }
6419
+ }, /*#__PURE__*/React.createElement("span", {
6420
+ onClick: () => history.push(`/digit-ui/employee/vendor/registry/modify-surveyor/${data.id}`)
6421
+ }, /*#__PURE__*/React.createElement(EditIcon, {
6422
+ fill: "#a82227",
6423
+ style: {
6424
+ cursor: "pointer"
6425
+ }
6426
+ })))), /*#__PURE__*/React.createElement("div", {
6427
+ className: "additional-grid"
6428
+ }, data === null || data === void 0 ? void 0 : (_data$values = data.values) === null || _data$values === void 0 ? void 0 : _data$values.map((value, idx) => /*#__PURE__*/React.createElement(React.Fragment, {
6429
+ key: idx
6430
+ }, /*#__PURE__*/React.createElement("div", {
6431
+ className: "additional-label"
6432
+ }, t(value.title)), /*#__PURE__*/React.createElement("div", {
6433
+ className: "additional-value"
6434
+ }, t(value.value) || "N/A")))));
6435
+ }), detail.type && /*#__PURE__*/React.createElement("div", {
6436
+ className: "add-details-link hover-button",
6437
+ style: {
6438
+ margin: "10px 16px",
6439
+ color: "#a82227",
6440
+ cursor: "pointer",
6441
+ display: "flex",
6442
+ alignItems: "center",
6443
+ gap: "5px",
6444
+ fontWeight: "bold"
6445
+ },
6446
+ onClick: () => history.push(`/digit-ui/employee/vendor/registry/new-surveyor?supervisorId=${supervisorId}`)
6447
+ }, /*#__PURE__*/React.createElement(AddIcon, {
6448
+ fill: "#a82227"
6449
+ }), t(`${detail.type}_ADD`)));
6637
6450
  }))), showModal && /*#__PURE__*/React.createElement(Modal, {
6638
6451
  headerBarMain: /*#__PURE__*/React.createElement(Heading$1, {
6639
6452
  label: t(modalHeading())
@@ -6658,7 +6471,7 @@ const SurveyorDetails = props => {
6658
6471
  zIndex: "19"
6659
6472
  }
6660
6473
  }, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
6661
- localeKeyPrefix: "ES_VENDOR_SURVEYOR_ACTION",
6474
+ localeKeyPrefix: "ES_VENDOR_SUPERVISOR_ACTION",
6662
6475
  options: ["EDIT", "DELETE"],
6663
6476
  t: t,
6664
6477
  onSelect: a => {
@@ -6671,14 +6484,449 @@ const SurveyorDetails = props => {
6671
6484
  })));
6672
6485
  };
6673
6486
 
6674
- const Heading$2 = props => {
6675
- return /*#__PURE__*/React.createElement("h1", {
6676
- className: "heading-m"
6677
- }, props.label);
6678
- };
6679
- const Close$2 = () => /*#__PURE__*/React.createElement("svg", {
6680
- xmlns: "http://www.w3.org/2000/svg",
6681
- viewBox: "0 0 24 24",
6487
+ const EditSupervisor = () => {
6488
+ var _Digit$UserService$ge;
6489
+ const {
6490
+ t
6491
+ } = useTranslation();
6492
+ const history = useHistory();
6493
+ const queryClient = useQueryClient();
6494
+ const {
6495
+ id: supervisorId
6496
+ } = useParams();
6497
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
6498
+ const rawTenantId = Digit.ULBService.getCurrentTenantId();
6499
+ const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : `${rawTenantId}.djb`;
6500
+ const [showToast, setShowToast] = useState(null);
6501
+ const [canSubmit, setCanSubmit] = useState(false);
6502
+ const [defaultValues, setDefaultValues] = useState({});
6503
+ const [supervisorDetails, setSupervisorDetails] = useState({});
6504
+ const {
6505
+ data: supervisorSearchResponse,
6506
+ isLoading
6507
+ } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6508
+ ids: supervisorId
6509
+ }, {
6510
+ staleTime: Infinity
6511
+ });
6512
+ const {
6513
+ mutate
6514
+ } = Digit.Hooks.fsm.useSupervisorUpdate(tenantId);
6515
+ const Config = SupervisorConfig(t);
6516
+ useEffect(() => {
6517
+ if (supervisorSearchResponse && supervisorSearchResponse.supervisors && supervisorSearchResponse.supervisors.length > 0) {
6518
+ var _details$owner, _details$owner2, _details$owner3, _details$owner4, _details$owner5, _details$owner6, _details$owner7, _details$owner8, _details$owner9;
6519
+ let details = supervisorSearchResponse.supervisors[0];
6520
+ setSupervisorDetails(details);
6521
+ let values = {
6522
+ fullName: (details === null || details === void 0 ? void 0 : (_details$owner = details.owner) === null || _details$owner === void 0 ? void 0 : _details$owner.name) || (details === null || details === void 0 ? void 0 : details.name),
6523
+ mobileNumber: (details === null || details === void 0 ? void 0 : (_details$owner2 = details.owner) === null || _details$owner2 === void 0 ? void 0 : _details$owner2.mobileNumber) || (details === null || details === void 0 ? void 0 : details.mobileNo),
6524
+ emailId: details === null || details === void 0 ? void 0 : (_details$owner3 = details.owner) === null || _details$owner3 === void 0 ? void 0 : _details$owner3.emailId,
6525
+ employeeId: details === null || details === void 0 ? void 0 : details.employeeId,
6526
+ gender: details !== null && details !== void 0 && (_details$owner4 = details.owner) !== null && _details$owner4 !== void 0 && _details$owner4.gender ? {
6527
+ code: details.owner.gender,
6528
+ name: `COMMON_GENDER_${details.owner.gender}`
6529
+ } : null,
6530
+ fatherOrHusbandName: details === null || details === void 0 ? void 0 : (_details$owner5 = details.owner) === null || _details$owner5 === void 0 ? void 0 : _details$owner5.fatherOrHusbandName,
6531
+ relationship: details !== null && details !== void 0 && (_details$owner6 = details.owner) !== null && _details$owner6 !== void 0 && _details$owner6.relationship ? {
6532
+ code: details.owner.relationship,
6533
+ name: `ES_COMMON_RELATION_${details.owner.relationship}`
6534
+ } : null,
6535
+ dob: (details === null || details === void 0 ? void 0 : (_details$owner7 = details.owner) === null || _details$owner7 === void 0 ? void 0 : _details$owner7.dob) && Digit.DateUtils.ConvertTimestampToDate(details === null || details === void 0 ? void 0 : (_details$owner8 = details.owner) === null || _details$owner8 === void 0 ? void 0 : _details$owner8.dob, "yyyy-MM-dd"),
6536
+ correspondenceAddress: details === null || details === void 0 ? void 0 : (_details$owner9 = details.owner) === null || _details$owner9 === void 0 ? void 0 : _details$owner9.correspondenceAddress,
6537
+ description: details === null || details === void 0 ? void 0 : details.description,
6538
+ assignedZone: details !== null && details !== void 0 && details.assignedZoneId ? {
6539
+ code: details.assignedZoneId,
6540
+ name: details.assignedZoneId
6541
+ } : null
6542
+ };
6543
+ setDefaultValues(values);
6544
+ }
6545
+ }, [supervisorSearchResponse]);
6546
+ const onFormValueChange = (setValue, formData) => {
6547
+ const isBasicDetailsFilled = (formData === null || formData === void 0 ? void 0 : formData.fullName) && (formData === null || formData === void 0 ? void 0 : formData.mobileNumber) && (formData === null || formData === void 0 ? void 0 : formData.emailId) && (formData === null || formData === void 0 ? void 0 : formData.fatherOrHusbandName) && (formData === null || formData === void 0 ? void 0 : formData.relationship) && (formData === null || formData === void 0 ? void 0 : formData.dob) && (formData === null || formData === void 0 ? void 0 : formData.gender) && (formData === null || formData === void 0 ? void 0 : formData.correspondenceAddress) && (formData === null || formData === void 0 ? void 0 : formData.assignedZone);
6548
+ if (isBasicDetailsFilled) {
6549
+ setCanSubmit(true);
6550
+ } else {
6551
+ setCanSubmit(false);
6552
+ }
6553
+ };
6554
+ const closeToast = () => {
6555
+ setShowToast(null);
6556
+ };
6557
+ const onSubmit = data => {
6558
+ var _data$assignedZone, _supervisorDetails$ow, _supervisorDetails$ow2, _data$relationship, _supervisorDetails$ow3, _data$gender, _supervisorDetails$ow4, _supervisorDetails$ow5, _supervisorDetails$ow6, _supervisorDetails$ow7, _supervisorDetails$ow8;
6559
+ const formData = {
6560
+ RequestInfo: {
6561
+ apiId: "Rainmaker",
6562
+ ver: "1.0",
6563
+ ts: null,
6564
+ action: "_update",
6565
+ msgId: `${Date.now()}|en_IN`,
6566
+ authToken: userInfo === null || userInfo === void 0 ? void 0 : userInfo.authToken,
6567
+ userInfo: {
6568
+ id: userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
6569
+ uuid: userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid,
6570
+ userName: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userName,
6571
+ name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
6572
+ type: userInfo === null || userInfo === void 0 ? void 0 : userInfo.type,
6573
+ tenantId: tenantId,
6574
+ roles: userInfo === null || userInfo === void 0 ? void 0 : userInfo.roles
6575
+ }
6576
+ },
6577
+ supervisor: {
6578
+ ...supervisorDetails,
6579
+ description: (data === null || data === void 0 ? void 0 : data.description) || (supervisorDetails === null || supervisorDetails === void 0 ? void 0 : supervisorDetails.description) || "",
6580
+ assignedZoneId: (data === null || data === void 0 ? void 0 : (_data$assignedZone = data.assignedZone) === null || _data$assignedZone === void 0 ? void 0 : _data$assignedZone.code) || (supervisorDetails === null || supervisorDetails === void 0 ? void 0 : supervisorDetails.assignedZoneId) || null,
6581
+ owner: {
6582
+ ...supervisorDetails.owner,
6583
+ name: (data === null || data === void 0 ? void 0 : data.fullName) || ((_supervisorDetails$ow = supervisorDetails.owner) === null || _supervisorDetails$ow === void 0 ? void 0 : _supervisorDetails$ow.name),
6584
+ fatherOrHusbandName: (data === null || data === void 0 ? void 0 : data.fatherOrHusbandName) || ((_supervisorDetails$ow2 = supervisorDetails.owner) === null || _supervisorDetails$ow2 === void 0 ? void 0 : _supervisorDetails$ow2.fatherOrHusbandName),
6585
+ relationship: (data === null || data === void 0 ? void 0 : (_data$relationship = data.relationship) === null || _data$relationship === void 0 ? void 0 : _data$relationship.code) || ((_supervisorDetails$ow3 = supervisorDetails.owner) === null || _supervisorDetails$ow3 === void 0 ? void 0 : _supervisorDetails$ow3.relationship),
6586
+ gender: (data === null || data === void 0 ? void 0 : (_data$gender = data.gender) === null || _data$gender === void 0 ? void 0 : _data$gender.code) || ((_supervisorDetails$ow4 = supervisorDetails.owner) === null || _supervisorDetails$ow4 === void 0 ? void 0 : _supervisorDetails$ow4.gender) || "OTHERS",
6587
+ dob: data !== null && data !== void 0 && data.dob ? new Date(data.dob).getTime() : (_supervisorDetails$ow5 = supervisorDetails.owner) === null || _supervisorDetails$ow5 === void 0 ? void 0 : _supervisorDetails$ow5.dob,
6588
+ emailId: (data === null || data === void 0 ? void 0 : data.emailId) || ((_supervisorDetails$ow6 = supervisorDetails.owner) === null || _supervisorDetails$ow6 === void 0 ? void 0 : _supervisorDetails$ow6.emailId),
6589
+ mobileNumber: (data === null || data === void 0 ? void 0 : data.mobileNumber) || ((_supervisorDetails$ow7 = supervisorDetails.owner) === null || _supervisorDetails$ow7 === void 0 ? void 0 : _supervisorDetails$ow7.mobileNumber),
6590
+ correspondenceAddress: (data === null || data === void 0 ? void 0 : data.correspondenceAddress) || ((_supervisorDetails$ow8 = supervisorDetails.owner) === null || _supervisorDetails$ow8 === void 0 ? void 0 : _supervisorDetails$ow8.correspondenceAddress)
6591
+ }
6592
+ }
6593
+ };
6594
+ mutate(formData, {
6595
+ onError: error => {
6596
+ setShowToast({
6597
+ key: "error",
6598
+ action: error
6599
+ });
6600
+ setTimeout(closeToast, 5000);
6601
+ },
6602
+ onSuccess: () => {
6603
+ setShowToast({
6604
+ key: "success",
6605
+ action: "UPDATE_SUPERVISOR"
6606
+ });
6607
+ queryClient.invalidateQueries("SUPERVISOR_SEARCH");
6608
+ setTimeout(() => {
6609
+ closeToast();
6610
+ history.push(`/digit-ui/employee/vendor/registry/supervisor-details/${supervisorId}`);
6611
+ }, 5000);
6612
+ }
6613
+ });
6614
+ };
6615
+ if (isLoading || Object.keys(defaultValues).length === 0) {
6616
+ return /*#__PURE__*/React.createElement(Loader, null);
6617
+ }
6618
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
6619
+ config: [{
6620
+ timeLine: [{
6621
+ actions: t("ES_VENDOR_SUPERVISOR_DETAILS"),
6622
+ currentStep: 1
6623
+ }]
6624
+ }],
6625
+ currentActiveIndex: 0,
6626
+ showFinalStep: false
6627
+ }), /*#__PURE__*/React.createElement("div", {
6628
+ style: {
6629
+ flex: "1",
6630
+ overflowY: "auto"
6631
+ }
6632
+ }, /*#__PURE__*/React.createElement(FormComposer, {
6633
+ isDisabled: !canSubmit,
6634
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
6635
+ config: Config.map(config => ({
6636
+ ...config,
6637
+ isCollapsible: true,
6638
+ isDefaultOpen: true
6639
+ })),
6640
+ fieldStyle: {
6641
+ marginRight: 0
6642
+ },
6643
+ onSubmit: onSubmit,
6644
+ defaultValues: defaultValues,
6645
+ onFormValueChange: onFormValueChange,
6646
+ noBreakLine: true,
6647
+ mode: "onChange",
6648
+ noCard: true
6649
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
6650
+ error: showToast.key === "error",
6651
+ label: t(showToast.key === "success" ? `ES_VENDOR_${showToast.action}_SUCCESS` : showToast.action),
6652
+ onClose: closeToast
6653
+ })));
6654
+ };
6655
+
6656
+ const {
6657
+ Dropdown: Dropdown$2,
6658
+ DatePicker: DatePicker$2
6659
+ } = require("@djb25/digit-ui-react-components");
6660
+ const SurveyorConfig = (t, agencies = [], reportingManagers = [], disabled = false) => {
6661
+ return [{
6662
+ head: "ES_VENDOR_SURVEYOR_BASIC_DETAILS",
6663
+ body: [{
6664
+ label: "ES_VENDOR_SURVEYOR_FULL_NAME",
6665
+ isMandatory: true,
6666
+ type: "text",
6667
+ populators: {
6668
+ name: "fullName",
6669
+ validation: {
6670
+ required: true,
6671
+ pattern: /^[A-Za-z\s]+$/
6672
+ },
6673
+ error: t("ES_VENDOR_INVALID_NAME")
6674
+ }
6675
+ }, {
6676
+ label: "ES_VENDOR_SURVEYOR_MOBILE_NUMBER",
6677
+ isMandatory: true,
6678
+ type: "mobileNumber",
6679
+ populators: {
6680
+ name: "mobileNumber",
6681
+ validation: {
6682
+ required: true,
6683
+ pattern: /^[6-9]\d{9}$/
6684
+ },
6685
+ error: t("ES_VENDOR_INVALID_MOBILE")
6686
+ }
6687
+ }, {
6688
+ label: "ES_VENDOR_SURVEYOR_EMAIL_ID",
6689
+ isMandatory: true,
6690
+ type: "text",
6691
+ populators: {
6692
+ name: "emailId",
6693
+ validation: {
6694
+ required: true,
6695
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
6696
+ },
6697
+ error: t("ES_VENDOR_INVALID_EMAIL")
6698
+ }
6699
+ }, {
6700
+ label: "ES_VENDOR_SURVEYOR_STAFF_CODE",
6701
+ isMandatory: true,
6702
+ type: "text",
6703
+ populators: {
6704
+ name: "employeeId",
6705
+ validation: {
6706
+ required: true
6707
+ }
6708
+ }
6709
+ }, {
6710
+ label: t("ES_VENDOR_SURVEYOR_GENDER"),
6711
+ isMandatory: true,
6712
+ type: "component",
6713
+ key: "gender",
6714
+ component: "SelectGender"
6715
+ }, {
6716
+ label: t("ES_FSM_REGISTRY_NEW_FATHER_NAME"),
6717
+ isMandatory: true,
6718
+ type: "text",
6719
+ populators: {
6720
+ name: "fatherOrHusbandName",
6721
+ validation: {
6722
+ required: true
6723
+ },
6724
+ className: "payment-form-text-input-correction"
6725
+ }
6726
+ }, {
6727
+ label: t("ES_FSM_REGISTRY_NEW_RELATIONSHIP"),
6728
+ isMandatory: true,
6729
+ type: "component",
6730
+ key: "relationship",
6731
+ component: "SelectEkycDropdown",
6732
+ populators: {
6733
+ name: "relationship",
6734
+ options: [{
6735
+ code: "FATHER",
6736
+ name: "ES_COMMON_RELATION_FATHER"
6737
+ }, {
6738
+ code: "HUSBAND",
6739
+ name: "ES_COMMON_RELATION_HUSBAND"
6740
+ }, {
6741
+ code: "OTHER",
6742
+ name: "ES_COMMON_RELATION_OTHER"
6743
+ }],
6744
+ optionsKey: "name"
6745
+ }
6746
+ }, {
6747
+ label: t("ES_FSM_REGISTRY_NEW_DOB"),
6748
+ isMandatory: true,
6749
+ type: "custom",
6750
+ key: "dob",
6751
+ populators: {
6752
+ name: "dob",
6753
+ validation: {
6754
+ required: true
6755
+ },
6756
+ component: (props, customProps) => /*#__PURE__*/React.createElement(DatePicker$2, Object.assign({
6757
+ onChange: props.onChange,
6758
+ date: props.value
6759
+ }, customProps))
6760
+ }
6761
+ }, {
6762
+ label: t("ES_FSM_REGISTRY_NEW_CORRESPONDENCE_ADDRESS"),
6763
+ isMandatory: true,
6764
+ type: "text",
6765
+ populators: {
6766
+ name: "correspondenceAddress",
6767
+ validation: {
6768
+ required: true
6769
+ },
6770
+ className: "payment-form-text-input-correction"
6771
+ }
6772
+ }, {
6773
+ label: t("ES_VENDOR_SURVEYOR_DESCRIPTION"),
6774
+ isMandatory: false,
6775
+ type: "text",
6776
+ populators: {
6777
+ name: "description",
6778
+ className: "payment-form-text-input-correction"
6779
+ }
6780
+ }]
6781
+ }];
6782
+ };
6783
+
6784
+ const AddSurveyor = ({
6785
+ parentUrl,
6786
+ heading
6787
+ }) => {
6788
+ var _Digit$UserService$ge;
6789
+ const {
6790
+ t
6791
+ } = useTranslation();
6792
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
6793
+ const rawTenantId = Digit.ULBService.getCurrentTenantId();
6794
+ const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : `${rawTenantId}.djb`;
6795
+ const [showToast, setShowToast] = useState(null);
6796
+ const queryClient = useQueryClient();
6797
+ const [canSubmit, setCanSubmit] = useState(false);
6798
+ const {
6799
+ mutate
6800
+ } = Digit.Hooks.fsm.useSurveyorCreate(tenantId);
6801
+ const {
6802
+ search
6803
+ } = useLocation();
6804
+ const queryParams = new URLSearchParams(search);
6805
+ const vendorIdParam = queryParams.get("vendorId");
6806
+ const Config = SurveyorConfig(t);
6807
+ const defaultValues = {
6808
+ role: {
6809
+ code: "SURVEYOR",
6810
+ name: "Surveyor"
6811
+ }
6812
+ };
6813
+ const onFormValueChange = (setValue, formData) => {
6814
+ const isBasicDetailsFilled = (formData === null || formData === void 0 ? void 0 : formData.fullName) && (formData === null || formData === void 0 ? void 0 : formData.mobileNumber) && (formData === null || formData === void 0 ? void 0 : formData.emailId) && (formData === null || formData === void 0 ? void 0 : formData.employeeId) && (formData === null || formData === void 0 ? void 0 : formData.fatherOrHusbandName) && (formData === null || formData === void 0 ? void 0 : formData.relationship) && (formData === null || formData === void 0 ? void 0 : formData.dob) && (formData === null || formData === void 0 ? void 0 : formData.correspondenceAddress);
6815
+ if (isBasicDetailsFilled) {
6816
+ setCanSubmit(true);
6817
+ } else {
6818
+ setCanSubmit(false);
6819
+ }
6820
+ };
6821
+ const closeToast = () => {
6822
+ setShowToast(null);
6823
+ };
6824
+ const onSubmit = data => {
6825
+ var _data$agencyName, _data$agencyName2, _data$reportingManage, _data$reportingManage2, _data$relationship, _data$gender;
6826
+ const formData = {
6827
+ RequestInfo: {
6828
+ apiId: "Rainmaker",
6829
+ ver: "1.0",
6830
+ ts: null,
6831
+ action: "_create",
6832
+ msgId: `${Date.now()}|en_IN`,
6833
+ authToken: userInfo === null || userInfo === void 0 ? void 0 : userInfo.authToken,
6834
+ userInfo: {
6835
+ id: userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
6836
+ uuid: userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid,
6837
+ userName: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userName,
6838
+ name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
6839
+ type: userInfo === null || userInfo === void 0 ? void 0 : userInfo.type,
6840
+ tenantId: tenantId,
6841
+ roles: userInfo === null || userInfo === void 0 ? void 0 : userInfo.roles
6842
+ }
6843
+ },
6844
+ surveyor: {
6845
+ tenantId: tenantId,
6846
+ vendorId: vendorIdParam || (data === null || data === void 0 ? void 0 : (_data$agencyName = data.agencyName) === null || _data$agencyName === void 0 ? void 0 : _data$agencyName.code) || (data === null || data === void 0 ? void 0 : (_data$agencyName2 = data.agencyName) === null || _data$agencyName2 === void 0 ? void 0 : _data$agencyName2.id) || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid),
6847
+ supervisorId: (data === null || data === void 0 ? void 0 : (_data$reportingManage = data.reportingManager) === null || _data$reportingManage === void 0 ? void 0 : _data$reportingManage.code) || (data === null || data === void 0 ? void 0 : (_data$reportingManage2 = data.reportingManager) === null || _data$reportingManage2 === void 0 ? void 0 : _data$reportingManage2.id) || null,
6848
+ description: (data === null || data === void 0 ? void 0 : data.description) || "",
6849
+ additionalDetails: {
6850
+ serviceType: "ekyc"
6851
+ },
6852
+ owner: {
6853
+ tenantId: tenantId,
6854
+ name: data === null || data === void 0 ? void 0 : data.fullName,
6855
+ fatherOrHusbandName: data === null || data === void 0 ? void 0 : data.fatherOrHusbandName,
6856
+ relationship: data === null || data === void 0 ? void 0 : (_data$relationship = data.relationship) === null || _data$relationship === void 0 ? void 0 : _data$relationship.code,
6857
+ gender: (data === null || data === void 0 ? void 0 : (_data$gender = data.gender) === null || _data$gender === void 0 ? void 0 : _data$gender.code) || "OTHERS",
6858
+ dob: data !== null && data !== void 0 && data.dob ? new Date(data.dob).getTime() : null,
6859
+ emailId: data === null || data === void 0 ? void 0 : data.emailId,
6860
+ mobileNumber: data === null || data === void 0 ? void 0 : data.mobileNumber,
6861
+ correspondenceAddress: data === null || data === void 0 ? void 0 : data.correspondenceAddress
6862
+ }
6863
+ }
6864
+ };
6865
+ mutate(formData, {
6866
+ onError: error => {
6867
+ setShowToast({
6868
+ key: "error",
6869
+ action: error
6870
+ });
6871
+ setTimeout(closeToast, 5000);
6872
+ },
6873
+ onSuccess: () => {
6874
+ setShowToast({
6875
+ key: "success",
6876
+ action: "ADD_SURVEYOR"
6877
+ });
6878
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
6879
+ setTimeout(closeToast, 5000);
6880
+ }
6881
+ });
6882
+ };
6883
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
6884
+ config: [{
6885
+ route: "surveyor-details",
6886
+ timeLine: [{
6887
+ actions: t("ES_VENDOR_SURVEYOR_DETAILS"),
6888
+ currentStep: 1
6889
+ }]
6890
+ }],
6891
+ currentActiveIndex: 0,
6892
+ showFinalStep: false
6893
+ }), /*#__PURE__*/React.createElement("div", {
6894
+ style: {
6895
+ flex: "1",
6896
+ overflowY: "auto"
6897
+ }
6898
+ }, /*#__PURE__*/React.createElement(FormComposer, {
6899
+ isDisabled: !canSubmit,
6900
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
6901
+ config: Config.map(config => ({
6902
+ ...config,
6903
+ isCollapsible: true,
6904
+ isDefaultOpen: true
6905
+ })),
6906
+ fieldStyle: {
6907
+ marginRight: 0
6908
+ },
6909
+ onSubmit: onSubmit,
6910
+ defaultValues: defaultValues,
6911
+ onFormValueChange: onFormValueChange,
6912
+ noBreakLine: true,
6913
+ mode: "onChange",
6914
+ noCard: true
6915
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
6916
+ error: showToast.key === "error",
6917
+ label: t(showToast.key === "success" ? `ES_VENDOR_${showToast.action}_SUCCESS` : showToast.action),
6918
+ onClose: closeToast
6919
+ })));
6920
+ };
6921
+
6922
+ const Heading$2 = props => {
6923
+ return /*#__PURE__*/React.createElement("h1", {
6924
+ className: "heading-m"
6925
+ }, props.label);
6926
+ };
6927
+ const Close$2 = () => /*#__PURE__*/React.createElement("svg", {
6928
+ xmlns: "http://www.w3.org/2000/svg",
6929
+ viewBox: "0 0 24 24",
6682
6930
  fill: "#FFFFFF"
6683
6931
  }, /*#__PURE__*/React.createElement("path", {
6684
6932
  d: "M0 0h24v24H0V0z",
@@ -6692,8 +6940,8 @@ const CloseBtn$2 = props => {
6692
6940
  onClick: props.onClick
6693
6941
  }, /*#__PURE__*/React.createElement(Close$2, null));
6694
6942
  };
6695
- const SupervisorDetails = props => {
6696
- var _supervisorData$5, _supervisorData$5$emp;
6943
+ const SurveyorDetails = props => {
6944
+ var _surveyorData$5, _surveyorData$5$emplo;
6697
6945
  const tenantId = Digit.ULBService.getCurrentTenantId();
6698
6946
  const {
6699
6947
  t
@@ -6701,7 +6949,7 @@ const SupervisorDetails = props => {
6701
6949
  const history = useHistory();
6702
6950
  const queryClient = useQueryClient();
6703
6951
  const {
6704
- id: supervisorId
6952
+ id: surveyorId
6705
6953
  } = useParams();
6706
6954
  const [displayMenu, setDisplayMenu] = useState(false);
6707
6955
  const [selectedAction, setSelectedAction] = useState(null);
@@ -6717,18 +6965,18 @@ const SupervisorDetails = props => {
6717
6965
  status: "ACTIVE"
6718
6966
  }, {});
6719
6967
  const {
6720
- data: supervisorSearchResponse,
6968
+ data: surveyorSearchResponse,
6721
6969
  isLoading,
6722
6970
  refetch
6723
- } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6724
- ids: supervisorId
6971
+ } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
6972
+ ids: surveyorId
6725
6973
  }, {
6726
6974
  staleTime: Infinity
6727
6975
  });
6728
- const supervisorData = React.useMemo(() => {
6729
- var _supervisorSearchResp;
6730
- if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && (_supervisorSearchResp = supervisorSearchResponse.supervisors) !== null && _supervisorSearchResp !== void 0 && _supervisorSearchResp.length)) return [];
6731
- return supervisorSearchResponse.supervisors.map(data => {
6976
+ const surveyorData = React.useMemo(() => {
6977
+ var _surveyorSearchRespon;
6978
+ if (!(surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && (_surveyorSearchRespon = surveyorSearchResponse.surveyors) !== null && _surveyorSearchRespon !== void 0 && _surveyorSearchRespon.length)) return [];
6979
+ return surveyorSearchResponse.surveyors.map(data => {
6732
6980
  var _mappedVendor$dsoDeta, _data$owner, _data$owner2, _data$owner3;
6733
6981
  const mappedVendor = vendorData === null || vendorData === void 0 ? void 0 : vendorData.find(v => {
6734
6982
  var _v$dsoDetails, _v$dsoDetails2;
@@ -6736,43 +6984,39 @@ const SupervisorDetails = props => {
6736
6984
  });
6737
6985
  const vendorName = (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || data.vendorId || "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR";
6738
6986
  return {
6739
- supervisorData: data,
6987
+ surveyorData: data,
6740
6988
  vendorDetails: {
6741
6989
  vendor: mappedVendor ? [mappedVendor.dsoDetails] : []
6742
6990
  },
6743
6991
  employeeResponse: [{
6744
- title: "ES_VENDOR_SUPERVISOR_BASIC_DETAILS",
6992
+ title: "ES_VENDOR_SURVEYOR_BASIC_DETAILS",
6745
6993
  values: [{
6746
- title: "ES_VENDOR_SUPERVISOR_FULL_NAME",
6994
+ title: "ES_VENDOR_SURVEYOR_FULL_NAME",
6747
6995
  value: data === null || data === void 0 ? void 0 : data.name
6748
6996
  }, {
6749
- title: "ES_VENDOR_SUPERVISOR_MOBILE_NUMBER",
6997
+ title: "ES_VENDOR_SURVEYOR_MOBILE_NUMBER",
6750
6998
  value: (data === null || data === void 0 ? void 0 : (_data$owner = data.owner) === null || _data$owner === void 0 ? void 0 : _data$owner.mobileNumber) || (data === null || data === void 0 ? void 0 : data.mobileNo)
6751
6999
  }, {
6752
- title: "ES_VENDOR_SUPERVISOR_EMAIL_ID",
7000
+ title: "ES_VENDOR_SURVEYOR_EMAIL_ID",
6753
7001
  value: data === null || data === void 0 ? void 0 : (_data$owner2 = data.owner) === null || _data$owner2 === void 0 ? void 0 : _data$owner2.emailId
6754
7002
  }, {
6755
- title: "ES_VENDOR_SUPERVISOR_STAFF_CODE",
7003
+ title: "ES_VENDOR_SURVEYOR_STAFF_CODE",
6756
7004
  value: (data === null || data === void 0 ? void 0 : data.employeeId) || "N/A"
6757
7005
  }, {
6758
- title: "ES_VENDOR_SUPERVISOR_GENDER",
7006
+ title: "ES_VENDOR_SURVEYOR_GENDER",
6759
7007
  value: data === null || data === void 0 ? void 0 : (_data$owner3 = data.owner) === null || _data$owner3 === void 0 ? void 0 : _data$owner3.gender
6760
7008
  }, {
6761
- title: "ES_VENDOR_SUPERVISOR_AGENCY_NAME",
7009
+ title: "ES_VENDOR_SURVEYOR_AGENCY_NAME",
6762
7010
  value: vendorName,
6763
7011
  type: "custom"
6764
7012
  }]
6765
- }, {
6766
- title: "ES_VENDOR_SUPERVISOR_MAPPED_SURVEYORS",
6767
- type: "ES_FSM_REGISTRY_DETAILS_TYPE_SURVEYOR",
6768
- child: []
6769
7013
  }]
6770
7014
  };
6771
7015
  });
6772
- }, [supervisorSearchResponse, vendorData]);
7016
+ }, [surveyorSearchResponse, vendorData]);
6773
7017
  const {
6774
- mutate: mutateSupervisor
6775
- } = Digit.Hooks.fsm.useSupervisorUpdate(tenantId);
7018
+ mutate: mutateSurveyor
7019
+ } = Digit.Hooks.fsm.useSurveyorUpdate(tenantId);
6776
7020
  const {
6777
7021
  mutate: mutateVendor
6778
7022
  } = Digit.Hooks.fsm.useVendorUpdate(tenantId);
@@ -6793,9 +7037,9 @@ const SupervisorDetails = props => {
6793
7037
  case "DELETE_VENDOR":
6794
7038
  return setShowModal(true);
6795
7039
  case "EDIT":
6796
- return history.push("/digit-ui/employee/vendor/modify-supervisor/" + supervisorId);
7040
+ return history.push("/digit-ui/employee/vendor/registry/modify-surveyor/" + surveyorId);
6797
7041
  case "HOME":
6798
- return history.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SUPERVISOR");
7042
+ return history.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SURVEYOR");
6799
7043
  }
6800
7044
  }, [selectedAction]);
6801
7045
  const closeToast = () => {
@@ -6804,7 +7048,7 @@ const SupervisorDetails = props => {
6804
7048
  const handleModalAction = () => {
6805
7049
  switch (selectedAction) {
6806
7050
  case "DELETE":
6807
- return handleDeleteSupervisor();
7051
+ return handleDeleteSurveyor();
6808
7052
  case "DELETE_VENDOR":
6809
7053
  return handleDeleteVendor();
6810
7054
  case "ADD_VENDOR":
@@ -6813,16 +7057,16 @@ const SupervisorDetails = props => {
6813
7057
  return handleEditVendor();
6814
7058
  }
6815
7059
  };
6816
- const handleDeleteSupervisor = () => {
6817
- var _supervisorData$;
6818
- let details = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$ = supervisorData[0]) === null || _supervisorData$ === void 0 ? void 0 : _supervisorData$.supervisorData;
7060
+ const handleDeleteSurveyor = () => {
7061
+ var _surveyorData$;
7062
+ let details = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$ = surveyorData[0]) === null || _surveyorData$ === void 0 ? void 0 : _surveyorData$.surveyorData;
6819
7063
  const formData = {
6820
- supervisor: {
7064
+ surveyor: {
6821
7065
  ...details,
6822
7066
  status: "INACTIVE"
6823
7067
  }
6824
7068
  };
6825
- mutateSupervisor(formData, {
7069
+ mutateSurveyor(formData, {
6826
7070
  onError: error => {
6827
7071
  setShowToast({
6828
7072
  key: "error",
@@ -6833,9 +7077,9 @@ const SupervisorDetails = props => {
6833
7077
  onSuccess: () => {
6834
7078
  setShowToast({
6835
7079
  key: "success",
6836
- action: "DELETE_SUPERVISOR"
7080
+ action: "DELETE_SURVEYOR"
6837
7081
  });
6838
- queryClient.invalidateQueries("SUPERVISOR_SEARCH");
7082
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
6839
7083
  setTimeout(() => {
6840
7084
  closeToast();
6841
7085
  history.push(`/digit-ui/employee/vendor/search-vendor`);
@@ -6845,19 +7089,19 @@ const SupervisorDetails = props => {
6845
7089
  setShowModal(false);
6846
7090
  };
6847
7091
  const handleDeleteVendor = () => {
6848
- var _supervisorData$2, _supervisorData$2$ven, _supervisorData$2$ven2;
6849
- let dsoDetails = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$2 = supervisorData[0]) === null || _supervisorData$2 === void 0 ? void 0 : (_supervisorData$2$ven = _supervisorData$2.vendorDetails) === null || _supervisorData$2$ven === void 0 ? void 0 : (_supervisorData$2$ven2 = _supervisorData$2$ven.vendor) === null || _supervisorData$2$ven2 === void 0 ? void 0 : _supervisorData$2$ven2[0];
6850
- let getSupervisorVendorDetails = (dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.supervisors) || [];
6851
- getSupervisorVendorDetails = getSupervisorVendorDetails.map(data => {
6852
- if (data.id === supervisorId) {
6853
- data.vendorSupervisorStatus = "INACTIVE";
7092
+ var _surveyorData$2, _surveyorData$2$vendo, _surveyorData$2$vendo2;
7093
+ let dsoDetails = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$2 = surveyorData[0]) === null || _surveyorData$2 === void 0 ? void 0 : (_surveyorData$2$vendo = _surveyorData$2.vendorDetails) === null || _surveyorData$2$vendo === void 0 ? void 0 : (_surveyorData$2$vendo2 = _surveyorData$2$vendo.vendor) === null || _surveyorData$2$vendo2 === void 0 ? void 0 : _surveyorData$2$vendo2[0];
7094
+ let getSurveyorVendorDetails = (dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.surveyors) || [];
7095
+ getSurveyorVendorDetails = getSurveyorVendorDetails.map(data => {
7096
+ if (data.id === surveyorId) {
7097
+ data.vendorSurveyorStatus = "INACTIVE";
6854
7098
  }
6855
7099
  return data;
6856
7100
  });
6857
7101
  const formData = {
6858
7102
  vendor: {
6859
7103
  ...dsoDetails,
6860
- supervisors: getSupervisorVendorDetails
7104
+ surveyors: getSurveyorVendorDetails
6861
7105
  }
6862
7106
  };
6863
7107
  mutateVendor(formData, {
@@ -6881,14 +7125,14 @@ const SupervisorDetails = props => {
6881
7125
  setShowModal(false);
6882
7126
  };
6883
7127
  const handleAddVendor = () => {
6884
- var _supervisorData$3;
7128
+ var _surveyorData$3;
6885
7129
  let dsoDetails = selectedOption;
6886
- let details = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$3 = supervisorData[0]) === null || _supervisorData$3 === void 0 ? void 0 : _supervisorData$3.supervisorData;
6887
- details.vendorSupervisorStatus = "ACTIVE";
7130
+ let details = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$3 = surveyorData[0]) === null || _surveyorData$3 === void 0 ? void 0 : _surveyorData$3.surveyorData;
7131
+ details.vendorSurveyorStatus = "ACTIVE";
6888
7132
  const formData = {
6889
7133
  vendor: {
6890
7134
  ...dsoDetails,
6891
- supervisors: dsoDetails.supervisors ? [...dsoDetails.supervisors, details] : [details]
7135
+ surveyors: dsoDetails.surveyors ? [...dsoDetails.surveyors, details] : [details]
6892
7136
  }
6893
7137
  };
6894
7138
  mutateVendor(formData, {
@@ -6905,7 +7149,7 @@ const SupervisorDetails = props => {
6905
7149
  key: "success",
6906
7150
  action: "ADD_VENDOR"
6907
7151
  });
6908
- queryClient.invalidateQueries("SUPERVISOR_SEARCH");
7152
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
6909
7153
  refetch();
6910
7154
  setTimeout(closeToast, 5000);
6911
7155
  }
@@ -6914,14 +7158,14 @@ const SupervisorDetails = props => {
6914
7158
  setSelectedAction(null);
6915
7159
  };
6916
7160
  const handleEditVendor = () => {
6917
- var _supervisorData$4;
7161
+ var _surveyorData$4;
6918
7162
  let dsoDetails = selectedOption;
6919
- let details = supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$4 = supervisorData[0]) === null || _supervisorData$4 === void 0 ? void 0 : _supervisorData$4.supervisorData;
6920
- details.vendorSupervisorStatus = "ACTIVE";
7163
+ let details = surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$4 = surveyorData[0]) === null || _surveyorData$4 === void 0 ? void 0 : _surveyorData$4.surveyorData;
7164
+ details.vendorSurveyorStatus = "ACTIVE";
6921
7165
  const formData = {
6922
7166
  vendor: {
6923
7167
  ...dsoDetails,
6924
- supervisors: dsoDetails.supervisors ? [...dsoDetails.supervisors, details] : [details]
7168
+ surveyors: dsoDetails.surveyors ? [...dsoDetails.surveyors, details] : [details]
6925
7169
  }
6926
7170
  };
6927
7171
  mutateVendor(formData, {
@@ -6938,7 +7182,7 @@ const SupervisorDetails = props => {
6938
7182
  action: "EDIT_VENDOR"
6939
7183
  });
6940
7184
  refetch();
6941
- queryClient.invalidateQueries("SUPERVISOR_SEARCH");
7185
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
6942
7186
  setTimeout(closeToast, 5000);
6943
7187
  }
6944
7188
  });
@@ -6954,17 +7198,17 @@ const SupervisorDetails = props => {
6954
7198
  switch (selectedAction) {
6955
7199
  case "DELETE":
6956
7200
  case "DELETE_VENDOR":
6957
- return "ES_VENDOR_SUPERVISOR_DELETE_POPUP_HEADER";
7201
+ return "ES_VENDOR_SURVEYOR_DELETE_POPUP_HEADER";
6958
7202
  case "ADD_VENDOR":
6959
7203
  case "EDIT_VENDOR":
6960
- return "ES_VENDOR_SUPERVISOR_ADD_VENDOR_POPUP_HEADER";
7204
+ return "ES_VENDOR_SURVEYOR_ADD_VENDOR_POPUP_HEADER";
6961
7205
  }
6962
7206
  };
6963
7207
  const renderModalContent = () => {
6964
7208
  if (selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR") {
6965
7209
  return /*#__PURE__*/React.createElement(ConfirmationBox, {
6966
7210
  t: t,
6967
- title: "ES_VENDOR_SUPERVISOR_DELETE_TEXT"
7211
+ title: "ES_VENDOR_SURVEYOR_DELETE_TEXT"
6968
7212
  });
6969
7213
  }
6970
7214
  if (selectedAction === "ADD_VENDOR" || selectedAction === "EDIT_VENDOR") {
@@ -6983,13 +7227,8 @@ const SupervisorDetails = props => {
6983
7227
  }
6984
7228
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
6985
7229
  className: "employee-form-content"
6986
- }, /*#__PURE__*/React.createElement(Card, {
6987
- style: {
6988
- position: "relative",
6989
- backgroundColor: "#fff"
6990
- }
6991
- }, supervisorData === null || supervisorData === void 0 ? void 0 : (_supervisorData$5 = supervisorData[0]) === null || _supervisorData$5 === void 0 ? void 0 : (_supervisorData$5$emp = _supervisorData$5.employeeResponse) === null || _supervisorData$5$emp === void 0 ? void 0 : _supervisorData$5$emp.map((detail, index) => {
6992
- var _detail$values, _detail$child;
7230
+ }, /*#__PURE__*/React.createElement(Card, null, surveyorData === null || surveyorData === void 0 ? void 0 : (_surveyorData$5 = surveyorData[0]) === null || _surveyorData$5 === void 0 ? void 0 : (_surveyorData$5$emplo = _surveyorData$5.employeeResponse) === null || _surveyorData$5$emplo === void 0 ? void 0 : _surveyorData$5$emplo.map((detail, index) => {
7231
+ var _detail$values;
6993
7232
  return /*#__PURE__*/React.createElement(React.Fragment, {
6994
7233
  key: index
6995
7234
  }, index > 0 && /*#__PURE__*/React.createElement(CardSectionHeader, {
@@ -6998,11 +7237,7 @@ const SupervisorDetails = props => {
6998
7237
  marginTop: "32px"
6999
7238
  }
7000
7239
  }, t(detail.title)), /*#__PURE__*/React.createElement(Card, {
7001
- className: "card-with-background",
7002
- style: {
7003
- margin: "10px 16px",
7004
- padding: "20px"
7005
- }
7240
+ className: "card-with-background"
7006
7241
  }, /*#__PURE__*/React.createElement("div", {
7007
7242
  className: "additional-grid"
7008
7243
  }, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
@@ -7047,64 +7282,7 @@ const SupervisorDetails = props => {
7047
7282
  }, t(value.title)), /*#__PURE__*/React.createElement("div", {
7048
7283
  className: "additional-value"
7049
7284
  }, t(value.value) || "N/A"));
7050
- }))), detail === null || detail === void 0 ? void 0 : (_detail$child = detail.child) === null || _detail$child === void 0 ? void 0 : _detail$child.map((data, index) => {
7051
- var _data$values;
7052
- return /*#__PURE__*/React.createElement(Card, {
7053
- className: "card-with-background",
7054
- key: data.id || index,
7055
- style: {
7056
- margin: "10px 16px",
7057
- padding: "20px"
7058
- }
7059
- }, /*#__PURE__*/React.createElement("div", {
7060
- className: "card-head",
7061
- style: {
7062
- display: "flex",
7063
- justifyContent: "space-between",
7064
- alignItems: "center",
7065
- marginBottom: "10px"
7066
- }
7067
- }, /*#__PURE__*/React.createElement("h2", {
7068
- style: {
7069
- fontSize: "18px",
7070
- fontWeight: "bold"
7071
- }
7072
- }, t(detail.type), " ", index + 1), /*#__PURE__*/React.createElement("div", {
7073
- style: {
7074
- display: "flex",
7075
- gap: "15px"
7076
- }
7077
- }, /*#__PURE__*/React.createElement("span", {
7078
- onClick: () => history.push(`/digit-ui/employee/vendor/registry/modify-surveyor/${data.id}`)
7079
- }, /*#__PURE__*/React.createElement(EditIcon, {
7080
- fill: "#a82227",
7081
- style: {
7082
- cursor: "pointer"
7083
- }
7084
- })))), /*#__PURE__*/React.createElement("div", {
7085
- className: "additional-grid"
7086
- }, data === null || data === void 0 ? void 0 : (_data$values = data.values) === null || _data$values === void 0 ? void 0 : _data$values.map((value, idx) => /*#__PURE__*/React.createElement(React.Fragment, {
7087
- key: idx
7088
- }, /*#__PURE__*/React.createElement("div", {
7089
- className: "additional-label"
7090
- }, t(value.title)), /*#__PURE__*/React.createElement("div", {
7091
- className: "additional-value"
7092
- }, t(value.value) || "N/A")))));
7093
- }), detail.type && /*#__PURE__*/React.createElement("div", {
7094
- className: "add-details-link hover-button",
7095
- style: {
7096
- margin: "10px 16px",
7097
- color: "#a82227",
7098
- cursor: "pointer",
7099
- display: "flex",
7100
- alignItems: "center",
7101
- gap: "5px",
7102
- fontWeight: "bold"
7103
- },
7104
- onClick: () => history.push(`/digit-ui/employee/vendor/registry/new-surveyor?supervisorId=${supervisorId}`)
7105
- }, /*#__PURE__*/React.createElement(AddIcon, {
7106
- fill: "#a82227"
7107
- }), t(`${detail.type}_ADD`)));
7285
+ }))));
7108
7286
  }))), showModal && /*#__PURE__*/React.createElement(Modal, {
7109
7287
  headerBarMain: /*#__PURE__*/React.createElement(Heading$2, {
7110
7288
  label: t(modalHeading())
@@ -7129,7 +7307,7 @@ const SupervisorDetails = props => {
7129
7307
  zIndex: "19"
7130
7308
  }
7131
7309
  }, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
7132
- localeKeyPrefix: "ES_VENDOR_SUPERVISOR_ACTION",
7310
+ localeKeyPrefix: "ES_VENDOR_SURVEYOR_ACTION",
7133
7311
  options: ["EDIT", "DELETE"],
7134
7312
  t: t,
7135
7313
  onSelect: a => {
@@ -7142,6 +7320,173 @@ const SupervisorDetails = props => {
7142
7320
  })));
7143
7321
  };
7144
7322
 
7323
+ const EditSurveyor = () => {
7324
+ var _Digit$UserService$ge;
7325
+ const {
7326
+ t
7327
+ } = useTranslation();
7328
+ const history = useHistory();
7329
+ const queryClient = useQueryClient();
7330
+ const {
7331
+ id: surveyorId
7332
+ } = useParams();
7333
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
7334
+ const rawTenantId = Digit.ULBService.getCurrentTenantId();
7335
+ const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : `${rawTenantId}.djb`;
7336
+ const [showToast, setShowToast] = useState(null);
7337
+ const [canSubmit, setCanSubmit] = useState(false);
7338
+ const [defaultValues, setDefaultValues] = useState({});
7339
+ const [surveyorDetails, setSurveyorDetails] = useState({});
7340
+ const {
7341
+ data: surveyorSearchResponse,
7342
+ isLoading
7343
+ } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
7344
+ ids: surveyorId
7345
+ }, {
7346
+ staleTime: Infinity
7347
+ });
7348
+ const {
7349
+ mutate
7350
+ } = Digit.Hooks.fsm.useSurveyorUpdate(tenantId);
7351
+ const Config = SurveyorConfig(t);
7352
+ useEffect(() => {
7353
+ if (surveyorSearchResponse && surveyorSearchResponse.surveyors && surveyorSearchResponse.surveyors.length > 0) {
7354
+ var _details$owner, _details$owner2, _details$owner3, _details$owner4, _details$owner5, _details$owner6, _details$owner7, _details$owner8, _details$owner9;
7355
+ let details = surveyorSearchResponse.surveyors[0];
7356
+ setSurveyorDetails(details);
7357
+ let values = {
7358
+ fullName: (details === null || details === void 0 ? void 0 : (_details$owner = details.owner) === null || _details$owner === void 0 ? void 0 : _details$owner.name) || (details === null || details === void 0 ? void 0 : details.name),
7359
+ mobileNumber: (details === null || details === void 0 ? void 0 : (_details$owner2 = details.owner) === null || _details$owner2 === void 0 ? void 0 : _details$owner2.mobileNumber) || (details === null || details === void 0 ? void 0 : details.mobileNo),
7360
+ emailId: details === null || details === void 0 ? void 0 : (_details$owner3 = details.owner) === null || _details$owner3 === void 0 ? void 0 : _details$owner3.emailId,
7361
+ employeeId: details === null || details === void 0 ? void 0 : details.employeeId,
7362
+ gender: details !== null && details !== void 0 && (_details$owner4 = details.owner) !== null && _details$owner4 !== void 0 && _details$owner4.gender ? {
7363
+ code: details.owner.gender,
7364
+ name: `COMMON_GENDER_${details.owner.gender}`
7365
+ } : null,
7366
+ fatherOrHusbandName: details === null || details === void 0 ? void 0 : (_details$owner5 = details.owner) === null || _details$owner5 === void 0 ? void 0 : _details$owner5.fatherOrHusbandName,
7367
+ relationship: details !== null && details !== void 0 && (_details$owner6 = details.owner) !== null && _details$owner6 !== void 0 && _details$owner6.relationship ? {
7368
+ code: details.owner.relationship,
7369
+ name: `ES_COMMON_RELATION_${details.owner.relationship}`
7370
+ } : null,
7371
+ dob: (details === null || details === void 0 ? void 0 : (_details$owner7 = details.owner) === null || _details$owner7 === void 0 ? void 0 : _details$owner7.dob) && Digit.DateUtils.ConvertTimestampToDate(details === null || details === void 0 ? void 0 : (_details$owner8 = details.owner) === null || _details$owner8 === void 0 ? void 0 : _details$owner8.dob, "yyyy-MM-dd"),
7372
+ correspondenceAddress: details === null || details === void 0 ? void 0 : (_details$owner9 = details.owner) === null || _details$owner9 === void 0 ? void 0 : _details$owner9.correspondenceAddress,
7373
+ description: details === null || details === void 0 ? void 0 : details.description
7374
+ };
7375
+ setDefaultValues(values);
7376
+ }
7377
+ }, [surveyorSearchResponse]);
7378
+ const onFormValueChange = (setValue, formData) => {
7379
+ const isBasicDetailsFilled = (formData === null || formData === void 0 ? void 0 : formData.fullName) && (formData === null || formData === void 0 ? void 0 : formData.mobileNumber) && (formData === null || formData === void 0 ? void 0 : formData.emailId) && (formData === null || formData === void 0 ? void 0 : formData.employeeId) && (formData === null || formData === void 0 ? void 0 : formData.fatherOrHusbandName) && (formData === null || formData === void 0 ? void 0 : formData.relationship) && (formData === null || formData === void 0 ? void 0 : formData.dob) && (formData === null || formData === void 0 ? void 0 : formData.correspondenceAddress);
7380
+ if (isBasicDetailsFilled) {
7381
+ setCanSubmit(true);
7382
+ } else {
7383
+ setCanSubmit(false);
7384
+ }
7385
+ };
7386
+ const closeToast = () => {
7387
+ setShowToast(null);
7388
+ };
7389
+ const onSubmit = data => {
7390
+ var _surveyorDetails$owne, _surveyorDetails$owne2, _data$relationship, _surveyorDetails$owne3, _data$gender, _surveyorDetails$owne4, _surveyorDetails$owne5, _surveyorDetails$owne6, _surveyorDetails$owne7, _surveyorDetails$owne8;
7391
+ const formData = {
7392
+ RequestInfo: {
7393
+ apiId: "Rainmaker",
7394
+ ver: "1.0",
7395
+ ts: null,
7396
+ action: "_update",
7397
+ msgId: `${Date.now()}|en_IN`,
7398
+ authToken: userInfo === null || userInfo === void 0 ? void 0 : userInfo.authToken,
7399
+ userInfo: {
7400
+ id: userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
7401
+ uuid: userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid,
7402
+ userName: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userName,
7403
+ name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
7404
+ type: userInfo === null || userInfo === void 0 ? void 0 : userInfo.type,
7405
+ tenantId: tenantId,
7406
+ roles: userInfo === null || userInfo === void 0 ? void 0 : userInfo.roles
7407
+ }
7408
+ },
7409
+ surveyor: {
7410
+ ...surveyorDetails,
7411
+ description: (data === null || data === void 0 ? void 0 : data.description) || (surveyorDetails === null || surveyorDetails === void 0 ? void 0 : surveyorDetails.description) || "",
7412
+ name: (data === null || data === void 0 ? void 0 : data.fullName) || (surveyorDetails === null || surveyorDetails === void 0 ? void 0 : surveyorDetails.name),
7413
+ mobileNo: (data === null || data === void 0 ? void 0 : data.mobileNumber) || (surveyorDetails === null || surveyorDetails === void 0 ? void 0 : surveyorDetails.mobileNo),
7414
+ employeeId: (data === null || data === void 0 ? void 0 : data.employeeId) || (surveyorDetails === null || surveyorDetails === void 0 ? void 0 : surveyorDetails.employeeId),
7415
+ owner: {
7416
+ ...surveyorDetails.owner,
7417
+ name: (data === null || data === void 0 ? void 0 : data.fullName) || ((_surveyorDetails$owne = surveyorDetails.owner) === null || _surveyorDetails$owne === void 0 ? void 0 : _surveyorDetails$owne.name),
7418
+ fatherOrHusbandName: (data === null || data === void 0 ? void 0 : data.fatherOrHusbandName) || ((_surveyorDetails$owne2 = surveyorDetails.owner) === null || _surveyorDetails$owne2 === void 0 ? void 0 : _surveyorDetails$owne2.fatherOrHusbandName),
7419
+ relationship: (data === null || data === void 0 ? void 0 : (_data$relationship = data.relationship) === null || _data$relationship === void 0 ? void 0 : _data$relationship.code) || ((_surveyorDetails$owne3 = surveyorDetails.owner) === null || _surveyorDetails$owne3 === void 0 ? void 0 : _surveyorDetails$owne3.relationship),
7420
+ gender: (data === null || data === void 0 ? void 0 : (_data$gender = data.gender) === null || _data$gender === void 0 ? void 0 : _data$gender.code) || ((_surveyorDetails$owne4 = surveyorDetails.owner) === null || _surveyorDetails$owne4 === void 0 ? void 0 : _surveyorDetails$owne4.gender) || "OTHERS",
7421
+ dob: data !== null && data !== void 0 && data.dob ? new Date(data.dob).getTime() : (_surveyorDetails$owne5 = surveyorDetails.owner) === null || _surveyorDetails$owne5 === void 0 ? void 0 : _surveyorDetails$owne5.dob,
7422
+ emailId: (data === null || data === void 0 ? void 0 : data.emailId) || ((_surveyorDetails$owne6 = surveyorDetails.owner) === null || _surveyorDetails$owne6 === void 0 ? void 0 : _surveyorDetails$owne6.emailId),
7423
+ mobileNumber: (data === null || data === void 0 ? void 0 : data.mobileNumber) || ((_surveyorDetails$owne7 = surveyorDetails.owner) === null || _surveyorDetails$owne7 === void 0 ? void 0 : _surveyorDetails$owne7.mobileNumber),
7424
+ correspondenceAddress: (data === null || data === void 0 ? void 0 : data.correspondenceAddress) || ((_surveyorDetails$owne8 = surveyorDetails.owner) === null || _surveyorDetails$owne8 === void 0 ? void 0 : _surveyorDetails$owne8.correspondenceAddress)
7425
+ }
7426
+ }
7427
+ };
7428
+ mutate(formData, {
7429
+ onError: error => {
7430
+ setShowToast({
7431
+ key: "error",
7432
+ action: error
7433
+ });
7434
+ setTimeout(closeToast, 5000);
7435
+ },
7436
+ onSuccess: () => {
7437
+ setShowToast({
7438
+ key: "success",
7439
+ action: "UPDATE_SURVEYOR"
7440
+ });
7441
+ queryClient.invalidateQueries("SURVEYOR_SEARCH");
7442
+ setTimeout(() => {
7443
+ closeToast();
7444
+ history.push(`/digit-ui/employee/vendor/registry/surveyor-details/${surveyorId}`);
7445
+ }, 5000);
7446
+ }
7447
+ });
7448
+ };
7449
+ if (isLoading || Object.keys(defaultValues).length === 0) {
7450
+ return /*#__PURE__*/React.createElement(Loader, null);
7451
+ }
7452
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
7453
+ config: [{
7454
+ timeLine: [{
7455
+ actions: t("ES_VENDOR_SURVEYOR_DETAILS"),
7456
+ currentStep: 1
7457
+ }]
7458
+ }],
7459
+ currentActiveIndex: 0,
7460
+ showFinalStep: false
7461
+ }), /*#__PURE__*/React.createElement("div", {
7462
+ style: {
7463
+ flex: "1",
7464
+ overflowY: "auto"
7465
+ }
7466
+ }, /*#__PURE__*/React.createElement(FormComposer, {
7467
+ isDisabled: !canSubmit,
7468
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
7469
+ config: Config.map(config => ({
7470
+ ...config,
7471
+ isCollapsible: true,
7472
+ isDefaultOpen: true
7473
+ })),
7474
+ fieldStyle: {
7475
+ marginRight: 0
7476
+ },
7477
+ onSubmit: onSubmit,
7478
+ defaultValues: defaultValues,
7479
+ onFormValueChange: onFormValueChange,
7480
+ noBreakLine: true,
7481
+ mode: "onChange",
7482
+ noCard: true
7483
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
7484
+ error: showToast.key === "error",
7485
+ label: t(showToast.key === "success" ? `ES_VENDOR_${showToast.action}_SUCCESS` : showToast.action),
7486
+ onClose: closeToast
7487
+ })));
7488
+ };
7489
+
7145
7490
  const ActionButton = ({
7146
7491
  jumpTo
7147
7492
  }) => {
@@ -8686,25 +9031,39 @@ const AddVehicle = ({
8686
9031
  };
8687
9032
  mutate(formData, {
8688
9033
  onError: (error, variables) => {
9034
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
9035
+ const errorMessage = (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || (error === null || error === void 0 ? void 0 : error.message) || "An error occurred";
8689
9036
  setShowToast({
8690
9037
  key: "error",
8691
- action: error
9038
+ action: errorMessage
8692
9039
  });
8693
9040
  setTimeout(closeToast, 5000);
8694
9041
  },
8695
9042
  onSuccess: (data, variables) => {
8696
- var _vendorData$;
9043
+ var _data$Errors, _data$data, _data$data$Errors, _vendorData$;
9044
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors = data.Errors) === null || _data$Errors === void 0 ? void 0 : _data$Errors.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : (_data$data$Errors = _data$data.Errors) === null || _data$data$Errors === void 0 ? void 0 : _data$data$Errors.length) > 0;
9045
+ if (isError) {
9046
+ var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
9047
+ const errorMessage = (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : (_data$data2$Errors = _data$data2.Errors) === null || _data$data2$Errors === void 0 ? void 0 : (_data$data2$Errors$ = _data$data2$Errors[0]) === null || _data$data2$Errors$ === void 0 ? void 0 : _data$data2$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors2 = data.Errors) === null || _data$Errors2 === void 0 ? void 0 : (_data$Errors2$ = _data$Errors2[0]) === null || _data$Errors2$ === void 0 ? void 0 : _data$Errors2$.message) || (data === null || data === void 0 ? void 0 : data.message) || "An error occurred";
9048
+ setShowToast({
9049
+ key: "error",
9050
+ action: errorMessage
9051
+ });
9052
+ setTimeout(closeToast, 5000);
9053
+ return;
9054
+ }
8697
9055
  setShowToast({
8698
9056
  key: "success",
8699
9057
  action: "ADD_VEHICLE"
8700
9058
  });
8701
9059
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8702
9060
  if (isCitizen && vendorData !== null && vendorData !== void 0 && (_vendorData$ = vendorData[0]) !== null && _vendorData$ !== void 0 && _vendorData$.dsoDetails) {
8703
- const newVehicle = data.vehicle.map(v => ({
9061
+ var _data$vehicle4;
9062
+ const newVehicle = (data === null || data === void 0 ? void 0 : (_data$vehicle4 = data.vehicle) === null || _data$vehicle4 === void 0 ? void 0 : _data$vehicle4.map(v => ({
8704
9063
  ...v,
8705
9064
  vendorVehicleStatus: "ACTIVE",
8706
9065
  status: "ACTIVE"
8707
- }));
9066
+ }))) || [];
8708
9067
  const vendor = vendorData[0].dsoDetails;
8709
9068
  const updatedVendor = {
8710
9069
  vendor: {
@@ -8714,13 +9073,27 @@ const AddVehicle = ({
8714
9073
  };
8715
9074
  mutateVendor(updatedVendor, {
8716
9075
  onError: error => {
9076
+ var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
9077
+ const errorMessage = (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message) || (error === null || error === void 0 ? void 0 : error.message) || "An error occurred";
8717
9078
  setShowToast({
8718
9079
  key: "error",
8719
- action: error
9080
+ action: errorMessage
8720
9081
  });
9082
+ setTimeout(closeToast, 5000);
8721
9083
  },
8722
- onSuccess: () => {
8723
- var _Digit$UserService$ge3, _Digit$UserService$ge4, _Digit$UserService$ge5;
9084
+ onSuccess: vendorDataRes => {
9085
+ var _vendorDataRes$Errors, _vendorDataRes$data, _vendorDataRes$data$E, _Digit$UserService$ge3, _Digit$UserService$ge4, _Digit$UserService$ge5;
9086
+ const isError = (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : vendorDataRes.error) === true || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$Errors = vendorDataRes.Errors) === null || _vendorDataRes$Errors === void 0 ? void 0 : _vendorDataRes$Errors.length) > 0 || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$data = vendorDataRes.data) === null || _vendorDataRes$data === void 0 ? void 0 : (_vendorDataRes$data$E = _vendorDataRes$data.Errors) === null || _vendorDataRes$data$E === void 0 ? void 0 : _vendorDataRes$data$E.length) > 0;
9087
+ if (isError) {
9088
+ var _vendorDataRes$data2, _vendorDataRes$data2$, _vendorDataRes$data2$2, _vendorDataRes$Errors2, _vendorDataRes$Errors3;
9089
+ const errorMessage = (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$data2 = vendorDataRes.data) === null || _vendorDataRes$data2 === void 0 ? void 0 : (_vendorDataRes$data2$ = _vendorDataRes$data2.Errors) === null || _vendorDataRes$data2$ === void 0 ? void 0 : (_vendorDataRes$data2$2 = _vendorDataRes$data2$[0]) === null || _vendorDataRes$data2$2 === void 0 ? void 0 : _vendorDataRes$data2$2.message) || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$Errors2 = vendorDataRes.Errors) === null || _vendorDataRes$Errors2 === void 0 ? void 0 : (_vendorDataRes$Errors3 = _vendorDataRes$Errors2[0]) === null || _vendorDataRes$Errors3 === void 0 ? void 0 : _vendorDataRes$Errors3.message) || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : vendorDataRes.message) || "An error occurred";
9090
+ setShowToast({
9091
+ key: "error",
9092
+ action: errorMessage
9093
+ });
9094
+ setTimeout(closeToast, 5000);
9095
+ return;
9096
+ }
8724
9097
  setShowToast({
8725
9098
  key: "success",
8726
9099
  action: "ADD_VEHICLE"
@@ -9395,9 +9768,11 @@ const componentsToRegister = {
9395
9768
  VehicleDetails,
9396
9769
  AddSupervisor,
9397
9770
  SupervisorDetails,
9771
+ EditSupervisor,
9398
9772
  SupervisorAreaAssignment,
9399
9773
  AddSurveyor,
9400
9774
  SurveyorDetails,
9775
+ EditSurveyor,
9401
9776
  SelectEkycZones,
9402
9777
  SelectEkycClusters,
9403
9778
  SelectEkycDropdown