Skip to content

Commit 02516e5

Browse files
committed
Add support for billable/non-billable setting
1 parent 0131bac commit 02516e5

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Clockify/ClockifyContext.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class ClockifyContext
2626
private string _taskName = string.Empty;
2727
private string _timerName = string.Empty;
2828
private string _workspaceName = string.Empty;
29+
private bool _billable = true;
2930

3031
public ClockifyContext(Logger logger)
3132
{
@@ -66,7 +67,8 @@ public async Task<bool> ToggleTimerAsync()
6667
UserId = _currentUser.Id,
6768
WorkspaceId = workspace.Id,
6869
Description = _timerName ?? string.Empty,
69-
Start = DateTimeOffset.UtcNow
70+
Start = DateTimeOffset.UtcNow,
71+
Billable = _billable
7072
};
7173

7274
if (!string.IsNullOrEmpty(_projectName))
@@ -183,6 +185,7 @@ public async Task UpdateSettings(PluginSettings settings)
183185
_taskName = settings.TaskName;
184186
_timerName = settings.TimerName;
185187
_clientName = settings.ClientName;
188+
_billable = settings.Billable;
186189
}
187190

188191
private async Task ReloadCacheAsync()
@@ -223,7 +226,7 @@ private async Task StopRunningTimerAsync()
223226
End = DateTimeOffset.UtcNow,
224227
ProjectId = runningTimer.ProjectId,
225228
TaskId = runningTimer.TaskId,
226-
Description = runningTimer.Description
229+
Description = runningTimer.Description,
227230
};
228231

229232
await _clockifyClient.UpdateTimeEntryAsync(workspace.Id, runningTimer.Id, timerUpdate);

Clockify/PluginSettings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class PluginSettings
2121

2222
[JsonProperty(PropertyName = "clientName")]
2323
public string ClientName { get; set; } = string.Empty;
24+
25+
[JsonProperty(PropertyName = "billable")]
26+
public bool Billable { get; set; } = true;
2427

2528
[JsonProperty(PropertyName = "titleFormat")]
2629
public string TitleFormat { get; set; } = string.Empty;

PropertyInspector/PluginActionPI.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@
3434
</div>
3535
<div type="group" class="sdpi-item" id="advanced">
3636
<div class="sdpi-item-label">Advanced</div>
37-
<div class="sdpi-item-group" id="messagegroup_items">
37+
<div class="sdpi-item-group" id="advancedgroup_items">
3838
<div class="sdpi-item">
3939
<div class="sdpi-item-label">Client Name</div>
4040
<input class="sdpi-item-value sdProperty" id="clientName" value="" placeholder="Enter the name of the Client" oninput="setSettings()">
4141
</div>
42+
<div class="sdpi-item">
43+
<div class="sdpi-item-label">Billable</div>
44+
<input type="checkbox" class="sdpi-item-value sdProperty" id="billable" oninput="setSettings()" checked>
45+
</div>
4246
<div class="sdpi-item">
4347
<div class="sdpi-item-label">Title Format</div>
4448
<div class="sdpi-item-value textarea">

0 commit comments

Comments
 (0)