Add job reuse, pause/resume, and delete actions
Summary
Implements Feature: reuse, pause/resume, and delete actions across Production Jobs, Instruction Photos, and Station Inventory.
Job Lifecycle
- Draft: can be Reused or Deleted from the Existing Jobs list; Activate Job button lives inside the job detail page.
- Active: cannot be reused or deleted from the list (list shows "Open job to pause" instead); Pause Job button appears inside the job detail page.
- Paused: behaves like Draft again — Reuse and Delete are available on the list; Resume Job button appears inside the job detail page. Kiosk scanning is blocked while paused.
- Completed: can be Reused or Deleted from the list; no manual state-change button (completion happens automatically once all product units finish).
New Actions
- Reuse a job: duplicates name, quantity, threshold, and all steps/required parts into a new Draft job. Auto-increments the name (" 1", " 2", ...) if the base name is already taken. Original job is untouched.
- Delete a job: blocked only while Active. Cleans up ProductUnit, UnitStepProgress, and TransferRequest rows before deleting the job (cascades to JobStep/StepPart). Never touches the global Part or InstructionPhoto library.
- Delete a photo: blocked if referenced by a step belonging to an Active job; otherwise removes the InstructionPhoto record and its file from disk.
- Delete a station inventory part: blocked if required by a step of an Active job at that station; removes only the StationInventory link, not the global Part catalog entry.
- Pause a job: Active -> Paused, preserves all production progress.
- Resume a job: Paused -> Active, no re-activation logic re-run.
UX
Blocked deletions re-render the same page with an inline error banner instead of a generic Flask error page. Destructive actions (Delete Job, Delete Photo, Delete Station Part) require a browser confirmation prompt before submitting.
Testing
All 56 existing automated tests pass unchanged. Manually verified: reuse/delete/pause/resume across all four job statuses, photo deletion blocking for Active-job references, station inventory deletion blocking for Active-job requirements, and kiosk barcode scanning correctly rejecting Paused jobs.