Some Changes in TimeTracking and boosting Mobile View

This commit is contained in:
2023-12-06 22:26:36 +01:00
parent 2b7bf12bc7
commit 36371f94e8
2 changed files with 62 additions and 29 deletions

View File

@@ -9,14 +9,15 @@ const toast = useToast()
console.log(user) console.log(user)
const {times, projects} = storeToRefs(useDataStore()) const {times, projects} = storeToRefs(useDataStore())
const {fetchTimes} = useDataStore() const {fetchTimes, getTimeTypes} = useDataStore()
const timeTypes = getTimeTypes
const timeInfo = ref({ const timeInfo = ref({
user: "", user: "",
start: "", start: "",
end: null, end: null,
notes: null, notes: null,
projectId: null projectId: null,
type: null
}) })
const runningTimeInfo = ref({ const runningTimeInfo = ref({
@@ -87,6 +88,7 @@ const selectStartedTime = () => {
<UButton <UButton
class="controlButton" class="controlButton"
@click="stopStartedTime" @click="stopStartedTime"
:disabled="!runningTimeInfo.id"
> >
Stop Stop
</UButton> </UButton>
@@ -99,9 +101,16 @@ const selectStartedTime = () => {
<div> <div>
Aktuelle gestarteter Eintrag:
{{runningTimeInfo}}
<div class="mt-3">
Aktuelle gestarteter Eintrag:
{{runningTimeInfo.id ? runningTimeInfo : "Keine Zeit gewählt"}}
</div>
<div v-if="runningTimeInfo.id">
<UFormGroup <UFormGroup
label="Notizen:" label="Notizen:"
> >
@@ -120,17 +129,37 @@ const selectStartedTime = () => {
v-model="runningTimeInfo.projectId" v-model="runningTimeInfo.projectId"
> >
<template #label> <template #label>
<span>{{ projects.find(project => project.id === runningTimeInfo.projectId) ? projects.find(project => project.id === runningTimeInfo.projectId).name : "" }}</span> <span v-if="runningTimeInfo.projectId">{{ projects.find(project => project.id === runningTimeInfo.projectId) ? projects.find(project => project.id === runningTimeInfo.projectId).name : "" }}</span>
<span v-else>Projekt auswählen</span>
</template> </template>
</USelectMenu> </USelectMenu>
</UFormGroup> </UFormGroup>
<UFormGroup
label="Kategorie:"
>
<USelectMenu
v-model="runningTimeInfo.type"
:options="timeTypes"
option-attribute="label"
value-attribute="label"
/>
</UFormGroup>
</div> </div>
<UTable :rows="times"/>
{{timeInfo}}
</div>
<UDivider class="mt-3"/>
<UTable
class="mt-3"
v-if="times && user"
:rows="times.filter(time => time.user === user.id)"
/>
</div> </div>
</template> </template>

View File

@@ -11,6 +11,9 @@ export const useDataStore = defineStore('data', {
ownTenant: { ownTenant: {
calendarConfig: { calendarConfig: {
eventTypes: [] as any[] eventTypes: [] as any[]
},
timeConfig: {
timeTypes: [] as any[]
} }
}, },
profiles: [] as any[], profiles: [] as any[],
@@ -150,6 +153,7 @@ export const useDataStore = defineStore('data', {
}), }),
] ]
}, },
getEventTypes: (state) => state.ownTenant.calendarConfig.eventTypes getEventTypes: (state) => state.ownTenant.calendarConfig.eventTypes,
getTimeTypes: (state) => state.ownTenant.timeConfig.timeTypes
} }
}) })