refactoring: renamed actions tp billActions
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { fetchBillById } from '@/app/lib/actions';
|
import { fetchBillById } from '@/app/lib/billActions';
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
|
|
||||||
export async function GET(request: Request, { params:{ id } }: { params: { id:string } }) {
|
export async function GET(request: Request, { params:{ id } }: { params: { id:string } }) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { deleteBillById } from '@/app/lib/actions';
|
import { deleteBillById } from '@/app/lib/billActions';
|
||||||
import { notFound, redirect } from 'next/navigation';
|
import { notFound, redirect } from 'next/navigation';
|
||||||
|
|
||||||
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { BillingLocation, Bill } from '@/app/lib/db-types';
|
import { BillingLocation, Bill } from '@/app/lib/db-types';
|
||||||
import { fetchBillById } from '@/app/lib/actions';
|
import { fetchBillById } from '@/app/lib/billActions';
|
||||||
import clientPromise from '@/app/lib/mongodb';
|
import clientPromise from '@/app/lib/mongodb';
|
||||||
import { BillEditForm } from '@/app/ui/BillEditForm';
|
import { BillEditForm } from '@/app/ui/BillEditForm';
|
||||||
import { ObjectId } from 'mongodb';
|
import { ObjectId } from 'mongodb';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { DocumentIcon, TrashIcon } from "@heroicons/react/24/outline";
|
|||||||
import { Bill } from "../lib/db-types";
|
import { Bill } from "../lib/db-types";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { useFormState } from "react-dom";
|
import { useFormState } from "react-dom";
|
||||||
import { gotoHome, updateOrAddBill } from "../lib/actions";
|
import { gotoHome, updateOrAddBill } from "../lib/billActions";
|
||||||
|
|
||||||
// Next.js does not encode an utf-8 file name correctly when sending a form with a file attachment
|
// Next.js does not encode an utf-8 file name correctly when sending a form with a file attachment
|
||||||
// This is a workaround for that
|
// This is a workaround for that
|
||||||
|
|||||||
@@ -13,15 +13,17 @@ export interface LocationCardProps {
|
|||||||
export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearMonth, bills }}) =>
|
export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearMonth, bills }}) =>
|
||||||
<div className="card card-compact card-bordered max-w-[36em] bg-base-100 shadow-s my-1">
|
<div className="card card-compact card-bordered max-w-[36em] bg-base-100 shadow-s my-1">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<Cog8ToothIcon className="h-[1em] w-[1em] absolute cursor-pointer top-3 right-3 text-2xl" />
|
<a href={`/location/${_id}/edit`} className="card-subtitle tooltip" data-tip="Edit Location">
|
||||||
<h2 className="card-title">{formatYearMonth(yearMonth)} {name}</h2>
|
<Cog8ToothIcon className="h-[1em] w-[1em] absolute cursor-pointer top-3 right-3 text-2xl" />
|
||||||
<div className="card-actions">
|
|
||||||
{
|
|
||||||
bills.map(bill => <BillBadge key={`${bill._id}`} locationId={_id} bill={bill} />)
|
|
||||||
}
|
|
||||||
<a href={`/bill/${_id}/add`} className="tooltip" data-tip="Dodaj novi tip računa">
|
|
||||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-2xl" />
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
<h2 className="card-title">{formatYearMonth(yearMonth)} {name}</h2>
|
||||||
|
<div className="card-actions">
|
||||||
|
{
|
||||||
|
bills.map(bill => <BillBadge key={`${bill._id}`} locationId={_id} bill={bill} />)
|
||||||
|
}
|
||||||
|
<a href={`/bill/${_id}/add`} className="tooltip" data-tip="Add a new bull">
|
||||||
|
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-2xl" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
Reference in New Issue
Block a user