+
{{ $t('timeSheet.dateRangesTo') }}
-
+
{{ pay_period_label.end_date }}
diff --git a/src/modules/timesheet-approval/services/services-timesheet-approval.ts b/src/modules/timesheet-approval/services/services-timesheet-approval.ts
index 814e7f1..48761e7 100644
--- a/src/modules/timesheet-approval/services/services-timesheet-approval.ts
+++ b/src/modules/timesheet-approval/services/services-timesheet-approval.ts
@@ -25,6 +25,7 @@ export const timesheetApprovalService = {
getTimesheetsByPayPeriodAndEmail: async (year: number, period_no: number, email: string): Promise
=> {
const response = await api.get('timesheets', { params: { year, period_no, email, }});
+ console.log('employee details: ', response.data);
return response.data;
},
diff --git a/src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface.ts b/src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface.ts
index bc8955e..01ce1b9 100644
--- a/src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface.ts
+++ b/src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface.ts
@@ -1,6 +1,11 @@
-import type { TimesheetDetailsWeek } from "src/modules/timesheets/types/timesheet-details-interface";
+import { default_timesheet_details_week, type TimesheetDetailsWeek } from "src/modules/timesheets/types/timesheet-details-interface";
export interface PayPeriodEmployeeDetails {
week1: TimesheetDetailsWeek;
week2: TimesheetDetailsWeek;
-};
\ No newline at end of file
+};
+
+export const default_pay_period_employee_details = {
+ week1: default_timesheet_details_week(),
+ week2: default_timesheet_details_week(),
+}
\ No newline at end of file
diff --git a/src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface.ts b/src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface.ts
index b0ebd46..30f2fe3 100644
--- a/src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface.ts
+++ b/src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface.ts
@@ -8,4 +8,16 @@ export interface PayPeriodOverviewEmployee {
expenses: number;
mileage: number;
is_approved: boolean;
-};
\ No newline at end of file
+};
+
+export const default_pay_period_overview_employee: PayPeriodOverviewEmployee = {
+ email: '',
+ employee_name: '',
+ regular_hours: -1,
+ evening_hours: -1,
+ emergency_hours: -1,
+ overtime_hours: -1,
+ expenses: -1,
+ mileage: -1,
+ is_approved: false
+}
\ No newline at end of file
diff --git a/src/modules/timesheets/types/timesheet-details-interface.ts b/src/modules/timesheets/types/timesheet-details-interface.ts
index 13a2817..daf3874 100644
--- a/src/modules/timesheets/types/timesheet-details-interface.ts
+++ b/src/modules/timesheets/types/timesheet-details-interface.ts
@@ -16,6 +16,11 @@ export interface TimesheetDetailsDailySchedule {
break_duration?: number;
}
+export interface Expense {
+ is_approved: boolean;
+ amount: number;
+};
+
type WeekDay = {
sun: T;
mon: T;
@@ -33,7 +38,35 @@ interface TimesheetDetailsDailyExpenses {
[otherType: string]: Expense[]; //for possible future types of expenses
}
-export interface Expense {
- is_approved: boolean;
- amount: number;
-};
\ No newline at end of file
+
+// empty default builder
+const makeWeek = (factory: () => T): WeekDay => ({
+ sun: factory(),
+ mon: factory(),
+ tue: factory(),
+ wed: factory(),
+ thu: factory(),
+ fri: factory(),
+ sat: factory(),
+});
+
+const emptyDailySchedule = (): TimesheetDetailsDailySchedule => ({
+ shifts: [],
+ regular_hours: 0,
+ evening_hours: 0,
+ emergency_hours: 0,
+ overtime_hours: 0,
+ short_date: "",
+ break_duration: 0,
+});
+
+const emptyDailyExpenses = (): TimesheetDetailsDailyExpenses => ({
+ cash: [],
+ km: [],
+});
+
+export const default_timesheet_details_week = (): TimesheetDetailsWeek => ({
+ is_approved: false,
+ shifts: makeWeek(emptyDailySchedule),
+ expenses: makeWeek(emptyDailyExpenses),
+});
diff --git a/src/modules/timesheets/types/timesheet-shift-interface.ts b/src/modules/timesheets/types/timesheet-shift-interface.ts
index 474b532..e75f528 100644
--- a/src/modules/timesheets/types/timesheet-shift-interface.ts
+++ b/src/modules/timesheets/types/timesheet-shift-interface.ts
@@ -1,5 +1,7 @@
export interface Shift {
- is_approved: boolean;
- start: string;
- end: string;
+ date : string;
+ start_time : string;
+ end_time : string;
+ type : string;
+ is_approved : boolean;
}
\ No newline at end of file
diff --git a/src/stores/timesheet-store.ts b/src/stores/timesheet-store.ts
index caeba8c..ad97173 100644
--- a/src/stores/timesheet-store.ts
+++ b/src/stores/timesheet-store.ts
@@ -3,7 +3,7 @@ import { ref } from 'vue';
import { timesheetApprovalService } from 'src/modules/timesheet-approval/services/services-timesheet-approval';
import type { PayPeriod } from 'src/modules/shared/types/pay-period-interface';
import type { PayPeriodOverviewEmployee } from "src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface";
-import type { PayPeriodEmployeeDetails } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface';
+import { default_pay_period_employee_details, type PayPeriodEmployeeDetails } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface';
import type { PayPeriodReportFilters } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-report-interface';
const default_pay_period: PayPeriod = {
@@ -20,7 +20,7 @@ export const useTimesheetStore = defineStore('timesheet', () => {
const current_pay_period = ref(default_pay_period);
const pay_period_overview_employees = ref([]);
const pay_period_overview_employee_approval_statuses = ref<{key: string, value: boolean}[] | undefined>();
- const pay_period_employee_details = ref();
+ const pay_period_employee_details = ref(default_pay_period_employee_details);
const pay_period_report = ref();
const getPayPeriodByDate = async (date_string: string): Promise => {