Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
f20ca5bd67
commit
a075571d2f
@@ -37,6 +37,13 @@ interface CaseOpt {
|
||||
client_id: string;
|
||||
default_hourly_rate: number | null;
|
||||
}
|
||||
interface FeeItem {
|
||||
id: string;
|
||||
name: string;
|
||||
category: "time" | "expense";
|
||||
amount: number;
|
||||
billable: boolean;
|
||||
}
|
||||
|
||||
function useClientsAndCases(open: boolean) {
|
||||
const [clients, setClients] = useState<ClientOpt[]>([]);
|
||||
@@ -60,6 +67,24 @@ function useClientsAndCases(open: boolean) {
|
||||
return { clients, cases };
|
||||
}
|
||||
|
||||
function useFeeItems(open: boolean, category: "time" | "expense") {
|
||||
const [items, setItems] = useState<FeeItem[]>([]);
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
(async () => {
|
||||
const { data } = await supabase
|
||||
.from("fee_schedule_items")
|
||||
.select("id, name, category, amount, billable")
|
||||
.eq("category", category)
|
||||
.eq("active", true)
|
||||
.order("sort_order")
|
||||
.order("name");
|
||||
setItems((data ?? []) as FeeItem[]);
|
||||
})();
|
||||
}, [open, category]);
|
||||
return items;
|
||||
}
|
||||
|
||||
/* -------------------- Quick add: Time -------------------- */
|
||||
export function QuickAddTime() {
|
||||
const { user } = useAuth();
|
||||
|
||||
@@ -300,12 +300,3 @@ const rootRouteChildren: RootRouteChildren = {
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
|
||||
import type { getRouter } from './router.tsx'
|
||||
import type { createStart } from '@tanstack/react-start'
|
||||
declare module '@tanstack/react-start' {
|
||||
interface Register {
|
||||
ssr: true
|
||||
router: Awaited<ReturnType<typeof getRouter>>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user