Skip to content

Commit c598a3e

Browse files
committed
wip
1 parent 5702f9b commit c598a3e

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

resources/js/Components/Common/Reporting/ReportingOverview.vue

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import { formatCents } from '@/packages/ui/src/utils/money';
1717
import ReportingTabNavbar from '@/Components/Common/Reporting/ReportingTabNavbar.vue';
1818
import ReportingExportButton from '@/Components/Common/Reporting/ReportingExportButton.vue';
19+
import ReportingRoundingControls from '@/Components/Common/Reporting/ReportingRoundingControls.vue';
1920
import TaskMultiselectDropdown from '@/Components/Common/Task/TaskMultiselectDropdown.vue';
2021
import ClientMultiselectDropdown from '@/Components/Common/Client/ClientMultiselectDropdown.vue';
2122
import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue';
@@ -33,7 +34,7 @@ import ReportSaveButton from '@/Components/Common/Report/ReportSaveButton.vue';
3334
import TagDropdown from '@/packages/ui/src/Tag/TagDropdown.vue';
3435
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
3536
36-
import { computed, type ComputedRef, inject, onMounted, ref } from 'vue';
37+
import { computed, type ComputedRef, inject, onMounted, ref, watch } from 'vue';
3738
import { type GroupingOption, useReportingStore } from '@/utils/useReporting';
3839
import { storeToRefs } from 'pinia';
3940
import {
@@ -54,6 +55,9 @@ import type { ExportFormat } from '@/types/reporting';
5455
import { getRandomColorWithSeed } from '@/packages/ui/src/utils/color';
5556
import { useProjectsStore } from '@/utils/useProjects';
5657
58+
// TimeEntryRoundingType is now defined in ReportingRoundingControls component
59+
type TimeEntryRoundingType = 'up' | 'down' | 'nearest';
60+
5761
const { handleApiRequestNotifications } = useNotificationsStore();
5862
5963
const startDate = useSessionStorage<string>(
@@ -71,6 +75,9 @@ const selectedTasks = ref<string[]>([]);
7175
const selectedClients = ref<string[]>([]);
7276
7377
const billable = ref<'true' | 'false' | null>(null);
78+
const roundingEnabled = ref<boolean>(false);
79+
const roundingType = ref<TimeEntryRoundingType>('nearest');
80+
const roundingMinutes = ref<number>(15);
7481
7582
const group = useStorage<GroupingOption>('reporting-group', 'project');
7683
const subGroup = useStorage<GroupingOption>('reporting-sub-group', 'task');
@@ -84,6 +91,11 @@ const { groupByOptions } = reportingStore;
8491
8592
const organization = inject<ComputedRef<Organization>>('organization');
8693
94+
// Watch rounding enabled state to trigger updates
95+
watch(roundingEnabled, () => {
96+
updateReporting();
97+
});
98+
8799
function getFilterAttributes(): AggregatedTimeEntriesQueryParams {
88100
let params: AggregatedTimeEntriesQueryParams = {
89101
start: getLocalizedDayJs(startDate.value).startOf('day').utc().format(),
@@ -111,6 +123,8 @@ function getFilterAttributes(): AggregatedTimeEntriesQueryParams {
111123
getCurrentRole() === 'employee'
112124
? getCurrentMembershipId()
113125
: undefined,
126+
rounding_type: roundingEnabled.value ? roundingType.value : undefined,
127+
rounding_minutes: roundingEnabled.value ? roundingMinutes.value : undefined,
114128
};
115129
return params;
116130
}
@@ -305,7 +319,7 @@ const tableData = computed(() => {
305319
<div class="py-2.5 w-full border-b border-default-background-separator">
306320
<MainContainer class="sm:flex space-y-4 sm:space-y-0 justify-between">
307321
<div
308-
class="flex flex-wrap items-center space-y-2 sm:space-y-0 space-x-4">
322+
class="flex flex-wrap items-center space-y-2 sm:space-y-0 space-x-3">
309323
<div class="text-sm font-medium">Filters</div>
310324
<MemberMultiselectDropdown
311325
v-model="selectedMembers"
@@ -395,6 +409,11 @@ const tableData = computed(() => {
395409
:icon="BillableIcon"></ReportingFilterBadge>
396410
</template>
397411
</SelectDropdown>
412+
<ReportingRoundingControls
413+
v-model:enabled="roundingEnabled"
414+
v-model:type="roundingType"
415+
v-model:minutes="roundingMinutes"
416+
@change="updateReporting"></ReportingRoundingControls>
398417
</div>
399418
<div>
400419
<DateRangePicker
@@ -490,7 +509,7 @@ const tableData = computed(() => {
490509
<div
491510
v-else
492511
class="chart flex flex-col items-center justify-center py-12 col-span-3">
493-
<p class="text-lg text-text-primary font-semibold">
512+
<p class="text-lg text-text-primary font-medium">
494513
No time entries found
495514
</p>
496515
<p>Try to change the filters and time range</p>
@@ -505,4 +524,4 @@ const tableData = computed(() => {
505524
</MainContainer>
506525
</template>
507526

508-
<style scoped></style>
527+
<style scoped></style>

0 commit comments

Comments
 (0)