track client and add feedback for running client

This commit is contained in:
2025-01-20 17:03:08 +01:00
parent 8faa0443a5
commit 6b8b0a9097
3 changed files with 89 additions and 8 deletions

View File

@@ -16,13 +16,34 @@ export function UpdateFeedbacks(self: TogglTrack): void {
type: 'dropdown',
label: 'Project',
default: -1,
choices: [{ id: -1, label: 'None' }].concat(self.projects!),
choices: self.projects ?? [{ id: -1, label: 'None' }],
},
],
callback: (feedback) => {
const projID = self.getVariableValue('timerProjectID')
self.log('debug', 'check if ' + feedback.options.project + '=' + projID)
return feedback.options.project == projID
//self.log('debug', 'check project counting ' + feedback.options.project)
return feedback.options.project == self.currentEntry?.project_id
},
},
ClientRunningState: {
name: 'Client Counting',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'client',
type: 'dropdown',
label: 'Client',
default: -1,
choices: self.clients ?? [{ id: -1, label: 'None' }],
},
],
callback: (feedback) => {
//self.log('debug', 'check client counting ' + feedback.options.client)
// find the project that matches the project_id of the current entry and compare its client_id with the configured one
return feedback.options.client == self.projects?.find((p) => p.id == self.currentEntry?.project_id)?.clientID
},
},
})