Project

General

Profile

Feature #9

closed
0S DH

Feature #7: Feature list

Calendar view for jobs

Feature #9: Calendar view for jobs

Added by 0x01 SIA about 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
07/27/2026
Due date:
% Done:

0%

Estimated time:

Description

Codex Task: Add Job Calendar View

Objective

Add a simple calendar view for jobs to the existing Task App.

The calendar should help admins and dispatchers see scheduled jobs by date without changing the existing lightweight architecture.

Keep the implementation simple and consistent with the current plain PHP, PDO and CSS codebase.

Do not introduce Laravel, React, Vue, a build system or a large frontend framework.


Existing Project Context

Task App is a lightweight field-service management application built with:

  • Plain PHP

  • PDO

  • MariaDB

  • Server-rendered PHP views

  • Simple CSS

  • Session-based authentication

  • Roles:

    • admin
    • dispatcher
    • worker

Jobs already contain scheduling information and can be viewed and managed through the existing job routes.

The existing job list and worker workflow must continue to work unchanged.


Required Feature

Create a calendar page where admins and dispatchers can see scheduled jobs grouped by date.

New Route

Add:

GET /jobs/calendar

Access must be limited to:

  • Admins
  • Dispatchers

Workers must receive the same existing 403 response used elsewhere in the application.


Calendar Views

Implement a simple monthly calendar.

The page should include:

  • Current month name and year
  • Previous month navigation
  • Next month navigation
  • A “Today” link or button
  • Seven weekday columns
  • One cell for each calendar date
  • Jobs displayed inside the relevant date cell

Use a query parameter for month navigation:

/jobs/calendar?month=2026-07

When no valid month parameter is supplied, show the current month.

Validate the parameter strictly using the YYYY-MM format.

Invalid values should safely fall back to the current month.


Job Scheduling Rules

Use the existing planned or scheduled job date field already present in the database.

Before implementing, inspect the existing schema and job repository to identify the correct field. Do not add a duplicate scheduling field.

Only place a job on the calendar when it has a valid scheduled date.

Jobs without a scheduled date should not appear in a date cell.

Add a small section above or below the calendar showing the number of unscheduled active jobs, with a link to the existing jobs list filtered appropriately if the current list supports such filtering.

Do not build a new unscheduled-job management workflow as part of this task.


Job Information Shown

Each calendar entry should show only compact, useful information:

  • Job number
  • Customer name
  • Location name or address
  • Assigned worker, when assigned
  • Current job status

The job number or full calendar entry should link to:

/jobs/{id}

Do not place full job descriptions or long notes inside the calendar.


Status Handling

Use the existing job statuses and existing status-label styling where possible.

Cancelled jobs should either:

  • be excluded from the calendar, or
  • remain visible with clearly muted styling

Use whichever approach is most consistent with the existing job list behaviour.

Do not introduce new statuses.


Calendar Navigation

Add a Calendar link to the admin/dispatcher navigation near the existing Jobs link.

Do not show this navigation item to workers.

The existing Jobs navigation and /jobs list page must remain available.

The calendar is an additional view, not a replacement for the job list.


Repository Changes

Add a focused repository function for retrieving jobs within a date range.

For example:

find_jobs_for_calendar(PDO $pdo, string $startDate, string $endDate): array

Use a range query covering the visible calendar grid, including dates from the previous or next month that appear in the first and last calendar rows.

Avoid querying the database once per calendar day.

The calendar should use one efficient query for the displayed date range.

Join or retrieve the required related information using the existing repository conventions:

  • Customer
  • Location
  • Assigned worker

Avoid unnecessary columns and avoid SELECT * where practical.


Date and Time Handling

Use PHP date utilities such as:

  • DateTimeImmutable
  • DateInterval
  • DatePeriod

Do not manually hardcode month lengths.

The calendar week should start on Monday.

Weekday headings should be:

Mon
Tue
Wed
Thu
Fri
Sat
Sun

Use the application/server timezone already configured by the project.

Do not add a new timezone setting unless one is already needed by the current application.


Visual Requirements

Keep the visual design aligned with the current Task App interface.

The calendar should:

  • Work on desktop
  • Remain usable on mobile
  • Avoid horizontal page overflow where reasonably possible
  • Clearly distinguish dates outside the selected month
  • Clearly highlight today
  • Keep job cards compact
  • Avoid oversized spacing

