Tanksafe Internal

Welcome to TankSafe Docs

Secure internal guidance and playbooks for the TankSafe team.

Sign in with your organisation Google account to continue.

Access is limited to authorised Google Workspace users.

Skip to main content
Tank Safe Solutions DocsDocumentationUser GuidesTechnical Guides
GitHub
  • TankSafe Overview
  • User Guides
    • Getting Started
    • Dashboard & Global Search
    • Account Management & Security
    • Running Inspections
    • Inspector Job List
    • admin
      • Administration
      • Job Management
    • inspections
  • Technical Guides
    • Platform Architecture
    • Development & Deployment Workflow
    • Local Development Setup
    • Integrations
  • Changelog
  • contributing
  • overview
  • User Guides
  • admin
  • Job Management

Job Management

This guide covers the Admin ▸ Jobs page implemented in src/pages/AdminJobs.tsx. It explains how the table is populated, what each control does, and how changes persist to Supabase.

Filters​

All filters are applied through Supabase queries before results reach the UI:

  • Search – Uses the or helper to match the entered text against job_number and operator_name_snapshot (ilike query).
  • Status – Maps the dropdown value through mapFilterToDbStatus. The "Cancelled" option targets the void status.
  • Dates – startDate and endDate feed gte/lte filters on the created_at column.

React Query caches the result set for five minutes (staleTime: 5 * 60 * 1000) and keeps data available while filtering.

Assigning inspectors​

  • The Assigned To column renders a <Select> populated from the inspectors table joined with matching profiles entries.
  • Choosing a value calls supabase.from('inspections').update({ inspector_id }) and writes a fresh updated_at timestamp.
  • While the update runs the dropdown is disabled to prevent double submissions (updatingInspectorId local state).
  • Selecting Unassigned passes null, clearing the relationship.

Status updates​

  • The overflow menu offers actions for Mark as In Progress and Mark as Complete.
  • Each action updates the status column and updated_at timestamp. No automatic completeness checks are enforced; administrators decide when to promote the status.

Deleting a job​

  • Delete Job opens a confirmation dialog. Confirming calls supabase.from('inspections').delete().eq('id', jobId).
  • Deleting removes the inspection row and any dependent records through database constraints. There is no undo.

Completeness & issues columns​

  • After the base query runs the component fetches completed form responses to calculate a percentage (Math.round(completed / 10 * 100)).
  • has_failures currently defaults to false. Extend the logic inside AdminJobs.tsx if you need to flag failing responses.

Operator snapshot backfill​

If operator_name_snapshot is empty, the component looks up the risk assessment form (form_responses table with template_id = TEMPLATE_IDS.RISK_ASSESSMENT). When it finds a vehicle_operator_name, it updates the inspection row so future queries include the value.

Quick actions​

  • View Details – Navigates to /admin/jobs/:jobNumber (read-only dossier).
  • Edit Job – Navigates to /admin/jobs/:jobNumber/edit (full edit interface).
  • New Inspection button – Links to /inspect/new/wizard to create fresh jobs.

Error handling​

  • Any Supabase error triggers a destructive toast (useToast) and logs to the console.
  • After successful mutations the page calls adminJobsQuery.refetch() to refresh data.

Pair this guide with the Administration guide to cover the full administrator workflow.

Tags:
  • user-guides
  • administration
Edit this page
Previous
Administration
Next
Operator Quick-Start
  • Filters
  • Assigning inspectors
  • Status updates
  • Deleting a job
  • Completeness & issues columns
  • Operator snapshot backfill
  • Quick actions
  • Error handling
Docs
  • Overview
Community
  • Support
  • Roadmap
  • Status Page
More
  • TankSafe.io
  • GitHub
Copyright © 2025 Tank Safe Solutions. Built with Docusaurus.