New Backend changes

This commit is contained in:
2025-09-02 18:47:12 +02:00
parent 6d76acc0bc
commit 27af6a0953
54 changed files with 485 additions and 684 deletions

View File

@@ -3,10 +3,6 @@
import dayjs from "dayjs";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {
//console.log(searchinput)

View File

@@ -1,9 +1,7 @@
<script setup>
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const route = useRoute()
const supabase = useSupabaseClient()

View File

@@ -2,10 +2,6 @@
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {
//console.log(searchinput)

View File

@@ -3,9 +3,7 @@
import dayjs from "dayjs";
import {filter} from "vuedraggable/dist/vuedraggable.common.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {

View File

@@ -7,15 +7,12 @@ import resourceTimelinePlugin from "@fullcalendar/resource-timeline";
import interactionPlugin from "@fullcalendar/interaction";
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
//TODO BACKEND CHANGE COLOR IN TENANT FOR RENDERING
//Config
const route = useRoute()
const router = useRouter()
const mode = ref(route.params.mode || "grid")
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const profileStore = useProfileStore()
@@ -130,13 +127,13 @@ const calendarOptionsTimeline = ref({
const loaded = ref(false)
const setupPage = async () => {
let tempData = (await useSupabaseSelect("events", "*")).filter(i => !i.archived)
let absencerequests = (await useSupabaseSelect("absencerequests", "*, profile(*)")).filter(i => !i.archived)
let projects = (await useSupabaseSelect("projects", "*")).filter(i => !i.archived)
let inventoryitems = (await useSupabaseSelect("inventoryitems", "*")).filter(i => !i.archived)
let inventoryitemgroups = (await useSupabaseSelect("inventoryitemgroups", "*")).filter(i => !i.archived)
let profiles = (await useSupabaseSelect("profiles", "*")).filter(i => !i.archived)
let vehicles = (await useSupabaseSelect("vehicles", "*")).filter(i => !i.archived)
let tempData = (await useEntities("events").select()).filter(i => !i.archived)
let absencerequests = (await useEntities("absencerequests").select("*, profile(*)")).filter(i => !i.archived)
let projects = (await useEntities("projects").select( "*")).filter(i => !i.archived)
let inventoryitems = (await useEntities("inventoryitems").select()).filter(i => !i.archived)
let inventoryitemgroups = (await useEntities("inventoryitemgroups").select()).filter(i => !i.archived)
let profiles = (await useEntities("profiles").select()).filter(i => !i.archived)
let vehicles = (await useEntities("vehicles").select()).filter(i => !i.archived)
calendarOptionsGrid.value.initialEvents = [
...tempData.map(event => {

View File

@@ -1,7 +1,5 @@
<script setup>
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {

View File

@@ -2,9 +2,7 @@
import { format, isToday } from 'date-fns'
import dayjs from "dayjs"
definePageMeta({
middleware: "auth"
})
defineShortcuts({
' ': () => {

View File

@@ -2,9 +2,7 @@
import dayjs from "dayjs";
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {

View File

@@ -8,9 +8,7 @@
<script setup>
import EntityList from "~/components/EntityList.vue";
definePageMeta({
middleware: "auth"
})
const items = ref([])

View File

@@ -13,9 +13,7 @@ const supabase = useSupabaseClient()
const modal = useModal()
definePageMeta({
middleware: "auth"
})
const itemInfo = ref({
@@ -84,23 +82,23 @@ const loaded = ref(false)
const setupPage = async () => {
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
createddocuments.value = (await useSupabaseSelect("createddocuments","*"))
projects.value = (await useSupabaseSelect("projects","*"))
plants.value = (await useSupabaseSelect("plants","*"))
services.value = (await useSupabaseSelect("services","*"))
servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
products.value = (await useSupabaseSelect("products","*"))
productcategories.value = (await useSupabaseSelect("productcategories","*"))
customers.value = (await useSupabaseSelect("customers","*","customerNumber"))
contacts.value = (await useSupabaseSelect("contacts","*"))
texttemplates.value = (await useSupabaseSelect("texttemplates","*"))
letterheads.value = (await useEntities("letterheads").select("*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
createddocuments.value = await useEntities("createddocuments").select("*")
projects.value = await useEntities("projects").select("*")
plants.value = await useEntities("plants").select("*")
services.value = await useEntities("services").select("*")
servicecategories.value = await useEntities("servicecategories").select("*")
products.value = await useEntities("products").select("*")
productcategories.value = await useEntities("productcategories").select("*")
customers.value = await useEntities("customers").select("*","customerNumber")
contacts.value = await useEntities("contacts").select("*")
texttemplates.value = await useEntities("texttemplactes").select("*")
if(productcategories.value.length > 0) selectedProductcategorie.value = productcategories.value[0].id
if(servicecategories.value.length > 0) selectedServicecategorie.value = servicecategories.value[0].id
if(route.params) {
if(route.params.id) {
itemInfo.value = await useSupabaseSelectSingle("createddocuments", route.params.id)
itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id)
checkCompatibilityWithInputPrice()
}
@@ -213,7 +211,7 @@ const setupPage = async () => {
setCustomerData()
for await (const doc of linkedDocuments.filter(i => i.type === "confirmationOrders")) {
let linkedDocument = await useSupabaseSelectSingle("createddocuments",doc.id)
let linkedDocument = await useEntities("createddocuments").selectSingle(doc.id)
itemInfo.value.rows.push({
mode: "title",
@@ -224,7 +222,7 @@ const setupPage = async () => {
}
for await (const doc of linkedDocuments.filter(i => i.type === "quotes")) {
let linkedDocument = await useSupabaseSelectSingle("createddocuments",doc.id)
let linkedDocument = await useEntities("createddocuments").selectSingle(doc.id)
itemInfo.value.rows.push({
mode: "title",
@@ -277,8 +275,7 @@ const setupPage = async () => {
if(route.query.linkedDocument) {
itemInfo.value.linkedDocument = route.query.linkedDocument
let linkedDocument = await useSupabaseSelectSingle("createddocuments",itemInfo.value.linkedDocument)
let linkedDocument = await useEntities("createddocuments").selectSingle(itemInfo.value.linkedDocument)
if(route.query.optionsToImport) {
//Import only true
@@ -361,7 +358,7 @@ const setupPage = async () => {
if(route.query.project) {
itemInfo.value.project = Number(route.query.project)
let project = await useSupabaseSelectSingle("projects",itemInfo.value.project)
let project = await useEntities("projects").selectSingle(itemInfo.value.project)
if(!itemInfo.value.description){
itemInfo.value.description = project.customerRef
@@ -389,21 +386,6 @@ const setupPage = async () => {
}
setupPage()
const openAdvanceInvoices = ref([])
const checkForOpenAdvanceInvoices = async () => {
console.log("Check for Open Advance Invoices")
const {data} = await supabase.from("createddocuments").select().eq("project", itemInfo.value.project).eq("advanceInvoiceResolved", false).eq("type","advanceInvoices")
const {data: usedAdvanceInvoices} = await supabase.from("createddocuments").select().in("id", itemInfo.value.usedAdvanceInvoices)
console.log(data)
openAdvanceInvoices.value = [...data, ...usedAdvanceInvoices.filter(i => !data.find(x => x.id === i.id))]
}
const addAdvanceInvoiceToInvoice = (advanceInvoice) => {
itemInfo.value.usedAdvanceInvoices.push(advanceInvoice)
}
const setDocumentTypeConfig = (withTexts = false) => {
if(itemInfo.value.type === "invoices" ||itemInfo.value.type === "advanceInvoices" || itemInfo.value.type === "serialInvoices"|| itemInfo.value.type === "cancellationInvoices") {
@@ -467,7 +449,7 @@ const setCustomerData = async (customerId, loadOnlyAdress = false) => {
itemInfo.value.customer = customerId
}
customers.value = await useSupabaseSelect("customers")
customers.value = await useEntities("customers").select()
let customer = customers.value.find(i => i.id === itemInfo.value.customer)
@@ -496,7 +478,7 @@ const setCustomerData = async (customerId, loadOnlyAdress = false) => {
}
const setContactPersonData = async () => {
//console.log(itemInfo.value.contactPerson)
//console.log(itemInfo.value.contactPerson) //TODO Set Profile
let profile = await useSupabaseSelectSingle("profiles",itemInfo.value.contactPerson, '*')
itemInfo.value.contactPersonName = profile.fullName
@@ -1187,32 +1169,9 @@ const uri = ref("")
const generateDocument = async () => {
const path = letterheads.value.find(i => i.id === itemInfo.value.letterhead).path
/*const {data,error} = await supabase.functions.invoke('create_pdf',{
body: {
invoiceData: getDocumentData(),
backgroundPath: path,
returnMode: "base64"
}
})*/
uri.value = await useFunctions().useCreatePDF(getDocumentData(), path)
//const {data,error} = await supabase.storage.from("files").download(path)
//console.log(data)
//console.log(error)
//console.log(JSON.stringify(getDocumentData()))
//uri.value = `data:${data.mimeType};base64,${data.base64}`
//uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
//alert(uri.value)
showDocument.value = true
//console.log(uri.value)
}
const onChangeTab = (index) => {
@@ -1454,12 +1413,12 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
console.log("Set Row Data")
if(service && service.id) {
row.service = service.id
services.value = await useSupabaseSelect("services","*")
services.value = await useEntities("services").select("*")
}
if(product && product.id) {
row.product = product.id
product.value = await useSupabaseSelect("products","*")
product.value = await useEntities("products").select("*")
}
if(row.service) {

View File

@@ -165,10 +165,6 @@
<script setup>
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {
//console.log(searchinput)
@@ -208,7 +204,8 @@ const items = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
items.value = (await useSupabaseSelect("createddocuments","*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber")).filter(i => !i.archived)
//items.value = (await useSupabaseSelect("createddocuments","*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber")).filter(i => !i.archived)
items.value = (await useEntities("createddocuments").select("*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber")).filter(i => !i.archived)
}
setupPage()

View File

@@ -126,7 +126,8 @@ const items = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
items.value = await useSupabaseSelect("createddocuments","*, customer(id,name)","documentDate")
//items.value = await useSupabaseSelect("createddocuments","*, customer(id,name)","documentDate")
items.value = await useEntities("createddocuments").select("*, customer(id,name)","documentDate")
}
const searchString = ref("")

View File

@@ -1,9 +1,7 @@
<script setup>
import CopyCreatedDocumentModal from "~/components/copyCreatedDocumentModal.vue";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {

View File

@@ -2,23 +2,14 @@
import {BlobReader, BlobWriter, ZipWriter} from "@zip.js/zip.js";
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
import DocumentDisplayModal from "~/components/DocumentDisplayModal.vue";
import DocumentUploadModal from "~/components/DocumentUploadModal.vue";
import dayjs from "dayjs";
import arraySort from "array-sort";
import {useTempStore} from "~/stores/temp.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
/*'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},*/
'+': () => {
//Hochladen
uploadModalOpen.value = true
@@ -30,9 +21,10 @@ defineShortcuts({
if(entry.type === "file") {
showFile(entry.id)
console.log(entry)
} else {
} else if(createFolderModalOpen.value === false && entry.type === "folder") {
changeFolder(currentFolders.value.find(i => i.id === entry.id))
} else if(createFolderModalOpen.value === true) {
createFolder()
}
}
@@ -55,13 +47,11 @@ defineShortcuts({
const dataStore = useDataStore()
const tempStore = useTempStore()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const router = useRouter()
const route = useRoute()
const modal = useModal()
dataStore.fetchDocuments()
const auth = useAuthStore()
const uploadModalOpen = ref(false)
const createFolderModalOpen = ref(false)
@@ -69,7 +59,7 @@ const uploadInProgress = ref(false)
const fileUploadFormData = ref({
tags: ["Eingang"],
path: "",
tenant: profileStore.currentTenant,
tenant: auth.activeTenant,
folder: null
})
@@ -92,15 +82,16 @@ const isDragTarget = ref(false)
const loaded = ref(false)
const setupPage = async () => {
folders.value = await useSupabaseSelect("folders")
folders.value = await useEntities("folders").select()
documents.value = await files.selectDocuments()
filetags.value = await useSupabaseSelect("filetags")
filetags.value = await useEntities("filetags").select()
if(route.query) {
if(route.query.folder) {
currentFolder.value = await useSupabaseSelectSingle("folders", route.query.folder)
currentFolder.value = await useEntities("folders").selectSingle(route.query.folder)
}
}
@@ -118,7 +109,6 @@ const setupPage = async () => {
}
dropZone.ondrop = async function (event) {
console.log("files dropped")
event.preventDefault()
}
@@ -213,14 +203,10 @@ const changeFolder = async (newFolder) => {
const createFolderData = ref({})
const createFolder = async () => {
const {data,error} = await supabase
.from("folders")
.insert({
tenant: profileStore.currentTenant,
parent: currentFolder.value ? currentFolder.value.id : undefined,
name: createFolderData.value.name,
})
const res = await useEntities("folders").create({
parent: currentFolder.value ? currentFolder.value.id : undefined,
name: createFolderData.value.name,
})
createFolderModalOpen.value = false
@@ -229,61 +215,14 @@ const createFolder = async () => {
}
const downloadSelected = async () => {
const bucket = "filesdev";
let files = []
files = filteredDocuments.value.filter(i => selectedFiles.value[i.id] === true).map(i => i.path)
// If there are no files in the folder, throw an error
if (!files || !files.length) {
throw new Error("No files to download");
}
const promises = [];
await useFiles().downloadFile(undefined,Object.keys(selectedFiles.value))
// Download each file in the folder
files.forEach((file) => {
promises.push(
supabase.storage.from(bucket).download(`${file}`)
);
});
// Wait for all the files to download
const response = await Promise.allSettled(promises);
// Map the response to an array of objects containing the file name and blob
const downloadedFiles = response.map((result, index) => {
if (result.status === "fulfilled") {
return {
name: files[index].split("/")[files[index].split("/").length -1],
blob: result.value.data,
};
}
});
// Create a new zip file
const zipFileWriter = new BlobWriter("application/zip");
const zipWriter = new ZipWriter(zipFileWriter, { bufferedWrite: true });
// Add each file to the zip file
downloadedFiles.forEach((downloadedFile) => {
if (downloadedFile) {
zipWriter.add(downloadedFile.name, new BlobReader(downloadedFile.blob));
}
});
// Download the zip file
const url = URL.createObjectURL(await zipWriter.close());
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "dateien.zip");
document.body.appendChild(link);
link.click();
}
const searchString = ref(tempStore.searchStrings["files"] ||'')
@@ -295,7 +234,6 @@ const renderedFileList = computed(() => {
type: "file"
}
})
console.log(currentFolders.value)
arraySort(files, (a,b) => {
let aVal = a.path ? a.path.split("/")[a.path.split("/").length -1] : null
@@ -338,7 +276,6 @@ const renderedFileList = computed(() => {
const selectedFileIndex = ref(0)
const showFile = (fileId) => {
console.log(fileId)
modal.open(DocumentDisplayModal,{
documentData: documents.value.find(i => i.id === fileId),
onUpdatedNeeded: setupPage()
@@ -413,7 +350,10 @@ const clearSearchString = () => {
</USelectMenu>
<UButton @click="modal.open(DocumentUploadModal,{fileData: {folder: currentFolder.id, type: currentFolder.standardFiletype, typeEnabled: currentFolder.standardFiletypeIsOptional}, onUploadFinished: () => {setupPage()}})">+ Datei</UButton>
<UButton
:disabled="!currentFolder"
@click="modal.open(DocumentUploadModal,{fileData: {folder: currentFolder.id, type: currentFolder.standardFiletype, typeEnabled: currentFolder.standardFiletypeIsOptional}, onUploadFinished: () => {setupPage()}})"
>+ Datei</UButton>
<UButton
@click="createFolderModalOpen = true"
variant="outline"

View File

@@ -4,9 +4,7 @@ import dayjs from "dayjs";
import HistoryDisplay from "~/components/HistoryDisplay.vue";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()

View File

@@ -4,9 +4,7 @@ import dayjs from "dayjs";
import HistoryDisplay from "~/components/HistoryDisplay.vue";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()

View File

@@ -1,9 +1,7 @@
<script setup>
import dayjs from "dayjs"
import {useSum} from "~/composables/useSum.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {
@@ -44,9 +42,14 @@ const sum = useSum()
const items = ref([])
const selectedItem = ref(0)
const sort = ref({
column: 'date',
direction: 'desc'
})
const setupPage = async () => {
items.value = await useSupabaseSelect("incominginvoices","*, vendor(id,name), statementallocations(id,amount)","created_at",false)
//items.value = await useSupabaseSelect("incominginvoices","*, vendor(id,name), statementallocations(id,amount)","created_at",false)
items.value = await useEntities("incominginvoices").select("*, vendor(id,name), statementallocations(id,amount)",sort.value.column,sort.value.direction === "asc")
}
setupPage()
@@ -54,26 +57,29 @@ setupPage()
const templateColumns = [
{
key: 'reference',
label: "Referenz:"
label: "Referenz:",
sortable: true,
}, {
key: 'state',
label: "Status:"
},
{
key: "date",
label: "Datum"
label: "Datum",
sortable: true,
},
{
key: "vendor",
label: "Lieferant"
label: "Lieferant",
},
{
key: "amount",
label: "Betrag"
label: "Betrag",
},
{
key: "dueDate",
label: "Fälligkeitsdatum"
label: "Fälligkeitsdatum",
sortable: true,
},
{
key: "paid",
@@ -81,7 +87,8 @@ const templateColumns = [
},
{
key: "paymentType",
label: "Zahlart"
label: "Zahlart",
sortable: true,
},
{
key: "description",
@@ -92,6 +99,7 @@ const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const searchString = ref(tempStore.searchStrings['incominginvoices'] ||'')
const clearSearchString = () => {
@@ -185,6 +193,9 @@ const selectIncomingInvoice = (invoice) => {
<UDashboardPanelContent>
<UTable
v-model:sort="sort"
sort-mode="manual"
@update:sort="setupPage"
:rows="filteredRows"
:columns="columns"
class="w-full"

View File

@@ -1,9 +1,7 @@
<script setup>
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()

View File

@@ -1,13 +1,13 @@
<template>
<!-- <UDashboardNavbar title="Home">
<UDashboardNavbar title="Home">
<template #right>
<UTooltip text="Notifications" :shortcuts="['N']">
<!-- <UTooltip text="Notifications" :shortcuts="['N']">
<UButton color="gray" variant="ghost" square @click="isNotificationsSlideoverOpen = true">
<UChip :show="unreadMessages" color="primary" inset>
<UIcon name="i-heroicons-bell" class="w-5 h-5" />
</UChip>
</UButton>
</UTooltip>
</UTooltip>-->
</template>
</UDashboardNavbar>
@@ -23,13 +23,11 @@
<UPageGrid>
<UDashboardCard
title="Buchhaltung"
v-if="profileStore.ownTenant.features.accounting"
>
<display-open-balances/>
</UDashboardCard>
<UDashboardCard
title="Bank"
v-if="profileStore.ownTenant.features.accounting"
>
<display-bankaccounts/>
</UDashboardCard>
@@ -38,7 +36,7 @@
>
<display-projects-in-phases/>
</UDashboardCard>
<UDashboardCard
<!--<UDashboardCard
title="Anwesende"
>
<display-present-profiles/>
@@ -52,14 +50,14 @@
title="Anwesenheiten"
>
<display-running-working-time/>
</UDashboardCard>
</UDashboardCard>-->
<UDashboardCard
title="Aufgaben"
>
<display-open-tasks/>
</UDashboardCard>
</UPageGrid>
</UDashboardPanelContent>-->
</UDashboardPanelContent>
</template>
<script setup>

View File

@@ -1,7 +1,5 @@
<script setup>
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()

View File

@@ -63,9 +63,7 @@
<script setup>
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {

View File

@@ -2,9 +2,7 @@
import { v4 as uuidv4 } from 'uuid';
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {

View File

@@ -1,7 +1,5 @@
<script setup>
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {

View File

@@ -4,9 +4,7 @@ import DocumentList from "~/components/DocumentList.vue";
import DocumentUpload from "~/components/DocumentUpload.vue";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {

View File

@@ -1,7 +1,5 @@
<script setup>
definePageMeta({
middleware: "auth"
})
const items = ref([])
const setup = async () => {

View File

@@ -1,7 +1,5 @@
<script setup>
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()

View File

@@ -48,9 +48,7 @@
<script setup>
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {

View File

@@ -1,7 +1,5 @@
<script setup>
definePageMeta({
middleware: "auth"
})
const supabase = useSupabaseClient()
const dataStore = useDataStore()

View File

@@ -22,7 +22,10 @@ const mode = ref("list")
const items = ref([])
const item = ref({})
const setupPage = async () => {
const setupPage = async (sort_column = null,sort_direction = null) => {
loaded.value = false
if(await useCapacitor().getIsPhone()) {
setPageLayout("mobile")
@@ -32,23 +35,18 @@ const setupPage = async () => {
if(mode.value === "show") {
//Load Data for Show
//item.value = await useSupabaseSelectSingle(type, route.params.id, dataType.supabaseSelectWithInformation || "*")
item.value = await useEntities(type).selectSingle(route.params.id,"*",true)
} else if(mode.value === "edit") {
//Load Data for Edit
//const data = JSON.stringify((await supabase.from(type).select().eq("id", route.params.id).single()).data)
//await useSupabaseSelectSingle(type, route.params.id)
item.value = JSON.stringify(await useEntities(type).selectSingle(route.params.id))
//item.value = data
} else if(mode.value === "create") {
//Load Data for Create
item.value = JSON.stringify({})
console.log(item.value)
} else if(mode.value === "list") {
//Load Data for List
items.value = await useEntities(type).select()
items.value = await useEntities(type).select(dataType.supabaseSelectWithInformation, sort_column || dataType.supabaseSortColumn , sort_direction === "asc")
}
loaded.value = true
@@ -68,17 +66,19 @@ setupPage()
:platform="platform"
/>
<EntityEdit
v-else-if="loaded && (mode === 'edit' || mode === 'create')"
v-else-if="(mode === 'edit' || mode === 'create')"
:type="route.params.type"
:item="item"
:mode="mode"
:platform="platform"
/>
<EntityList
v-else-if="loaded && mode === 'list'"
:loading="!loaded"
v-else-if="mode === 'list'"
:type="type"
:items="items"
:platform="platform"
@sort="(i) => setupPage(i.sort_column, i.sort_direction)"
/>
<UProgress
v-else

15
pages/test.vue Normal file
View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
async function handleSingle() {
await useFiles().downloadFile("f60e8466-7136-4492-ad94-a60603bc3c38") // Einzel-Download
}
async function handleMulti() {
await useFiles().downloadFile(undefined, ["f60e8466-7136-4492-ad94-a60603bc3c38", "f60e8466-7136-4492-ad94-a60603bc3c38"]) // Multi-Download ZIP
}
</script>
<template>
<button @click="handleSingle">Einzeldatei</button>
<button @click="handleMulti">Mehrere als ZIP</button>
</template>

View File

@@ -5,9 +5,7 @@ import '@vuepic/vue-datepicker/dist/main.css'
import {setPageLayout} from "#app";
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()

View File

@@ -4,9 +4,7 @@ import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {

View File

@@ -67,9 +67,7 @@
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
defineShortcuts({
'/': () => {

View File

@@ -7,9 +7,7 @@ import FloatingActionButton from "~/components/mobile/FloatingActionButton.vue";
dayjs.extend(customParseFormat)
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()