For smaller screens, it is acceptable for each day cell to stack vertically or for the calendar to use controlled horizontal scrolling, provided the page remains usable.

Do not redesign the whole application.

Do not include the previously tracked header, footer or dashboard-counter polish items in this task.


Empty States

Provide clear empty states.

Examples:

  • No jobs scheduled during the displayed month
  • No jobs scheduled on a particular date
  • No unscheduled active jobs

Do not fill every empty date cell with repetitive text. Empty date cells may remain visually empty.


Security and Validation

Maintain the existing project security patterns:

  • Require authentication
  • Enforce admin/dispatcher role access
  • Escape all output
  • Validate the month query parameter
  • Do not trust IDs or date values directly from requests
  • Use prepared statements for database queries

This feature is read-only, so no new CSRF-protected POST actions are required.


Suggested Files

Inspect the existing project structure first.

Likely files include:

public/index.php
app/repositories/jobs.php
app/views/jobs/calendar.php
app/views/layout.php
public/assets/css/app.css
README.md

Use the actual existing layout and navigation files found in the repository.

Do not create duplicate layout or helper systems.


README Update

Update the README with:

  • The new calendar route
  • Access roles
  • Month query format
  • A brief description of how scheduled and unscheduled jobs are handled

Acceptance Criteria

The task is complete when:

  1. Admins and dispatchers can open /jobs/calendar.
  2. Workers cannot access the calendar.
  3. The current month is shown by default.
  4. Previous and next month navigation works.
  5. The calendar week starts on Monday.
  6. Jobs appear on their correct scheduled dates.
  7. Calendar entries link to the existing job detail page.
  8. Customer, location, worker and status information are displayed compactly.
  9. Dates outside the selected month are visually muted.
  10. Today is visually highlighted.
  11. Invalid month values do not cause errors.
  12. Jobs are retrieved using a date-range query rather than one query per day.
  13. Existing job list, job management and worker workflows continue to work.
  14. The calendar remains usable on mobile.
  15. No large frontend framework or unnecessary dependency is introduced.

Validation

Run relevant validation available in the repository.

At minimum:

php -l public/index.php
php -l app/repositories/jobs.php
php -l app/views/jobs/calendar.php

Also manually verify:

/jobs/calendar
/jobs/calendar?month=2026-07
/jobs/calendar?month=2026-08
/jobs/calendar?month=invalid

Test access as:

  • Admin
  • Dispatcher
  • Worker

Confirm that existing pages still function:

/jobs
/jobs/{id}
/work
/work/jobs/{id}

Final Response

When complete, report:

  1. Summary of the implementation
  2. Files changed
  3. Route added
  4. Database fields used
  5. Calendar behaviour
  6. Access-control behaviour
  7. Validation commands and results
  8. Any assumptions made
  9. Any remaining limitations

Do not implement attachments, photos, signatures, maps, materials, inventory, dark mode or API integrations as part of this task.

0S Updated by 0x01 SIA about 2 months ago #1

  • Assignee set to DEV Machines

DM Updated by DEV Machines about 2 months ago #2

  • Status changed from New to Feedback
  • Assignee changed from DEV Machines to DEV Humans

Implemented the monthly job calendar at /jobs/calendar for admin and dispatcher roles.

Summary:

  • Added a range-based calendar query using the existing jobs.planned_date field
  • Added month navigation with strict YYYY-MM validation and Monday-start calendar weeks
  • Added compact linked job cards with existing status badge styling, muted out-of-month dates, and today highlighting
  • Added an unscheduled active jobs summary with a filtered jobs-list link
  • Added Calendar navigation for admin/dispatcher users and kept the existing jobs flow unchanged

Files changed:

  • public/index.php
  • app/repositories/jobs.php
  • app/views/jobs/calendar.php
  • app/views/jobs/index.php
  • app/helpers.php
  • public/assets/css/app.css

Validation:

  • php -l public/index.php
  • php -l app/repositories/jobs.php
  • php -l app/views/jobs/calendar.php
  • php -l app/views/jobs/index.php
  • php -l app/helpers.php

Notes:

  • Cancelled jobs remain visible in the calendar with muted styling for consistency with the existing jobs list
  • I did not run a browser-level or database-backed verification inside the app

