Supabase Removals Frontend

This commit is contained in:
2026-02-14 12:48:59 +01:00
parent 053f184a33
commit 55699da42c
28 changed files with 135 additions and 222 deletions

View File

@@ -60,7 +60,6 @@ const router = useRouter()
const createddocuments = ref([])
const setup = async () => {
//createddocuments.value = (await useSupabaseSelect("createddocuments")).filter(i => !i.archived)
createddocuments.value = (await useEntities("createddocuments").select()).filter(i => !i.archived)
}
setup()
@@ -308,4 +307,4 @@ const selectItem = (item) => {
<style scoped>
</style>
</style>

View File

@@ -1,9 +1,6 @@
<script setup>
import dayjs from "dayjs";
const supabase = useSupabaseClient()
const route = useRoute()
const router = useRouter()
const profileStore = useProfileStore()
const props = defineProps({
@@ -28,8 +25,6 @@ const statementallocations = ref([])
const incominginvoices = ref([])
const setup = async () => {
//statementallocations.value = (await supabase.from("statementallocations").select("*, bs_id(*)").eq("account", route.params.id).eq("tenant",profileStore.currentTenant).order("created_at",{ascending: true})).data
//incominginvoices.value = (await useSupabaseSelect("incominginvoices", "*, vendor(*)")).filter(i => i.accounts.find(x => x.account == route.params.id))
}
setup()
@@ -105,4 +100,4 @@ const renderedAllocations = computed(() => {
<style scoped>
</style>
</style>

View File

@@ -24,7 +24,6 @@ const emit = defineEmits(["updateNeeded"]);
const router = useRouter()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const renderedPhases = computed(() => {
if(props.topLevelType === "projects" && props.item.phases) {
@@ -77,17 +76,6 @@ const changeActivePhase = async (key) => {
const res = await useEntities("projects").update(item.id, {phases:item.phases,active_phase: item.phases.find(i => i.active).label})
//const {error:updateError} = await supabase.from("projects").update({phases: item.phases}).eq("id",item.id)
/*const {error} = await supabase.from("historyitems").insert({
createdBy: profileStore.activeProfile.id,
tenant: profileStore.currentTenant,
text: `Aktive Phase zu "${phaseLabel}" gewechselt`,
project: item.id
})*/
emit("updateNeeded")
}
@@ -166,4 +154,4 @@ const changeActivePhase = async (key) => {
<style scoped>
</style>
</style>

View File

@@ -1,10 +1,5 @@
<script setup>
import dayjs from "dayjs";
const supabase = useSupabaseClient()
const route = useRoute()
const router = useRouter()
const profileStore = useProfileStore()
const props = defineProps({
queryStringData: {
@@ -114,4 +109,4 @@ const columns = [
<style scoped>
</style>
</style>

View File

@@ -57,7 +57,7 @@
const selectedItem = ref(0)
const sort = ref({
column: dataType.supabaseSortColumn || "date",
column: dataType.sortColumn || "date",
direction: 'desc'
})

View File

@@ -1,14 +1,17 @@
<script setup>
const supabase = useSupabaseClient()
const profileStore = useProfileStore()
const globalMessages = ref([])
const setup = async () => {
let {data} = await supabase.from("globalmessages").select("*, profiles(id)")
let data = []
try {
data = await useNuxtApp().$api("/api/resource/globalmessages")
} catch (e) {
data = []
}
data = data.filter((message) => message.profiles.length === 0)
data = (data || []).filter((message) => !message.profiles || message.profiles.length === 0)
globalMessages.value = data
@@ -29,10 +32,17 @@ const showMessage = (message) => {
showMessageModal.value = true
}
const markMessageAsRead = async () => {
await supabase.from("globalmessagesseen").insert({
profile: profileStore.activeProfile.id,
message: messageToShow.value.id,
})
try {
await useNuxtApp().$api("/api/resource/globalmessagesseen", {
method: "POST",
body: {
profile: profileStore.activeProfile.id,
message: messageToShow.value.id,
}
})
} catch (e) {
// noop: endpoint optional in newer backend versions
}
showMessageModal.value = false
setup()
@@ -86,4 +96,4 @@ setup()
<style scoped>
</style>
</style>

View File

@@ -3,10 +3,7 @@ const { isHelpSlideoverOpen } = useDashboard()
const { metaSymbol } = useShortcuts()
const shortcuts = ref(false)
const dataStore = useDataStore()
const profileStore = useProfileStore()
const query = ref('')
const supabase = useSupabaseClient()
const toast = useToast()
const router = useRouter()
@@ -228,4 +225,4 @@ const resetContactRequest = () => {
</div>
<UProgress class="mt-5" animation="carousel" v-else/>-->
</UDashboardSlideover>
</template>
</template>

View File

@@ -1,9 +1,6 @@
<script setup>
import {formatTimeAgo} from '@vueuse/core'
const supabase = useSupabaseClient()
const { isNotificationsSlideoverOpen } = useDashboard()
watch(isNotificationsSlideoverOpen, async (newVal,oldVal) => {
@@ -15,18 +12,24 @@ watch(isNotificationsSlideoverOpen, async (newVal,oldVal) => {
const notifications = ref([])
const setup = async () => {
notifications.value = (await supabase.from("notifications").select()).data
try {
notifications.value = await useNuxtApp().$api("/api/resource/notifications_items")
} catch (e) {
notifications.value = []
}
}
setup()
const setNotificationAsRead = async (notification) => {
console.log(notification)
const {data,error} = await supabase.from("notifications").update({read: true}).eq("id", notification.id)
console.log(error)
try {
await useNuxtApp().$api(`/api/resource/notifications_items/${notification.id}`, {
method: "PUT",
body: { readAt: new Date() }
})
} catch (e) {
// noop: endpoint optional in older/newer backend variants
}
setup()
}
@@ -41,7 +44,7 @@ const setNotificationAsRead = async (notification) => {
class="p-3 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800/50 cursor-pointer flex items-center gap-3 relative"
@click="setNotificationAsRead(notification)"
>
<UChip color="primary" :show="!notification.read" inset>
<UChip color="primary" :show="!notification.read && !notification.readAt" inset>
<UAvatar alt="FEDEO" size="md" />
</UChip>
@@ -49,7 +52,7 @@ const setNotificationAsRead = async (notification) => {
<p class="flex items-center justify-between">
<span class="text-gray-900 dark:text-white font-medium">{{notification.title}}</span>
<time :datetime="notification.date" class="text-gray-500 dark:text-gray-400 text-xs" v-text="formatTimeAgo(new Date(notification.created_at))" />
<time :datetime="notification.date || notification.createdAt || notification.created_at" class="text-gray-500 dark:text-gray-400 text-xs" v-text="formatTimeAgo(new Date(notification.createdAt || notification.created_at))" />
</p>
<p class="text-gray-500 dark:text-gray-400">
{{ notification.message }}

View File

@@ -2,7 +2,6 @@
const toast = useToast()
const dataStore = useDataStore()
const supabase = useSupabaseClient()
const modal = useModal()
const props = defineProps({
type: {
@@ -35,11 +34,10 @@ const item = ref({})
const setupPage = async () => {
if(props.mode === "show") {
//Load Data for Show
item.value = await useEntities(props.type).selectSingle(props.id, dataType.supabaseSelectWithInformation || "*")
item.value = await useEntities(props.type).selectSingle(props.id, dataType.selectWithInformation || "*")
} else if(props.mode === "edit") {
//Load Data for Edit
const data = JSON.stringify(await useEntities(props.type).selectSingle(props.id)/*(await supabase.from(props.type).select().eq("id", props.id).single()).data*/)
//await useSupabaseSelectSingle(type, route.params.id)
const data = JSON.stringify(await useEntities(props.type).selectSingle(props.id))
item.value = data
} else if(props.mode === "create") {
@@ -48,7 +46,7 @@ const setupPage = async () => {
} else if(props.mode === "list") {
//Load Data for List
items.value = await useEntities(props.type).select(dataType.supabaseSelectWithInformation || "*", dataType.supabaseSortColumn,dataType.supabaseSortAscending || false)
items.value = await useEntities(props.type).select(dataType.selectWithInformation || "*", dataType.sortColumn,dataType.sortAscending || false)
}
loaded.value = true
@@ -95,4 +93,4 @@ setupPage()
<style scoped>
</style>
</style>

View File

@@ -3,11 +3,6 @@
const { isHelpSlideoverOpen } = useDashboard()
const { isDashboardSearchModalOpen } = useUIState()
const { metaSymbol } = useShortcuts()
const user = useSupabaseUser()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const router = useRouter()
const auth = useAuthStore()
const items = computed(() => [
@@ -59,4 +54,4 @@ const items = computed(() => [
</div>
</template>
</UDropdown>
</template>
</template>

View File

@@ -7,11 +7,9 @@ const props = defineProps({
}
})
const supabase = useSupabaseClient()
let inventoryitemgroups = await Promise.all(props.row.inventoryitemgroups.map(async (i) => {
return (await supabase.from("inventoryitemgroups").select("id,name").eq("id",i).single()).data.name
const group = await useEntities("inventoryitemgroups").selectSingle(i)
return group?.name
}))
</script>

View File

@@ -7,11 +7,9 @@ const props = defineProps({
}
})
const supabase = useSupabaseClient()
let inventoryitems = await Promise.all(props.row.inventoryitems.map(async (i) => {
return (await supabase.from("inventoryitems").select("id,name").eq("id",i).single()).data.name
const item = await useEntities("inventoryitems").selectSingle(i)
return item?.name
}))
</script>

View File

@@ -7,11 +7,9 @@ const props = defineProps({
}
})
const supabase = useSupabaseClient()
let vehicles = await Promise.all(props.row.vehicles.map(async (i) => {
return (await supabase.from("vehicles").select("id,licensePlate").eq("id",i).single()).data.licensePlate
const vehicle = await useEntities("vehicles").selectSingle(i)
return vehicle?.licensePlate
}))
</script>

View File

@@ -1,8 +1,4 @@
<script setup>
const supabase = useSupabaseClient()
const profileStore = useProfileStore()
const props = defineProps({
item: {
required: true,
@@ -27,4 +23,4 @@ setupPage()
<style scoped>
</style>
</style>

View File

@@ -8,15 +8,12 @@ let incomeData = ref({})
let expenseData = ref({})
const setup = async () => {
//let incomeRawData = (await supabase.from("createddocuments").select().eq("tenant",profileStore.currentTenant).eq("state","Gebucht").in('type',['invoices','advanceInvoices','cancellationInvoices'])).data
let incomeRawData = (await useEntities("createddocuments").select()).filter(i => i.state === "Gebucht" && ['invoices','advanceInvoices','cancellationInvoices'].includes(i.type))
let incomeRawFilteredData = incomeRawData.filter(x => x.state === 'Gebucht' && incomeRawData.find(i => i.linkedDocument && i.linkedDocument.id === x.id && i.type === 'cancellationInvoices') && ['invoices','advanceInvoices'].includes(row.type))
//let expenseRawData =(await supabase.from("incominginvoices").select().eq("tenant",profileStore.currentTenant)).data
let expenseRawData =(await useEntities("incominginvoices").select())
//let withoutInvoiceRawData = (await supabase.from("statementallocations").select().eq("tenant",profileStore.currentTenant).not("account","is",null)).data
let withoutInvoiceRawData = (await useEntities("statementallocations").select()).filter(i => i.account)
let withoutInvoiceRawDataExpenses = []
@@ -241,4 +238,4 @@ setup()
<style scoped>
</style>
</style>

View File

@@ -32,15 +32,7 @@ const default_data = {
const newProjectDescription = ref(data|| default_data.value);
const saveProjectDescription = async () => {
//Update Project Description
/*const {data:updateData,error:updateError} = await supabase
.from("projects")
.update({description: newProjectDescription.value})
.eq('id',currentProject.id)
.select()
console.log(updateData)
console.log(updateError)*/
@@ -61,4 +53,4 @@ const saveProjectDescription = async () => {
<style scoped>
</style>
</style>

View File

@@ -1,10 +1,20 @@
<script setup>
const supabase = useSupabaseClient()
const profileStore = useProfileStore()
const workingtimes = ref([])
const setupPage = async () => {
workingtimes.value = (await supabase.from("workingtimes").select().eq("tenant",profileStore.currentTenant).is("endDate",null)).data
const profiles = profileStore.profiles || []
const checks = await Promise.all(profiles.map(async (profile) => {
try {
const spans = await useNuxtApp().$api(`/api/staff/time/spans?targetUserId=${profile.user_id || profile.id}`)
const openSpan = (spans || []).find((s) => !s.endedAt && s.type === "work")
if (openSpan) return { profile: profile.id }
} catch (e) {
return null
}
return null
}))
workingtimes.value = checks.filter(Boolean)
}
setupPage()
@@ -21,4 +31,4 @@ setupPage()
<style scoped>
</style>
</style>