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