adding new billing location completed
This commit is contained in:
@@ -2,13 +2,15 @@ import { PlusCircleIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
|
||||
export interface AddLocationButtonProps {
|
||||
/** year month at which the new billing location should be addes */
|
||||
yyyymm: string
|
||||
}
|
||||
|
||||
export const AddLocationButton:React.FC<AddLocationButtonProps> = () =>
|
||||
export const AddLocationButton:React.FC<AddLocationButtonProps> = ({yyyymm}) =>
|
||||
<div className="card card-compact card-bordered max-w-[36em] bg-base-100 shadow-s my-1">
|
||||
<div className="card-body">
|
||||
<span className='grid self-center' data-tip="Dodaj novu lokaciju">
|
||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
|
||||
</span>
|
||||
</div>
|
||||
<a href={`/location/${yyyymm}/add`} className="card-body tooltip self-center" data-tip="Add a new billing location">
|
||||
<span className='grid self-center' data-tip="Add a new billing location">
|
||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
|
||||
</span>
|
||||
</a>
|
||||
</div>;
|
||||
@@ -21,7 +21,7 @@ export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearM
|
||||
{
|
||||
bills.map(bill => <BillBadge key={`${bill._id}`} locationId={_id} bill={bill} />)
|
||||
}
|
||||
<a href={`/bill/${_id}/add`} className="tooltip" data-tip="Add a new bull">
|
||||
<a href={`/bill/${_id}/add`} className="tooltip" data-tip="Add a new bill">
|
||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-2xl" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -9,13 +9,15 @@ import { gotoHome } from "../lib/billActions";
|
||||
|
||||
export interface LocationEditFormProps {
|
||||
/** location which should be edited */
|
||||
location?: BillingLocation
|
||||
location?: BillingLocation,
|
||||
/** year month at a new billing location should be assigned */
|
||||
yearMonth?: string
|
||||
}
|
||||
|
||||
export const LocationEditForm:FC<LocationEditFormProps> = ({ location }) =>
|
||||
export const LocationEditForm:FC<LocationEditFormProps> = ({ location, yearMonth }) =>
|
||||
{
|
||||
const initialState = { message: null, errors: {} };
|
||||
const handleAction = updateOrAddLocation.bind(null, location?._id);
|
||||
const handleAction = updateOrAddLocation.bind(null, location?._id, yearMonth);
|
||||
const [ state, dispatch ] = useFormState(handleAction, initialState);
|
||||
|
||||
// redirect to the main page
|
||||
|
||||
Reference in New Issue
Block a user