New Backend changes
This commit is contained in:
@@ -158,6 +158,22 @@ const onTabChange = (index) => {
|
||||
v-else-if="!props.inModal && platform === 'mobile'"
|
||||
:ui="{center: 'flex items-stretch gap-1.5 min-w-0'}"
|
||||
>
|
||||
<!-- <template #left>
|
||||
<UButton
|
||||
icon="i-heroicons-chevron-left"
|
||||
variant="outline"
|
||||
@click="router.back()/*router.push(`/standardEntity/${type}`)*/"
|
||||
>
|
||||
Zurück
|
||||
</UButton>
|
||||
<UButton
|
||||
icon="i-heroicons-chevron-left"
|
||||
variant="outline"
|
||||
@click="router.push(`/standardEntity/${type}`)"
|
||||
>
|
||||
Übersicht
|
||||
</UButton>
|
||||
</template>-->
|
||||
<template #toggle>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
@@ -14,7 +14,7 @@ export const useEntities = (
|
||||
const select = async (
|
||||
select: string = "*",
|
||||
sortColumn: string | null = null,
|
||||
ascending: boolean = false,
|
||||
ascending: boolean = true,
|
||||
noArchivedFiltering: boolean = false
|
||||
) => {
|
||||
|
||||
@@ -23,7 +23,7 @@ export const useEntities = (
|
||||
params: {
|
||||
select,
|
||||
sort: sortColumn || undefined,
|
||||
asc: ascending
|
||||
asc: ascending ? "true" : "false"
|
||||
}
|
||||
})
|
||||
|
||||
@@ -36,24 +36,6 @@ export const useEntities = (
|
||||
return data
|
||||
}
|
||||
|
||||
const selectSpecial = async (
|
||||
select: string = "*",
|
||||
sortColumn: string | null = null,
|
||||
ascending: boolean = false,
|
||||
) => {
|
||||
|
||||
const res = await useNuxtApp().$api(`/api/resource-special/${relation}`, {
|
||||
method: "GET",
|
||||
params: {
|
||||
select,
|
||||
sort: sortColumn || undefined,
|
||||
asc: ascending
|
||||
}
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
const selectSingle = async (
|
||||
idToEq: string | number,
|
||||
select: string = "*",
|
||||
@@ -61,7 +43,7 @@ export const useEntities = (
|
||||
) => {
|
||||
if (!idToEq) return null
|
||||
|
||||
const res = await useNuxtApp().$api(withInformation ? `/api/resource/${relation}/${idToEq}/${withInformation}` : `/api/resource/${relation}/${idToEq}`, {
|
||||
const res = await useNuxtApp().$api(`/api/resource/${relation}/${idToEq}/${withInformation}`, {
|
||||
method: "GET",
|
||||
params: { select }
|
||||
})
|
||||
@@ -131,7 +113,7 @@ export const useEntities = (
|
||||
return res
|
||||
}
|
||||
|
||||
return {select, create, update, archive, selectSingle, selectSpecial}
|
||||
return {select, create, update, archive, selectSingle}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<UDashboardNavbar title="Home">
|
||||
<!-- <UDashboardNavbar title="Home">
|
||||
<template #right>
|
||||
<!-- <UTooltip text="Notifications" :shortcuts="['N']">
|
||||
<UButton color="gray" variant="ghost" square @click="isNotificationsSlideoverOpen = true">
|
||||
@@ -57,7 +57,7 @@
|
||||
<display-open-tasks/>
|
||||
</UDashboardCard>
|
||||
</UPageGrid>
|
||||
</UDashboardPanelContent>
|
||||
</UDashboardPanelContent>-->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -22,10 +22,7 @@ const mode = ref("list")
|
||||
const items = ref([])
|
||||
const item = ref({})
|
||||
|
||||
|
||||
|
||||
const setupPage = async (sort_column = null,sort_direction = null) => {
|
||||
loaded.value = false
|
||||
const setupPage = async () => {
|
||||
|
||||
if(await useCapacitor().getIsPhone()) {
|
||||
setPageLayout("mobile")
|
||||
@@ -35,18 +32,23 @@ const setupPage = async (sort_column = null,sort_direction = null) => {
|
||||
|
||||
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(dataType.supabaseSelectWithInformation, sort_column || dataType.supabaseSortColumn , sort_direction === "asc")
|
||||
items.value = await useEntities(type).select()
|
||||
}
|
||||
|
||||
loaded.value = true
|
||||
@@ -66,19 +68,17 @@ setupPage()
|
||||
:platform="platform"
|
||||
/>
|
||||
<EntityEdit
|
||||
v-else-if="(mode === 'edit' || mode === 'create')"
|
||||
v-else-if="loaded && (mode === 'edit' || mode === 'create')"
|
||||
:type="route.params.type"
|
||||
:item="item"
|
||||
:mode="mode"
|
||||
:platform="platform"
|
||||
/>
|
||||
<EntityList
|
||||
:loading="!loaded"
|
||||
v-else-if="mode === 'list'"
|
||||
v-else-if="loaded && mode === 'list'"
|
||||
:type="type"
|
||||
:items="items"
|
||||
:platform="platform"
|
||||
@sort="(i) => setupPage(i.sort_column, i.sort_direction)"
|
||||
/>
|
||||
<UProgress
|
||||
v-else
|
||||
|
||||
Reference in New Issue
Block a user