Skip to content

Commit

Permalink
UM-6631 Pt MDMS v2 call modification
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmoy-eGov committed Apr 9, 2024
1 parent bff1edb commit 03a7fac
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@upyog/digit-ui-module-noc": "1.7.3",
"@upyog/digit-ui-module-obps": "1.7.2",
"@upyog/digit-ui-module-pgr": "1.7.8",
"@upyog/digit-ui-module-pt": "1.7.6",
"@upyog/digit-ui-module-pt": "1.7.7",
"@upyog/digit-ui-module-receipts": "1.7.3",
"@upyog/digit-ui-module-tl": "1.7.2",
"@upyog/digit-ui-module-ws": "1.7.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useUserSearch } from "./userSearch";
import { useApplicationsForBusinessServiceSearch } from "./useApplicationForBillSearch";
import useBoundaryLocalities from "./useLocalities";
import useCommonMDMS from "./useMDMS";
import useCommonMDMSV2 from "./useMDMSV2";
import useCustomMDMS from "./useCustomMDMS";
import useCustomAPIHook from "./useCustomAPIHook";
import useInboxGeneral from "./useInboxGeneral/useInboxGeneral";
Expand Down Expand Up @@ -521,6 +522,7 @@ const Hooks = {
useEmployeeSearch,
useBoundaryLocalities,
useCommonMDMS,
useCommonMDMSV2,
useApplicationStatusGeneral,
useModuleTenants,
useRecieptSearch,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { MdmsServiceV2 } from "../services/elements/MDMSV2";
import { useQuery } from "react-query";

const useMDMS = (tenantId, moduleCode, type, config = {}, payload = []) => {
const usePaymentGateway = () => {
return useQuery("PAYMENT_GATEWAY", () => MdmsServiceV2.getPaymentGateway(tenantId, moduleCode, type), {
select: (data) => {
return data?.[moduleCode]?.[type].filter((e) => e.active).map(({ gateway }) => gateway);
},
...config,
});
};

const useReceiptKey = () => {
return useQuery("RECEIPT_KEY", () => MdmsServiceV2.getReceiptKey(tenantId, moduleCode, type), config);
};

const useBillsGenieKey = () => {
return useQuery("BILLS_GENIE_KEY", () => MdmsServiceV2.getBillsGenieKey(tenantId, moduleCode, type), config);
};

const useFSTPPlantInfo = () => {
return useQuery("FSTP_PLANTINFO", () => MdmsServiceV2.getFSTPPlantInfo(tenantId, moduleCode, type), config);
};

const _default = () => {
return useQuery([tenantId, moduleCode, type], () => MdmsServiceV2.getMultipleTypes(tenantId, moduleCode, type), config);
};

switch (type) {
case "PaymentGateway":
return usePaymentGateway();
case "ReceiptKey":
return useReceiptKey();
case "FSTPPlantInfo":
return useFSTPPlantInfo();
case "BillsGenieKey":
return useBillsGenieKey();
default:
return _default();
}
};

export default useMDMS;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@upyog/digit-ui-module-pt",
"version": "1.7.6",
"version": "1.7.7",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const SelectPTUnits = React.memo(({ t, config, onSelect, userType, formData }) =
}
};

const { data: mdmsData, isLoading } = Digit.Hooks.useCommonMDMS(
const { data: mdmsData, isLoading } = Digit.Hooks.useCommonMDMSV2(
Digit.ULBService.getStateId(),
"PropertyTax",
["Floor", "OccupancyType", "UsageCategory"],
Expand Down
2 changes: 1 addition & 1 deletion frontend/micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@upyog/digit-ui-module-obps": "1.7.2",
"@upyog/digit-ui-module-noc": "1.7.3",
"@upyog/digit-ui-module-pgr": "1.7.8",
"@upyog/digit-ui-module-pt": "1.7.6",
"@upyog/digit-ui-module-pt": "1.7.7",
"@upyog/digit-ui-module-receipts": "1.7.3",
"@upyog/digit-ui-module-tl": "1.7.2",
"@upyog/digit-ui-module-ws": "1.7.3",
Expand Down

0 comments on commit 03a7fac

Please sign in to comment.