@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.
package/dist/index.js CHANGED
@@ -2680,7 +2680,7 @@ const VendorInbox = props => {
2680
2680
  };
2681
2681
 
2682
2682
  const SearchVendor = () => {
2683
- 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;
2683
+ 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;
2684
2684
  const _useTranslation = reactI18next.useTranslation(),
2685
2685
  t = _useTranslation.t;
2686
2686
  const tenantId = Digit.ULBService.getCurrentTenantId();
@@ -2722,6 +2722,21 @@ const SearchVendor = () => {
2722
2722
  setShowToast = _useState9[1];
2723
2723
  const _Digit$Hooks$useToast = Digit.Hooks.useToast(),
2724
2724
  consumeToast = _Digit$Hooks$useToast.consumeToast;
2725
+ const _Digit$Hooks$useCusto = Digit.Hooks.useCustomMDMS(tenantId, "tenant", [{
2726
+ name: "citymodule"
2727
+ }], {
2728
+ select: data => {
2729
+ var _data$tenant;
2730
+ return data === null || data === void 0 ? void 0 : (_data$tenant = data.tenant) === null || _data$tenant === void 0 ? void 0 : _data$tenant.citymodule;
2731
+ }
2732
+ }),
2733
+ serviceTypes = _Digit$Hooks$useCusto.data,
2734
+ isServiceTypeLoading = _Digit$Hooks$useCusto.isLoading;
2735
+ const formattedServiceTypes = (serviceTypes === null || serviceTypes === void 0 ? void 0 : serviceTypes.map(service => ({
2736
+ i18nKey: service.code,
2737
+ code: service.code,
2738
+ value: service.name
2739
+ }))) || [];
2725
2740
  React.useEffect(() => {
2726
2741
  const message = consumeToast();
2727
2742
  if (message) {
@@ -2788,7 +2803,8 @@ const SearchVendor = () => {
2788
2803
  tenantId,
2789
2804
  filters: _extends({}, paginationParms, {
2790
2805
  name: searchParams === null || searchParams === void 0 ? void 0 : searchParams.name,
2791
- status: "ACTIVE,DISABLED"
2806
+ status: "ACTIVE,DISABLED",
2807
+ 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()
2792
2808
  }),
2793
2809
  config: {
2794
2810
  enabled: false
@@ -2797,16 +2813,6 @@ const SearchVendor = () => {
2797
2813
  dsoData = _ref.data,
2798
2814
  isLoading = _ref.isLoading,
2799
2815
  refetch = _ref.refetch;
2800
- Digit.Hooks.fsm.useVendorSearch({
2801
- tenantId,
2802
- filters: _extends({}, paginationParms, {
2803
- name: searchParams === null || searchParams === void 0 ? void 0 : searchParams.name,
2804
- status: "ACTIVE,DISABLED"
2805
- }),
2806
- config: {
2807
- enabled: false
2808
- }
2809
- });
2810
2816
  const _Digit$Hooks$fsm$useD2 = Digit.Hooks.fsm.useDsoSearch(tenantId, {
2811
2817
  vehicleIds: vehicleIds,
2812
2818
  driverIds: driverIds,
@@ -2821,16 +2827,12 @@ const SearchVendor = () => {
2821
2827
  var _ele$dsoDetails, _ele$dsoDetails$addit, _ele$dsoDetails$addit2;
2822
2828
  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";
2823
2829
  }).length;
2824
- console.log(ekycVendorCount);
2825
2830
  const inboxTotalCount = (dsoData === null || dsoData === void 0 ? void 0 : dsoData.totalCount) || 50;
2826
2831
  React.useEffect(() => {
2827
- var _location$state;
2832
+ var _location$state, _location$state2;
2828
2833
  refetch();
2829
2834
  refetchVendor();
2830
- if ((_location$state = location.state) !== null && _location$state !== void 0 && _location$state.showSuccessToast) {
2831
- var _location$state2;
2832
- setShowToast((_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.message);
2833
- }
2835
+ 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);
2834
2836
  }, []);
2835
2837
  React.useEffect(() => {
2836
2838
  refetch();
@@ -2995,6 +2997,15 @@ const SearchVendor = () => {
2995
2997
  pattern: "[0-9]{10}",
2996
2998
  maxLength: 10,
2997
2999
  title: t("ES_FSM_MOBILE_NUMBER_FORMAT_TIP") || "Enter 10-digit mobile number"
3000
+ }] : tab === "VENDOR" ? [{
3001
+ label: t("ES_VENDOR_SEARCH_VENDOR_NAME"),
3002
+ name: "name"
3003
+ }, {
3004
+ label: t("ES_VENDOR_SEARCH_VENDOR_TYPE"),
3005
+ name: "vendor",
3006
+ type: "dropdown",
3007
+ options: formattedServiceTypes,
3008
+ optionsKey: "code"
2998
3009
  }] : [{
2999
3010
  label: t("ES_VENDOR_SEARCH_VENDOR_NAME"),
3000
3011
  name: "name"
@@ -3022,7 +3033,7 @@ const SearchVendor = () => {
3022
3033
  table: tableData
3023
3034
  },
3024
3035
  searchParams: searchParams,
3025
- isLoading: isLoading || isVendorLoading,
3036
+ isLoading: isLoading || isVendorLoading || isServiceTypeLoading,
3026
3037
  onSort: handleSort,
3027
3038
  disableSort: false,
3028
3039
  sortParams: sortParams,
@@ -5167,9 +5178,10 @@ const AddVendor = () => {
5167
5178
  const _temp = function () {
5168
5179
  if (isEkyc) {
5169
5180
  return Promise.resolve(refetch()).then(function (_ref) {
5170
- var _mergedData$zoneIds, _mergedData$clusterId;
5181
+ var _data$vendor, _mergedData$zoneIds, _mergedData$clusterId;
5171
5182
  let data = _ref.data;
5172
- if ((data === null || data === void 0 ? void 0 : data.totalCount) >= 3) {
5183
+ 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;
5184
+ if (activeVendorCount >= 3) {
5173
5185
  setShowToast({
5174
5186
  key: "error",
5175
5187
  message: t("EKYC_VENDOR_LIMIT"),