Merged in feature-export-csv-roles (pull request #18)

Feature export csv roles

Approved-by: Tiago Ribeiro
This commit is contained in:
João Ramos
2024-01-11 14:22:42 +00:00
committed by Tiago Ribeiro

View File

@@ -784,18 +784,20 @@ export default function PaymentRecord() {
<div className="w-full flex flex-end justify-between p-2">
<h1 className="text-2xl font-semibold">Payment Record</h1>
{(user.type === "developer" || user.type === "admin") && (
<div className="flex justify-end gap-2">
<div className="flex justify-end gap-2">
{(user.type === "developer" || user.type === "admin" || user.type === 'agent' || user.type === 'corporate') && (
<Button className="max-w-[200px]" variant="outline">
<CSVLink data={csvRows} headers={csvColumns} filename="payment-records.csv">
Download CSV
</CSVLink>
</Button>
)}
{(user.type === "developer" || user.type === "admin") && (
<Button className="max-w-[200px]" variant="outline" onClick={() => setIsCreatingPayment(true)}>
New Payment
</Button>
</div>
)}
)}
</div>
</div>
<div className={clsx("grid grid-cols-1 md:grid-cols-2 gap-8 w-full", user.type !== "corporate" && "lg:grid-cols-3")}>
<div className="flex flex-col gap-3 w-full">
@@ -809,14 +811,14 @@ export default function PaymentRecord() {
options={(users.filter((u) => u.type === "corporate") as CorporateUser[]).map((user) => ({
value: user.id,
meta: user,
label: `${user.corporateInformation.companyInformation.name || user.name} - ${user.email}`,
label: `${user.corporateInformation?.companyInformation?.name || user.name} - ${user.email}`,
}))}
defaultValue={
user.type === "corporate"
? {
value: user.id,
meta: user,
label: `${user.corporateInformation.companyInformation.name || user.name} - ${user.email}`,
label: `${user.corporateInformation?.companyInformation?.name || user.name} - ${user.email}`,
}
: undefined
}