"use client"; import { TrashIcon } from "@heroicons/react/24/outline"; import { PlainBill } from "../lib/db-types"; import { FC } from "react"; import { useFormState } from "react-dom"; import { updateBill } from "../lib/actions"; export interface BillEditFormProps { invoiceID: string, bill: PlainBill } export const BillEditForm:FC = ({ invoiceID, bill: { id, name, paid } }) => { const initialState = { message: null, errors: {} }; const updateBillWithId = updateBill.bind(null, invoiceID, id); const [ state, dispatch ] = useFormState(updateBillWithId, initialState); return(
{state.errors?.billName && state.errors.billName.map((error: string) => (

{error}

))}
{ // // // // 2023-22-12 document GSKG račun za 2023.pdf // }
{state.errors?.billAttachment && state.errors.billAttachment.map((error: string) => (

{error}

))}
{state.errors?.billNotes && state.errors.billNotes.map((error: string) => (

{error}

))}
{state.message &&

{state.message}

}
); }