Skip to content

Commit

Permalink
Merge pull request upyog#31 from niua-org/niua-dev
Browse files Browse the repository at this point in the history
Asset Report, Default City selection feature and Extra Sub Category added in the frontend
  • Loading branch information
niua-upyog authored May 30, 2024
2 parents 2695fdc + ed4c9b2 commit d9f23b5
Show file tree
Hide file tree
Showing 16 changed files with 541 additions and 86 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useQuery } from "react-query";
import { MdmsService } from "../../services/elements/MDMS";

const useAssetparentSubType = (tenantId, moduleCode, type, config = {}) => {
const useAssetparentsubsub = () => {
return useQuery("AST_PARENT_SUB_TYPE", () => MdmsService.AST_PARENT(tenantId, moduleCode ,type), config);
};


switch (type) {
case "assetSubCategory":
return useAssetparentsubsub();
default:
return null;
}
};



export default useAssetparentSubType;
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ import useAssetApplicationDetail from "./asset/useAssetApplicationDetail";
import useASSETSearch from "./asset/useASSETSearch";
import useTenantsASSET from "./asset/useTenants"
import useASSETApplicationAction from "./asset/useASSETApplicationAction";
import useAssetparentSubType from "./asset/useAssetparentSubType";
import useProductPriceMDMS from "./ew/useProductPriceMDMS";


Expand Down Expand Up @@ -313,6 +314,7 @@ const asset = {
useAssetApplicationDetail,
useASSETApplicationAction,
useASSETSearch,
useAssetparentSubType,
useTenants: useTenantsASSET
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,23 @@ const getAssetClassificationList = (tenantId, moduleCode, type) => ({
},
});

const getAssetparentsubcategoryList = (tenantId, moduleCode, type) => ({
type,
details: {
tenantId,
moduleDetails: [
{
moduleName: moduleCode,
masterDetails: [
{
name: "assetSubCategory",
},
],
},
],
},
});

const getAssetParentList = (tenantId, moduleCode, type) => ({
type,
details: {
Expand Down Expand Up @@ -1203,6 +1220,17 @@ const GetPropertySubtype = (MdmsRes) =>
});
//return MdmsRes;
};

const getAssetparentsubcategory= (MdmsRes) => {
return MdmsRes["ASSET"].assetSubCategory.filter((assetSubCategory) => assetSubCategory.active).map((assetparentDetails) => {
return {
...assetparentDetails,
i18nKey: `AST_${assetparentDetails.code}`,
};
});
//return MdmsRes;
};


const getAssetParent = (MdmsRes) => {
return MdmsRes["ASSET"].assetParentCategory.filter((assetParentCategory) => assetParentCategory.active).map((assetparentDetails) => {
Expand Down Expand Up @@ -1252,6 +1280,16 @@ const GetPropertySubtype = (MdmsRes) =>
};
});
};

const AST_PARENT= (MdmsRes) => {
MdmsRes["ASSET"].assetSubCategory.filter((assetSubCategory) => assetSubCategory.active).map((asset_parent_mdms) => {
return {
...asset_parent_mdms,
i18nKey: `AST_PAR_${asset_parent_mdms.code}`,
};
});
};

const AssetTypeParent = (MdmsRes) => {
MdmsRes["ASSET"].assetParentCategory.filter((assetParentCategory) => assetParentCategory.active).map((asset_type_mdms) => {
return {
Expand Down Expand Up @@ -1743,9 +1781,15 @@ const transformResponse = (type, MdmsRes, moduleCode, tenantId) => {

case "assetClassification":
return getAssetClassification(MdmsRes);

case "assetSubCategory":
return getAssetparentsubcategory(MdmsRes);

case "Asset_Classification":
return Asset_Classification(MdmsRes);

case "AST_PARENT":
return AST_PARENT(MdmsRes);

case "assetParentCategory":
return getAssetParent(MdmsRes);
Expand Down Expand Up @@ -1915,9 +1959,15 @@ export const MdmsService = {
getAssetClassification: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getAssetClassificationList(tenantId, moduleCode, type), moduleCode);
},
getAssetparentsubcategory: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getAssetparentsubcategoryList(tenantId, moduleCode, type), moduleCode);
},
Asset_Classification: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getAssetClassificationList(tenantId, moduleCode, type), moduleCode);
},
AST_PARENT: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getAssetparentsubcategoryList(tenantId, moduleCode, type), moduleCode);
},

AssetTypeParent: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getAssetParentList(tenantId, moduleCode, type), moduleCode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { ASSETService } from "../../elements/PTR";
import { ASSETService } from "../../elements/ASSET"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
"dependencies": {
"@upyog/digit-ui-libraries": "1.7.0-beta.5",
"@upyog/digit-ui-react-components": "1.7.0-beta.4",
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.8.2",
"lodash.merge": "^4.6.2",
"microbundle-crl": "^0.13.11",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
"react-i18next": "11.16.2",
"react-query": "3.6.1",
"react-router-dom": "5.3.0"
"react-router-dom": "5.3.0",
"xlsx": "^0.18.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const ASSETCard = () => {
label: t("MY_ASSET_APPLICATION"),
link: `/digit-ui/employee/asset/assetservice/my-asset`,
},
{
label: t("AST_REPORT"),
link: `/digit-ui/employee/asset/assetservice/report`,
},
]
const ASSET_INITIATOR = Digit.UserService.hasAccess(["ASSET_INITIATOR","ASSET_VERIFIER", "ASSET_APPROVER"]) || false;
const propsForModuleCard = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@

const ASSETSearchApplication = ({tenantId, isLoading, t, onSubmit, data, count, setShowToast }) => {
const isMobile = window.Digit.Utils.browser.isMobile();

const user = Digit.UserService.getUser().info;
const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({
defaultValues: {
offset: 0,
limit: !isMobile && 10,
sortBy: "commencementDate",
sortOrder: "DESC"
sortOrder: "DESC",
city: user?.tenantId
}
})
useEffect(() => {
Expand All @@ -19,6 +22,8 @@
register("sortBy", "commencementDate")
register("sortOrder", "DESC")
},[register])





Expand Down Expand Up @@ -104,6 +109,10 @@
<span style={{color:"#505A5F"}}>{t("Provide at least one parameter to search for an application")}</span>
</Card>
<SearchForm onSubmit={onSubmit} handleSubmit={handleSubmit}>
<SearchField>
<label>{t("MYCITY_CODE_LABEL")}</label>
<TextInput name="city" inputRef={register({})} />
</SearchField>
<SearchField>
<label>{t("AST_APPLICATION_ID")}</label>
<TextInput name="applicationNo" inputRef={register({})} />
Expand Down Expand Up @@ -132,6 +141,7 @@
reset({
applicationNo: "",
fromDate: "",
city: user?.tenantId,
toDate: "",
offset: 0,
limit: 10,
Expand Down
Loading

0 comments on commit d9f23b5

Please sign in to comment.