Removed Unused Files

This commit is contained in:
2025-09-07 19:10:08 +02:00
parent f5f2949545
commit 9f59b94336
4 changed files with 0 additions and 554 deletions

View File

@@ -1,108 +0,0 @@
<script setup>
definePageMeta({
layout: "default"
})
import dayjs from "dayjs";
const supabase = useSupabaseClient()
const user = useSupabaseUser()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const selectedChat = ref({})
const messageText = ref("")
</script>
<template>
<div class="flex h-full">
<div class="w-1/5 mr-2 scrollList">
<a
v-for="chat in dataStore.chats"
@click="selectedChat = chat"
>
<UAlert
:title="chat.title ? chat.title : chat.members.map(i => { if(i !== user.id) return profileStore.getProfileById(i).fullName}).join(' ')"
:avatar="{alt: chat.members.map(i => { if(i !== user.id) return profileStore.getProfileById(i).fullName}).join(' ')}"
:color="selectedChat.id === chat.id ? 'primary' : 'white'"
variant="outline"
>
<template #title="{title}">
{{title}} <!-- TODO: Add Unread Counter <UBadge class="ml-1">{{dataStore.getMessagesByChatId(chat.id).filter(i => !i.read ).length}}</UBadge>-->
</template>
</UAlert>
</a>
</div>
<div class="w-full h-full px-5 flex flex-col justify-between" v-if="selectedChat.id">
<div class="flex flex-col mt-5 scrollList">
<div
v-for="message in dataStore.getMessagesByChatId(selectedChat.id)"
>
<div class="flex justify-end mb-4" v-if="message.origin === user.id">
<div
class="mr-2 py-3 px-4 bg-primary-400 rounded-bl-3xl rounded-tl-3xl rounded-tr-xl text-white"
>
{{message.text}}
</div>
<UAvatar
:alt="profileStore.getProfileById(message.origin) ? profileStore.getProfileById(message.origin).fullName : ''"
size="md"
/>
</div>
<div class="flex justify-start mb-4" v-else>
<UAvatar
:alt="profileStore.getProfileById(message.origin) ? profileStore.getProfileById(message.origin).fullName : ''"
size="md"
/>
<div
class="ml-2 py-3 px-4 bg-gray-400 rounded-br-3xl rounded-tr-3xl rounded-tl-xl text-white"
>
{{message.text}}
</div>
</div>
</div>
</div>
<div class="py-5">
<UButtonGroup class="w-full">
<UInput
variant="outline"
color="primary"
placeholder="Neue Nachricht"
v-model="messageText"
@keyup.enter="dataStore.createNewItem('messages',{
text: messageText,
origin: user.id,
destination: selectedChat.id
})"
class="flex-auto"
/>
<UButton
@click="dataStore.createNewItem('messages',{
text: messageText,
origin: user.id,
destination: selectedChat.id
})"
>
Senden
</UButton>
</UButtonGroup>
</div>
</div>
</div>
</template>
<style scoped>
</style>

View File

@@ -1,84 +0,0 @@
<script setup>
import dayjs from "dayjs"
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const router = useRouter()
const items = ref([])
const setup = async () => {
items.value = (await supabase.from("historyitems").select().like('text',`%@${profileStore.activeProfile.username}%`)/*.textSearch("text", `'@${profileStore.activeProfile.username}'`)*/.order("created_at")).data
}
const navigateToHistoryItem = (item) => {
/*if(item.customer) {
router.push(`/customers/show/${item.customer}`)
} else if(item.vendor) {
router.push(`/vendors/show/${item.vendor}`)
} else if(item.project) {
router.push(`/projects/show/${item.project}`)
} else if(item.plant) {
router.push(`/plants/show/${item.plant}`)
} else if(item.incomingInvoice) {
router.push(`/incomingInvoices/show/${item.incomingInvoice}`)
}/!* else if(item.document) {
router.push(`/documents/show/${item.document}`)
}*!/ else if(item.contact) {
router.push(`/contacts/show/${item.contact}`)
} else if(item.inventoryitem) {
router.push(`/inventoryitems/show/${item.inventoryitem}`)
} else if(item.product) {
router.push(`/products/show/${item.product}`)
} else if(item.profile) {
router.push(`/profiles/show/${item.profile}`)
} else if(item.absenceRequest) {
router.push(`/absenceRequests/show/${item.absenceRequest}`)
} else if(item.event) {
router.push(`/events/show/${item.event}`)
} else if(item.task) {
router.push(`/tasks/show/${item.task}`)
} else if(item.vehicle) {
router.push(`/vehicle/show/${item.vehicle}`)
} else if(item.bankStatement) {
router.push(`/bankStatements/show/${item.bankStatement}`)
} else if(item.space) {
router.push(`/spaces/show/${item.space}`)
} else if(item.trackingtrip) {
router.push(`/trackingtrips/show/${item.trackingtrip}`)
}*/
if(item.config && item.config.type !== "document") {
router.push(`/${item.config.type}s/show/${item.config.id}`)
}
}
setup()
</script>
<template>
<UDashboardNavbar title="Erwähnungen in Logbüchern" :badge="items.length">
</UDashboardNavbar>
<UTable
:rows="items"
@select="navigateToHistoryItem"
:columns="[{key:'created_at',label:'Datum'},{key:'config',label:'Typ'},{key:'text',label:'Text'}]"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Erwähnungen anzuzeigen' }"
class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
>
<template #config-data="{row}">
<span v-if="row.config">{{dataStore.dataTypes[row.config.type + "s"].labelSingle}}</span>
</template>
<template #created_at-data="{row}">
{{dayjs(row.created_at).format("HH:mm DD.MM.YYYY")}}
</template>
</UTable>
</template>
<style scoped>
</style>

