From efa8437b4871971bca1ab61c5486230a48485bd8 Mon Sep 17 00:00:00 2001 From: rob Date: Thu, 2 May 2024 12:15:52 -0400 Subject: [PATCH] bunch of little fixes --- app/views/client/editor.pug | 12 ++++- app/views/client/view.pug | 2 +- .../report/components/weekly-summary.pug | 33 ++++++------ app/views/report/dashboard.pug | 51 ++++++++++--------- client/js/time-tracker-client.js | 9 +++- 5 files changed, 63 insertions(+), 44 deletions(-) diff --git a/app/views/client/editor.pug b/app/views/client/editor.pug index d782ee6..984f44d 100644 --- a/app/views/client/editor.pug +++ b/app/views/client/editor.pug @@ -42,5 +42,13 @@ block view-content ).uk-input .uk-text-small.uk-text-muted Use zero or 168 (7 x 24) for unlimited hours per week. - .uk-card-footer.uk-flex.uk-flex-right - button(type="submit").uk-button.uk-button-default.uk-border-rounded #[span= !!client ? "Update" : "Create"] Client \ No newline at end of file + .uk-card-footer + div(uk-grid).uk-grid-small.uk-flex-right + .uk-width-auto + a(href=`/client/${client._id}`).uk-button.uk-button-default.uk-border-rounded + i.fa-solid.fa-chevron-left + span.uk-margin-small-left Back + .uk-width-auto + button(type="submit").uk-button.uk-button-default.uk-border-rounded + i.fa-solid.fa-save + span.uk-margin-small-left #{!!client ? "Update" : "Create"} Client \ No newline at end of file diff --git a/app/views/client/view.pug b/app/views/client/view.pug index ef8b579..00695ce 100644 --- a/app/views/client/view.pug +++ b/app/views/client/view.pug @@ -13,7 +13,7 @@ block view-content .uk-width-auto a(href=`/client/${client._id}/edit`).uk-button.uk-button-default.uk-button-small i.fa-solid.fa-cog - span.uk-margin-small-left Edit Client + span.uk-margin-small-left Settings .uk-width-auto a(href=`/client/${client._id}/project/create`).uk-button.uk-button-default.uk-button-small i.fa-solid.fa-plus diff --git a/app/views/report/components/weekly-summary.pug b/app/views/report/components/weekly-summary.pug index 4d708ed..d9158c9 100644 --- a/app/views/report/components/weekly-summary.pug +++ b/app/views/report/components/weekly-summary.pug @@ -1,17 +1,20 @@ mixin renderWeeklySummaryReport (data) - table.uk-table.uk-table-small.uk-table-responsive.no-select - thead - tr - th Project - th Client - th Sessions - th Time Worked - th Billable - tbody - each row in data + .uk-overflow-auto + table.uk-table.uk-table-small.no-select + thead tr - td.uk-table-expand=row.project.name - td= row.project.client.name - td= formatCount(row.sessionCount) - td= numeral(row.duration).format('0:00:00') - td= numeral(row.billable).format('$0,0.00') \ No newline at end of file + th Project + th Client + th Sessions + th Time Worked + th Billable + tbody + each row in data + tr + td.uk-table-expand + a(href=`/client/${row.project.client._id}/project/${row.project._id}`)=row.project.name + td + a(href=`/client/${row.project.client._id}`)= row.project.client.name + td= formatCount(row.sessionCount) + td= numeral(row.duration).format('0:00:00') + td= numeral(row.billable).format('$0,0.00') \ No newline at end of file diff --git a/app/views/report/dashboard.pug b/app/views/report/dashboard.pug index 2b1c014..f7eaf96 100644 --- a/app/views/report/dashboard.pug +++ b/app/views/report/dashboard.pug @@ -10,31 +10,32 @@ block view-content .uk-margin-medium h2 Daily Hours - table.uk-table.uk-table-small.uk-table-divider - thead - tr - th.uk-table-expand Day of Week - th.uk-text-nowrap.uk-text-right.uk-table-shrink Session Count - th.uk-text-nowrap.uk-text-right.uk-table-shrink Hours Worked - th.uk-text-nowrap.uk-text-right.uk-table-shrink Time Worked - tbody - - - var totalHoursWorked = 0; - var totalSessionCount = 0; - - each day in dailyTimeWorked + .uk-overflow-auto + table.uk-table.uk-table-small.uk-table-divider + thead + tr + th.uk-table-expand Day of Week + th.uk-text-nowrap.uk-text-right.uk-table-shrink Session Count + th.uk-text-nowrap.uk-text-right.uk-table-shrink Hours Worked + th.uk-text-nowrap.uk-text-right.uk-table-shrink Time Worked + tbody - - totalHoursWorked += day.hoursWorked; - totalSessionCount += day.workSessionCount; + var totalHoursWorked = 0; + var totalSessionCount = 0; + + each day in dailyTimeWorked + - + totalHoursWorked += day.hoursWorked; + totalSessionCount += day.workSessionCount; + tr + td.uk-table-expand= dayjs(day.date).format('dddd') + td.uk-text-right.uk-text-nowrap.uk-table-shrink= (day.workSessionCount > 0) ? formatCount(day.workSessionCount) : '---' + td.uk-text-right.uk-text-nowrap.uk-table-shrink= (day.hoursWorked > 0) ? numeral(day.hoursWorked).format('0.00') : '---' + td.uk-text-right.uk-text-nowrap.uk-table-shrink= (day.hoursWorked > 0) ? numeral(day.hoursWorked * 3600).format('0:00:00') : '---' + tfoot tr - td.uk-table-expand= dayjs(day.date).format('dddd') - td.uk-text-right.uk-text-nowrap.uk-table-shrink= (day.workSessionCount > 0) ? formatCount(day.workSessionCount) : '---' - td.uk-text-right.uk-text-nowrap.uk-table-shrink= (day.hoursWorked > 0) ? numeral(day.hoursWorked).format('0.00') : '---' - td.uk-text-right.uk-text-nowrap.uk-table-shrink= (day.hoursWorked > 0) ? numeral(day.hoursWorked * 3600).format('0:00:00') : '---' - tfoot - tr - td.uk-table-expand TOTALS - td.uk-text-right.uk-text-nowrap.uk-table-shrink= formatCount(totalSessionCount) - td.uk-text-right.uk-text-nowrap.uk-table-shrink= numeral(totalHoursWorked).format('0.00') - td.uk-text-right.uk-text-nowrap.uk-table-shrink= numeral(totalHoursWorked * 3600).format('0:00:00') \ No newline at end of file + td.uk-table-expand TOTALS + td.uk-text-right.uk-text-nowrap.uk-table-shrink= formatCount(totalSessionCount) + td.uk-text-right.uk-text-nowrap.uk-table-shrink= numeral(totalHoursWorked).format('0.00') + td.uk-text-right.uk-text-nowrap.uk-table-shrink= numeral(totalHoursWorked * 3600).format('0:00:00') \ No newline at end of file diff --git a/client/js/time-tracker-client.js b/client/js/time-tracker-client.js index 42af697..fb552c5 100644 --- a/client/js/time-tracker-client.js +++ b/client/js/time-tracker-client.js @@ -47,6 +47,7 @@ export class TimeTrackerApp extends DtpApp { /* * Page Visibility API hooks */ + window.addEventListener('pageshow', this.onWindowPageShow.bind(this)); window.addEventListener('pagehide', this.onWindowPageHide.bind(this)); window.addEventListener('freeze', this.onWindowFreeze.bind(this)); window.addEventListener('resume', this.onWindowResume.bind(this)); @@ -74,9 +75,15 @@ export class TimeTrackerApp extends DtpApp { this.haveFocus = false; } + async onWindowPageShow (event) { + this.log.debug('onWindowPageShow', 'the page is being shown', { event }); + } + async onWindowPageHide (event) { this.log.debug('onWindowPageHide', 'the page is being hidden', { event }); - await this.socket.disconnect(); + if (!event.persisted) { + await this.socket.disconnect(); + } } async onWindowFreeze (event) {