Opening the STH Trackerโฆ
Log in with your team username to see your Ship To Home orders.
Team usernames: noah ยท marcus ยท james ยท justice ยท emma. First time in? Use the temporary password you were given, then change it under Account. Install steps and help live in Account โ All you need to know.
The tracker page is working, but the database tables behind it haven't been created yet โ so there's nothing to log in to. This part is for Justice (the owner) only, and it only has to happen once.
Accounts to create (the email is just how Supabase stores the login โ nobody needs to check it):
noah@sth-tracker.local โ Noah (rep)marcus@sth-tracker.local โ Marcus (rep)james@sth-tracker.local โ James (rep)justice@sth-tracker.local โ Justice (manager)emma@sth-tracker.local โ Emma (manager)The SQL also links each login to its username and role, and turns on Row Level Security: reps can only ever see their own orders, and only Justice and Emma can see everyone's. Reps can edit their own orders to fix mistakes, but they cannot delete any order โ pending or cashed out. Only managers (Justice and Emma) can delete, after they've reviewed and verified it.
Already set up before this update? You don't need to re-run everything. Just run this small update in SQL Editor to lock deletes to managers only:
-- Lock deletes to managers only (run once if you set up before this update) drop policy if exists "orders delete own or manager" on public.sth_orders; drop policy if exists "orders delete manager only" on public.sth_orders; create policy "orders delete manager only" on public.sth_orders for delete to authenticated using (public.is_manager()); grant select on public.profiles to authenticated; grant select, insert, update, delete on public.sth_orders to authenticated;
Add the Invoice # column (one-time, for the RQ invoice number): every STH now carries its RQ invoice # โ always TRUROIN + the numbers, e.g. TRUROIN3114 โ so Justice and Emma can look the sales order up in RQ. If you set up before this update, run this once in SQL Editor:
-- Add Invoice # (RQ) column (run once if you set up before this update) alter table public.sth_orders add column if not exists invoice_number text;
Turn on real-time push (one-time): so when Emma marks an STH Shipped, it flips on the rep's already-open screen right away โ plus an on-screen notification pops up. Run this once in SQL Editor too. If it says the table is already a member of the publication, that's fine โ it's already on.
-- Real-time push for sth_orders (run once) do $$ begin alter publication supabase_realtime add table public.sth_orders; exception when duplicate_object then null; end $$; alter table public.sth_orders replica identity full;
Even without this, the tracker now auto-refreshes on its own (when you come back to it, and on a timer) and has a Refresh now button โ real-time push just makes it instant.
Copied โ-- ============================================================
-- STH Tracker โ one-time database setup
-- Run this whole block once in Supabase: SQL Editor -> Run
-- ============================================================
create table if not exists public.profiles (
id uuid primary key references auth.users(id) on delete cascade,
username text unique not null,
display_name text not null,
email text unique not null,
role text not null default 'rep' check (role in ('rep','manager')),
created_at timestamptz not null default now()
);
create table if not exists public.sth_orders (
id uuid primary key default gen_random_uuid(),
owner_id uuid not null references public.profiles(id) on delete cascade,
date_processed date not null default current_date,
customer_first_name text not null,
order_number_es text not null,
postal_code text not null,
invoice_number text,
item text not null,
expected_ship_date date,
est_delivery_date date,
actual_delivery_date date,
status text not null default 'Processed' check (status in ('Processed','Shipped','Delivered')),
date_emailed_retail_orders date,
cashed_out_rq_date date,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
alter table public.profiles enable row level security;
alter table public.sth_orders enable row level security;
-- Helper: is the signed-in user a manager? (security definer avoids RLS loops)
create or replace function public.is_manager()
returns boolean language sql security definer set search_path = public stable as $$
select exists (select 1 from public.profiles where id = auth.uid() and role = 'manager');
$$;
-- Login helper: the app looks up a username's login email BEFORE sign-in.
-- Only the matching email is returned; no other profile data is exposed.
create or replace function public.get_login_email(p_username text)
returns text language sql security definer set search_path = public stable as $$
select email from public.profiles where username = lower(trim(p_username)) limit 1;
$$;
grant execute on function public.get_login_email(text) to anon, authenticated;
grant execute on function public.is_manager() to authenticated;
-- Profiles policies: you can read your own; managers can read everyone.
drop policy if exists "profiles read own or manager" on public.profiles;
create policy "profiles read own or manager" on public.profiles
for select to authenticated using (id = auth.uid() or public.is_manager());
drop policy if exists "profiles update own" on public.profiles;
create policy "profiles update own" on public.profiles
for update to authenticated using (id = auth.uid()) with check (id = auth.uid());
-- Orders policies: reps only ever touch their own; managers see and can update all.
drop policy if exists "orders read own or manager" on public.sth_orders;
create policy "orders read own or manager" on public.sth_orders
for select to authenticated using (owner_id = auth.uid() or public.is_manager());
drop policy if exists "orders insert own" on public.sth_orders;
create policy "orders insert own" on public.sth_orders
for insert to authenticated with check (owner_id = auth.uid());
drop policy if exists "orders update own or manager" on public.sth_orders;
create policy "orders update own or manager" on public.sth_orders
for update to authenticated using (owner_id = auth.uid() or public.is_manager())
with check (owner_id = auth.uid() or public.is_manager());
drop policy if exists "orders delete own or manager" on public.sth_orders;
drop policy if exists "orders delete manager only" on public.sth_orders;
create policy "orders delete manager only" on public.sth_orders
for delete to authenticated using (public.is_manager());
grant select on public.profiles to authenticated;
grant select, insert, update, delete on public.sth_orders to authenticated;
-- Real-time push: let open trackers receive changes instantly.
do $$ begin
alter publication supabase_realtime add table public.sth_orders;
exception when duplicate_object then null;
end $$;
alter table public.sth_orders replica identity full;
-- Link the 5 Auth users to usernames + roles.
-- Run AFTER creating the users in Authentication -> Users.
insert into public.profiles (id, username, display_name, email, role)
select id, 'noah', 'Noah', email, 'rep' from auth.users where email = 'noah@sth-tracker.local'
on conflict (id) do update set username = excluded.username, display_name = excluded.display_name, email = excluded.email, role = excluded.role;
insert into public.profiles (id, username, display_name, email, role)
select id, 'marcus', 'Marcus', email, 'rep' from auth.users where email = 'marcus@sth-tracker.local'
on conflict (id) do update set username = excluded.username, display_name = excluded.display_name, email = excluded.email, role = excluded.role;
insert into public.profiles (id, username, display_name, email, role)
select id, 'james', 'James', email, 'rep' from auth.users where email = 'james@sth-tracker.local'
on conflict (id) do update set username = excluded.username, display_name = excluded.display_name, email = excluded.email, role = excluded.role;
insert into public.profiles (id, username, display_name, email, role)
select id, 'justice', 'Justice', email, 'manager' from auth.users where email = 'justice@sth-tracker.local'
on conflict (id) do update set username = excluded.username, display_name = excluded.display_name, email = excluded.email, role = excluded.role;
insert into public.profiles (id, username, display_name, email, role)
select id, 'emma', 'Emma', email, 'manager' from auth.users where email = 'emma@sth-tracker.local'
on conflict (id) do update set username = excluded.username, display_name = excluded.display_name, email = excluded.email, role = excluded.role;
Nothing is public here โ without a login, no order information can be seen at all.
Newest first. Cashed-out orders stay at the bottom. Team updates appear here live.
Every rep's open, overdue, and cashed-out counts โ across the whole store.
Grouped by rep. Managers can edit any order, and delete one after reviewing it.
Add it right when the order is processed โ you only have the expected ship date at this stage.
Right now you're using the tracker in a browser tab
Install it so it opens like an app from your home screen โ notifications work properly from the installed version.
Status: Checkingโฆ
This switch is per person, per phone. When it's on, your phone buzzes when one of your STHs is marked Shipped, Delivered, emailed, or cashed out โ even with the tracker closed or the screen locked, as long as it's installed.
Turn notifications on first, then send yourself a test to see what a โjust shipped!โ alert looks like on this phone.
Everything about the tracker, in one place. New here? Read it top to bottom once โ it takes two minutes.
Start every shift at My STHs โ Needs your attention โ anything past a date or waiting on its next step floats to the top there.
Installing puts the tracker on your home screen like a real app โ one tap, full-screen, and it's what makes lock-screen notifications work. The Install button lives in Settings (the other tab above) when Chrome is ready; otherwise follow these steps.
In Chrome or Edge, click the install icon at the right end of the address bar (a little monitor with a down-arrow) โ or just bookmark the page.
Install never works in an Incognito / private tab, and Chrome has no setting that forces it โ if Install isn't offered, work through โThis app cannot be installedโ in Troubleshooting below.
Type just your username (e.g. noah) โ not your email, and not noah@sth-tracker.local. The tracker adds the rest itself. Passwords are case-sensitive. Still stuck? Ask Justice to reset your password, then change it in Settings once you're in.
Work through these in order: 1. Open the link directly in Chrome (not a Messages or QR preview, not Incognito). 2. Delete any old home-screen shortcut for the tracker. 3. Fully close the tracker, reopen the link fresh, and try Install again โ Chrome needs one visit with the tracker properly loaded before it offers a real install. 4. Run the setup check below on that phone โ it names the exact missing piece. If it says a website file is missing, tell a manager โ that's a website fix, not something to fix on this phone.
If the site shows as โAutomatically blockedโ, Chrome won't let you edit it from the notifications list โ go around it: open the tracker in Chrome, tap the tune icon just left of the address bar โ Site settings โ Notifications โ Allow. Then come back, flip the Settings switch off and back on once, and send a test. On iPhone: Settings โ Notifications โ STH Tracker โ Allow Notifications, and make sure you're opening the tracker from its home-screen icon.
Check in order: the tracker is installed (not just a browser shortcut) ยท notifications are allowed for it (see above) ยท you sent a test notification from Settings and it arrived. If the test arrives but real updates don't, keep the tracker installed and tell a manager so it can be checked.
Tap โป Refresh now at the top. Updates normally arrive on their own โ live while the tracker is open, and on an automatic refresh โ but if you had a form open when the update landed, the tracker holds it (so it doesn't wipe what you were typing) and shows a โShow the updateโ bar instead.
Wrong details: tap Edit on the card and fix them. Duplicate or entered by mistake: only Managers can delete โ ask Justice or Emma to review and remove it.
๐ Setup check
Tests this phone against the live website, piece by piece, and names the exact thing that's missing. Run it in Chrome on the live site (sth-tracker.pages.dev) โ inside the Muse app it will always report the service worker and notifications as missing, because Muse's preview browser can't run them.
Ship To Home tracker ยท Processed โ Shipped โ Delivered โ emailed Retail Orders โ cashed out in RQ