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 @@ - \ 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