mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-15 13:32:43 +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 { formatCents } from '@/utils/money';
|
||||
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
|
||||
import { getCurrentMembershipId, getCurrentRole } from '@/utils/useUser';
|
||||
|
||||
const startDate = ref<string | null>(
|
||||
getDayJsInstance()().subtract(14, 'd').format('YYYY-MM-DD')
|
||||
@@ -87,6 +88,9 @@ function updateGraphReporting() {
|
||||
'd'
|
||||
);
|
||||
const params = getFilterAttributes();
|
||||
if (getCurrentRole() === 'employee') {
|
||||
params.member_id = getCurrentMembershipId();
|
||||
}
|
||||
params.fill_gaps_in_time_groups = 'true';
|
||||
params.group = getOptimalGroupingOption(diffInDays);
|
||||
useReportingStore().fetchGraphReporting(params);
|
||||
@@ -94,6 +98,9 @@ function updateGraphReporting() {
|
||||
|
||||
function updateTableReporting() {
|
||||
const params = getFilterAttributes();
|
||||
if (getCurrentRole() === 'employee') {
|
||||
params.member_id = getCurrentMembershipId();
|
||||
}
|
||||
params.group = group.value;
|
||||
params.sub_group = subGroup.value;
|
||||
useReportingStore().fetchTableReporting(params);
|
||||
@@ -185,6 +192,7 @@ onMounted(() => {
|
||||
</TagDropdown>
|
||||
|
||||
<SelectDropdown
|
||||
@changed="updateReporting"
|
||||
v-model="billable"
|
||||
:get-key-from-item="(item) => item.value"
|
||||
:get-name-for-item="(item) => item.label"
|
||||
|
||||
@@ -78,7 +78,7 @@ export function formatDate(date: string): 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;
|
||||
}
|
||||
|
||||
function getCurrentRole() {
|
||||
return page.props.auth.user.all_teams.find(
|
||||
(team) => team.id === getCurrentOrganizationId()
|
||||
)?.membership.role;
|
||||
}
|
||||
|
||||
function getUserTimezone() {
|
||||
return page.props.auth.user.timezone;
|
||||
}
|
||||
@@ -34,4 +40,5 @@ export {
|
||||
getUserTimezone,
|
||||
getWeekStart,
|
||||
getCurrentMembershipId,
|
||||
getCurrentRole,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user