Metals MFR Tracker

Metals MFR Tracker

Aluminum and copper requests, purchase orders, receipts and payment due dates.

Cloud sync (optional)

Data is saved on this device and in your Supabase project. Create the two sign-in accounts in Supabase (Authentication → Users → Add user), run the SQL below once, then set the admin role (see supabase/setup.sql). Every signed-in account can add and edit MFRs, POs, receipts and payments; Backup, Restore and Cloud sync stay with the admin account.

create table if not exists public.mfrs(id text primary key, data jsonb not null default '{}', u bigint not null default 0, deleted boolean not null default false);
alter table public.mfrs enable row level security;
create or replace function public.is_admin() returns boolean language sql stable as $$ select coalesce(auth.jwt() -> 'app_metadata' ->> 'role','') = 'admin' $$;
drop policy if exists "open" on public.mfrs;
drop policy if exists "read" on public.mfrs;
drop policy if exists "admin_insert" on public.mfrs;
drop policy if exists "admin_update" on public.mfrs;
drop policy if exists "admin_delete" on public.mfrs;
drop policy if exists "write_insert" on public.mfrs;
drop policy if exists "write_update" on public.mfrs;
drop policy if exists "write_delete" on public.mfrs;
create policy "read" on public.mfrs for select to authenticated using (true);
create policy "write_insert" on public.mfrs for insert to authenticated with check (true);
create policy "write_update" on public.mfrs for update to authenticated using (true) with check (true);
create policy "write_delete" on public.mfrs for delete to authenticated using (true);
revoke all on public.mfrs from anon;
grant select, insert, update, delete on public.mfrs to authenticated;