Skip to content

Commit

Permalink
Changed approach when deleting timelog, to handling things frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
jeppekroghitk committed Jan 13, 2025
1 parent 157669c commit 436f305
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions Language/da-DK.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ timeTable.button_show_this_week="Vis denne uge"
timeTable.hours_left="Resterende timer:"
timeTable.entry_copy_button_close="Annuller"
timeTable.entry_copy_button_apply="Kopier"
timeTable.update_to_show_correct_sums="Opdater siden for at få vist de korrekte summer"
1 change: 1 addition & 0 deletions Language/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ timeTable.button_show_this_week="Show this week"
timeTable.hours_left="Hours left:"
timeTable.entry_copy_button_close="Cancel"
timeTable.entry_copy_button_apply="Copy"
timeTable.update_to_show_correct_sums="Please reload the page to get the correct sums"
5 changes: 3 additions & 2 deletions Templates/timetable.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
class="timetable-to-today btn btn-default">{{ __('timeTable.button_show_this_week') }}</button>
</div>
</form>
<p class="recently-deleted-timelog-info hidden"><i class="fas fa-info-circle"></i> {{ __('timeTable.update_to_show_correct_sums') }}</p>
<div class="timetable-scroll-container">
<table id="timetable" class="table">
<thead>
Expand Down Expand Up @@ -82,7 +83,7 @@ class="timetable-to-today btn btn-default">{{ __('timeTable.button_show_this_wee
$hoursLeft = $timesheetDate[0]['hourRemaining'] ?? null;
$description = $timesheetDate[0]['description'] ?? null;
$isMissingDescription = isset($hours) && trim($description) === '';
// accumulate hours
if ($hours) {
if (isset($totalHours[$weekDateAccessor])) {
Expand All @@ -92,7 +93,7 @@ class="timetable-to-today btn btn-default">{{ __('timeTable.button_show_this_wee
}
$rowTotal += $hours; // add to row total
}
$weekendClass = isset($weekDate) && $weekDate->isWeekend() ? 'weekend' : '';
$todayClass = isset($weekDate) && $weekDate->isToday() ? 'today' : '';
$newWeekClass = isset($weekDate) && $weekDate->isMonday() ? 'new-week' : ''; // Add new-week class for Mondays
Expand Down
6 changes: 6 additions & 0 deletions assets/timeTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
--itk-color-success-100: hsla(141, 84%, 93%, 1);
--itk-color-danger: hsla(0, 72%, 51%, 1);
--itk-color-danger-800: hsla(0, 70%, 35%, 1);
--itk-color-info: hsla(45, 90%, 51%, 1);
--itk-color-info-800: hsla(45, 80%, 35%, 1);
--itk-color-white: white;
--itk-color-gray-50: hsla(210, 40%, 98%, 1);
--itk-color-gray-100: hsla(214, 32%, 91%, 1);
Expand All @@ -39,13 +41,17 @@
}

.timetable {
.recently-deleted-timelog-info > i {
color: var(--itk-color-info);
}
.timetable-scroll-container {
overflow-x: auto;
}

#timetable {
background-color: var(--itk-color-white);


.new-week {
border-left: 2px solid var(--itk-border-color) !important;
position: relative;
Expand Down
12 changes: 11 additions & 1 deletion assets/timeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,14 @@ jQuery(document).ready(function ($) {
.then((response) => response.json())
.then((data) => {
if (data.status === "success") {
window.location.href = data.redirectUrl;
$('td.timetable-edit-entry[data-id="'+timesheetId+'"]')
.children('span').text('')
.end()
.attr('data-id', '')
.attr('data-hours', '')
.attr('data-description', '');
$('.recently-deleted-timelog-info').removeClass('hidden');
this.closeEditTimeLogModal()
} else {
alert("An error has occurred");
}
Expand All @@ -640,6 +647,9 @@ jQuery(document).ready(function ($) {
closeEditTimeLogModal() {
this.timeEditModal.removeClass("shown").removeAttr("data-value");
this.timeEditModal.find("input:not([name='action']), textarea").val("");
$(this.modalDeleteButton)
.html('<i class="fa fa-trash"></i>')
.removeClass("deleting");
$(document).off("mousedown", this.boundClickOutsideModalHandler);
}

Expand Down
6 changes: 6 additions & 0 deletions dist/css/timeTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
--itk-color-success-100: hsla(141, 84%, 93%, 1);
--itk-color-danger: hsla(0, 72%, 51%, 1);
--itk-color-danger-800: hsla(0, 70%, 35%, 1);
--itk-color-info: hsla(45, 90%, 51%, 1);
--itk-color-info-800: hsla(45, 80%, 35%, 1);
--itk-color-white: white;
--itk-color-gray-50: hsla(210, 40%, 98%, 1);
--itk-color-gray-100: hsla(214, 32%, 91%, 1);
Expand All @@ -39,13 +41,17 @@
}

.timetable {
.recently-deleted-timelog-info > i {
color: var(--itk-color-info);
}
.timetable-scroll-container {
overflow-x: auto;
}

#timetable {
background-color: var(--itk-color-white);


.new-week {
border-left: 2px solid var(--itk-border-color) !important;
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion dist/js/timeTable.js

Large diffs are not rendered by default.

0 comments on commit 436f305

Please sign in to comment.