Added Phases to Projects

This commit is contained in:
2024-02-05 20:48:15 +01:00
parent 22a3b8698c
commit 2fc45b3ea0
5 changed files with 190 additions and 38 deletions

View File

@@ -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,