Skip to content

Frontend: disable timesheet based on deadlines passed in from backend #20

@izzyconner

Description

@izzyconner

Context

In Timesheet.tsx, there's a calculated variable disabled, which determines if a user is able to edit and submit the timesheet.

// use this to control whether the timesheet is disabled or not
const disabled = false;

Right now, cases where they will not be able to disable it are:

  • A supervisor cannot edit or submit before an associate has submitted their timesheet
  • A user cannot submit the timesheet once the corresponding deadline has passed

Description

The backend /timesheet endpoint will now return additional fields in the Timesheet schema to track deadlines, in addition to the Start field that is currently included.

  • DueDateAssociate : an epoch representing the day and time that this timesheet must be submitted by the associate
  • DueDateSupervisor: an epoch representing the day and time that this timesheet must be reviewed by the supervisor

Image

The frontend should expect these fields to be passed in when making a GET request to the /timesheet endpoint (you may need to create mock data and stub out a testing endpoint in apiClient.tsx that return the mock data if the backend has not been updated yet). Then, for the current timesheet, there should be a disabled variable that replaces the current const disabled whose value is calculated based on the current user's role, and the appropriate deadline for the user.

Conditions of Satisfaction

  • When the due date has not yet been reached for an associate, the associate is able to edit the timesheet
  • When the due date has not yet been reached for a supervisor, the supervisor is able to edit the timesheet
  • When the due date has been reached for an associate, the associate can not longer edit the timesheet
  • When the due date has been reached for a supervisor, the supervisor can no longer edit the timesheet

(optional)

  • Create a debug button on the frontend to trigger the change of the disabled state to test while the backend is still in progress

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions