From 655a7ecff128480f1d40bf9f0c38e48d14bdbc4e Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Fri, 26 Sep 2025 17:03:19 -0400 Subject: [PATCH] BREAKING(approvals): begin process of merging and DRYing timesheet with timesheet approvals, adjust imports, WIP - DO NOT MERGE --- .../components/pay-period-navigator.vue} | 37 +++--- ...vue => detailed-dialog-chart-expenses.vue} | 64 ++++----- ...=> detailed-dialog-chart-hours-worked.vue} | 0 ... => detailed-dialog-chart-shift-types.vue} | 0 .../detailed-dialog.vue} | 45 +++---- .../components/detailed-shift-list-header.vue | 33 ----- .../components/detailed-shift-list-row.vue | 99 -------------- .../components/detailed-shift-list.vue | 82 ------------ .../composables/use-timesheet-approval-api.ts | 14 +- .../detailed-dialog-shift-color.model.ts} | 0 .../timesheet-approval-csv-report.models.ts} | 8 +- .../timesheet-approval-overview.models.ts} | 26 +++- ...proval.vue => timesheet-approval-page.vue} | 8 +- .../types/pay-period-employee-details.ts | 15 --- .../types/pay-period-overview.ts | 11 -- .../types/pay-period-report.ts | 16 --- .../components/shift/shift-crud-dialog.vue | 1 - ...-list-header.vue => shift-list-header.vue} | 0 ...hifts-legend.vue => shift-list-legend.vue} | 0 ...-shift-list-row.vue => shift-list-row.vue} | 0 ...detailed-shift-list.vue => shift-list.vue} | 0 .../expense-validation.interface.ts | 0 .../timesheets/models/expense.models.ts | 78 +++++++++++ src/modules/timesheets/models/shift.models.ts | 83 ++++++++++++ .../timesheets/models/timesheet.models.ts | 125 ++++++++++++++++++ .../timesheets/{types => models}/ui.types.ts | 0 ...etails-overview.vue => timesheet-page.vue} | 16 +-- ...sheet-services.ts => timesheet-service.ts} | 2 +- .../timesheets/types/expense.defaults.ts | 0 .../timesheets/types/expense.interfaces.ts | 47 ------- src/modules/timesheets/types/expense.types.ts | 29 ---- .../timesheets/types/shift.defaults.ts | 11 -- .../timesheets/types/shift.interfaces.ts | 44 ------ src/modules/timesheets/types/shift.types.ts | 30 ----- .../timesheets/types/timesheet.defaults.ts | 39 ------ .../timesheets/types/timesheet.interfaces.ts | 54 -------- .../timesheets/types/timesheet.types.ts | 29 ---- src/stores/timesheet-store.ts | 67 ++++------ 38 files changed, 424 insertions(+), 689 deletions(-) rename src/modules/{timesheets/components/timesheet/timesheet-navigation.vue => shared/components/pay-period-navigator.vue} (74%) rename src/modules/timesheet-approval/components/{detailed-chart-expenses.vue => detailed-dialog-chart-expenses.vue} (51%) rename src/modules/timesheet-approval/components/{detailed-chart-hours-worked.vue => detailed-dialog-chart-hours-worked.vue} (100%) rename src/modules/timesheet-approval/components/{detailed-chart-shift-types.vue => detailed-dialog-chart-shift-types.vue} (100%) rename src/modules/timesheet-approval/{pages/timesheet-approval-detailed.vue => components/detailed-dialog.vue} (71%) delete mode 100644 src/modules/timesheet-approval/components/detailed-shift-list-header.vue delete mode 100644 src/modules/timesheet-approval/components/detailed-shift-list-row.vue delete mode 100644 src/modules/timesheet-approval/components/detailed-shift-list.vue rename src/modules/timesheet-approval/{types/detailed-shift-color.ts => models/detailed-dialog-shift-color.model.ts} (100%) rename src/modules/timesheet-approval/{types/pay-period-report-options.ts => models/timesheet-approval-csv-report.models.ts} (69%) rename src/modules/timesheet-approval/{types/pay-period-employee-overview.ts => models/timesheet-approval-overview.models.ts} (71%) rename src/modules/timesheet-approval/pages/{timesheet-approval.vue => timesheet-approval-page.vue} (84%) delete mode 100644 src/modules/timesheet-approval/types/pay-period-employee-details.ts delete mode 100644 src/modules/timesheet-approval/types/pay-period-overview.ts delete mode 100644 src/modules/timesheet-approval/types/pay-period-report.ts rename src/modules/timesheets/components/shift/{detailed-shift-list-header.vue => shift-list-header.vue} (100%) rename src/modules/timesheets/components/shift/{shifts-legend.vue => shift-list-legend.vue} (100%) rename src/modules/timesheets/components/shift/{detailed-shift-list-row.vue => shift-list-row.vue} (100%) rename src/modules/timesheets/components/shift/{detailed-shift-list.vue => shift-list.vue} (100%) rename src/modules/timesheets/{types => models}/expense-validation.interface.ts (100%) create mode 100644 src/modules/timesheets/models/expense.models.ts create mode 100644 src/modules/timesheets/models/shift.models.ts create mode 100644 src/modules/timesheets/models/timesheet.models.ts rename src/modules/timesheets/{types => models}/ui.types.ts (100%) rename src/modules/timesheets/pages/{timesheet-details-overview.vue => timesheet-page.vue} (92%) rename src/modules/timesheets/services/{timesheet-services.ts => timesheet-service.ts} (98%) delete mode 100644 src/modules/timesheets/types/expense.defaults.ts delete mode 100644 src/modules/timesheets/types/expense.interfaces.ts delete mode 100644 src/modules/timesheets/types/expense.types.ts delete mode 100644 src/modules/timesheets/types/shift.defaults.ts delete mode 100644 src/modules/timesheets/types/shift.interfaces.ts delete mode 100644 src/modules/timesheets/types/shift.types.ts delete mode 100644 src/modules/timesheets/types/timesheet.defaults.ts delete mode 100644 src/modules/timesheets/types/timesheet.interfaces.ts delete mode 100644 src/modules/timesheets/types/timesheet.types.ts diff --git a/src/modules/timesheets/components/timesheet/timesheet-navigation.vue b/src/modules/shared/components/pay-period-navigator.vue similarity index 74% rename from src/modules/timesheets/components/timesheet/timesheet-navigation.vue rename to src/modules/shared/components/pay-period-navigator.vue index ada6b56..d440b8b 100644 --- a/src/modules/timesheets/components/timesheet/timesheet-navigation.vue +++ b/src/modules/shared/components/pay-period-navigator.vue @@ -1,27 +1,28 @@ @@ -33,39 +34,43 @@ icon="keyboard_arrow_left" color="primary" @click="emit('pressed-previous-button')" - :disable="props.isPreviousLimit || props.isDisabled" + :disable="is_previous_pay_period_limit || timesheet_store.is_loading" class="q-mr-sm q-px-sm" > {{ $t( 'timesheet.nav_button.previous_week' )}} + > + {{ $t( 'timesheet.nav_button.previous_week' )}} + {{ $t('timesheet.nav_button.calendar_date_picker') }} + > + {{ $t('timesheet.nav_button.calendar_date_picker') }} + (); - const expenses_dataset = ref[]>([]); - const expenses_labels = ref([]); + // const expenses_dataset = ref[]>([]); + // const expenses_labels = ref([]); - const getExpensesData = (): ChartData<'bar'> => { - if (props.rawData) { - const all_weeks = [props.rawData.week1, props.rawData.week2]; - const all_days = all_weeks.flatMap( week => Object.values(week.expenses)); - const all_days_dates = all_weeks.flatMap( week => Object.values(week.shifts)) + // const getExpensesData = (): ChartData<'bar'> => { + // if (timesheetDetails) { + // const all_weeks = [timesheetDetails.week1, timesheetDetails.week2]; + // const all_days = all_weeks.flatMap( week => Object.values(week.expenses)); + // const all_days_dates = all_weeks.flatMap( week => Object.values(week.shifts)) - const all_costs = all_days.map( day => getTotalAmounts(day.cash)); - const all_mileage = all_days.map( day => getTotalAmounts(day.km)); + // const all_costs = all_days.map( day => getTotalAmounts(day.cash)); + // const all_mileage = all_days.map( day => getTotalAmounts(day.km)); - expenses_dataset.value = [ - { - label: t('timesheet_approvals.table.expenses'), - data: all_costs, - backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-primary').trim(), - }, - { - label: t('timesheet_approvals.table.mileage'), - data: all_mileage, - backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-info').trim(), - } - ] + // expenses_dataset.value = [ + // { + // label: t('timesheet_approvals.table.expenses'), + // data: all_costs, + // backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-primary').trim(), + // }, + // { + // label: t('timesheet_approvals.table.mileage'), + // data: all_mileage, + // backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-info').trim(), + // } + // ] - expenses_labels.value = all_days_dates.map( day => day.short_date); - } + // expenses_labels.value = all_days_dates.map( day => day.short_date); + // } - return { - datasets: expenses_dataset.value, - labels: expenses_labels.value - }; - }; + // return { + // datasets: expenses_dataset.value, + // labels: expenses_labels.value + // }; + // }; const getTotalAmounts = (expenses: Expense[]): number => { let total_amount = 0; diff --git a/src/modules/timesheet-approval/components/detailed-chart-hours-worked.vue b/src/modules/timesheet-approval/components/detailed-dialog-chart-hours-worked.vue similarity index 100% rename from src/modules/timesheet-approval/components/detailed-chart-hours-worked.vue rename to src/modules/timesheet-approval/components/detailed-dialog-chart-hours-worked.vue diff --git a/src/modules/timesheet-approval/components/detailed-chart-shift-types.vue b/src/modules/timesheet-approval/components/detailed-dialog-chart-shift-types.vue similarity index 100% rename from src/modules/timesheet-approval/components/detailed-chart-shift-types.vue rename to src/modules/timesheet-approval/components/detailed-dialog-chart-shift-types.vue diff --git a/src/modules/timesheet-approval/pages/timesheet-approval-detailed.vue b/src/modules/timesheet-approval/components/detailed-dialog.vue similarity index 71% rename from src/modules/timesheet-approval/pages/timesheet-approval-detailed.vue rename to src/modules/timesheet-approval/components/detailed-dialog.vue index b7f1f1b..5b547ea 100644 --- a/src/modules/timesheet-approval/pages/timesheet-approval-detailed.vue +++ b/src/modules/timesheet-approval/components/detailed-dialog.vue @@ -1,25 +1,23 @@