Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map skills to mdms v2 #397

Open
wants to merge 6 commits into
base: UAT
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const getAttendanceTableData = async(data, skills, t, expenseCalculations) => {
tableRow.actualWorkingDays = item?.actualTotalAttendance || 0
tableRow.nameOfIndividual = item?.additionalDetails?.userName || t("NA")
tableRow.guardianName = item?.additionalDetails?.fatherName || t("NA")
tableRow.skill = skills[item?.additionalDetails?.skillCode]?.code || t("NA")
tableRow.skill = skills[item?.additionalDetails?.skillCode]?.description || t("NA")
tableRow.amount = skills[item?.additionalDetails?.skillCode]?.amount * item?.actualTotalAttendance || 0
tableRow.modifiedAmount = expenseCalculations?.filter(data=>data?.payee?.identifier === item?.individualId)?.[0]?.lineItems?.[0]?.amount || 0;
tableRow.modifiedWorkingDays = item?.modifiedTotalAttendance ? item?.modifiedTotalAttendance : item?.actualTotalAttendance
Expand Down Expand Up @@ -134,16 +134,49 @@ const workflowDataDetails = async (tenantId, businessIds) => {
}

const getWageSeekerSkills = async (data) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lokendra-egov check if this hook or method is being used anywhere else also where it might do impact.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've checked the impact is on muster roll view

const skills = {}
const skillResponse = await Digit.MDMSService.getMultipleTypesWithFilter(Digit.ULBService.getStateId(), "common-masters", [{"name": "WageSeekerSkills"}])
const labourChangesResponse = await Digit.MDMSService.getMultipleTypesWithFilter(Digit.ULBService.getStateId(), "expense", [{"name": "LabourCharges"}])
skillResponse?.['common-masters']?.WageSeekerSkills.forEach(item => {
let amount = labourChangesResponse?.["expense"]?.LabourCharges?.find(charge => charge?.code === item?.code && charge?.effectiveFrom < data?.musterRolls?.[0]?.auditDetails?.createdTime && (charge?.effectiveTo == null || charge?.effectiveTo > data?.musterRolls?.[0]?.auditDetails?.createdTime))?.amount
let skillWithAmount = {...item, amount}
skills[item.code] = skillWithAmount
})
return skills
}
const tenantId = Digit.ULBService.getStateId();
const skills = {};

const requestCriteria = {
url: "/mdms-v2/v1/_search",
body: {
MdmsCriteria: {
tenantId: tenantId,
moduleDetails: [
{
moduleName: "WORKS-SOR",
masterDetails: [
{
name: "SOR"
},
],
},
],
},
},
};
let skillResponse = await Digit.CustomService.getResponse(requestCriteria)


if (skillResponse?.MdmsRes?.['WORKS-SOR']?.SOR) {
skillResponse.MdmsRes['WORKS-SOR'].SOR.forEach(skill => {
skills[skill.id] = { description: skill.description };
});
}
return skills;
};

// const getWageSeekerSkills = async (data) => {
// const skills = {}
// const skillResponse = await Digit.MDMSService.getMultipleTypesWithFilter(Digit.ULBService.getStateId(), "common-masters", [{"name": "WageSeekerSkills"}])
// const labourChangesResponse = await Digit.MDMSService.getMultipleTypesWithFilter(Digit.ULBService.getStateId(), "expense", [{"name": "LabourCharges"}])
// skillResponse?.['common-masters']?.WageSeekerSkills.forEach(item => {
// let amount = labourChangesResponse?.["expense"]?.LabourCharges?.find(charge => charge?.code === item?.code && charge?.effectiveFrom < data?.musterRolls?.[0]?.auditDetails?.createdTime && (charge?.effectiveTo == null || charge?.effectiveTo > data?.musterRolls?.[0]?.auditDetails?.createdTime))?.amount
// let skillWithAmount = {...item, amount}
// skills[item.code] = skillWithAmount
// })
// return skills
// }

export const fetchAttendanceDetails = async (t, tenantId, searchParams) => {
try {
Expand Down
Loading