| @@ -43,6 +43,7 @@ const ResourceOverconsumptionReport: React.FC<Props> = ({ team, customer, subsid | |||||
| const [_custType_B, id_B] = readIntFromString(b.value) as [string, number] | const [_custType_B, id_B] = readIntFromString(b.value) as [string, number] | ||||
| return (id_A - id_B) | return (id_A - id_B) | ||||
| }); | }); | ||||
| console.log(custCombo) | |||||
| const subsidiariesCombo: combo[] = subsidiaries.map(sub => ({ | const subsidiariesCombo: combo[] = subsidiaries.map(sub => ({ | ||||
| value: `subsidiaryId-${sub.id}`, | value: `subsidiaryId-${sub.id}`, | ||||
| label: `${sub.code} - ${sub.name}`, | label: `${sub.code} - ${sub.name}`, | ||||
| @@ -53,6 +54,7 @@ const ResourceOverconsumptionReport: React.FC<Props> = ({ team, customer, subsid | |||||
| const [_custType_B, id_B] = readIntFromString(b.value) as [string, number] | const [_custType_B, id_B] = readIntFromString(b.value) as [string, number] | ||||
| return (id_A - id_B) | return (id_A - id_B) | ||||
| }); | }); | ||||
| console.log(subsidiariesCombo) | |||||
| const searchCriteria: Criterion<SearchParamNames>[] = useMemo( | const searchCriteria: Criterion<SearchParamNames>[] = useMemo( | ||||
| () => [ | () => [ | ||||
| @@ -99,10 +101,20 @@ return ( | |||||
| lowerLimit: 0.9 | lowerLimit: 0.9 | ||||
| } | } | ||||
| if (query.team.length > 0 && query.team.toLocaleLowerCase() !== "all") { | if (query.team.length > 0 && query.team.toLocaleLowerCase() !== "all") { | ||||
| console.log(team) | |||||
| console.log(query.team) | |||||
| console.log(teamCombo) | |||||
| index = teamCombo.findIndex(team => team === query.team) | index = teamCombo.findIndex(team => team === query.team) | ||||
| const teamId = team[index].id | |||||
| console.log(teamId) | |||||
| postData.teamId = teamId | |||||
| const teamId1 = team[index].id | |||||
| console.log(teamId1) | |||||
| const sortedTeam = team.sort((a, b) => a.code.localeCompare(b.code)) | |||||
| const sortedId = sortedTeam[index].id | |||||
| console.log(sortedId) | |||||
| // console.log(sortedId) | |||||
| // console.log(team.find(team => query.team === `${team.code} - Team ${team.staffName}`)?.id) | |||||
| // const teamId = team.find(team => query.team === `${team.code} - Team ${team.staffName}`)?.id | |||||
| postData.teamId = sortedId | |||||
| // postData.teamId = teamId | |||||
| } | } | ||||
| if (Boolean(query.lowerLimit)) { | if (Boolean(query.lowerLimit)) { | ||||
| postData.lowerLimit = query.lowerLimit/100 | postData.lowerLimit = query.lowerLimit/100 | ||||
| @@ -112,6 +124,7 @@ return ( | |||||
| } | } | ||||
| postData.status = query.status | postData.status = query.status | ||||
| console.log(postData) | console.log(postData) | ||||
| return | |||||
| const response = await fetchProjectResourceOverconsumptionReport(postData) | const response = await fetchProjectResourceOverconsumptionReport(postData) | ||||
| if (response) { | if (response) { | ||||
| downloadFile(new Uint8Array(response.blobValue), response.filename!!) | downloadFile(new Uint8Array(response.blobValue), response.filename!!) | ||||