Deprecated Events as non Standard Entity
Repaired query Reparied Document Show
This commit is contained in:
@@ -32,6 +32,7 @@ defineShortcuts({
|
||||
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const supabase = useSupabaseClient()
|
||||
@@ -64,9 +65,23 @@ const setupCreate = () => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
setupCreate()
|
||||
|
||||
const setupQuery = () => {
|
||||
if(route.query) {
|
||||
console.log(route.query)
|
||||
|
||||
Object.keys(route.query).forEach(key => {
|
||||
if(["customer","contract","plant","contact"].includes(key)){
|
||||
props.item[key] = Number(route.query[key])
|
||||
} else {
|
||||
props.item[key] = route.query[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
setupQuery()
|
||||
|
||||
const loadedOptions = ref({})
|
||||
const loadOptions = async () => {
|
||||
let optionsToLoad = dataType.templateColumns.filter(i => i.selectDataType).map(i => {
|
||||
@@ -315,7 +330,7 @@ const contentChanged = (content, datapoint) => {
|
||||
</div>
|
||||
</div>
|
||||
<UFormGroup
|
||||
v-for="datapoint in dataType.templateColumns.filter(i => i.inputType && i.inputColumn === columnName)"
|
||||
v-for="datapoint in dataType.templateColumns.filter(i => i.inputType)"
|
||||
:label="datapoint.label"
|
||||
>
|
||||
<template #help>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import dayjs from "dayjs";
|
||||
import {useSupabaseSelectSomeDocuments} from "~/composables/useSupabase.js";
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
@@ -37,6 +38,17 @@ const profileStore = useProfileStore()
|
||||
|
||||
const dataType = dataStore.dataTypes[type]
|
||||
|
||||
const documents = ref([])
|
||||
|
||||
const setup = async () => {
|
||||
if(props.item.documents) {
|
||||
documents.value = await useSupabaseSelectSomeDocuments(props.item.documents.map(i => i.id)) || []
|
||||
}
|
||||
}
|
||||
|
||||
setup()
|
||||
|
||||
|
||||
const openTab = ref(0)
|
||||
|
||||
const renderedPhases = computed(() => {
|
||||
@@ -162,17 +174,16 @@ const renderedPhases = computed(() => {
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Dokumente'">
|
||||
<UCard class="mt-5">
|
||||
<!-- <Toolbar>
|
||||
<Toolbar>
|
||||
<DocumentUpload
|
||||
type="vehicle"
|
||||
:type="type.substring(0,type.length-1)"
|
||||
:element-id="item.id"
|
||||
/>
|
||||
</Toolbar>
|
||||
|
||||
<DocumentList
|
||||
:documents="dataStore.getDocumentsByVehicleId(item.id)"
|
||||
/>-->
|
||||
{{props.item.documents}}
|
||||
:documents="documents"
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Projekte'">
|
||||
@@ -206,6 +217,12 @@ const renderedPhases = computed(() => {
|
||||
>
|
||||
+ Objekt
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="type === 'customers'"
|
||||
@click="router.push(`/standardEntity/plants/create?${type.substring(0,type.length-1)}=${props.item.id}&name=${encodeURIComponent(`${props.item.infoData.street}, ${props.item.infoData.zip} ${props.item.infoData.city}`)}`)"
|
||||
>
|
||||
+ Kundenadresse als Objekt
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.plants"
|
||||
|
||||
@@ -35,7 +35,7 @@ const links = computed(() => {
|
||||
}] : [],
|
||||
... profileStore.ownTenant.features.calendar ? [{
|
||||
label: "Termine",
|
||||
to: "/events",
|
||||
to: "/standardEntity/events",
|
||||
icon: "i-heroicons-calendar-days"
|
||||
}] : [],
|
||||
{
|
||||
|
||||
@@ -160,6 +160,18 @@ export const useRole = () => {
|
||||
label: "Abwesenheiten erstellen",
|
||||
parent: "absencerequests"
|
||||
},
|
||||
events: {
|
||||
label: "Termine",
|
||||
showToAllUsers: false
|
||||
},
|
||||
"events-viewAll": {
|
||||
label: "Alle Termine einsehen",
|
||||
parent: "events"
|
||||
},
|
||||
"events-create": {
|
||||
label: "Termine erstellen",
|
||||
parent: "events"
|
||||
},
|
||||
spaces: {
|
||||
label: "Lagerplätze",
|
||||
showToAllUsers: false
|
||||
|
||||
@@ -67,6 +67,52 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
|
||||
return data
|
||||
}
|
||||
|
||||
export const useSupabaseSelectSomeDocuments = async (documentIds, select = '*', sortColumn = null, folderPath = "_") => {
|
||||
const supabase = useSupabaseClient()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
let data = null
|
||||
|
||||
if(sortColumn !== null ) {
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.in("id",documentIds)
|
||||
.eq("tenant", profileStore.currentTenant)
|
||||
.order(sortColumn, {ascending: true})).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.in("id",documentIds)
|
||||
.eq("tenant", profileStore.currentTenant)).data
|
||||
|
||||
}
|
||||
|
||||
if(data.length > 0){
|
||||
let paths = []
|
||||
data.forEach(doc => {
|
||||
paths.push(doc.path)
|
||||
})
|
||||
|
||||
const {data: supabaseData,error} = await supabase.storage.from('files').createSignedUrls(paths,3600)
|
||||
|
||||
data = data.map((doc,index) => {
|
||||
|
||||
return {
|
||||
...doc,
|
||||
url: supabaseData[index].signedUrl
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
//console.log(data)
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
export const useSupabaseSelectSingle = async (relation,idToEq,select = '*' ) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
@@ -73,7 +73,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
label: "Kategorie"
|
||||
},{
|
||||
key: "profile",
|
||||
label: "Benutzer",
|
||||
label: "Mitarbeiter",
|
||||
component: profile,
|
||||
inputType: "select",
|
||||
selectDataType: "profiles",
|
||||
@@ -151,7 +151,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
inputType: "bool"
|
||||
},
|
||||
{
|
||||
key: "infoData.streetNumber",
|
||||
key: "infoData.street",
|
||||
label: "Straße + Hausnummer",
|
||||
inputType: "text",
|
||||
disabledInTable: true
|
||||
@@ -1133,8 +1133,63 @@ export const useDataStore = defineStore('data', () => {
|
||||
events: {
|
||||
label: "Termine",
|
||||
labelSingle: "Termin",
|
||||
isStandardEntity: true,
|
||||
historyItemHolder: "event",
|
||||
redirect: true
|
||||
supabaseSelectWithInformation: "*, project(id,name), vehicles(*), inventoryitems(*)",
|
||||
redirect: true,
|
||||
filters:[],
|
||||
templateColumns: [
|
||||
{
|
||||
key: 'name',
|
||||
label: "Name",
|
||||
title: true,
|
||||
inputType: "text"
|
||||
},
|
||||
{
|
||||
key: "startDate",
|
||||
label: "Start",
|
||||
},
|
||||
{
|
||||
key: "endDate",
|
||||
label: "Ende"
|
||||
},/*{
|
||||
key: "eventtype",
|
||||
label: "Typ",
|
||||
inputType: "select",
|
||||
selectManualOptions: ["Umsetzung","Vor Ort Termin", "Büro", "Sonstiges"],
|
||||
},*/{
|
||||
key: "link",
|
||||
label: "Link",
|
||||
inputType: "text"
|
||||
},{
|
||||
key: "notes",
|
||||
label: "Notizen",
|
||||
inputType: "textarea"
|
||||
},
|
||||
{
|
||||
key: "project",
|
||||
label: "Projekt",
|
||||
component: project,
|
||||
inputType: "select",
|
||||
selectDataType: "projects",
|
||||
selectOptionAttribute: "name",
|
||||
selectSearchAttributes: ['name'],
|
||||
},
|
||||
{
|
||||
key: "profiles",
|
||||
label: "Beteiligte Benutzer",
|
||||
inputType: "select",
|
||||
selectDataType: "profiles",
|
||||
selectOptionAttribute: "fullName",
|
||||
selectSearchAttributes: ['fullName'],
|
||||
selectMultiple: true,
|
||||
component: profiles
|
||||
},
|
||||
],
|
||||
showTabs: [
|
||||
{
|
||||
label: 'Informationen',}
|
||||
]
|
||||
},
|
||||
profiles: {
|
||||
label: "Mitarbeiter",
|
||||
@@ -2138,10 +2193,6 @@ export const useDataStore = defineStore('data', () => {
|
||||
return (await supabase.from("contacts").select().eq("customer", itemId)).data
|
||||
}
|
||||
|
||||
async function getProjectsByCustomerId (itemId) {
|
||||
return (await supabase.from("projects").select().eq("customer",itemId)).data
|
||||
}
|
||||
|
||||
const getPlantsByCustomerId = computed(() => (customerId) => {
|
||||
return plants.value.filter(item => item.customer === customerId)
|
||||
})
|
||||
@@ -2637,7 +2688,6 @@ export const useDataStore = defineStore('data', () => {
|
||||
getOpenTasksCount,
|
||||
getMovementsBySpace,
|
||||
getContactsByCustomerId,
|
||||
getProjectsByCustomerId,
|
||||
getPlantsByCustomerId,
|
||||
getContractsByCustomerId,
|
||||
getContactsByVendorId,
|
||||
|
||||
Reference in New Issue
Block a user