DM Updated by DEV Machines about 2 months ago #3

  • Tracker changed from Bug to Feature

DH Updated by DEV Humans about 2 months ago #4

Codex Task: Polish and Fix Job Calendar Layout

Objective

Fix the visual layout of the existing job calendar so job entries remain contained within their assigned day cells and the calendar is easier to scan.

Do not rebuild the calendar feature or change its database logic. This is a focused frontend and view-layer polish task.

The existing route is:

GET /jobs/calendar

Current Problems

The current implementation has several layout issues:

  1. Job cards extend beyond the width of their day cells.
  2. Cards overlap adjacent dates and other calendar entries.
  3. Job numbers wrap awkwardly.
  4. Customer and location names make entries too tall.
  5. Status badges take too much horizontal space.
  6. Busy days become difficult to read.
  7. Cancelled jobs are not sufficiently visually muted.
  8. Job-count indicators sit awkwardly near cell borders.
  9. The desktop calendar uses space inefficiently.
  10. The mobile behaviour needs to remain usable after the fixes.

Use the supplied screenshot as the visual reference for the current problems.


Required Layout Fixes

1. Contain entries within day cells

Every calendar job entry must remain fully inside its corresponding day cell.

Apply appropriate CSS constraints such as:

min-width: 0;
max-width: 100%;
overflow: hidden;
box-sizing: border-box;

Ensure grid children are allowed to shrink correctly.

Pay particular attention to CSS Grid behaviour. Calendar columns and day cells should use shrinkable widths such as:

grid-template-columns: repeat(7, minmax(0, 1fr));

Do not allow calendar cards to overlap neighbouring cells.

2. Simplify each calendar entry

Each calendar entry should use a compact layout.

Display:

  • Job number
  • Scheduled time
  • Customer name
  • Assigned worker, when available
  • Compact status indicator

Do not display both the location name and full location details when this makes the card too tall.

Prefer this hierarchy:

JOB-000007 · 08:30
Bluebird Manufacturing
Unassigned
Planned

The exact arrangement may differ, but the entry must remain compact.

3. Prevent awkward wrapping

The following values should normally remain on one line:

  • Job number
  • Time
  • Status badge

Use ellipsis for long customer, location or worker names:

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

Do not break job numbers into forms such as:

JOB-
000007

4. Rework status display

Status styling should be smaller and less dominant.

Use a compact badge, dot or short label.

Possible presentation:

● Planned
● Completed
● Cancelled

Status badges must not force the job number to wrap.

Cancelled jobs should have:

  • Muted text
  • Muted border/background
  • Reduced visual emphasis

Completed jobs may remain visible but should not overpower planned or active jobs.

Use the existing application status colours where practical.

5. Improve busy-day behaviour

A day with several jobs must remain readable without overlapping.

Set a practical maximum number of fully visible entries per day cell, such as three.

When additional jobs exist, display a compact link such as:

+2 more

The link may:

  • Open the existing filtered jobs list, or
  • Expand the entries within the cell using minimal JavaScript, or
  • Link to the same calendar page with a selected-date query parameter

Prefer the simplest approach that fits the existing application.

Do not introduce a JavaScript framework.

6. Improve day-cell sizing

Avoid extremely tall blank calendar cells.

Use a reasonable minimum height rather than a large fixed height.

For example, desktop day cells may use approximately:

min-height: 150px;

Adjust this based on the existing layout.

Cells should grow when necessary, but calendar rows should remain visually balanced.

Do not let one busy cell cause excessive overlapping or broken row alignment.

7. Fix job-count indicators

The current round job-count indicators appear partly outside the cells.

Either:

  • Place the count cleanly beside the day number, or
  • Remove it when the visible job entries already communicate the count

A preferred day header format is:

24                    3 jobs

or:

24  ·  3

The indicator must stay inside the day cell.

Do not use absolutely positioned bubbles that cross cell boundaries.

8. Strengthen calendar hierarchy

Each day cell should have:

  • A compact day header
  • Clear separation between the date and jobs
  • Consistent padding
  • Subtle borders
  • Muted styling for dates outside the selected month
  • A visible but restrained highlight for today

Avoid oversized rounded corners on every nested element.

Reduce the “card inside card inside card” appearance.

The day cell may remain rounded, but job entries should use smaller radii and lighter borders.


Suggested Desktop Entry Layout

