@djb25/digit-ui-module-vendor 1.0.84 → 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,
@@ -2820,13 +2826,10 @@ const SearchVendor = () => {
2820
2826
  }).length;
2821
2827
  const inboxTotalCount = (dsoData === null || dsoData === void 0 ? void 0 : dsoData.totalCount) || 50;
2822
2828
  useEffect(() => {
2823
- var _location$state;
2829
+ var _location$state, _location$state2;
2824
2830
  refetch();
2825
2831
  refetchVendor();
2826
- if ((_location$state = location.state) !== null && _location$state !== void 0 && _location$state.showSuccessToast) {
2827
- var _location$state2;
2828
- setShowToast((_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.message);
2829
- }
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);
2830
2833
  }, []);
2831
2834
  useEffect(() => {
2832
2835
  refetch();
@@ -2991,6 +2994,15 @@ const SearchVendor = () => {
2991
2994
  pattern: "[0-9]{10}",
2992
2995
  maxLength: 10,
2993
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"
2994
3006
  }] : [{
2995
3007
  label: t("ES_VENDOR_SEARCH_VENDOR_NAME"),
2996
3008
  name: "name"
@@ -3018,7 +3030,7 @@ const SearchVendor = () => {
3018
3030
  table: tableData
3019
3031
  },
3020
3032
  searchParams: searchParams,
3021
- isLoading: isLoading || isVendorLoading,
3033
+ isLoading: isLoading || isVendorLoading || isServiceTypeLoading,
3022
3034
  onSort: handleSort,
3023
3035
  disableSort: false,
3024
3036
  sortParams: sortParams,
@@ -5163,9 +5175,10 @@ const AddVendor = () => {
5163
5175
  const _temp = function () {
5164
5176
  if (isEkyc) {
5165
5177
  return Promise.resolve(refetch()).then(function (_ref) {
5166
- var _mergedData$zoneIds, _mergedData$clusterId;
5178
+ var _data$vendor, _mergedData$zoneIds, _mergedData$clusterId;
5167
5179
  let data = _ref.data;
5168
- 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) {
5169
5182
  setShowToast({
5170
5183
  key: "error",
5171
5184
  message: t("EKYC_VENDOR_LIMIT"),