Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nuxtus/directus-extension-timesheet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Timesheets
A project timer layout for timesheet collections in Directus. Allows users to start/stop a timer and record the times in a timesheet.
Installation
- Git clone this project
npm i
npm run build
- Copy the entire folder into your Directus extensions folder
/extensions/directus-extension-timesheet
- Run the supplied schema to update your database:
npx directus schema apply ./schema/schema.json
- Restart directus
- Create your leave types (eg. Annual leave, Sick/Carer's leave, 9 day fortnight, Work from Home etc) in the
leave type
collection. Note: Where users still accrue leave should be marked as "claimable" - Go to Timesheets > Settings and save your default settings
- Set permissions for timesheets and all ts_ collections for each role type
- (optional) You can change the collection that the timesheets record time against by visiting the Timesheets > Settings and manually changing the settings
- (optional) If you wish to calculate 9 day fortnights, set each users manager and nineDayFortnightStart field. It should be set to the LAST monday (start of the 9DF week) for this staff member.
- (recommended) Create a "manual trigger" flow on the leave collection. Add the "Approve Leave" operation to the flow. This will allow users to approve leave.
Note: If using Docker you may want to add the extension to the volumes via directus -> volumes, add: - ./node_-_modules/directus-extension-timesheet/dist:/directus/extensions/directus-extension-timesheet
Using your own task collection
The collection that that timers are run against is configurable in the Timesheet > Settings area. You can change this to any collection you like, but it must have the following fields:
- id (integer)
- name\description (string) - This can be called anything you want but must be a string
- status - A standard Directus status field, only the "active" status is displayed in the timer dropdown
Permissions
It's up to you to manually define the permissions for CRUD operations within Directus. I usually:
- Lock users to only being able to CRU the start_time, end_time and project fields.
- Add permission to only allow users to view their own timesheets
- Give users permission to view everyone's leave, but not edit/delete it.
- Do not allow add/edit of the leave approval fields.
Some example roles with these permissions are provided in the schema folder.