@djb25/digit-ui-module-vendor 1.0.71 → 1.0.72

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
@@ -43,7 +43,10 @@ function _catch(body, recover) {
43
43
 
44
44
  const _require = require("@djb25/digit-ui-react-components"),
45
45
  DatePicker = _require.DatePicker;
46
- const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
46
+ const SurveyorConfig = function (t, genderMenu, disabled) {
47
+ if (genderMenu === void 0) {
48
+ genderMenu = [];
49
+ }
47
50
  return [{
48
51
  head: "ES_VENDOR_SURVEYOR_BASIC_DETAILS",
49
52
  body: [{
@@ -93,11 +96,16 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
93
96
  error: t("ES_VENDOR_INVALID_EMAIL")
94
97
  }
95
98
  }, {
96
- label: t("ES_VENDOR_SURVEYOR_GENDER"),
99
+ label: t("ES_FSM_REGISTRY_NEW_GENDER"),
97
100
  isMandatory: true,
98
101
  type: "component",
99
102
  key: "gender",
100
- component: "SelectEkycDropdown"
103
+ component: "SelectEkycDropdown",
104
+ populators: {
105
+ name: "gender",
106
+ options: genderMenu,
107
+ optionsKey: "i18nKey"
108
+ }
101
109
  }, {
102
110
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
103
111
  isMandatory: true,
@@ -211,8 +219,26 @@ const AddSurveyor = _ref => {
211
219
  });
212
220
  }
213
221
  }, [isSupervisor, supervisorSearchResponse, isSupervisorSearchLoading, matchedSupervisor]);
222
+ const _useState4 = React.useState([]),
223
+ genderMenu = _useState4[0],
224
+ setGenderMenu = _useState4[1];
225
+ const stateId = Digit.ULBService.getStateId();
226
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
227
+ genderTypeData = _Digit$Hooks$obps$use.data;
228
+ React.useEffect(() => {
229
+ var _genderTypeData$commo, _genderTypeData$commo2;
230
+ if (genderTypeData && (_genderTypeData$commo = genderTypeData["common-masters"]) !== null && _genderTypeData$commo !== void 0 && (_genderTypeData$commo2 = _genderTypeData$commo.GenderType) !== null && _genderTypeData$commo2 !== void 0 && _genderTypeData$commo2.length) {
231
+ var _genderTypeData$commo3, _genderTypeData$commo4;
232
+ const menuItems = (_genderTypeData$commo3 = genderTypeData["common-masters"]) === null || _genderTypeData$commo3 === void 0 ? void 0 : (_genderTypeData$commo4 = _genderTypeData$commo3.GenderType) === null || _genderTypeData$commo4 === void 0 ? void 0 : _genderTypeData$commo4.filter(data => data.active).map(genderDetails => ({
233
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
234
+ code: "" + genderDetails.code,
235
+ value: "" + genderDetails.code
236
+ }));
237
+ setGenderMenu(menuItems);
238
+ }
239
+ }, [genderTypeData]);
214
240
  const Config = React.useMemo(() => {
215
- const baseConfig = SurveyorConfig(t);
241
+ const baseConfig = SurveyorConfig(t, genderMenu);
216
242
  if (isSupervisor) {
217
243
  return baseConfig.map(section => _extends({}, section, {
218
244
  body: section.body.map(field => {
@@ -228,7 +254,7 @@ const AddSurveyor = _ref => {
228
254
  }));
229
255
  }
230
256
  return baseConfig;
231
- }, [t, isSupervisor]);
257
+ }, [t, genderMenu, isSupervisor]);
232
258
  const isValidAge = dateStr => {
233
259
  if (!dateStr) return false;
234
260
  const today = new Date();
@@ -3455,7 +3481,10 @@ const SupervisorDetails = props => {
3455
3481
 
3456
3482
  const _require$1 = require("@djb25/digit-ui-react-components"),
3457
3483
  DatePicker$1 = _require$1.DatePicker;
3458
- const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
3484
+ const SupervisorConfig = function (t, genderMenu, disabled) {
3485
+ if (genderMenu === void 0) {
3486
+ genderMenu = [];
3487
+ }
3459
3488
  if (disabled === void 0) {
3460
3489
  disabled = false;
3461
3490
  }
@@ -3516,11 +3545,16 @@ const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
3516
3545
  className: "payment-form-text-input-correction"
3517
3546
  }
3518
3547
  }, {
3519
- label: t("ES_VENDOR_SUPERVISOR_GENDER"),
3548
+ label: t("ES_FSM_REGISTRY_NEW_GENDER"),
3520
3549
  isMandatory: true,
3521
3550
  type: "component",
3522
3551
  key: "gender",
3523
- component: "SelectEkycDropdown"
3552
+ component: "SelectEkycDropdown",
3553
+ populators: {
3554
+ name: "gender",
3555
+ options: genderMenu,
3556
+ optionsKey: "i18nKey"
3557
+ }
3524
3558
  }, {
3525
3559
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
3526
3560
  isMandatory: true,
@@ -3595,7 +3629,27 @@ const AddSupervisor = _ref => {
3595
3629
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorCreate(tenantId),
3596
3630
  mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
3597
3631
  const history = reactRouterDom.useHistory();
3598
- const Config = SupervisorConfig(t);
3632
+ const _useState3 = React.useState([]),
3633
+ genderMenu = _useState3[0],
3634
+ setGenderMenu = _useState3[1];
3635
+ const stateId = Digit.ULBService.getStateId();
3636
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
3637
+ genderTypeData = _Digit$Hooks$obps$use.data;
3638
+ React.useEffect(() => {
3639
+ var _genderTypeData$commo, _genderTypeData$commo2;
3640
+ if (genderTypeData && (_genderTypeData$commo = genderTypeData["common-masters"]) !== null && _genderTypeData$commo !== void 0 && (_genderTypeData$commo2 = _genderTypeData$commo.GenderType) !== null && _genderTypeData$commo2 !== void 0 && _genderTypeData$commo2.length) {
3641
+ var _genderTypeData$commo3, _genderTypeData$commo4;
3642
+ const menuItems = (_genderTypeData$commo3 = genderTypeData["common-masters"]) === null || _genderTypeData$commo3 === void 0 ? void 0 : (_genderTypeData$commo4 = _genderTypeData$commo3.GenderType) === null || _genderTypeData$commo4 === void 0 ? void 0 : _genderTypeData$commo4.filter(data => data.active).map(genderDetails => ({
3643
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
3644
+ code: "" + genderDetails.code,
3645
+ value: "" + genderDetails.code
3646
+ }));
3647
+ setGenderMenu(menuItems);
3648
+ }
3649
+ }, [genderTypeData]);
3650
+ const Config = React__default.useMemo(() => {
3651
+ return SupervisorConfig(t, genderMenu);
3652
+ }, [t, genderMenu]);
3599
3653
  const defaultValues = {
3600
3654
  role: {
3601
3655
  code: "SUPERVISOR",
@@ -5425,7 +5479,27 @@ const EditSupervisor = () => {
5425
5479
  isLoading = _Digit$Hooks$fsm$useS.isLoading;
5426
5480
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorUpdate(tenantId),
5427
5481
  mutate = _Digit$Hooks$fsm$useS2.mutate;
5428
- const Config = SupervisorConfig(t);
5482
+ const _useState5 = React.useState([]),
5483
+ genderMenu = _useState5[0],
5484
+ setGenderMenu = _useState5[1];
5485
+ const stateId = Digit.ULBService.getStateId();
5486
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
5487
+ genderTypeData = _Digit$Hooks$obps$use.data;
5488
+ React.useEffect(() => {
5489
+ var _genderTypeData$commo, _genderTypeData$commo2;
5490
+ if (genderTypeData && (_genderTypeData$commo = genderTypeData["common-masters"]) !== null && _genderTypeData$commo !== void 0 && (_genderTypeData$commo2 = _genderTypeData$commo.GenderType) !== null && _genderTypeData$commo2 !== void 0 && _genderTypeData$commo2.length) {
5491
+ var _genderTypeData$commo3, _genderTypeData$commo4;
5492
+ const menuItems = (_genderTypeData$commo3 = genderTypeData["common-masters"]) === null || _genderTypeData$commo3 === void 0 ? void 0 : (_genderTypeData$commo4 = _genderTypeData$commo3.GenderType) === null || _genderTypeData$commo4 === void 0 ? void 0 : _genderTypeData$commo4.filter(data => data.active).map(genderDetails => ({
5493
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
5494
+ code: "" + genderDetails.code,
5495
+ value: "" + genderDetails.code
5496
+ }));
5497
+ setGenderMenu(menuItems);
5498
+ }
5499
+ }, [genderTypeData]);
5500
+ const Config = React__default.useMemo(() => {
5501
+ return SupervisorConfig(t, genderMenu);
5502
+ }, [t, genderMenu]);
5429
5503
  React.useEffect(() => {
5430
5504
  if (supervisorSearchResponse && supervisorSearchResponse.supervisors && supervisorSearchResponse.supervisors.length > 0) {
5431
5505
  var _details$owner, _details$owner2, _details$owner3, _details$owner4, _details$owner5, _details$owner6, _details$owner7;
@@ -5602,7 +5676,27 @@ const EditSurveyor = () => {
5602
5676
  isLoading = _Digit$Hooks$fsm$useS.isLoading;
5603
5677
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
5604
5678
  mutate = _Digit$Hooks$fsm$useS2.mutate;
5605
- const Config = SurveyorConfig(t);
5679
+ const _useState5 = React.useState([]),
5680
+ genderMenu = _useState5[0],
5681
+ setGenderMenu = _useState5[1];
5682
+ const stateId = Digit.ULBService.getStateId();
5683
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
5684
+ genderTypeData = _Digit$Hooks$obps$use.data;
5685
+ React.useEffect(() => {
5686
+ var _genderTypeData$commo, _genderTypeData$commo2;
5687
+ if (genderTypeData && (_genderTypeData$commo = genderTypeData["common-masters"]) !== null && _genderTypeData$commo !== void 0 && (_genderTypeData$commo2 = _genderTypeData$commo.GenderType) !== null && _genderTypeData$commo2 !== void 0 && _genderTypeData$commo2.length) {
5688
+ var _genderTypeData$commo3, _genderTypeData$commo4;
5689
+ const menuItems = (_genderTypeData$commo3 = genderTypeData["common-masters"]) === null || _genderTypeData$commo3 === void 0 ? void 0 : (_genderTypeData$commo4 = _genderTypeData$commo3.GenderType) === null || _genderTypeData$commo4 === void 0 ? void 0 : _genderTypeData$commo4.filter(data => data.active).map(genderDetails => ({
5690
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
5691
+ code: "" + genderDetails.code,
5692
+ value: "" + genderDetails.code
5693
+ }));
5694
+ setGenderMenu(menuItems);
5695
+ }
5696
+ }, [genderTypeData]);
5697
+ const Config = React__default.useMemo(() => {
5698
+ return SurveyorConfig(t, genderMenu);
5699
+ }, [t, genderMenu]);
5606
5700
  React.useEffect(() => {
5607
5701
  if (surveyorSearchResponse && surveyorSearchResponse.surveyors && surveyorSearchResponse.surveyors.length > 0) {
5608
5702
  var _details$owner, _details$owner2, _details$owner3, _details$owner4, _details$owner5, _details$owner6, _details$owner7, _details$owner8, _details$owner9;