A compact entry could use:

<a class="calendar-job" href="/jobs/7">
    <div class="calendar-job__top">
        <strong>JOB-000007</strong>
        <time>08:30</time>
    </div>

    <div class="calendar-job__customer">
        Bluebird Manufacturing
    </div>

    <div class="calendar-job__bottom">
        <span>Unassigned</span>
        <span class="status-badge status-planned">Planned</span>
    </div>
</a>

This is only a structural suggestion. Adapt it to the existing project conventions.


Mobile Behaviour

On small screens, do not squeeze seven columns into an unreadable layout.

Use one of these lightweight approaches:

Preferred approach

Switch to a chronological agenda-style list on narrow screens:

Monday, 22 July
No jobs

Tuesday, 23 July
08:30 · JOB-000007
Bluebird Manufacturing

The desktop monthly grid can be hidden below an appropriate breakpoint while the same job data is shown in an agenda layout.

Acceptable alternative

Keep the monthly grid inside a controlled horizontally scrollable container.

If using horizontal scrolling:

  • Keep day columns at a readable minimum width.
  • Do not let the entire page overflow.
  • Make it visually clear that the calendar can scroll.

Prefer the agenda layout when it can be implemented without duplicating excessive logic.


Accessibility

Ensure:

  • Job cards remain keyboard-accessible links.
  • Status is communicated with text, not colour alone.
  • Text contrast remains readable.
  • Links have visible hover and focus states.
  • Ellipsised values retain the full text through a title attribute where useful.

Scope Restrictions

Do not:

  • Change calendar database queries unless necessary for the “more jobs” count.
  • Add drag-and-drop scheduling.
  • Add job editing inside the calendar.
  • Add a frontend framework.
  • Redesign the whole application.
  • Implement attachments, photos, signatures, maps, materials, inventory, dark mode or API features.
  • Include the unrelated header, footer or dashboard-counter polish items.

Likely Files

Inspect the repository first.

Likely files include:

app/views/jobs/calendar.php
public/assets/css/app.css
public/index.php
app/repositories/jobs.php

Only modify the route or repository if required for the compact overflow behaviour.


Acceptance Criteria

The task is complete when:

  1. No job card crosses into a neighbouring day cell.
  2. No job cards overlap each other.
  3. Job numbers remain readable and do not wrap after JOB-.
  4. Long customer and worker names use ellipsis.
  5. Status indicators are compact.
  6. Cancelled jobs are visually muted.
  7. Busy days show a clean overflow treatment such as +2 more.
  8. Job-count indicators remain inside their cells or are removed.
  9. Calendar cells use reasonable heights.
  10. Blank days no longer create excessive empty space.
  11. Today remains clearly identifiable.
  12. Dates outside the selected month remain visually muted.
  13. Desktop layout remains a seven-column calendar.
  14. Mobile layout remains readable and does not break page width.
  15. Existing links to /jobs/{id} continue to work.
  16. Existing month navigation continues to work.
  17. No large dependency or frontend framework is introduced.

Validation

Run:

php -l app/views/jobs/calendar.php
php -l public/index.php
php -l app/repositories/jobs.php

Manually test months containing:

  • No jobs
  • One job per day
  • Multiple jobs on one day
  • Long customer names
  • Long location names
  • Unassigned jobs
  • Planned jobs
  • Completed jobs
  • Cancelled jobs

Test at approximate widths:

1440px
1024px
768px
390px

Verify that no card overlaps another date at any tested width.


Final Response

Report:

  1. Summary of the visual fixes
  2. Files changed
  3. How entry overflow is handled
  4. How long text is handled
  5. Desktop behaviour
  6. Mobile behaviour
  7. Validation commands and results
  8. Any remaining visual limitations

DH Updated by DEV Humans about 2 months ago #5

  • Status changed from Feedback to In Progress
  • Assignee changed from DEV Humans to DEV Machines

DM Updated by DEV Machines about 2 months ago #6

  • Assignee changed from DEV Machines to DEV Humans

Completed the job calendar layout polish in /Users/gustavs/Documents/GitHub/task.

