feat: add multi-bill-edit page for batch bill status updates
- 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>
This commit is contained in:
@@ -12,6 +12,7 @@ import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { ToastContainer, toast } from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
import { useTranslations } from "next-intl";
|
||||
import { MultiBillEditButton } from "../[locale]/home/multi-bill-edit/[year]/[month]/MultiBillEditButton";
|
||||
|
||||
const getNextYearMonth = (yearMonth:YearMonth) => {
|
||||
const {year, month} = yearMonth;
|
||||
@@ -84,6 +85,12 @@ export const MonthLocationList:React.FC<MonthLocationListProps > = ({
|
||||
params.delete('locationDeleted');
|
||||
messageShown = true;
|
||||
}
|
||||
|
||||
if (search.get('bill-multi-edit-saved') === 'true') {
|
||||
toast.success(t("bill-multi-edit-save-success-message"), { theme: "dark" });
|
||||
params.delete('bill-multi-edit-saved');
|
||||
messageShown = true;
|
||||
}
|
||||
}, [search, router, t]);
|
||||
|
||||
if(!availableYears || !months) {
|
||||
@@ -128,6 +135,7 @@ export const MonthLocationList:React.FC<MonthLocationListProps > = ({
|
||||
<div className="flex gap-2 justify-center">
|
||||
<AddLocationButton yearMonth={yearMonth} />
|
||||
<PrintButton yearMonth={yearMonth} />
|
||||
<MultiBillEditButton yearMonth={yearMonth} />
|
||||
</div>
|
||||
</MonthCard>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user