Skip to content

Commit

Permalink
fix employee reporting request, fix billable update, fix start of wee…
Browse files Browse the repository at this point in the history
…k in reporting
  • Loading branch information
Onatcer authored and korridor committed May 22, 2024
1 parent c888ac7 commit ce00f5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions resources/js/Pages/Reporting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -87,13 +88,19 @@ 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);
}
function updateTableReporting() {
const params = getFilterAttributes();
if (getCurrentRole() === 'employee') {
params.member_id = getCurrentMembershipId();
}
params.group = group.value;
params.sub_group = subGroup.value;
useReportingStore().fetchTableReporting(params);
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/*
Expand Down
7 changes: 7 additions & 0 deletions resources/js/utils/useUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -34,4 +40,5 @@ export {
getUserTimezone,
getWeekStart,
getCurrentMembershipId,
getCurrentRole,
};

0 comments on commit ce00f5f

Please sign in to comment.