diff --git a/src/modules/timesheet-approval/components/options-dialog-csv-download.vue b/src/modules/timesheet-approval/components/options-dialog-csv-download.vue deleted file mode 100644 index d1e41a9..0000000 --- a/src/modules/timesheet-approval/components/options-dialog-csv-download.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/timesheet-approval/components/overview-list.vue b/src/modules/timesheet-approval/components/overview-list.vue index 46153d8..14671d9 100644 --- a/src/modules/timesheet-approval/components/overview-list.vue +++ b/src/modules/timesheet-approval/components/overview-list.vue @@ -1,42 +1,37 @@ - diff --git a/src/modules/timesheet-approval/components/overview-report.vue b/src/modules/timesheet-approval/components/overview-report.vue index 417f2b4..2813411 100644 --- a/src/modules/timesheet-approval/components/overview-report.vue +++ b/src/modules/timesheet-approval/components/overview-report.vue @@ -1,93 +1,92 @@ - - - - - - - - - {{ $t('timesheet_approvals.print_report.company') }} - - - - - - - - + + + + - - - - {{ $t('timesheet_approvals.print_report.type') }} - - - - - - + + + + + + + + \ No newline at end of file diff --git a/src/modules/timesheet-approval/composables/use-timesheet-approval-api.ts b/src/modules/timesheet-approval/composables/use-timesheet-approval-api.ts index 39bb247..ffb74a9 100644 --- a/src/modules/timesheet-approval/composables/use-timesheet-approval-api.ts +++ b/src/modules/timesheet-approval/composables/use-timesheet-approval-api.ts @@ -26,21 +26,16 @@ export const useTimesheetApprovalApi = () => { timesheet_store.is_loading = false; }; - const getTimesheetApprovalCSVReport = async (report_filter_company: boolean[], report_filter_type: boolean[], year?: number, period_number?: number) => { + const getTimesheetApprovalCSVReport = async (report_filter_company: boolean[], report_filter_type: boolean[]) => { if (timesheet_store.pay_period === undefined) return; const [targo, solucom] = report_filter_company; const [shifts, expenses, holiday, vacation] = report_filter_type; const options = { - types: { shifts, expenses, holiday, vacation }, - companies: { targo, solucom }, + shifts, expenses, holiday, vacation, targo, solucom } as TimesheetApprovalCSVReportFilters; - await timesheet_store.getPayPeriodReportByYearAndPeriodNumber( - year ?? timesheet_store.pay_period.pay_year, - period_number ?? timesheet_store.pay_period.pay_period_no, - options - ); + await timesheet_store.getPayPeriodReport(options); }; return { diff --git a/src/modules/timesheet-approval/models/timesheet-approval-csv-report.models.ts b/src/modules/timesheet-approval/models/timesheet-approval-csv-report.models.ts index 3633813..572e1a6 100644 --- a/src/modules/timesheet-approval/models/timesheet-approval-csv-report.models.ts +++ b/src/modules/timesheet-approval/models/timesheet-approval-csv-report.models.ts @@ -1,25 +1,18 @@ -export interface TimesheetApprovalCSVReportFilters { - types: { - shifts: boolean; - expenses: boolean; - holiday: boolean; - vacation: boolean; - }; - companies: { - targo: boolean; - solucom: boolean; +export class TimesheetApprovalCSVReportFilters { + shifts: boolean; + expenses: boolean; + holiday: boolean; + vacation: boolean; + targo: boolean; + solucom: boolean; + + constructor() { + this.shifts = true; + this.expenses = true; + this.holiday = false; + this.vacation = false; + this.targo = true; + this.solucom = true; }; } -export const default_timesheet_approval_cvs_report_filters: TimesheetApprovalCSVReportFilters = { - types: { - shifts: true, - expenses: true, - holiday: true, - vacation: true, - }, - companies: { - targo: true, - solucom: true, - }, -}; \ No newline at end of file diff --git a/src/pages/timesheet-approval-page.vue b/src/pages/timesheet-approval-page.vue index d9201cb..f0d3834 100644 --- a/src/pages/timesheet-approval-page.vue +++ b/src/pages/timesheet-approval-page.vue @@ -9,6 +9,7 @@ import OverviewList from 'src/modules/timesheet-approval/components/overview-lis import DetailsDialog from 'src/modules/timesheet-approval/components/details-dialog.vue'; import QTableFilters from 'src/modules/shared/components/q-table-filters.vue'; import PayPeriodNavigator from 'src/modules/shared/components/pay-period-navigator.vue'; +import OverviewReport from 'src/modules/timesheet-approval/components/overview-report.vue'; const timesheet_approval_api = useTimesheetApprovalApi(); const timesheet_store = useTimesheetStore(); @@ -74,12 +75,12 @@ onMounted(async () => { color="accent" :label="$q.screen.lt.md ? '' : $t('shared.label.download')" class="col-auto q-mr-sm" + @click="timesheet_store.is_report_dialog_open = true" /> - - + \ No newline at end of file diff --git a/src/stores/timesheet-store.ts b/src/stores/timesheet-store.ts index 22b9f56..e749d4f 100644 --- a/src/stores/timesheet-store.ts +++ b/src/stores/timesheet-store.ts @@ -3,7 +3,7 @@ import { defineStore } from 'pinia'; import { unwrapAndClone } from 'src/utils/unwrap-and-clone'; import { timesheetApprovalService } from 'src/modules/timesheet-approval/services/timesheet-approval-service'; import { timesheetService } from 'src/modules/timesheets/services/timesheet-service'; -import type { TimesheetOverview } from "src/modules/timesheet-approval/models/timesheet-overview.models"; +import type { PayPeriodOverviewResponse, TimesheetOverview } from "src/modules/timesheet-approval/models/timesheet-overview.models"; import type { PayPeriod } from 'src/modules/shared/models/pay-period.models'; import type { Timesheet } from 'src/modules/timesheets/models/timesheet.models'; import type { TimesheetApprovalCSVReportFilters } from 'src/modules/timesheet-approval/models/timesheet-approval-csv-report.models'; @@ -17,7 +17,8 @@ export const useTimesheetStore = defineStore('timesheet', () => { const initial_timesheets = ref([]); const pay_period_overviews = ref([]); - const is_csv_dialog_open = ref(false); + const pay_period_infos = ref(); + const is_report_dialog_open = ref(false); const is_details_dialog_open = ref(false); const selected_employee_name = ref(); @@ -94,9 +95,10 @@ export const useTimesheetStore = defineStore('timesheet', () => { } }; - const getPayPeriodReportByYearAndPeriodNumber = async (year: number, period_number: number, report_filters?: TimesheetApprovalCSVReportFilters) => { + const getPayPeriodReport = async ( report_filters?: TimesheetApprovalCSVReportFilters) => { try { - const response = await timesheetApprovalService.getPayPeriodReportByYearAndPeriodNumber(year, period_number, report_filters); + if(!pay_period.value) return false; + const response = await timesheetApprovalService.getPayPeriodReportByYearAndPeriodNumber(pay_period.value.pay_year, pay_period.value.pay_period_no, report_filters); pay_period_report.value = response; return true; } catch (error) { @@ -107,15 +109,28 @@ export const useTimesheetStore = defineStore('timesheet', () => { return false; }; + const openReportDialog = () => { + is_report_dialog_open.value = true; + is_loading.value = true; + + + is_loading.value = false; + }; + + const closeReportDialog = () => { + is_report_dialog_open.value = false; + }; + return { is_loading, - is_csv_dialog_open, + is_report_dialog_open, is_approval_grid_mode, is_details_dialog_open, search_filter, pay_period, pay_period_overviews, current_pay_period_overview, + pay_period_infos, selected_employee_name, timesheets, all_current_shifts, @@ -123,6 +138,8 @@ export const useTimesheetStore = defineStore('timesheet', () => { getPayPeriodByDateOrYearAndNumber, getTimesheetOverviews, getTimesheetsByOptionalEmployeeEmail, - getPayPeriodReportByYearAndPeriodNumber, + getPayPeriodReport, + openReportDialog, + closeReportDialog, }; }); \ No newline at end of file
- {{ $t('timesheet_approvals.print_report.type') }}