|
|
@@ -19,7 +19,7 @@ type SearchParamNames = keyof SearchQuery; |
|
|
|
const CostAndExpenseReport: React.FC<Props> = ({ team, customer }) => { |
|
|
|
const { t } = useTranslation("report"); |
|
|
|
const teamCombo = team.map((t) => `${t.name} - ${t.code}`); |
|
|
|
const custCombo = customer.map(c => `${c.name} - ${c.code}`) |
|
|
|
const custCombo = customer.map(c => ({label: `${c.name} - ${c.code}`, value: c.id})) |
|
|
|
|
|
|
|
const searchCriteria: Criterion<SearchParamNames>[] = useMemo( |
|
|
|
() => [ |
|
|
@@ -30,13 +30,13 @@ const CostAndExpenseReport: React.FC<Props> = ({ team, customer }) => { |
|
|
|
options: teamCombo, |
|
|
|
needAll: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: t("Client"), |
|
|
|
paramName: "customer", |
|
|
|
type: "select", |
|
|
|
options: custCombo, |
|
|
|
needAll: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: t("Client"), |
|
|
|
paramName: "customer", |
|
|
|
type: "autocomplete", |
|
|
|
options: custCombo, |
|
|
|
needAll: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: t("Remaining Percentage"), |
|
|
|
paramName: "budgetPercentage", |
|
|
@@ -63,9 +63,8 @@ const CostAndExpenseReport: React.FC<Props> = ({ team, customer }) => { |
|
|
|
index = teamCombo.findIndex(team => team === query.team) |
|
|
|
postData.teamId = team[index].id |
|
|
|
} |
|
|
|
if (query.customer.length > 0 && query.customer.toLocaleLowerCase() !== "all") { |
|
|
|
index = custCombo.findIndex(customer => customer === query.customer) |
|
|
|
postData.clientId = customer[index].id |
|
|
|
if (typeof query.customer === "string" && query.customer.toLocaleLowerCase() !== "all") { |
|
|
|
postData.clientId = query.customer |
|
|
|
} |
|
|
|
if (Boolean(query.budgetPercentage)) { |
|
|
|
postData.budgetPercentage = query.budgetPercentage/100 |
|
|
|