Skip to content

Commit

Permalink
Bulk edit status
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Jul 3, 2024
1 parent bacaa01 commit 01f16c4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 30 additions & 1 deletion apps/dashboard/src/components/bulk-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const sections = [
label: "Assign",
icon: Icons.Face,
},
{
id: "status",
label: "Status",
icon: Icons.AlertCircle,
},
];

export function BulkActions({ ids }) {
Expand All @@ -47,7 +52,7 @@ export function BulkActions({ ids }) {
setTransactionIds(undefined);
}
},
onSuccess: (data, input) => {
onSuccess: (data) => {
setTransactionIds(undefined);
toast({
title: `Updated ${data.length} transactions.`,
Expand Down Expand Up @@ -176,6 +181,30 @@ export function BulkActions({ ids }) {
}}
/>
)}

{section.id === "status" && (
<RadioGroup
onValueChange={(status) => {
console.log(status);
bulkUpdateTransactions.execute({
type: "status",
data: ids.map((transaction) => ({
id: transaction,
status,
})),
});
}}
>
<div className="flex items-center space-x-2">
<RadioGroupItem value="completed" id="completed" />
<Label htmlFor="completed">Completed</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="posted" id="posted" />
<Label htmlFor="posted">Uncompleted</Label>
</div>
</RadioGroup>
)}
</Tabs.TabsContent>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/transaction-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function TransactionStatus({ fullfilled }: Props) {
side="left"
sideOffset={10}
>
Missing attachment
Missing receipt
</TooltipContent>
</Tooltip>
</TooltipProvider>
Expand Down

0 comments on commit 01f16c4

Please sign in to comment.