Add time tracking on tasks with a weekly sheet

Phase 1, item 8 (last of phase 1). New TimeTracking module:
- One entry per user, task and day (0.25-24 h in quarters, with a note);
  the job and work type are copied from the task. A user's day cannot
  exceed 24 h, and hours on a done, invoiced, billed or archived job
  cannot be added or changed.
- Weekly sheet /time: tasks as rows (own open tasks, tasks with hours
  that week, tasks added by search), days as columns, row, day and week
  totals, week navigation. A cell saves on change and an empty cell
  removes the entry; on phones one day at a time. Saves and errors are
  announced, errors are tied to their cell.
- Task booking page /time/tasks/{task}: date, hours and note, added to
  the day's entry; own entries with edit and remove.
- Anyone but subcontractors may book on any unlocked task;
  subcontractors only on jobs they are attached to.

Jobs module:
- JobStatus::locksTime(), BookableTask and task queries for booking.
- A task with time entries cannot be removed (TaskUsage contract,
  provided by TimeTracking); the job page links tasks to booking.
- The "involved in a job" rule is shared in JobInvolvement.

Spec and CLAUDE.md updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 05:52:45 +02:00
co-authored by Claude Opus 5.5
parent 02a62eb16e
commit 3922c744a7
53 changed files with 2496 additions and 19 deletions
+66
View File
@@ -0,0 +1,66 @@
<?php
return [
'title' => 'Tuntikirjaus',
'week_heading' => 'Viikko :number: :from–:to',
'previous_week' => 'Edellinen viikko',
'this_week' => 'Tämä viikko',
'next_week' => 'Seuraava viikko',
'intro' => 'Kirjaa tunnit tehtäville vartin tarkkuudella, esimerkiksi 2,5. Tyhjä kenttä poistaa päivän kirjauksen. Kenttä tallentuu, kun siirryt pois siitä.',
'table_caption' => 'Viikon tunnit tehtävittäin',
'task' => 'Tehtävä',
'total' => 'Yhteensä',
'day_total' => 'Päivä yhteensä',
'week_total' => 'Viikko yhteensä: :hours h',
'hours_suffix' => ':hours h',
'no_rows' => 'Ei tehtäviä tällä viikolla. Lisää tehtävä hakemalla alta.',
'locked' => 'Lukittu – työ on valmis',
'cell_label' => 'Tunnit: :task, :day',
'choose_day' => 'Valitse päivä',
'day_button' => ':day, :hours h',
'saved' => 'Tallennettu: :task :day :hours h.',
'removed' => 'Poistettu: :task :day.',
'days' => ['ma', 'ti', 'ke', 'to', 'pe', 'la', 'su'],
'add' => [
'search' => 'Lisää tehtävä viikolle',
'search_description' => 'Hae työn numerolla, työn nimellä tai tehtävän nimellä.',
'results' => '{0} Ei osumia.|{1} :count osuma.|[2,*] :count osumaa.',
'choose' => 'Lisää viikolle: :task',
'added' => 'Tehtävä :task lisätty viikolle.',
],
'task_page' => [
'title' => 'Kirjaa tunnit: :task',
'job' => 'Asiakastyö',
'work_type' => 'Työtehtävä',
'worked_on' => 'Päivä',
'hours' => 'Tunnit',
'hours_description' => 'Vartin tarkkuudella, esimerkiksi 1,75. Samalle päivälle kirjatut tunnit lisätään päivän kirjaukseen.',
'note' => 'Selite',
'save' => 'Kirjaa tunnit',
'saved' => 'Kirjattu :hours h. Päivän :day kirjaus on nyt :total h.',
'own_entries' => 'Omat kirjaukset',
'no_entries' => 'Et ole vielä kirjannut tunteja tälle tehtävälle.',
'edit' => 'Muokkaa',
'edit_named' => 'Muokkaa kirjausta :day',
'remove' => 'Poista',
'remove_named' => 'Poista kirjaus :day',
'remove_question' => 'Poistetaanko päivän :day kirjaus (:hours h)? Poistoa ei voi perua.',
'updated' => 'Päivän :day kirjaus tallennettu.',
'entry_removed' => 'Päivän :day kirjaus poistettu.',
'back_to_week' => 'Viikkonäkymään',
'back_to_job' => 'Asiakastyöhön',
'locked' => 'Työ on valmis, joten sen tunnit on lukittu. Kirjauksia ei voi lisätä eikä muuttaa.',
],
'errors' => [
'invalid_hours' => 'Anna tunnit vartin tarkkuudella väliltä 0,25–24, esimerkiksi 2,5.',
'day_full' => 'Päivän tunnit voivat olla yhteensä enintään 24.',
'locked' => 'Työ on valmis, joten sen tunnit on lukittu.',
'not_found' => 'Tehtävää tai kirjausta ei löytynyt. Päivitä sivu.',
'date_required' => 'Anna päivä.',
'invalid_date' => 'Anna päivämäärä muodossa pp.kk.vvvv.',
],
];