@djb25/digit-ui-module-vendor 1.0.83 → 1.0.85

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.
@@ -2677,7 +2677,7 @@ const VendorInbox = props => {
2677
2677
  };
2678
2678
 
2679
2679
  const SearchVendor = () => {
2680
- var _Digit$UserService$ge, _Digit$UserService$ge2, _Digit$UserService$ge3, _userInfo$info, _userInfo$info2, _sortParams$, _sortParams$2, _searchParams$vendor, _searchParams$filling, _searchParams$vendor2, _allFillingPoints$fil;
2680
+ var _Digit$UserService$ge, _Digit$UserService$ge2, _Digit$UserService$ge3, _userInfo$info, _userInfo$info2, _sortParams$, _sortParams$2, _searchParams$vendor, _searchParams$filling, _searchParams$vendor2, _searchParams$vendor3, _searchParams$vendor4, _allFillingPoints$fil;
2681
2681
  const _useTranslation = useTranslation(),
2682
2682
  t = _useTranslation.t;
2683
2683
  const tenantId = Digit.ULBService.getCurrentTenantId();
@@ -2719,6 +2719,21 @@ const SearchVendor = () => {
2719
2719
  setShowToast = _useState9[1];
2720
2720
  const _Digit$Hooks$useToast = Digit.Hooks.useToast(),
2721
2721
  consumeToast = _Digit$Hooks$useToast.consumeToast;
2722
+ const _Digit$Hooks$useCusto = Digit.Hooks.useCustomMDMS(tenantId, "tenant", [{
2723
+ name: "citymodule"
2724
+ }], {
2725
+ select: data => {
2726
+ var _data$tenant;
2727
+ return data === null || data === void 0 ? void 0 : (_data$tenant = data.tenant) === null || _data$tenant === void 0 ? void 0 : _data$tenant.citymodule;
2728
+ }
2729
+ }),
2730
+ serviceTypes = _Digit$Hooks$useCusto.data,
2731
+ isServiceTypeLoading = _Digit$Hooks$useCusto.isLoading;
2732
+ const formattedServiceTypes = (serviceTypes === null || serviceTypes === void 0 ? void 0 : serviceTypes.map(service => ({
2733
+ i18nKey: service.code,
2734
+ code: service.code,
2735
+ value: service.name
2736
+ }))) || [];
2722
2737
  useEffect(() => {
2723
2738
  const message = consumeToast();
2724
2739
  if (message) {
@@ -2785,7 +2800,8 @@ const SearchVendor = () => {
2785
2800
  tenantId,
2786
2801
  filters: _extends({}, paginationParms, {
2787
2802
  name: searchParams === null || searchParams === void 0 ? void 0 : searchParams.name,
2788
- status: "ACTIVE,DISABLED"
2803
+ status: "ACTIVE,DISABLED",
2804
+ serviceType: searchParams === null || searchParams === void 0 ? void 0 : (_searchParams$vendor3 = searchParams.vendor) === null || _searchParams$vendor3 === void 0 ? void 0 : (_searchParams$vendor4 = _searchParams$vendor3.code) === null || _searchParams$vendor4 === void 0 ? void 0 : _searchParams$vendor4.toLowerCase()
2789
2805
  }),
2790
2806
  config: {
2791
2807
  enabled: false
@@ -2794,16 +2810,6 @@ const SearchVendor = () => {
2794
2810
  dsoData = _ref.data,
2795
2811
  isLoading = _ref.isLoading,
2796
2812
  refetch = _ref.refetch;
2797
- Digit.Hooks.fsm.useVendorSearch({
2798
- tenantId,
2799
- filters: _extends({}, paginationParms, {
2800
- name: searchParams === null || searchParams === void 0 ? void 0 : searchParams.name,
2801
- status: "ACTIVE,DISABLED"
2802
- }),
2803
- config: {
2804
- enabled: false
2805
- }
2806
- });
2807
2813
  const _Digit$Hooks$fsm$useD2 = Digit.Hooks.fsm.useDsoSearch(tenantId, {
2808
2814
  vehicleIds: vehicleIds,
2809
2815
  driverIds: driverIds,
@@ -2818,16 +2824,12 @@ const SearchVendor = () => {
2818
2824
  var _ele$dsoDetails, _ele$dsoDetails$addit, _ele$dsoDetails$addit2;
2819
2825
  return (ele === null || ele === void 0 ? void 0 : (_ele$dsoDetails = ele.dsoDetails) === null || _ele$dsoDetails === void 0 ? void 0 : (_ele$dsoDetails$addit = _ele$dsoDetails.additionalDetails) === null || _ele$dsoDetails$addit === void 0 ? void 0 : (_ele$dsoDetails$addit2 = _ele$dsoDetails$addit.serviceType) === null || _ele$dsoDetails$addit2 === void 0 ? void 0 : _ele$dsoDetails$addit2.toLowerCase()) === "ekyc";
2820
2826
  }).length;
2821
- console.log(ekycVendorCount);
2822
2827
  const inboxTotalCount = (dsoData === null || dsoData === void 0 ? void 0 : dsoData.totalCount) || 50;
2823
2828
  useEffect(() => {
2824
- var _location$state;
2829
+ var _location$state, _location$state2;
2825
2830
  refetch();
2826
2831
  refetchVendor();
2827
- if ((_location$state = location.state) !== null && _location$state !== void 0 && _location$state.showSuccessToast) {
2828
- var _location$state2;
2829
- setShowToast((_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.message);
2830
- }
2832
+ if ((_location$state = location.state) !== null && _location$state !== void 0 && _location$state.showSuccessToast) setShowToast((_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.message);
2831
2833
  }, []);
2832
2834
  useEffect(() => {
2833
2835
  refetch();
@@ -2992,6 +2994,15 @@ const SearchVendor = () => {
2992
2994
  pattern: "[0-9]{10}",
2993
2995
  maxLength: 10,
2994
2996
  title: t("ES_FSM_MOBILE_NUMBER_FORMAT_TIP") || "Enter 10-digit mobile number"
2997
+ }] : tab === "VENDOR" ? [{
2998
+ label: t("ES_VENDOR_SEARCH_VENDOR_NAME"),
2999
+ name: "name"
3000
+ }, {
3001
+ label: t("ES_VENDOR_SEARCH_VENDOR_TYPE"),
3002
+ name: "vendor",
3003
+ type: "dropdown",
3004
+ options: formattedServiceTypes,
3005
+ optionsKey: "code"
2995
3006
  }] : [{
2996
3007
  label: t("ES_VENDOR_SEARCH_VENDOR_NAME"),
2997
3008
  name: "name"
@@ -3019,7 +3030,7 @@ const SearchVendor = () => {
3019
3030
  table: tableData
3020
3031
  },
3021
3032
  searchParams: searchParams,
3022
- isLoading: isLoading || isVendorLoading,
3033
+ isLoading: isLoading || isVendorLoading || isServiceTypeLoading,
3023
3034
  onSort: handleSort,
3024
3035
  disableSort: false,
3025
3036
  sortParams: sortParams,
@@ -5164,9 +5175,10 @@ const AddVendor = () => {
5164
5175
  const _temp = function () {
5165
5176
  if (isEkyc) {
5166
5177
  return Promise.resolve(refetch()).then(function (_ref) {
5167
- var _mergedData$zoneIds, _mergedData$clusterId;
5178
+ var _data$vendor, _mergedData$zoneIds, _mergedData$clusterId;
5168
5179
  let data = _ref.data;
5169
- if ((data === null || data === void 0 ? void 0 : data.totalCount) >= 3) {
5180
+ const activeVendorCount = (data === null || data === void 0 ? void 0 : (_data$vendor = data.vendor) === null || _data$vendor === void 0 ? void 0 : _data$vendor.filter(vendor => vendor.status === "ACTIVE").length) || 0;
5181
+ if (activeVendorCount >= 3) {
5170
5182
  setShowToast({
5171
5183
  key: "error",
5172
5184
  message: t("EKYC_VENDOR_LIMIT"),