- Add getLocationsByMonth server action with aggregation pipeline to calculate hasAttachment - Add updateMonth server action for bulk bill status updates with path revalidation - Create multi-bill-edit page at /home/multi-bill-edit/[year]/[month] - Implement MultiBillEdit component with toggle functionality for all bills - Add BillToggleBadge component integration for consistent bill display - Add "set all as paid/unpaid" toggle button for batch operations - Implement server-side redirect with success message after save - Add Suspense boundary with loading skeleton - Update translations for multi-bill-edit feature (Croatian and English) - Ensure data freshness with unstable_noStore and revalidatePath 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
24 lines
839 B
TypeScript
24 lines
839 B
TypeScript
import { FC } from "react"
|
|
import { Bill } from "@/app/lib/db-types"
|
|
import { TicketIcon } from "@heroicons/react/24/outline"
|
|
|
|
export interface BillBadgeProps {
|
|
locationId: string,
|
|
bill: Pick<Bill, 'name' | 'paid' | 'hasAttachment' | 'proofOfPayment'>,
|
|
onClick?: () => void
|
|
};
|
|
|
|
export const BillToggleBadge:FC<BillBadgeProps> = ({ bill: { name, paid, hasAttachment, proofOfPayment }, onClick}) => {
|
|
|
|
const className = `badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`;
|
|
|
|
return (
|
|
<div className={className} onClick={onClick}>
|
|
{name}
|
|
{
|
|
proofOfPayment?.uploadedAt ?
|
|
<TicketIcon className="h-[1em] w-[1em] inline-block ml-1" /> : null
|
|
}
|
|
</div>
|
|
);
|
|
} |