From 072e0931a15dd3f5852eb1efaac09f41b3aff047 Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Mon, 8 Sep 2025 16:11:48 -0400 Subject: [PATCH] feat(details): Adjust shift display UI, DRY code in details components, prep for modifying UI --- src/css/quasar.variables.scss | 2 +- ...al-employee-details-hours-worked-chart.vue | 71 ++++++--- ...val-employee-details-shift-types-chart.vue | 30 ++-- ...sheet-approval-employee-expenses-chart.vue | 36 ++++- ...val-employee-details-shifts-row-header.vue | 46 ++---- ...t-approval-employee-details-shifts-row.vue | 132 ++++++++--------- ...sheet-approval-employee-details-shifts.vue | 33 +++-- .../timesheet-approval-employee-details.vue | 140 +++++++++--------- .../types/timesheet-shift-interface.ts | 4 +- 9 files changed, 262 insertions(+), 232 deletions(-) diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index 1725989..4279286 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -26,5 +26,5 @@ $dark-page: #323232; $positive: #21ba45; $negative: #e6364b; $info: #6bb9e7; -$warning: #eec964; +$warning: #e4a944; $white: white; diff --git a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue index 424e65c..728e623 100644 --- a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue +++ b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue @@ -1,5 +1,6 @@ \ No newline at end of file diff --git a/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts.vue b/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts.vue index 24432cc..14c2d6c 100644 --- a/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts.vue +++ b/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts.vue @@ -2,12 +2,17 @@ import TimesheetApprovalEmployeeDetailsShiftsRow from 'src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts-row.vue'; import TimesheetApprovalEmployeeDetailsShiftsRowHeader from 'src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts-row-header.vue'; import type { PayPeriod } from 'src/modules/shared/types/pay-period-interface'; + import { default_shift, type Shift } from 'src/modules/timesheets/types/timesheet-shift-interface'; import type { PayPeriodEmployeeDetails } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface'; const props = defineProps<{ rawData: PayPeriodEmployeeDetails; currentPayPeriod: PayPeriod; }>(); + + const shifts_or_placeholder = (shifts: Shift[]): Shift[] => { + return shifts.length > 0 ? shifts : [default_shift]; + }; const getDate = (shift_date: string): Date => { return new Date(props.currentPayPeriod.pay_year.toString() + '/' + shift_date); @@ -27,29 +32,39 @@ bordered class="row items-center rounded-10 q-mb-xs" > -
{{ $d(getDate(day.short_date), {weekday: 'long'}) }} + >{{ $d(getDate(day.short_date), {weekday: $q.screen.lt.md ? 'short' : 'long'}) }} {{ day.short_date.split('/')[1] }} {{ $d(getDate(day.short_date), {month: 'long'}) }} + >{{ $d(getDate(day.short_date), {month: $q.screen.lt.md ? 'short' : 'long'}) }}
- + + + + diff --git a/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue b/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue index 60e6ff2..048b5a7 100644 --- a/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue +++ b/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue @@ -9,6 +9,7 @@ import type { PayPeriodOverviewEmployee } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface'; import type { PayPeriodEmployeeDetails } from '../types/timesheet-approval-pay-period-employee-details-interface'; import { PayPeriod } from 'src/modules/shared/types/pay-period-interface'; +import { colors } from 'quasar'; const props = defineProps<{ isLoading: boolean; @@ -21,6 +22,53 @@ import { PayPeriod } from 'src/modules/shared/types/pay-period-interface'; const { t } = useI18n(); const is_showing_graph = ref(true); + + // case 'REGULAR': return 'green-5'; + // case 'EVENING': return 'green-9'; + // case 'EMERGENCY': return 'warning'; + // case 'OVERTIME': return 'negative'; + // case 'VACATION': return 'purple-10'; + // case 'HOLIDAY': return 'purple-10'; + // case 'SICK': return 'grey-9'; + // default : return 'transparent'; + + type shiftColor = { + type: string; + color: string; + text_color?: string; + } + + const shift_type_legend: shiftColor[] = [ + { + type: t('timeSheet.shiftRegular'), + color: 'secondary', + text_color: 'grey-8', + }, + { + type: t('timeSheet.shiftEvening'), + color: 'warning', + }, + { + type: t('timeSheet.shiftEmergency'), + color: 'amber-10', + }, + { + type: t('timeSheetValidations.hoursWorkedOvertime'), + color: 'negative', + }, + { + type: t('timeSheet.shiftVacation'), + color: 'purple-10', + }, + { + type: t('timeSheet.shiftHoliday'), + color: 'purple-8', + }, + { + type: t('timeSheet.shiftSick'), + color: 'grey-8', + }, + ]