mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 20:52:14 +01:00
fix employee reporting request, fix billable update, fix start of week in reporting
This commit is contained in:
committed by
Constantin Graf
parent
c888ac7ec2
commit
ce00f5f446
@@ -27,6 +27,7 @@ import ReportingGroupBySelect from '@/Components/Common/Reporting/ReportingGroup
|
|||||||
import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue';
|
import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue';
|
||||||
import { formatCents } from '@/utils/money';
|
import { formatCents } from '@/utils/money';
|
||||||
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
|
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
|
||||||
|
import { getCurrentMembershipId, getCurrentRole } from '@/utils/useUser';
|
||||||
|
|
||||||
const startDate = ref<string | null>(
|
const startDate = ref<string | null>(
|
||||||
getDayJsInstance()().subtract(14, 'd').format('YYYY-MM-DD')
|
getDayJsInstance()().subtract(14, 'd').format('YYYY-MM-DD')
|
||||||
@@ -87,6 +88,9 @@ function updateGraphReporting() {
|
|||||||
'd'
|
'd'
|
||||||
);
|
);
|
||||||
const params = getFilterAttributes();
|
const params = getFilterAttributes();
|
||||||
|
if (getCurrentRole() === 'employee') {
|
||||||
|
params.member_id = getCurrentMembershipId();
|
||||||
|
}
|
||||||
params.fill_gaps_in_time_groups = 'true';
|
params.fill_gaps_in_time_groups = 'true';
|
||||||
params.group = getOptimalGroupingOption(diffInDays);
|
params.group = getOptimalGroupingOption(diffInDays);
|
||||||
useReportingStore().fetchGraphReporting(params);
|
useReportingStore().fetchGraphReporting(params);
|
||||||
@@ -94,6 +98,9 @@ function updateGraphReporting() {
|
|||||||
|
|
||||||
function updateTableReporting() {
|
function updateTableReporting() {
|
||||||
const params = getFilterAttributes();
|
const params = getFilterAttributes();
|
||||||
|
if (getCurrentRole() === 'employee') {
|
||||||
|
params.member_id = getCurrentMembershipId();
|
||||||
|
}
|
||||||
params.group = group.value;
|
params.group = group.value;
|
||||||
params.sub_group = subGroup.value;
|
params.sub_group = subGroup.value;
|
||||||
useReportingStore().fetchTableReporting(params);
|
useReportingStore().fetchTableReporting(params);
|
||||||
@@ -185,6 +192,7 @@ onMounted(() => {
|
|||||||
</TagDropdown>
|
</TagDropdown>
|
||||||
|
|
||||||
<SelectDropdown
|
<SelectDropdown
|
||||||
|
@changed="updateReporting"
|
||||||
v-model="billable"
|
v-model="billable"
|
||||||
:get-key-from-item="(item) => item.value"
|
:get-key-from-item="(item) => item.value"
|
||||||
:get-name-for-item="(item) => item.label"
|
:get-name-for-item="(item) => item.label"
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export function formatDate(date: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatWeek(date: string | null): string {
|
export function formatWeek(date: string | null): string {
|
||||||
return 'Week ' + dayjs(date).week();
|
return 'Week ' + getDayJsInstance()(date).week();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ function getCurrentMembershipId() {
|
|||||||
)?.membership.id;
|
)?.membership.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentRole() {
|
||||||
|
return page.props.auth.user.all_teams.find(
|
||||||
|
(team) => team.id === getCurrentOrganizationId()
|
||||||
|
)?.membership.role;
|
||||||
|
}
|
||||||
|
|
||||||
function getUserTimezone() {
|
function getUserTimezone() {
|
||||||
return page.props.auth.user.timezone;
|
return page.props.auth.user.timezone;
|
||||||
}
|
}
|
||||||
@@ -34,4 +40,5 @@ export {
|
|||||||
getUserTimezone,
|
getUserTimezone,
|
||||||
getWeekStart,
|
getWeekStart,
|
||||||
getCurrentMembershipId,
|
getCurrentMembershipId,
|
||||||
|
getCurrentRole,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user