diff --git a/spaces/components/HistoryDisplay.vue b/spaces/components/HistoryDisplay.vue
index 045e067..76388bb 100644
--- a/spaces/components/HistoryDisplay.vue
+++ b/spaces/components/HistoryDisplay.vue
@@ -123,7 +123,8 @@ const renderText = (text) => {
{
}
+/*const phasesTemplate = ref([{
+ label: 'Erstkontakt',
+ icon: 'i-heroicons-clipboard-document',
+ active: true
+}, {
+ label: 'Überprüfung Vor Ort',
+ icon: 'i-heroicons-magnifying-glass'
+}, {
+ label: 'Angebotserstellung',
+ icon: 'i-heroicons-document-text'
+}, {
+ label: 'Auftragsvergabe',
+ icon: 'i-heroicons-document-check'
+}, {
+ label: 'Umsetzung',
+ icon: 'i-heroicons-wrench-screwdriver'
+},{
+ label: 'Rechnungsstellung',
+ icon: 'i-heroicons-document-text'
+}, {
+ label: 'Abgeschlossen',
+ icon: 'i-heroicons-check'
+}])*/
+const phasesTemplateSelected = ref(dataStore.phasesTemplates[0].id)
+const changeActivePhase = (phase) => {
+ currentItem.value.phases = currentItem.value.phases.map(p => {
+ if(p.active) delete p.active
+
+ if(p.label === phase.label) p.active = true
+
+ return p
+ })
+
+ savePhases()
+
+}
+
+const savePhases = () => {
+ dataStore.updateItem("projects", currentItem.value)
+}
+
+const loadPhases = async () => {
+ currentItem.value.phases = dataStore.phasesTemplates.find(i => i.id === phasesTemplateSelected.value).initialPhases
+ await dataStore.updateItem("projects", currentItem.value)
+}
+
setupPage()
@@ -183,29 +230,69 @@ setupPage()
-
+
+
+
+
+ Phase aktivieren
+
+
+
+
+
+
+
-
+
+ Projekt
+
+
@@ -16,6 +21,9 @@
:columns="itemColumns"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
>
+
+ {{getActivePhaseLabel(row)}}
+
{{dataStore.getCustomerById(row.customer) ? dataStore.getCustomerById(row.customer).name : ""}}
@@ -35,6 +43,10 @@ const supabase = useSupabaseClient()
const router = useRouter()
const itemColumns = [
+ {
+ key: "phase",
+ label: "Phase"
+ },
{
key: "measure",
label: "Gewerk"
@@ -43,13 +55,13 @@ const itemColumns = [
label: "Name"
},
{
- key: "notes",
- label: "Notizen",
+ key: "customer",
+ label: "Kunde",
sortable: true
},
{
- key: "customer",
- label: "Kunde",
+ key: "notes",
+ label: "Notizen",
sortable: true
},
{
@@ -64,15 +76,49 @@ const selectItem = (item) => {
router.push(`/projects/show/${item.id} `)
}
+const getActivePhaseLabel = (item) => {
+ if(item.phases) {
+ if(item.phases.length > 0) {
+
+ let activePhase = item.phases.find(i => i.active)
+
+ if(activePhase) {
+ return activePhase.label
+ } else {
+ return ""
+ }
+ }
+ }
+}
+
+
const searchString = ref('')
+const showFinished = ref(false)
const filteredRows = computed(() => {
- if(!searchString.value) {
- return dataStore.projects
+ let items = dataStore.projects
+
+ items = items.map(item => {
+ return {
+ ...item,
+ phaseLabel: getActivePhaseLabel(item)
+ }
+ })
+
+ if(showFinished.value) {
+ items = items.filter(i => i.phaseLabel === "Abgeschlossen")
+ } else {
+ items = items.filter(i => i.phaseLabel !== "Abgeschlossen")
}
- return dataStore.projects.filter(product => {
- return Object.values(product).some((value) => {
+ if(!searchString.value) {
+ return items
+ }
+
+
+
+ return items.filter(project => {
+ return Object.values(project).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
})
})
diff --git a/spaces/pages/tasks/[mode]/[[id]].vue b/spaces/pages/tasks/[mode]/[[id]].vue
index 2b717b9..e92fe01 100644
--- a/spaces/pages/tasks/[mode]/[[id]].vue
+++ b/spaces/pages/tasks/[mode]/[[id]].vue
@@ -85,10 +85,20 @@ setupPage()
{{currentItem.name}}
+
+
+ Zum Projekt
+
+
+
Beschreibung:
{{currentItem.description}}
-
+ Projekt: {{currentItem.project ? dataStore.getProjectById(currentItem.project).name : "Kein Projekt zugeordnet"}}
diff --git a/spaces/stores/data.js b/spaces/stores/data.js
index 173e1f1..ec80a6f 100644
--- a/spaces/stores/data.js
+++ b/spaces/stores/data.js
@@ -156,6 +156,7 @@ export const useDataStore = defineStore('data', () => {
const messages = ref([])
const createddocuments = ref([])
const workingtimes = ref([])
+ const phasesTemplates = ref([])
const rights = ref({
@@ -271,6 +272,7 @@ export const useDataStore = defineStore('data', () => {
await fetchMessages()
await fetchCreatedDocuments()
await fetchWorkingTimes()
+ await fetchPhasesTemplates()
loaded.value = true
}
@@ -310,6 +312,7 @@ export const useDataStore = defineStore('data', () => {
messages.value = []
createddocuments.value = []
workingtimes.value = []
+ phasesTemplates.value = []
}
function hasRight (right) {
@@ -333,7 +336,7 @@ export const useDataStore = defineStore('data', () => {
schema: 'public',
},
(payload) => {
- console.log(payload)
+ //console.log(payload)
if(payload.eventType === 'INSERT') {
const c = payload.table + '.value.push(' + JSON.stringify(payload.new) + ')'
@@ -347,7 +350,7 @@ export const useDataStore = defineStore('data', () => {
.subscribe()
async function createNewItem (dataType,data){
- console.log(dataType)
+ //console.log(dataType)
if(dataTypes[dataType].numberRangeHolder) {
const numberRange = useNumberRange(dataType)
@@ -368,7 +371,7 @@ export const useDataStore = defineStore('data', () => {
if(supabaseError) {
console.log(supabaseError)
} else if (supabaseData) {
- await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')')
+ //await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')')
toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`})
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${supabaseData[0].id}`)
return supabaseData
@@ -556,6 +559,10 @@ export const useDataStore = defineStore('data', () => {
workingtimes.value = (await supabase.from("workingtimes").select().eq('tenant', currentTenant.value).order('created_at', {ascending:true})).data
}
+ async function fetchPhasesTemplates() {
+ phasesTemplates.value = (await supabase.from("phasesTemplates").select().eq('tenant', currentTenant.value).order('created_at', {ascending:true})).data
+ }
+
async function fetchDocuments () {
let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
@@ -959,6 +966,7 @@ export const useDataStore = defineStore('data', () => {
messages,
createddocuments,
workingtimes,
+ phasesTemplates,
documentTypesForCreation,
//Functions
createNewItem,