View File

@@ -1,338 +0,0 @@
<script setup>
import dayjs from "dayjs";
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
defineShortcuts({
'backspace': () => {
router.push("/contacts")
},
'arrowleft': () => {
if(openTab.value > 0){
openTab.value -= 1
}
},
'arrowright': () => {
if(openTab.value < 3) {
openTab.value += 1
}
},
})
const dataStore = useDataStore()
const profileStore = useProfileStore()
const route = useRoute()
const router = useRouter()
const toast = useToast()
const id = ref(route.params.id ? route.params.id : null )
const openTab = ref(0)
//Working
const mode = ref(route.params.mode || "show")
const itemInfo = ref({
active: true,
profiles: [profileStore.activeProfile.id]
})
const oldItemInfo = ref({})
//Functions
const setupPage = async () => {
if(mode.value === "show"){
itemInfo.value = await useSupabaseSelectSingle("contacts",route.params.id,"*, customer(id, name), vendor(id,name) ")
} else if(mode.value === "edit") {
itemInfo.value = await useSupabaseSelectSingle("contacts",route.params.id,"*")
}
if(mode.value === "create") {
let query = route.query
if(query.customer) itemInfo.value.customer = Number(query.customer)
if(query.vendor) itemInfo.value.vendor = Number(query.vendor)
}
if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
}
setupPage()
</script>
<template>
<UDashboardNavbar
:ui="{center: 'flex items-stretch gap-1.5 min-w-0'}"
>
<template #left>
<UButton
icon="i-heroicons-chevron-left"
variant="outline"
@click="router.push(`/contacts`)"
>
Ansprechpartner
</UButton>
</template>
<template #center>
<h1
v-if="itemInfo"
:class="['text-xl','font-medium', ... itemInfo.active ? ['text-primary'] : ['text-rose-500']]"
>{{itemInfo.id ? `Ansprechpartner: ${itemInfo.fullName}` : (mode === 'create' ? 'Ansprechpartner erstellen' : 'Ansprechpartner bearbeiten')}}</h1>
</template>
<template #right>
<UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('contacts',{...itemInfo, fullName: itemInfo.firstName + ' ' + itemInfo.lastName},oldItemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('contacts',{...itemInfo, fullName: itemInfo.firstName + ' ' + itemInfo.lastName})"
>
Erstellen
</UButton>
<UButton
@click="router.push(itemInfo.id ? `/contacts/show/${itemInfo.value.id}` : `/contacts/`)"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/contacts/edit/${itemInfo.id}`)"
>
Bearbeiten
</UButton>
</template>
<!-- <template #badge v-if="itemInfo">
<UBadge
v-if="itemInfo.active"
>
Kontakt aktiv
</UBadge>
<UBadge
v-else
color="red"
>
Kontakt inaktiv
</UBadge>
</template>-->
</UDashboardNavbar>
<UTabs
:items="[{label: 'Informationen'}, {label: 'Logbuch'}]"
v-if="itemInfo && mode == 'show'"
class="p-5"
v-model="openTab"
>
<template #item="{item}">
<div v-if="item.label === 'Informationen'" class="flex flex-row mt-5">
<div class="w-1/2 mr-5">
<UCard>
<Toolbar>
<UButton
@click="router.push(`/email/new?to=${itemInfo.email}`)"
icon="i-heroicons-envelope"
:disabled="!itemInfo.email"
>
E-Mail
</UButton>
</Toolbar>
<table class="w-full">
<tr>
<td>Kunde: </td>
<td><nuxt-link v-if="itemInfo.customer" :to="`/customers/show/${itemInfo.customer?.id}`">{{itemInfo?.customer?.name}}</nuxt-link></td>
</tr>
<tr>
<td>Lieferant: </td>
<td><nuxt-link v-if="itemInfo.vendor" :to="`/customers/show/${itemInfo.vendor?.id}`">{{itemInfo?.vendor?.name}}</nuxt-link></td>
</tr>
<tr>
<td>E-Mail:</td>
<td>{{itemInfo.email}}</td>
</tr>
<tr>
<td>Mobil:</td>
<td>{{itemInfo.phoneMobile}}</td>
</tr>
<tr>
<td>Festnetz:</td>
<td>{{itemInfo.phoneHome}}</td>
</tr>
<tr>
<td>Rolle:</td>
<td>{{itemInfo.role}}</td>
</tr>
<tr>
<td>Geburtstag:</td>
<td>{{itemInfo.birthday ? dayjs(itemInfo.birthday).format("DD.MM.YYYY") : ""}}</td>
</tr>
<tr>
<td>Notizen:</td>
<td>{{itemInfo.notes}}</td>
</tr>
</table>
</UCard>
</div>
<div class="w-1/2">
<UCard>
<HistoryDisplay
type="contact"
v-if="itemInfo"
:element-id="itemInfo.id"
/>
</UCard>
</div>
</div>
</template>
</UTabs>
<UForm
v-else-if="mode == 'edit' || mode == 'create'"
class="p-5"
>
<UFormGroup
label="Anrede:"
>
<UInput
v-model="itemInfo.salutation"
/>
</UFormGroup>
<UFormGroup
label="Vorname:"
>
<UInput
v-model="itemInfo.firstName"
/>
</UFormGroup>
<UFormGroup
label="Nachname:"
>
<UInput
v-model="itemInfo.lastName"
/>
</UFormGroup>
<UFormGroup
label="Kunde:"
>
<USelectMenu
v-model="itemInfo.customer"
option-attribute="name"
value-attribute="id"
:options="dataStore.customers"
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.customers.find(customer => customer.id === itemInfo.customer) ? dataStore.customers.find(customer => customer.id === itemInfo.customer).name : "Kunde auswählen"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Lieferant:"
>
<USelectMenu
v-model="itemInfo.vendor"
option-attribute="name"
value-attribute="id"
:options="dataStore.vendors"
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor) ? dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor).name : "Lieferant auswählen"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Kontakt aktiv:"
>
<UCheckbox
v-model="itemInfo.active"
/>
</UFormGroup>
<UFormGroup
label="E-Mail:"
>
<UInput
v-model="itemInfo.email"
/>
</UFormGroup>
<UFormGroup
label="Mobil:"
>
<UInput
v-model="itemInfo.phoneMobile"
/>
</UFormGroup>
<UFormGroup
label="Festnetz:"
>
<UInput
v-model="itemInfo.phoneHome"
/>
</UFormGroup>
<UFormGroup
label="Rolle:"
>
<UInput
v-model="itemInfo.role"
/>
</UFormGroup>
<UFormGroup
label="Geburtstag:"
>
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
variant="outline"
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.birthday ? dayjs(itemInfo.birthday).format('DD.MM.YYYY') : 'Datum auswählen'"
/>
<template #panel="{ close }">
<LazyDatePicker
v-model="itemInfo.birthday"
mode="date"
/>
</template>
</UPopover>
</UFormGroup>
<UFormGroup
label="Berechtige Benutzer:"
>
<USelectMenu
v-model="itemInfo.profiles"
:options="profileStore.profiles"
option-attribute="fullName"
value-attribute="id"
searchable
multiple
:search-attributes="['fullName']"
>
<template #label>
{{itemInfo.profiles.length > 0 ? itemInfo.profiles.map(i => profileStore.getProfileById(i).fullName).join(", ") : "Kein Benutzer ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Notizen:"
>
<UTextarea
v-model="itemInfo.notes"
/>
</UFormGroup>
</UForm>
</template>
<style scoped>
td {
border-bottom: 1px solid lightgrey;
vertical-align: top;
padding-bottom: 0.15em;
padding-top: 0.15em;
}
</style>

View File

@@ -1,24 +0,0 @@
<template>
<EntityList
type="contacts"
:items="items"
></EntityList>
</template>
<script setup>
import EntityList from "~/components/EntityList.vue";
const items = ref([])
const setupPage = async () => {
items.value = await useSupabaseSelect("contacts","*, customer(name), vendor(name)")
}
setupPage()
</script>
<style scoped>
</style>