|
|
@@ -19,18 +19,19 @@ interface SubComponents { |
|
|
|
// } |
|
|
|
|
|
|
|
const InvoiceSearchWrapper: React.FC & SubComponents = async () => { |
|
|
|
// const userStaff = await fetchUserStaff() |
|
|
|
// const teamId = userStaff?.teamId |
|
|
|
const userStaff = await fetchUserStaff() |
|
|
|
const teamId = userStaff?.teamId |
|
|
|
const invoices = await fetchInvoicesV3() |
|
|
|
const projects = await fetchProjects() |
|
|
|
// const filteredProjects = projects.filter(project => project.teamId === teamId) |
|
|
|
|
|
|
|
// let filteredInvoice = invoices |
|
|
|
// if (teamId) { |
|
|
|
// filteredInvoice = invoices.filter(invoice => invoice.teamId === teamId) |
|
|
|
// } |
|
|
|
let filteredInvoice = invoices |
|
|
|
if (teamId) { |
|
|
|
filteredInvoice = invoices.filter(i => i.teamId === teamId) |
|
|
|
} else { |
|
|
|
filteredInvoice = [] |
|
|
|
} |
|
|
|
|
|
|
|
const convertedInvoices = invoices.map((invoice)=>{ |
|
|
|
const convertedInvoices = filteredInvoice.map((invoice)=>{ |
|
|
|
return{ |
|
|
|
id: invoice.id, |
|
|
|
invoiceNo: invoice.invoiceNo, |
|
|
|