Summary of visual fixes:

  • Reworked calendar entries into a compact job/time/customer/worker/status layout
  • Added shrink-safe grid and card sizing so entries stay inside their day cells without overlapping neighboring dates
  • Truncated long customer and worker names with ellipsis and added title attributes for full text
  • Replaced large status badges with compact text-plus-dot status indicators
  • Muted cancelled jobs more clearly and softened completed-job emphasis
  • Limited desktop day cells to 3 visible entries with a +N more link to the filtered jobs list
  • Added a mobile agenda view below 768px so the calendar remains readable on narrow screens

Files changed:

  • app/views/jobs/calendar.php
  • public/assets/css/app.css

Validation:

  • php -l app/views/jobs/calendar.php
  • php -l public/index.php
  • php -l app/repositories/jobs.php

Notes:

  • Syntax checks passed; local PHP also emitted the existing warning that the redis module is already loaded
  • I did not run browser-width verification inside the app itself

DH Updated by DEV Humans about 2 months ago #7

  • Status changed from In Progress to Closed

DH Updated by DEV Humans about 2 months ago #8

  • Status changed from Closed to New
  • Assignee changed from DEV Humans to DEV Machines

Codex Task: Redesign Job Calendar with Week and Month Views

Objective

Improve the existing job calendar so it is useful for day-to-day dispatch and worker planning.

The current month-only calendar is not convenient because users are usually most interested in:

  • Today
  • The next several days
  • The coming week

Add a selectable Week / Month view.

The Week view must be the default.

Keep the implementation lightweight and consistent with the existing plain PHP, PDO and CSS architecture.

Do not introduce a frontend framework.


Existing Route

The calendar currently exists at:

GET /jobs/calendar

Keep this route.

Use query parameters to control the selected view and date.

Examples:

/jobs/calendar
/jobs/calendar?view=week
/jobs/calendar?view=week&date=2026-07-27
/jobs/calendar?view=month&month=2026-07

Access

The calendar should remain available to:

  • Admin
  • Dispatcher

If the calendar is already available to workers, preserve that access unless the existing role rules clearly restrict it.

Do not broaden permissions accidentally.

Use the existing authentication and role-checking helpers.


Default Behaviour

When opening:

/jobs/calendar

show the current week.

The week must:

  • Start on Monday
  • End on Sunday
  • Include today
  • Clearly highlight today

The default page should immediately answer:

  • What jobs are scheduled today?
  • What is scheduled during the rest of this week?
  • Which workers are assigned?

View Selector

Add a clear view switcher near the calendar heading:

Week | Month

The active view must be visually clear.

Suggested URLs:

/jobs/calendar?view=week
/jobs/calendar?view=month

Do not use JavaScript-only state for the selected view.

The selected view must be represented in the URL so the page can be bookmarked and refreshed.

Only accept these values:

week
month

Invalid values must fall back safely to:

week

Week View

Week Navigation

The week view must include:

  • Previous week
  • Today
  • Next week
  • Visible start and end dates

Example heading:

27 July – 2 August 2026

Suggested navigation URLs:

/jobs/calendar?view=week&date=2026-07-20
/jobs/calendar?view=week&date=2026-07-27
/jobs/calendar?view=week&date=2026-08-03

Use the date parameter as the anchor date.

Validate it strictly using:

YYYY-MM-DD

Invalid dates must safely fall back to today.


Week Layout

Create a seven-day week layout with one column or section per day:

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

Each day header should show:

  • Weekday
  • Date
  • Job count

Example:

Monday
27 July
3 jobs

Today should be visually highlighted without overwhelming the layout.

Dates should remain readable on desktop, tablet and mobile.


Week Job Entries

Week-view job entries may contain more information than month-view entries because more horizontal and vertical space is available.

Show:

  • Scheduled time
  • Job number
  • Customer name
  • Location name or short address
  • Assigned worker
  • Current status

Suggested hierarchy:

08:30
JOB-000007
Bluebird Manufacturing
Bluebird Plant
Worker User
Planned

The job number or full entry must link to:

/jobs/{id}

Long values must use ellipsis or sensible wrapping without crossing into neighbouring days.

No job entry may overlap another day.


Today-first usability

In the week view:

  • Today must be easy to identify.
  • Jobs should be ordered by scheduled time.
  • Jobs without a scheduled time should appear after timed jobs for that date.
  • Empty days should show a compact empty state such as No jobs.
  • Do not create very large blank cards for empty days.

The current week should be the primary operational view.


Month View

Month Navigation

Keep the existing month navigation:

  • Previous month
  • Today
  • Next month

