Skip to content

Commit

Permalink
Add support for billable/non-billable setting
Browse files Browse the repository at this point in the history
  • Loading branch information
eXpl0it3r committed Nov 21, 2024
1 parent 0131bac commit 75d094e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Clockify/ClockifyContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ClockifyContext
private string _taskName = string.Empty;
private string _timerName = string.Empty;
private string _workspaceName = string.Empty;
private bool _billable = true;

public ClockifyContext(Logger logger)
{
Expand Down Expand Up @@ -66,7 +67,8 @@ public async Task<bool> ToggleTimerAsync()
UserId = _currentUser.Id,
WorkspaceId = workspace.Id,
Description = _timerName ?? string.Empty,
Start = DateTimeOffset.UtcNow
Start = DateTimeOffset.UtcNow,
Billable = _billable
};

if (!string.IsNullOrEmpty(_projectName))
Expand Down Expand Up @@ -183,6 +185,7 @@ public async Task UpdateSettings(PluginSettings settings)
_taskName = settings.TaskName;
_timerName = settings.TimerName;
_clientName = settings.ClientName;
_billable = settings.Billable;
}

private async Task ReloadCacheAsync()
Expand Down Expand Up @@ -223,7 +226,7 @@ private async Task StopRunningTimerAsync()
End = DateTimeOffset.UtcNow,
ProjectId = runningTimer.ProjectId,
TaskId = runningTimer.TaskId,
Description = runningTimer.Description
Description = runningTimer.Description,
};

await _clockifyClient.UpdateTimeEntryAsync(workspace.Id, runningTimer.Id, timerUpdate);
Expand Down
3 changes: 3 additions & 0 deletions Clockify/PluginSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class PluginSettings

[JsonProperty(PropertyName = "clientName")]
public string ClientName { get; set; } = string.Empty;

[JsonProperty(PropertyName = "billable")]
public bool Billable { get; set; } = true;

[JsonProperty(PropertyName = "titleFormat")]
public string TitleFormat { get; set; } = string.Empty;
Expand Down
6 changes: 5 additions & 1 deletion PropertyInspector/PluginActionPI.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@
</div>
<div type="group" class="sdpi-item" id="advanced">
<div class="sdpi-item-label">Advanced</div>
<div class="sdpi-item-group" id="messagegroup_items">
<div class="sdpi-item-group" id="advancedgroup_items">
<div class="sdpi-item">
<div class="sdpi-item-label">Client Name</div>
<input class="sdpi-item-value sdProperty" id="clientName" value="" placeholder="Enter the name of the Client" oninput="setSettings()">
</div>
<div class="sdpi-item">
<div class="sdpi-item-label">Billable</div>
<input type="checkbox" class="sdpi-item-value sdProperty sdCheckbox" id="billable" oninput="setSettings()" checked>
</div>
<div class="sdpi-item">
<div class="sdpi-item-label">Title Format</div>
<div class="sdpi-item-value textarea">
Expand Down

0 comments on commit 75d094e

Please sign in to comment.