diff --git a/components/MainNav.vue b/components/MainNav.vue
index 75586b3..a2307b8 100644
--- a/components/MainNav.vue
+++ b/components/MainNav.vue
@@ -125,7 +125,7 @@ const links = computed(() => {
icon: "i-heroicons-user-group",
children: [
... profileStore.ownTenant.features.timeTracking ? [{
- label: "Zeiterfassung",
+ label: "Projektzeiten",
to: "/times",
icon: "i-heroicons-clock"
}] : [],
diff --git a/components/displayRunningTime.vue b/components/displayRunningTime.vue
index 643f675..e8a431a 100644
--- a/components/displayRunningTime.vue
+++ b/components/displayRunningTime.vue
@@ -43,9 +43,9 @@ const startTime = async () => {
.select()
if(error) {
console.log(error)
- toast.add({title: "Fehler beim starten der Zeit",color:"rose"})
+ toast.add({title: "Fehler beim starten der Projektzeit",color:"rose"})
} else if(data) {
- toast.add({title: "Zeit erfolgreich gestartet"})
+ toast.add({title: "Projektzeit erfolgreich gestartet"})
runningTimeInfo.value = data[0]
//console.log(runningTimeInfo.value)
}
@@ -63,11 +63,11 @@ const stopStartedTime = async () => {
if(error) {
console.log(error)
let errorId = await useError().logError(`${status} - ${JSON.stringify(error)}`)
- toast.add({title: errorId ? `Fehler beim stoppen der Zeit (Fehler ID: ${errorId})` : `Fehler beim stoppen der Zeit`,color:"rose"})
+ toast.add({title: errorId ? `Fehler beim stoppen der Projektzeit (Fehler ID: ${errorId})` : `Fehler beim stoppen der Projektzeit`,color:"rose"})
} else {
- toast.add({title: "Zeit erfolgreich gestoppt"})
+ toast.add({title: "Projektzeit erfolgreich gestoppt"})
runningTimeInfo.value = {}
}
}
@@ -111,7 +111,7 @@ const stopStartedTime = async () => {
-
Keine Zeit gestartet
+
Keine Projektzeit gestartet
diff --git a/pages/times/index.vue b/pages/times/index.vue
index 5fa4b85..02f9717 100644
--- a/pages/times/index.vue
+++ b/pages/times/index.vue
@@ -35,8 +35,11 @@ const configTimeMode = ref("create")
const platform = ref("default")
+const projects = ref([])
+
const setup = async () => {
times.value = await useSupabaseSelect("times","*, profile(*), project(id, name)")
+ projects.value = await useSupabaseSelect("projects","*")
if(await useCapacitor().getIsPhone()) {
platform.value = "mobile"
@@ -179,10 +182,27 @@ const createTime = async () => {
}
}
+const openTime = (row) => {
+ itemInfo.value = row
+
+ itemInfo.value.project = itemInfo.value.project.id
+ itemInfo.value.profile = itemInfo.value.profile.id
+
+ showConfigTimeModal.value = true
+ configTimeMode.value = "edit"
+
+
+}
+
const updateTime = async () => {
+ let data = itemInfo.value
+
+ data.profile = data.profile.id
+ data.project = data.project.id
+
const {error} = await supabase
.from("times")
- .update(itemInfo.value)
+ .update(data)
.eq('id',itemInfo.value.id)
if(error) {
@@ -191,7 +211,7 @@ const updateTime = async () => {
toast.add({title: "Zeit erfolgreich gespeichert"})
showConfigTimeModal.value = false
- await dataStore.fetchTimes()
+ setup()
}
const format = (date) => {
@@ -230,7 +250,7 @@ const getSecondInfo = (item) => {
-
+
@@ -317,7 +337,7 @@ const getSecondInfo = (item) => {
>
- Zeiteintrag {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}}
+ Projektzeit {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}}
{
@@ -340,7 +360,7 @@ const getSecondInfo = (item) => {
@@ -354,13 +374,12 @@ const getSecondInfo = (item) => {
>
- {{profileStore.profiles.find(profile => profile.id === itemInfo.user) ? profileStore.profiles.find(profile => profile.id === itemInfo.user).fullName : "Benutzer auswählen"}}
+ {{profileStore.profiles.find(profile => profile.id === itemInfo.profile) ? profileStore.profiles.find(profile => profile.id === itemInfo.profile).fullName : "Benutzer auswählen"}}
@@ -368,14 +387,13 @@ const getSecondInfo = (item) => {
label="Projekt:"
>
{{dataStore.projects.find(project => project.id === itemInfo.project) ? dataStore.projects.find(project => project.id === itemInfo.project).name : "Projekt auswählen"}}
@@ -390,7 +408,6 @@ const getSecondInfo = (item) => {
:options="timeTypes"
option-attribute="label"
value-attribute="label"
- :disabled="configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf'"
>
{{itemInfo.type ? itemInfo.type : "Kategorie auswählen"}}
@@ -402,12 +419,11 @@ const getSecondInfo = (item) => {
>
-
+
{
Speichern
@@ -456,9 +471,7 @@ const getSecondInfo = (item) => {
:columns="columns"
:rows="filteredRows"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
- @select="(row) => {configTimeMode = 'edit';
- itemInfo = row;
- showConfigTimeModal = true}"
+ @select="(row) => openTime(row)"
>