Use:

/jobs/calendar?view=month&month=2026-07

Validate month strictly using:

YYYY-MM

Invalid values must safely fall back to the current month.


Month Layout

Keep a standard seven-column monthly grid:

Mon
Tue
Wed
Thu
Fri
Sat
Sun

The month view is intended for broader planning, not detailed job reading.

Therefore month entries must be more compact than week entries.

Show only:

  • Scheduled time
  • Job number
  • Customer name
  • Compact status indicator

Do not show full location and worker details if this makes the cards too tall.


Month Overflow Behaviour

Show a practical maximum number of entries in each date cell, such as three.

When more jobs exist, display:

+2 more

The simplest acceptable behaviour is for this link to open the week containing that date:

/jobs/calendar?view=week&date=2026-07-24

This is preferred over adding complicated expansion JavaScript.

No card may cross into a neighbouring day cell.


Shared Calendar Requirements

Date-range queries

Use one efficient date-range query for each displayed period.

For week view, retrieve the selected Monday through Sunday.

For month view, retrieve the entire visible calendar grid, including muted dates from adjacent months where required.

Do not query once per day.

Use or extend the existing calendar repository function rather than creating duplicate scheduling logic.

Suggested functions:

find_jobs_for_calendar(
    PDO $pdo,
    string $startDate,
    string $endDate
): array;

A single reusable range function is preferred.


Scheduled field

Inspect the existing schema and repository and continue using the existing scheduled date/time field.

Do not add a duplicate scheduling column.

Jobs without a valid scheduled date should not appear in week or month date cells.

Preserve the existing unscheduled-active-jobs summary if already implemented.


Job ordering

Within each day, sort jobs by:

  1. Scheduled time ascending
  2. Job number ascending as a stable fallback

Jobs with no scheduled time but a valid scheduled date should appear after timed jobs.


Status display

Use existing statuses and status styles.

Status labels must remain compact.

Cancelled jobs should be visibly muted.

Completed jobs should remain readable but less prominent than upcoming planned or active work.

Status must be communicated using text, not colour alone.


Layout fixes

Correct the existing visual problems:

  • Cards must stay inside their date or day container.
  • Cards must not overlap neighbouring dates.
  • Job numbers must not wrap after JOB-.
  • Long names must not force the layout wider.
  • Count indicators must remain inside the day header.
  • Avoid excessive rounded cards nested inside other rounded cards.
  • Avoid extremely tall empty month cells.
  • Use minmax(0, 1fr) where appropriate in CSS Grid.
  • Apply min-width: 0 to shrinkable grid and flex children.
  • Use box-sizing: border-box.
  • Use ellipsis where appropriate.

Example CSS principles:

.calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-day,
.calendar-job {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.calendar-job__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

Adapt selectors to the actual code.


Responsive Behaviour

Desktop

On desktop:

  • Week view should show all seven days clearly.
  • Month view should remain a seven-column calendar.
  • Entries must never overlap.
  • Navigation and view selection should remain on one clean toolbar where space allows.

Tablet

At medium widths:

  • Week columns may become narrower, but entries must remain contained.
  • Reduce secondary text before allowing overlap.
  • A controlled horizontal scroll area is acceptable if necessary.

Mobile

Do not squeeze seven columns into an unreadable width.

For the week view, use a chronological stacked agenda:

Monday, 27 July
08:30 · JOB-000007
Bluebird Manufacturing

Tuesday, 28 July
No jobs

For the month view, one of these is acceptable:

  1. A controlled horizontally scrollable monthly grid, or
  2. A compact month agenda grouped by date

Prefer the simplest reliable implementation.

The whole page must not overflow horizontally.


Navigation and State Preservation

When switching views, preserve the most relevant date.

Examples:

  • From week view on 27 July to month view:
    /jobs/calendar?view=month&month=2026-07
  • From July month view to week view:
    /jobs/calendar?view=week&date=2026-07-01

When clicking +N more in month view, open the week containing that date.

The Today button should:

  • Open the current week when in week view
  • Open the current month when in month view

Accessibility

Ensure:

  • Week/Month controls are real links or buttons with clear active state.
  • Job entries remain keyboard-accessible links.
  • Focus states are visible.
  • Today is identified using text or an accessible label, not only colour.
  • Status text remains available.
  • Ellipsised values use a title attribute where useful.

Scope Restrictions

Do not:

  • Add drag-and-drop scheduling.
  • Add inline job editing.
  • Add a frontend framework.
  • Add a large calendar library unless the existing project already uses one.
  • Redesign unrelated application pages.
  • Implement attachments, photos, signatures, maps, materials, inventory, dark mode or API integrations.
  • Include the unrelated header, footer or dashboard-counter polish items.

Likely Files

Inspect the repository first.

Likely files include:

public/index.php
app/repositories/jobs.php
app/views/jobs/calendar.php
public/assets/css/app.css
README.md

Use the actual existing layout and helper files.

Do not create duplicate routing, date or layout systems.


Acceptance Criteria

The task is complete when:

  1. /jobs/calendar opens the current week by default.
  2. Users can select Week or Month.
  3. The selected view is stored in the URL.
  4. Invalid view values fall back to Week.
  5. Week navigation moves backward and forward by seven days.
  6. Month navigation moves backward and forward by one month.
  7. Today works correctly in both views.
  8. Week starts on Monday.
  9. Week view shows Monday through Sunday.
  10. Today is clearly highlighted.
  11. Jobs are ordered by scheduled time.
  12. Job entries link to existing job detail pages.
  13. Week view shows useful operational details.
  14. Month view uses compact entries.
  15. Busy month dates show +N more.
  16. +N more opens the relevant week.
  17. No job card overlaps another date or day.
  18. Job numbers do not wrap after JOB-.
  19. Long text does not break the layout.
  20. Cancelled jobs are visually muted.
  21. Desktop and mobile layouts remain usable.
  22. Database queries use a date range rather than one query per day.
  23. Existing job list and job workflows continue to work.
  24. No large dependency or frontend framework is introduced.

Validation

Run at minimum:

php -l public/index.php
php -l app/repositories/jobs.php
php -l app/views/jobs/calendar.php

Manually test:

/jobs/calendar
/jobs/calendar?view=week
/jobs/calendar?view=week&date=2026-07-27
/jobs/calendar?view=week&date=invalid
/jobs/calendar?view=month
/jobs/calendar?view=month&month=2026-07
/jobs/calendar?view=month&month=invalid
/jobs/calendar?view=invalid

Test:

  • Current week
  • Previous week
  • Next week
  • A week crossing two months
  • A week crossing two years
  • A month starting on Sunday
  • A month ending on Monday
  • Empty week
  • Busy week
  • Busy month date
  • Long customer and location names
  • Planned, active, completed and cancelled jobs
  • Jobs with a date but no time
  • Unassigned jobs

Test approximate widths:

1440px
1024px
768px
390px

Confirm that no entry overlaps or breaks the page width.


README Update

Document:

  • The calendar route
  • Week and Month views
  • Week as the default
  • Supported query parameters
  • Access roles
  • How month overflow links to the relevant week

Final Response

When complete, report:

  1. Summary of the implementation
  2. Files changed
  3. Routes and query parameters used
  4. Default view behaviour
  5. Week navigation behaviour
  6. Month navigation behaviour
  7. Responsive behaviour
  8. Database query approach
  9. Validation commands and results
  10. Assumptions or remaining limitations

DM Updated by DEV Machines about 2 months ago #9

  • Assignee changed from DEV Machines to DEV Humans

Implemented the calendar redesign in /Users/gustavs/Documents/GitHub/task with Week and Month views on the existing /jobs/calendar route.

Summary:

  • Week view is now the default and opens the current Monday-Sunday week
  • Added URL-backed view selection with strict validation for view=week|month, date=YYYY-MM-DD, and month=YYYY-MM
  • Added week navigation (previous week, today, next week) and kept month navigation on the same route
  • Reworked the template so week view shows operational details: time, job number, customer, location, worker, and status
  • Kept month view compact and changed +N more links to open the relevant week
  • Preserved the unscheduled active jobs summary and reused the existing range query
  • Updated job ordering inside the calendar to use scheduled time first and job number as the stable fallback
  • Added responsive layouts so week view becomes a mobile agenda and month view stays readable without page-width breakage
  • Updated the README to document the new default week behavior and supported calendar query parameters

Files changed:

  • public/index.php
  • app/repositories/jobs.php
  • app/views/jobs/calendar.php
  • public/assets/css/app.css
  • README.md

Validation:

  • php -l public/index.php
  • php -l app/repositories/jobs.php
  • php -l app/views/jobs/calendar.php

Notes:

  • Syntax checks passed; local PHP also emitted the existing warning that the redis module is already loaded
  • I did not run manual browser-width verification inside the app itself

DH Updated by DEV Humans about 2 months ago #10

  • Assignee changed from DEV Humans to DEV Machines

Codex Task: Add Worker Access to the Job Calendar

Objective

Allow worker users to access the existing job calendar.

The Week/Month calendar has already been implemented. Do not redesign or rebuild it.

Workers must see only jobs assigned to their own user account.


Required Changes

Calendar access

Make the existing calendar route available to:

  • Admin
  • Dispatcher
  • Worker

Existing route:

GET /jobs/calendar

Add the Calendar navigation item to the worker navigation.

Worker filtering

When the authenticated user has the worker role:

  • Show only jobs assigned to that worker.
  • Do not show unassigned jobs.
  • Do not show jobs assigned to other workers.
  • Apply the restriction in the server-side repository or SQL query.

Do not fetch all jobs and filter them only in PHP or the browser.

Admin and dispatcher behaviour must remain unchanged.

Job links

Calendar entries must link to the correct detail page:

  • Admin/dispatcher: /jobs/{id}
  • Worker: /work/jobs/{id}

Week and Month views

Worker filtering must apply consistently to:

  • Week view
  • Month view
  • Previous/next navigation
  • Today navigation
  • Any +N more links or overflow views

Changing URL parameters must not bypass the worker filter.


Likely Files

Inspect the existing implementation first.

Likely files include:

public/index.php
app/repositories/jobs.php
app/views/jobs/calendar.php
app/views/layout.php

Use the actual existing navigation and role helpers.


Acceptance Criteria

  1. Workers can see the Calendar navigation item.
  2. Workers can open /jobs/calendar.
  3. Workers can use both Week and Month views.
  4. Workers see only jobs assigned to themselves.
  5. Workers cannot see unassigned jobs.
  6. Workers cannot see jobs assigned to another worker.
  7. Worker calendar entries link to /work/jobs/{id}.
  8. Admin and dispatcher calendar behaviour remains unchanged.
  9. Filtering is enforced server-side.
  10. Existing calendar styling and navigation remain unchanged.

Validation

Test as:

  • Admin
  • Dispatcher
  • Worker A
  • Worker B

Confirm:

  • Admin and dispatcher still see all permitted jobs.
  • Worker A sees only Worker A jobs.
  • Worker B sees only Worker B jobs.
  • Neither worker sees unassigned jobs.
  • Week and Month views both respect filtering.
  • Direct URL changes do not expose other workers' jobs.

Run relevant syntax checks, at minimum:

php -l public/index.php
php -l app/repositories/jobs.php
php -l app/views/jobs/calendar.php

Final Response

Report:

  1. Files changed
  2. How worker filtering was implemented
  3. Navigation changes
  4. Worker link behaviour
  5. Validation results

DM Updated by DEV Machines about 2 months ago #11

Completed the worker calendar access update in /Users/gustavs/Documents/GitHub/task.

Summary:

  • Opened GET /jobs/calendar to worker users while keeping existing admin and dispatcher access unchanged
  • Added the Calendar navigation item to the worker navigation
  • Enforced worker filtering server-side in the calendar SQL so workers only receive jobs assigned to their own user id
  • Applied the same worker restriction to the unscheduled active jobs count
  • Updated calendar job links so workers go to /work/jobs/{id} while admin and dispatcher links remain /jobs/{id}
  • Kept week view, month view, navigation, and +N more flows under the same server-side filter

Files changed:

  • app/helpers.php
  • app/repositories/jobs.php
  • public/index.php
  • app/views/jobs/calendar.php

Validation:

  • php -l public/index.php
  • php -l app/repositories/jobs.php
  • php -l app/views/jobs/calendar.php

Notes:

  • Syntax checks passed; local PHP also emitted the existing warning that the redis module is already loaded
  • I did not run full role-by-role browser verification inside the app itself

DH Updated by DEV Humans about 2 months ago #12

  • Status changed from New to Closed
  • Assignee changed from DEV Machines to DEV Humans

Tested and published

Also available in: PDF Atom