-
-
+
diff --git a/src/modules/timesheet-approval/components/overview-list-item.vue b/src/modules/timesheet-approval/components/overview-list-item.vue
index 55599e5..30b257b 100644
--- a/src/modules/timesheet-approval/components/overview-list-item.vue
+++ b/src/modules/timesheet-approval/components/overview-list-item.vue
@@ -2,17 +2,17 @@
setup
lang="ts"
>
- import type { TimesheetOverview } from 'src/modules/timesheet-approval/models/timesheet-overview.models';
+ import type { TimesheetApprovalOverview } from 'src/modules/timesheet-approval/models/timesheet-overview.models';
const modelApproval = defineModel
();
const { row, index = 0 } = defineProps<{
- row: TimesheetOverview;
+ row: TimesheetApprovalOverview;
index?: number;
}>();
const emit = defineEmits<{
- 'clickDetails': [overview: TimesheetOverview];
+ 'clickDetails': [overview: TimesheetApprovalOverview];
'clickApprovalAll' : [is_approved: boolean];
}>();
@@ -37,7 +37,7 @@
>
- {{ row.employee_name.split(' ')[0] }}
+ {{ row.employee_first_name }}
- {{ row.employee_name.split(' ')[1] }}
+ {{ row.employee_last_name }}
diff --git a/src/modules/timesheet-approval/components/overview-list.vue b/src/modules/timesheet-approval/components/overview-list.vue
index 08dcedf..ae2f31f 100644
--- a/src/modules/timesheet-approval/components/overview-list.vue
+++ b/src/modules/timesheet-approval/components/overview-list.vue
@@ -10,11 +10,13 @@
import OverviewListFilters from 'src/modules/timesheet-approval/components/overview-list-filters.vue';
import { computed, ref } from 'vue';
+ import { useAuthStore } from 'src/stores/auth-store';
import { useTimesheetStore } from 'src/stores/timesheet-store';
import { useTimesheetApprovalApi } from 'src/modules/timesheet-approval/composables/use-timesheet-approval-api';
- import { overview_column_names, pay_period_overview_columns, PayPeriodOverviewFilters, type TimesheetOverview } from 'src/modules/timesheet-approval/models/timesheet-overview.models';
+ import { overview_column_names, pay_period_overview_columns, PayPeriodOverviewFilters, type TimesheetApprovalOverview } from 'src/modules/timesheet-approval/models/timesheet-overview.models';
+ const auth_store = useAuthStore();
const timesheet_store = useTimesheetStore();
const timesheet_approval_api = useTimesheetApprovalApi();
@@ -39,7 +41,7 @@
name_search_string: search_string.value,
});
- const onClickedDetails = async (row: TimesheetOverview) => {
+ const onClickedDetails = async (row: TimesheetApprovalOverview) => {
timesheet_store.current_pay_period_overview = row;
await timesheet_store.getTimesheetsByOptionalEmployeeEmail(row.email);
@@ -50,16 +52,23 @@
await timesheet_approval_api.toggleTimesheetsApprovalByEmployeeEmail(email, is_approved);
}
- const filterEmployeeRows = (rows: readonly TimesheetOverview[], terms: PayPeriodOverviewFilters): TimesheetOverview[] => {
+ const filterEmployeeRows = (rows: readonly TimesheetApprovalOverview[], terms: PayPeriodOverviewFilters): TimesheetApprovalOverview[] => {
let result = [...rows];
if (!terms.is_showing_inactive) {
result = result.filter(row => row.is_active);
}
- // if (terms.name_search_string) {
- // result = result.filter(row => row.employee_name.includes(terms.name_search_string ?? ''));
- // }
+ if (terms.is_showing_team_only) {
+ result = result.filter(row => row.supervisor !== null && row.supervisor.email === (auth_store.user ? auth_store.user.email : '') );
+ }
+
+ if (terms.name_search_string.length > 0) {
+ const search_words = terms.name_search_string.trim().split(' ');
+ search_words.map(word => result = result.filter(row =>
+ row.employee_first_name.includes(word ?? '') || row.employee_last_name.includes(word ?? '')
+ ));
+ }
return result;
};
@@ -110,9 +119,9 @@
:class="$q.platform.is.mobile ? 'q-mb-sm' : ''"
style="height: 40px;"
/>
-
+