Changed to new Layout System

This commit is contained in:
2024-02-23 19:30:43 +01:00
parent 96d4ee7356
commit 0d86e4c4f9
32 changed files with 1690 additions and 2214 deletions

View File

@@ -520,7 +520,14 @@ const footerLinks = [/*{
</template> </template>
</UDashboardSidebar> </UDashboardSidebar>
</UDashboardPanel> </UDashboardPanel>
<UDashboardPage>
<UDashboardPanel grow>
<slot /> <slot />
</UDashboardPanel>
</UDashboardPage>
<!-- ~/components/HelpSlideover.vue --> <!-- ~/components/HelpSlideover.vue -->
<HelpSlideover /> <HelpSlideover />

View File

@@ -7,6 +7,12 @@ export default defineNuxtConfig({
extends: [ extends: [
'@nuxt/ui-pro' '@nuxt/ui-pro'
], ],
components: [{
path: '~/components'
}, {
path: '~/components/common',
pathPrefix: false
}],
build: { build: {
transpile: ['@vuepic/vue-datepicker'] transpile: ['@vuepic/vue-datepicker']
}, },

View File

@@ -6,13 +6,12 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const id = ref(route.params.id ? route.params.id : null ) const id = ref(route.params.id ? route.params.id : null )
let currentItem = null let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
@@ -37,13 +36,10 @@ const absenceReasons = [
//Functions //Functions
const setupPage = () => { const setupPage = () => {
if(mode.value === "show" || mode.value === "edit"){ if(mode.value === "show" || mode.value === "edit"){
currentItem = dataStore.getAbsenceRequestById(Number(useRoute().params.id)) currentItem.value = dataStore.getAbsenceRequestById(Number(useRoute().params.id))
} }
if(mode.value === "edit") itemInfo.value = currentItem if(mode.value === "edit") itemInfo.value = currentItem.value
} }
const editItem = async () => { const editItem = async () => {
@@ -52,38 +48,46 @@ const editItem = async () => {
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
mode.value = "show" if(currentItem.value) {
itemInfo.value = { router.push(`/tasks/show/${currentItem.value.id}`)
id: 0, } else {
infoData: {} router.push(`/tasks/`)
} }
} }
const updateItem = async () => {
const {error} = await supabase
.from("absenceRequests")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
}
router.push(`/employees/absenceRequests/show/${currentItem.id}`)
toast.add({title: "Abwesenheit erfolgreich gespeichert"})
dataStore.fetchAbsenceRequests()
}
setupPage() setupPage()
</script> </script>
<template> <template>
<div> <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Abwesenheit erstellen' : 'Abwesenheit bearbeiten')">
<UCard v-if="currentItem && mode == 'show'" > <template #right>
<template #header> <UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('tasks',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('tasks',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="editItem"
>
Bearbeiten
</UButton>
</template>
<template #badge v-if="currentItem">
<UBadge <UBadge
v-if="currentItem.approved === 'Offen'" v-if="currentItem.approved === 'Offen'"
color="blue" color="blue"
@@ -96,40 +100,28 @@ setupPage()
v-else-if="currentItem.approved === 'Abgelehnt'" v-else-if="currentItem.approved === 'Abgelehnt'"
color="rose" color="rose"
>{{currentItem.approved}}</UBadge> >{{currentItem.approved}}</UBadge>
{{currentItem.reason}}
</template> </template>
</UDashboardNavbar>
<span>Mitarbeiter: {{dataStore.profiles.find(item => item.id === currentItem.user) ? dataStore.profiles.find(item => item.id === currentItem.user).fullName : ""}}<br></span> <UTabs
<span>Start: {{dayjs(currentItem.start).format("DD.MM.YYYY")}}<br></span> :items="[{label: 'Informationen'}]"
<span>Ende: {{dayjs(currentItem.end).format("DD.MM.YYYY")}}<br></span> v-if="currentItem && mode == 'show'"
class="p-5"
Notizen:<br>
{{currentItem.note}}<br>
<template #footer>
<UButton
v-if="mode == 'show' && currentItem.id"
@click="editItem"
> >
Bearbeiten <template #item="{item}">
</UButton> <UCard class="mt-5">
</template> <div v-if="item.label === 'Informationen'">
<div class="truncate">
<p>Mitarbeiter: {{dataStore.profiles.find(item => item.id === currentItem.user) ? dataStore.profiles.find(item => item.id === currentItem.user).fullName : ""}}</p>
<p>Start: {{dayjs(currentItem.start).format("DD.MM.YYYY")}}</p>
<p>Ende: {{dayjs(currentItem.end).format("DD.MM.YYYY")}}</p>
<p>Grund: {{currentItem.reason}}</p>
<p>Notizen: {{currentItem.notes}}</p>
</div>
</div>
</UCard> </UCard>
<UCard v-else-if="mode == 'edit' || mode == 'create'" >
<template #header v-if="mode === 'edit'">
{{itemInfo.reason}}
</template> </template>
</UTabs>
<UForm v-else-if="mode == 'edit' || mode == 'create'" class="p-5" >
<UFormGroup <UFormGroup
label="Status:" label="Status:"
> >
@@ -196,31 +188,7 @@ setupPage()
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="updateItem"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('absenceRequests', itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</div>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,13 +1,47 @@
<template> <template>
<div id="main"> <UDashboardNavbar title="Abwesenheiten" :badge="filteredRows.length">
<template #right>
<UInput
id="searchinput"
v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..."
class="hidden lg:block"
@keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/employees/absenceRequests/create/`)">+ Abwesenheit</UButton> <UButton @click="router.push(`/absenceRequests/create`)">+ Abwesenheit</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<UTable <UTable
:rows="dataStore.absenceRequests" :rows="filteredRows"
:columns="columns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/absenceRequests/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Abwesenheiten anzuzeigen' }"
> >
<template #approved-data="{row}"> <template #approved-data="{row}">
<span v-if="!row.approved"> <span v-if="!row.approved">
@@ -30,8 +64,6 @@
{{dataStore.profiles.find(profile => profile.id === row.user) ? dataStore.profiles.find(profile => profile.id === row.user).fullName : ""}} {{dataStore.profiles.find(profile => profile.id === row.user) ? dataStore.profiles.find(profile => profile.id === row.user).fullName : ""}}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
@@ -40,11 +72,21 @@ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/absenceRequests/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
const columns = [ const templateColumns = [
{ {
key: "approved", key: "approved",
label: "Genehmigt", label: "Genehmigt",
@@ -73,10 +115,24 @@ const columns = [
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const searchString = ref('')
const filteredRows = computed(() => {
let items = dataStore.absenceRequests
if(!searchString.value) {
return items
}
return items.filter(item => {
return Object.values(item).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
})
})
})
const selectItem = (item) => {
router.push(`/employees/absenceRequests/show/${item.id} `)
}
</script> </script>
<style scoped> <style scoped>

View File

@@ -287,8 +287,6 @@ const calendarOptionsTimeline = reactive({
</UModal> </UModal>
<UDashboardPage>
<UDashboardPanel grow>
<UDashboardNavbar :title="currentItem ? currentItem.name : ''"> <UDashboardNavbar :title="currentItem ? currentItem.name : ''">
<template #right> <template #right>
@@ -306,9 +304,6 @@ const calendarOptionsTimeline = reactive({
:options="calendarOptionsTimeline" :options="calendarOptionsTimeline"
/> />
</div> </div>
</UDashboardPanel>
</UDashboardPage>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,22 +1,16 @@
<script setup> <script setup>
import HistoryDisplay from "~/components/HistoryDisplay.vue";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
// const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const id = ref(route.params.id ? route.params.id : null ) const id = ref(route.params.id ? route.params.id : null )
//Store
const dataStore = useDataStore()
let currentItem = null
let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
@@ -37,14 +31,7 @@ const setupPage = () => {
if(query.customer) itemInfo.value.customer = Number(query.customer) if(query.customer) itemInfo.value.customer = Number(query.customer)
if(query.vendor) itemInfo.value.vendor = Number(query.vendor) if(query.vendor) itemInfo.value.vendor = Number(query.vendor)
} }
}
const editCustomer = async () => {
router.push(`/contacts/edit/${currentItem.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -60,26 +47,36 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.fullName : (mode === 'create' ? 'Ansprechpartner erstellen' : 'Ansprechpartner bearbeiten')">
class="mb-3 font-bold text-2xl truncate" <template #right>
v-if="currentItem"
>Ansprechpartner: {{currentItem.fullName}}</h1>
<UTabs
:items="[{label: 'Informationen'}, {label: 'Logbuch'}]"
v-if="currentItem && mode == 'show'"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton <UButton
v-if="mode == 'show' && currentItem.id" v-if="mode === 'edit'"
@click="editCustomer" @click="dataStore.updateItem('contacts',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('contacts',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/contacts/edit/${currentItem.id}`)"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</Toolbar> </template>
<template #badge v-if="currentItem">
<UBadge <UBadge
v-if="currentItem.active" v-if="currentItem.active"
> >
@@ -91,6 +88,17 @@ setupPage()
> >
Kontakt inaktiv Kontakt inaktiv
</UBadge> </UBadge>
</template>
</UDashboardNavbar>
<UTabs
:items="[{label: 'Informationen'}, {label: 'Logbuch'}]"
v-if="currentItem && mode == 'show'"
class="p-5"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<div class="text-wrap mt-3"> <div class="text-wrap mt-3">
<p v-if="currentItem.customer">Kunde: <nuxt-link :to="`/customers/show/${currentItem.customer}`">{{dataStore.customers.find(customer => customer.id === currentItem.customer) ? dataStore.customers.find(customer => customer.id === currentItem.customer).name : "" }}</nuxt-link></p> <p v-if="currentItem.customer">Kunde: <nuxt-link :to="`/customers/show/${currentItem.customer}`">{{dataStore.customers.find(customer => customer.id === currentItem.customer) ? dataStore.customers.find(customer => customer.id === currentItem.customer).name : "" }}</nuxt-link></p>
@@ -115,11 +123,10 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode == 'edit' || mode == 'create'" > <UForm
<template #header> v-else-if="mode == 'edit' || mode == 'create'"
{{itemInfo.fullName}} class="p-5"
</template> >
<UFormGroup <UFormGroup
label="Anrede:" label="Anrede:"
> >
@@ -211,31 +218,7 @@ setupPage()
v-model="itemInfo.role" v-model="itemInfo.role"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('contacts',{...itemInfo, fullName: `${itemInfo.firstName} ${itemInfo.lastName}`})"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('contacts',{...itemInfo, fullName: `${itemInfo.firstName} ${itemInfo.lastName}`})"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,40 +1,48 @@
<template> <template>
<Toolbar> <UDashboardNavbar title="Ansprechpartner" :badge="filteredRows.length">
<UButton @click="router.push(`/contacts/create/`)">+ Kontakt</UButton> <template #right>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
@keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/contacts/create`)">+ Kontakt</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu <USelectMenu
v-model="selectedColumns" v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple multiple
:options="columnTemplate" class="hidden lg:block"
:uiMenu="{width:'w-40'}"
:popper="{placement: 'bottom-start'}"
by="key" by="key"
> >
<UButton <template #label>
color="gray" Spalten
variant="ghost"
class="flex-1 justify-between"
icon="i-heroicons-view-columns"
/>
<template #option="{ option }">
{{option.label}}
</template> </template>
</USelectMenu> </USelectMenu>
</Toolbar> </template>
</UDashboardToolbar>
<div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="selectedColumns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/contacts/show/${i.id}`)"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Ansprechpartner anzuzeigen' }"
> >
<template #active-data="{row}"> <template #active-data="{row}">
<span v-if="row.active" class="text-primary-500">Aktiv</span> <span v-if="row.active" class="text-primary-500">Aktiv</span>
@@ -47,8 +55,6 @@
{{dataStore.vendors.find(vendor => vendor.id === row.vendor) ? dataStore.vendors.find(vendor => vendor.id === row.vendor).name : ''}} {{dataStore.vendors.find(vendor => vendor.id === row.vendor) ? dataStore.vendors.find(vendor => vendor.id === row.vendor).name : ''}}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
@@ -57,11 +63,21 @@ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/contacts/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
const columnTemplate = ref([ const templateColumns = [
{ {
key: "fullName", key: "fullName",
@@ -102,30 +118,9 @@ const columnTemplate = ref([
key: "birtday", key: "birtday",
label: "Geburtstag", label: "Geburtstag",
} }
]) ]
const selectedColumns = ref([ const selectedColumns = ref(templateColumns)
{ const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
key: "fullName",
label: "Name",
sortable: true
},
{
key: "customer",
label: "Kunde",
sortable: true
},
{
key: "vendor",
label: "Lieferant",
sortable: true
},
])
const selectItem = (item) => {
router.push(`/contacts/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')

View File

@@ -6,19 +6,13 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const id = ref(route.params.id ? route.params.id : null ) const id = ref(route.params.id ? route.params.id : null )
//Store
const {customers, contracts } = storeToRefs(useDataStore())
let currentItem = ref(null) let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
const itemInfo = ref({ const itemInfo = ref({
@@ -39,14 +33,7 @@ const setupPage = () => {
let query = route.query let query = route.query
if(query.customer) itemInfo.value.customer = Number(query.customer) if(query.customer) itemInfo.value.customer = Number(query.customer)
} }
}
const editCustomer = async () => {
router.push(`/contracts/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -61,13 +48,40 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Vertrag erstellen' : 'Vertrag bearbeiten')">
class="mb-3 truncate font-bold text-2xl" <template #right>
v-if="currentItem" <UButton
>Vertrag: {{currentItem.name}}</h1> v-if="mode === 'edit'"
@click="dataStore.updateItem('contracts',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('contracts',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/contracts/edit/${currentItem.id}`)"
>
Bearbeiten
</UButton>
</template>
</UDashboardNavbar>
<UTabs <UTabs
v-if="currentItem && mode === 'show'" v-if="currentItem && mode === 'show'"
:items="[{label: 'Informationen'}, {label: 'Logbuch'}, {label: 'Dokumente'}]" :items="[{label: 'Informationen'}, {label: 'Logbuch'}, {label: 'Dokumente'}]"
class="p-5"
> >
<template #item="{item}"> <template #item="{item}">
<UCard class="mt-5"> <UCard class="mt-5">
@@ -125,7 +139,7 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode == 'edit' || mode == 'create'" > <UForm v-else-if="mode == 'edit' || mode == 'create'" class="p-5" >
<UFormGroup <UFormGroup
label="Name:" label="Name:"
@@ -142,7 +156,7 @@ setupPage()
v-model="itemInfo.customer" v-model="itemInfo.customer"
option-attribute="name" option-attribute="name"
value-attribute="id" value-attribute="id"
:options="customers" :options="dataStore.customers"
searchable searchable
:search-attributes="['name']" :search-attributes="['name']"
> >
@@ -166,31 +180,7 @@ setupPage()
v-model="itemInfo.description" v-model="itemInfo.description"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('contracts',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('contracts',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,43 +1,75 @@
<template> <template>
<div id="main"> <UDashboardNavbar title="Verträge" :badge="filteredRows.length">
<!-- TODO: Kontakte erstellen und dem Kunden zuweisen --> <template #right>
<div class="flex items-center gap-1">
<UButton @click="router.push(`/contracts/create/`)">+ Vertrag</UButton>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</div> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/contracts/create`)">+ Vertrag</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="itemColumns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/contracts/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Verträge anzuzeigen' }"
> >
<template #customer-data="{row}"> <template #customer-data="{row}">
{{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : row.customer }} {{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : row.customer }}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/contracts/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
const itemColumns = [ const templateColumns = [
{ {
key: 'customer', key: 'customer',
label: "Kundennr.:", label: "Kundennr.:",
@@ -53,15 +85,11 @@ const itemColumns = [
label: "Beschreibung" label: "Beschreibung"
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const selectItem = (item) => {
router.push(`/contracts/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')
const filteredRows = computed(() => { const filteredRows = computed(() => {
if(!searchString.value) { if(!searchString.value) {
return dataStore.contracts return dataStore.contracts

View File

@@ -1,17 +1,13 @@
<script setup> <script setup>
import HistoryDisplay from "~/components/HistoryDisplay.vue";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
const supabase = useSupabaseClient() const dataStore = useDataStore()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const id = ref(route.params.id ? route.params.id : null ) const id = ref(route.params.id ? route.params.id : null )
const numberRange = useNumberRange("customers")
const dataStore = useDataStore()
let currentItem = ref(null) let currentItem = ref(null)
@@ -34,13 +30,10 @@ const setupPage = async () => {
} }
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
} }
const editCustomer = async () => { const editItem = async () => {
router.push(`/customers/edit/${currentItem.value.id}`) await router.push(`/customers/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -56,26 +49,36 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Kunde erstellen' : 'Kunde bearbeiten')">
class="mb-3 font-bold text-3xl truncate" <template #right>
v-if="currentItem "
>Kunde: {{currentItem.name}}</h1>
<UTabs
v-if="currentItem && mode == 'show'"
:items="[{label: 'Informationen'}, {label: 'Logbuch'}, {label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}, {label: 'Ansprechpartner'}]"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton <UButton
v-if="mode == 'show' && currentItem.id" v-if="mode === 'edit'"
@click="editCustomer" @click="dataStore.updateItem('customers',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('customers',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="editItem"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</Toolbar> </template>
<template #badge v-if="currentItem">
<UBadge <UBadge
v-if="currentItem.active" v-if="currentItem.active"
> >
@@ -87,6 +90,18 @@ setupPage()
> >
Kunde gesperrt Kunde gesperrt
</UBadge> </UBadge>
</template>
</UDashboardNavbar>
<UTabs
v-if="currentItem && mode == 'show'"
:items="[{label: 'Informationen'}, {label: 'Logbuch'}, {label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}, {label: 'Ansprechpartner'}]"
class="p-5"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<div class="text-wrap"> <div class="text-wrap">
<p>Kundennummer: {{currentItem.customerNumber}}</p> <p>Kundennummer: {{currentItem.customerNumber}}</p>
@@ -183,12 +198,7 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UForm v-else-if="mode === 'edit' || mode === 'create'" class="p-5">
<UCard v-else-if="mode === 'edit' || mode === 'create'" >
<template #header v-if="mode === 'edit'">
<UBadge>{{itemInfo.customerNumber}}</UBadge>{{itemInfo.name}}
</template>
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -288,36 +298,11 @@ setupPage()
v-model="itemInfo.infoData.ustid" v-model="itemInfo.infoData.ustid"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('customers', itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('customers',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>
td {
padding: 0.2em;
}
</style> </style>

View File

@@ -1,64 +1,80 @@
<template> <template>
<UDashboardNavbar title="Kunden" :badge="filteredRows.length">
<template #right>
<UInput
ref="searchinput"
v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..."
class="hidden lg:block"
@keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<Toolbar>
<UButton @click="router.push(`/customers/create/`)">+ Kunde</UButton> <UButton @click="router.push(`/customers/create/`)">+ Kunde</UButton>
<UInput </template>
v-model="searchString" </UDashboardNavbar>
placeholder="Suche..."
/>
<UDashboardToolbar>
<template #right>
<USelectMenu <USelectMenu
v-model="selectedColumns" v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple multiple
:options="columnTemplate" class="hidden lg:block"
:uiMenu="{width:'w-40'}"
:popper="{placement: 'bottom-start'}"
by="key" by="key"
> >
<UButton <template #label>
color="gray" Spalten
variant="ghost"
class="flex-1 justify-between"
icon="i-heroicons-view-columns"
/>
<template #option="{ option }">
{{option.label}}
</template> </template>
</USelectMenu> </USelectMenu>
</Toolbar> </template>
</UDashboardToolbar>
<div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="selectedColumns" :columns="columns"
@select="selectItem" class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" @select="(i) => router.push(`/customers/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Kunden anzuzeigen' }"
> >
<template #active-data="{row}"> <template #active-data="{row}">
<span v-if="row.active" class="text-primary-500">Aktiv</span> <span v-if="row.active" class="text-primary-500">Aktiv</span>
<span v-else class="text-rose">Gesperrt</span> <span v-else class="text-rose-500">Gesperrt</span>
</template> </template>
<template #address-data="{row}"> <template #address-data="{row}">
{{row.infoData.street}}, {{row.infoData.special ? `${row.infoData.special},` : ''}} {{row.infoData.zip}} {{row.infoData.city}}, {{row.infoData.country}} {{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{(row.infoData.zip || row.infoData.city) ? `${row.infoData.zip} ${row.infoData.city}, ` : ''}} {{row.infoData.country}}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/customers/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
const columnTemplate = ref([ const templateColumns = [
{ {
key: 'customerNumber', key: 'customerNumber',
label: "Kundennr.", label: "Kundennr.",
@@ -84,26 +100,9 @@ const columnTemplate = ref([
label: "Adresse", label: "Adresse",
sortable: true sortable: true
} }
]) ]
const selectedColumns = ref([ const selectedColumns = ref(templateColumns)
{ const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
key: 'customerNumber',
label: "Kundennr.",
sortable: true
},
{
key: "name",
label: "Name",
sortable: true
},
])
const selectItem = (customer) => {
console.log(customer)
router.push(`/customers/show/${customer.id} `)
}
const searchString = ref('') const searchString = ref('')

View File

@@ -110,14 +110,20 @@ const downloadSelected = async () => {
</script> </script>
<template> <template>
<div> <UDashboardNavbar
<Toolbar> title="Dokumente"
>
</UDashboardNavbar>
<UDashboardToolbar>
<template #left>
<UButton @click="uploadModalOpen = true">Hochladen</UButton> <UButton @click="uploadModalOpen = true">Hochladen</UButton>
<UButton <UButton
@click="downloadSelected" @click="downloadSelected"
:disabled="dataStore.documents.filter(doc => doc.selected).length === 0" :disabled="dataStore.documents.filter(doc => doc.selected).length === 0"
>Herunterladen</UButton> >Herunterladen</UButton>
</template>
<template #right>
<USelectMenu <USelectMenu
:options="tags" :options="tags"
v-model="selectedTags" v-model="selectedTags"
@@ -127,10 +133,16 @@ const downloadSelected = async () => {
{{selectedTags}} {{selectedTags}}
</template> </template>
</USelectMenu> </USelectMenu>
</template>
</UDashboardToolbar>
</Toolbar>
<div class="scrollList"> <div class="scrollList">
<DocumentList
:documents="filteredDocuments"
/>
</div>
<USlideover <USlideover
v-model="uploadModalOpen" v-model="uploadModalOpen"
> >
@@ -178,12 +190,6 @@ const downloadSelected = async () => {
</template> </template>
</UCard> </UCard>
</USlideover> </USlideover>
<DocumentList
:documents="filteredDocuments"
/>
</div>
</div>
</template> </template>

View File

@@ -6,7 +6,6 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
@@ -28,13 +27,6 @@ const setupPage = () => {
} }
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
}
const editItem = async () => {
router.push(`/inventoryitems/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -43,34 +35,50 @@ const cancelEditorCreate = () => {
} else { } else {
router.push(`/inventoryitems`) router.push(`/inventoryitems`)
} }
} }
setupPage() setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Inventartikel erstellen' : 'Inventartikel bearbeiten')">
class="text-center my-3 font-bold text-2xl" <template #right>
v-if="currentItem " <UButton
>{{currentItem.name}}</h1> v-if="mode === 'edit'"
@click="dataStore.updateItem('inventoryitems',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('inventoryitems',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click=" router.push(`/inventoryitems/edit/${currentItem.id}`)"
>
Bearbeiten
</UButton>
</template>
</UDashboardNavbar>
<UTabs <UTabs
:items="[{label: 'Informationen'}, {label: 'Logbuch'}]" :items="[{label: 'Informationen'}, {label: 'Logbuch'}]"
v-if="currentItem && mode == 'show'" v-if="currentItem && mode == 'show'"
class="p-5"
> >
<template #item="{item}"> <template #item="{item}">
<UCard class="mt-5"> <UCard class="mt-5">
<div v-if="item.label === 'Informationen'"> <div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton
v-if="mode === 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
</Toolbar>
<div class="text-wrap"> <div class="text-wrap">
<p v-if="currentItem.currentSpace">Lagerplatz: {{dataStore.getSpaceById(currentItem.currentSpace).spaceNumber}} - {{dataStore.getSpaceById(currentItem.currentSpace).description}}</p> <p v-if="currentItem.currentSpace">Lagerplatz: {{dataStore.getSpaceById(currentItem.currentSpace).spaceNumber}} - {{dataStore.getSpaceById(currentItem.currentSpace).description}}</p>
@@ -87,11 +95,10 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode == 'edit' || mode == 'create'" > <UForm
<template #header v-if="mode === 'edit'"> v-else-if="mode == 'edit' || mode == 'create'"
{{itemInfo.name}} class="p-5"
</template> >
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -123,31 +130,7 @@ setupPage()
v-model="itemInfo.description" v-model="itemInfo.description"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('inventoryitems',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('inventoryitems',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,29 +1,52 @@
<template> <template>
<div> <UDashboardNavbar title="Inventar" :badge="filteredRows.length">
<template #right>
<div class="flex items-center gap-1">
<UButton @click="router.push(`/inventoryitems/create/`)">+ Inventarartikel</UButton>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</div> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/inventoryitems/create`)">+ Inventarartikel</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
@select="selectItem" :columns="columns"
:columns="itemColumns" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/inventoryitems/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Inventarartikel anzuzeigen' }"
> >
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
@@ -31,11 +54,22 @@
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/tasks/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const router = useRouter() const router = useRouter()
const itemColumns = [ const templateColumns = [
{ {
key: "name", key: "name",
label: "Name", label: "Name",
@@ -47,14 +81,11 @@ const itemColumns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const selectItem = (item) => {
console.log(item)
router.push(`/inventoryitems/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')
const filteredRows = computed(() => { const filteredRows = computed(() => {
if(!searchString.value) { if(!searchString.value) {
return dataStore.inventoryitems return dataStore.inventoryitems

View File

@@ -1,262 +0,0 @@
<script setup>
import FullCalendar from "@fullcalendar/vue3"
import resourceTimelinePlugin from '@fullcalendar/resource-timeline'
import deLocale from '@fullcalendar/core/locales/de'
import interactionPlugin from '@fullcalendar/interaction'
import listPlugin from '@fullcalendar/list';
import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
})
const viewport = useViewport()
watch(viewport.breakpoint, (newBreakpoint, oldBreakpoint) => {
console.log('Breakpoint updated:', oldBreakpoint, '->', newBreakpoint)
})
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const resources = dataStore.getResources
const eventTypes = dataStore.getEventTypes
const events = dataStore.getEvents
const openNewEventModal = ref(false)
const showEventModal = ref(false)
const newEventData = ref({
resourceId: "",
resourceType: "",
title: "",
type: "Umsetzung",
start: "",
end: null
})
const selectedEvent = ref({})
const createEvent = async () => {
const {data,error} = await supabase
.from("events")
.insert([newEventData.value])
.select()
if(error) {
console.log(error)
}
console.log("OK")
openNewEventModal.value = false
newEventData.value = {}
dataStore.fetchEvents()
}
const calendarOptionsList = reactive({
locale: deLocale,
plugins: [listPlugin],
initialView: "listWeek",
initialEvents: events,
nowIndicator: true,
height: "80vh"
})
const calendarOptionsTimeline = reactive({
schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
locale: deLocale,
plugins: [resourceTimelinePlugin, interactionPlugin],
initialView: "resourceTimeline3Hours",
headerToolbar: {
left: 'prev,next',
center: 'title',
right: 'resourceTimelineDay,resourceTimeline3Hours,resourceTimelineMonth'
},
initialEvents: events,
selectable: true,
weekNumbers: true,
select: function (info) {
//console.log(info)
newEventData.value.resourceId = info.resource.id
if(info.resource.extendedProps){
newEventData.value.resourceType = info.resource.extendedProps.type
}
newEventData.value.start = info.startStr
newEventData.value.end = info.endStr
openNewEventModal.value = true
},
eventClick: function (info){
selectedEvent.value = info.event
showEventModal.value = true
console.log(info)
},
resourceGroupField: "type",
resources: resources,
nowIndicator:true,
views: {
resourceTimeline3Hours: {
type: 'resourceTimeline',
slotDuration: {hours: 3},
slotMinTime: "06:00:00",
slotMaxTime: "21:00:00",
duration: {days:7},
buttonText: "Woche",
visibleRange: function(currentDate) {
// Generate a new date for manipulating in the next step
var startDate = new Date(currentDate);
var endDate = new Date(currentDate);
// Adjust the start & end dates, respectively
startDate.setDate(startDate.getDate() - startDate.getDay() +1); // One day in the past
endDate.setDate(startDate.getDate() + 5); // Two days into the future
return { start: startDate, end: endDate };
}
}
},
})
</script>
<template>
<UDashboardPage>
<UDashboardPanel grow>
<UDashboardNavbar :title="currentItem ? currentItem.name : ''">
<template #right>
</template>
</UDashboardNavbar>
<div v-if="viewport.isLessThan('tablet')">
<FullCalendar
:options="calendarOptionsList"
/>
</div>
<div v-else>
<FullCalendar
:options="calendarOptionsTimeline"
/>
</div>
</UDashboardPanel>
</UDashboardPage>
<div>
<UModal
v-model="openNewEventModal"
>
<UCard>
<template #header>
Neuen Termin erstellen
</template>
<UFormGroup
label="Resource:"
>
<USelectMenu
v-model="newEventData.resourceId"
:options="resources"
value-attribute="id"
option-attribute="title"
>
<template #label>
<span>{{ resources.find(resource => resource.id === newEventData.resourceId).title }}</span>
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Titel:"
>
<UInput
v-model="newEventData.title"
/>
</UFormGroup>
<UFormGroup
label="Projekt:"
>
<USelectMenu
v-model="newEventData.project"
:options="dataStore.projects"
option-attribute="name"
value-attribute="id"
searchable
searchable-placeholder="Suche..."
:search-attributes="['name']"
>
<template #label>
{{dataStore.getProjectById(newEventData.project) ? dataStore.getProjectById(newEventData.project).name : "Kein Projekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Typ:"
>
<USelectMenu
v-model="newEventData.type"
:options="eventTypes"
option-attribute="label"
value-attribute="label"
>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Start:"
>
<UInput
v-model="newEventData.start"
/>
</UFormGroup>
<UFormGroup
label="Ende:"
>
<UInput
v-model="newEventData.end"
/>
</UFormGroup>
<template #footer>
<UButton
@click="createEvent"
>
Erstellen
</UButton>
</template>
</UCard>
</UModal>
<UModal
v-model="showEventModal"
>
<UCard>
<template #header>
{{selectedEvent.title}}
</template>
Start: {{dayjs(selectedEvent.startStr).format("DD.MM.YYYY HH:mm")}}<br>
Ende: {{dayjs(selectedEvent.endStr).format("DD.MM.YYYY HH:mm")}}
<DevOnly>
<UDivider class="my-3"/>
{{selectedEvent}}
</DevOnly>
</UCard>
</UModal>
</div>
</template>
<style scoped>
</style>

View File

@@ -9,7 +9,6 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
@@ -53,17 +52,7 @@ const setupPage = () => {
if(mode.value === "create") { if(mode.value === "create") {
let query = route.query let query = route.query
if(query.customer) itemInfo.value.customer = Number(query.customer) if(query.customer) itemInfo.value.customer = Number(query.customer)
} }
}
const editItem = async () => {
await router.push(`/plants/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -79,24 +68,45 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Objekt erstellen' : 'Objekt bearbeiten')">
class="mb-3 truncate font-bold text-2xl" <template #right>
v-if="currentItem "
>Objekt: {{currentItem.name}}</h1>
<div v-if="currentItem && mode == 'show'">
<UTabs :items="tabItems">
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton <UButton
v-if="mode == 'show' && currentItem.id" v-if="mode === 'edit'"
@click="editItem" @click="dataStore.updateItem('plants',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('plants',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/plants/edit/${currentItem.id}`)"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</Toolbar> </template>
</UDashboardNavbar>
<UTabs
:items="tabItems"
v-if="mode === 'show'"
class="p-5"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<div class="text-wrap"> <div class="text-wrap">
<p>Kunde: <nuxt-link :to="`/customers/show/${currentItem.customer}`">{{dataStore.getCustomerById(currentItem.customer).name}}</nuxt-link></p> <p>Kunde: <nuxt-link :to="`/customers/show/${currentItem.customer}`">{{dataStore.getCustomerById(currentItem.customer).name}}</nuxt-link></p>
</div> </div>
@@ -153,67 +163,6 @@ setupPage()
/> />
</Toolbar> </Toolbar>
<!-- <UModal
v-model="uploadModalOpen"
>
<UCard class="p-4">
<template #header>
Datei hochladen
</template>
<UFormGroup
label="Datei:"
>
<UInput
type="file"
id="fileUploadInput"
/>
</UFormGroup>
&lt;!&ndash; <UFormGroup
label="Name:"
class="mt-3"
>
<UInput
v-model="fileUploadFormData.name"
/>
</UFormGroup>&ndash;&gt;
<UFormGroup
label="Tags:"
class="mt-3"
>
<USelectMenu
multiple
searchable
searchable-placeholder="Suchen..."
:options="tags"
v-model="fileUploadFormData.tags"
/>
</UFormGroup>
&lt;!&ndash;<UFormGroup
label="Ordner:"
class="mt-3"
>
<USelectMenu
:options="folders"
v-model="fileUploadFormData.folder"
value-attribute="label"
/>
</UFormGroup>&ndash;&gt;
<template #footer>
<UButton
class="mt-3"
@click="uploadFiles"
>Hochladen</UButton>
</template>
</UCard>
</UModal>-->
<DocumentList :documents="dataStore.getDocumentsByPlantId(currentItem.id)"/> <DocumentList :documents="dataStore.getDocumentsByPlantId(currentItem.id)"/>
</div> </div>
@@ -221,29 +170,20 @@ setupPage()
<Editor/> <Editor/>
</div> </div>
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<div v-if="currentItem && mode == 'show'">
</div> </div>
<UForm
<!-- <UCard v-if="currentItem && mode == 'show'"> v-else-if="mode === 'edit' || mode === 'create'"
<template #header> class="p-5"
{{currentItem.name}} >
</template>
</UCard>-->
<UCard v-else-if="mode === 'edit' || mode === 'create'">
<template #header v-if="mode === 'edit'">
{{itemInfo.name}}
</template>
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -268,34 +208,7 @@ setupPage()
</template> </template>
</USelectMenu> </USelectMenu>
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('plants',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('plants', itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,25 +1,62 @@
<template> <template>
<Toolbar> <UDashboardNavbar title="Objekte" :badge="filteredRows.length">
<UButton @click="router.push(`/plants/create/`)">+ Objekt</UButton> <template #right>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</Toolbar> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/plants/create`)">+ Objekt</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #left>
<UCheckbox
label="Erledigte Anzeigen"
v-model="showDone"
/>
</template>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="columns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/plants/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Objekte anzuzeigen' }"
> >
<template #customer-data="{row}"> <template #customer-data="{row}">
{{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : "" }} {{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : "" }}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
@@ -29,11 +66,21 @@ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/plants/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
const columns = [ const templateColumns = [
{ {
key: "name", key: "name",
label: "Name", label: "Name",
@@ -44,6 +91,9 @@ const columns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const searchString = ref('') const searchString = ref('')

View File

@@ -8,7 +8,6 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
@@ -16,8 +15,6 @@ const id = ref(route.params.id ? route.params.id : null )
let currentItem = ref(null) let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
const itemInfo = ref({ const itemInfo = ref({
@@ -33,51 +30,60 @@ const setupPage = () => {
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
}
const editItem = async () => {
router.push(`/products/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
mode.value = "show" if(currentItem.value) {
itemInfo.value = { router.push(`/products/show/${currentItem.value.id}`)
id: 0, } else {
router.push(`/products/`)
} }
} }
setupPage() setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Artikel erstellen' : 'Artikel bearbeiten')">
class="mb-3 truncate font-bold text-2xl" <template #right>
v-if="currentItem " <UButton
>Artikel: {{currentItem.name}}</h1> v-if="mode === 'edit'"
@click="dataStore.updateItem('products',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('products',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click=" router.push(`/products/edit/${currentItem.id}`)"
>
Bearbeiten
</UButton>
</template>
</UDashboardNavbar>
<UTabs <UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'},{label: 'Dokumente'}]" :items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'},{label: 'Dokumente'}]"
v-if="mode === 'show'" v-if="mode === 'show'"
class="p-5"
> >
<template #item="{item}"> <template #item="{item}">
<UCard class="mt-5"> <UCard class="mt-5">
<div <div
v-if="item.label === 'Informationen'" v-if="item.label === 'Informationen'"
> >
<Toolbar>
<UButton
v-if="mode === 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
</Toolbar>
<UBadge <UBadge
v-for="tag in currentItem.tags" v-for="tag in currentItem.tags"
class="mr-2" class="mr-2"
@@ -121,11 +127,10 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode == 'edit' || mode == 'create'" > <UForm
<template #header v-if="mode === 'edit'"> v-else-if="mode == 'edit' || mode == 'create'"
{{itemInfo.name}} class="p-5"
</template> >
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -161,7 +166,11 @@ setupPage()
v-model="itemInfo.tags" v-model="itemInfo.tags"
:options="dataStore.ownTenant.tags.products" :options="dataStore.ownTenant.tags.products"
multiple multiple
/> >
<template #label>
{{itemInfo.tags.join(", ")}}
</template>
</USelectMenu>
</UFormGroup> </UFormGroup>
<UFormGroup <UFormGroup
label="EAN:" label="EAN:"
@@ -190,31 +199,7 @@ setupPage()
</template> </template>
</UInput> </UInput>
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('products',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('products',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,20 +1,50 @@
<template> <template>
<Toolbar> <UDashboardNavbar title="Artikel" :badge="filteredRows.length">
<UButton @click="router.push(`/products/create/`)">+ Artikel</UButton> <template #right>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</Toolbar> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/products/create`)">+ Artikel</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<div class="table"> <div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="itemColumns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/products/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
> >
<template #stock-data="{row}"> <template #stock-data="{row}">
{{`${dataStore.getStockByProductId(row.id)} ${(dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : "")}`}} {{`${dataStore.getStockByProductId(row.id)} ${(dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : "")}`}}
@@ -45,11 +75,22 @@
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/products/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const router = useRouter() const router = useRouter()
const itemColumns = [ const templateColumns = [
{ {
key: "stock", key: "stock",
label: "Bestand" label: "Bestand"
@@ -80,11 +121,8 @@ const itemColumns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns)
const selectItem = (item) => { const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
console.log(item)
router.push(`/products/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')

View File

@@ -82,12 +82,6 @@ const itemInfo = ref({
customer: 0, customer: 0,
users: [user.value.id] users: [user.value.id]
}) })
const uploadModalOpen = ref(false)
const fileUploadFormData = ref({
tags: ["Dokument"],
project: null
})
const tags = dataStore.getDocumentTags const tags = dataStore.getDocumentTags
@@ -109,13 +103,6 @@ const setupPage = () => {
itemInfo.value.customer = dataStore.getPlantById(itemInfo.value.plant).customer itemInfo.value.customer = dataStore.getPlantById(itemInfo.value.plant).customer
} }
} }
}
const editItem = async () => {
router.push(`/projects/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -126,32 +113,6 @@ const cancelEditorCreate = () => {
} }
} }
const updateItem = async () => {
const {error} = await supabase
.from("projects")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
}
router.push(`/projects/show/${currentItem.value.id}`)
toast.add({title: "Projekt erfolgreich gespeichert"})
dataStore.fetchProjects()
}
const uploadFiles = async () => {
//uploadInProgress.value = true;
await dataStore.uploadFiles({...fileUploadFormData.value, project: currentItem.value.id}, document.getElementById("fileUploadInput").files)
uploadModalOpen.value = false;
//uploadInProgress.value = false;
}
const projectHours = () => { const projectHours = () => {
let hours = 0 let hours = 0
dataStore.getTimesByProjectId(currentItem.value.id).forEach(item => { dataStore.getTimesByProjectId(currentItem.value.id).forEach(item => {
@@ -212,21 +173,45 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Projekt erstellen' : 'Projekt bearbeiten')">
class="mb-3 truncate font-bold text-2xl" <template #right>
v-if="currentItem "
>Projekt: {{currentItem.name}}</h1>
<UTabs :items="tabItems" class="w-full" v-if="currentItem && mode == 'show'">
<template #item="{ item }">
<UCard class="mt-5">
<div v-if="item.key === 'information'">
<Toolbar>
<UButton <UButton
@click="editItem" v-if="mode === 'edit'"
@click="dataStore.updateItem('projects',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('projects',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/projects/edit/${currentItem.id}`)"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</Toolbar> </template>
</UDashboardNavbar>
<UTabs
:items="tabItems"
v-if="currentItem && mode == 'show'"
class="p-5"
>
<template #item="{ item }">
<UCard class="mt-5">
<div v-if="item.key === 'information'">
<div class="text-wrap"> <div class="text-wrap">
@@ -391,11 +376,7 @@ setupPage()
</UTabs> </UTabs>
<UCard v-else-if="mode === 'edit' || mode === 'create'" > <UForm v-else-if="mode === 'edit' || mode === 'create'" class="p-5" >
<template #header v-if="mode === 'edit'">
{{itemInfo.name}}
</template>
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -477,32 +458,7 @@ setupPage()
v-model="itemInfo.notes" v-model="itemInfo.notes"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('projects',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('projects',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,25 +1,60 @@
<template> <template>
<InputGroup > <UDashboardNavbar title="Projekte" :badge="filteredRows.length">
<UButton @click="router.push(`/projects/create/`)">+ Projekt</UButton> <template #right>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
@keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/projects/create`)">+ Projekt</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #left>
<UCheckbox <UCheckbox
label="Abgeschlossene anzeigen" label="Abgeschlossene anzeigen"
v-model="showFinished" v-model="showFinished"
/> />
</InputGroup> </template>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
@select="selectItem" :columns="columns"
:columns="itemColumns" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/projects/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Projekte anzuzeigen' }"
> >
<template #phase-data="{row}"> <template #phase-data="{row}">
{{getActivePhaseLabel(row)}} {{getActivePhaseLabel(row)}}
@@ -34,20 +69,29 @@
{{row.users.map(i => dataStore.getProfileById(i).fullName).join(", ")}} {{row.users.map(i => dataStore.getProfileById(i).fullName).join(", ")}}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/projects/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const router = useRouter() const router = useRouter()
const itemColumns = [ const templateColumns = [
{ {
key: "phase", key: "phase",
label: "Phase" label: "Phase"
@@ -80,11 +124,9 @@ const itemColumns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const selectItem = (item) => {
console.log(item)
router.push(`/projects/show/${item.id} `)
}
const getActivePhaseLabel = (item) => { const getActivePhaseLabel = (item) => {
if(item.phases) { if(item.phases) {
@@ -125,18 +167,10 @@ const filteredRows = computed(() => {
return items return items
} }
return items.filter(project => { return items.filter(project => {
return Object.values(project).some((value) => { return Object.values(project).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase()) return String(value).toLowerCase().includes(searchString.value.toLowerCase())
}) })
}) })
}) })
</script> </script>
<style scoped>
</style>

View File

@@ -1,14 +1,9 @@
<script setup> <script setup>
import HistoryDisplay from "~/components/HistoryDisplay.vue";
import DocumentList from "~/components/DocumentList.vue";
import DocumentUpload from "~/components/DocumentUpload.vue";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
@@ -16,8 +11,6 @@ const id = ref(route.params.id ? route.params.id : null )
let currentItem = ref(null) let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
const itemInfo = ref({ const itemInfo = ref({
@@ -32,21 +25,13 @@ const setupPage = () => {
} }
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
}
const editItem = async () => {
router.push(`/services/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
mode.value = "show" if(currentItem.value) {
itemInfo.value = { router.push(`/services/show/${currentItem.value.id}`)
id: 0, } else {
router.push(`/services/`)
} }
} }
@@ -56,13 +41,40 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Leistung erstellen' : 'Leistung bearbeiten')">
class="mb-3 truncate font-bold text-2xl" <template #right>
v-if="currentItem " <UButton
>Leistung: {{currentItem.name}}</h1> v-if="mode === 'edit'"
@click="dataStore.updateItem('services',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('services',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/services/edit/${currentItem.id}`)"
>
Bearbeiten
</UButton>
</template>
</UDashboardNavbar>
<UTabs <UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Dokumente'}]" :items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Dokumente'}]"
v-if="mode === 'show'" v-if="mode === 'show'"
class="p-5"
> >
<template #item="{item}"> <template #item="{item}">
<UCard class="mt-5"> <UCard class="mt-5">
@@ -86,7 +98,7 @@ setupPage()
<UDivider <UDivider
class="my-2" class="my-2"
/>--> />-->
<span v-if="currentItem.sellingPrice">Verkaufspreis: {{Number(currentItem.sellingPrice).toFixed(2)}} <br></span> <span v-if="currentItem.sellingPrice">Verkaufspreis: {{String(Number(currentItem.sellingPrice).toFixed(2)).replace(".",",")}} <br></span>
</div> </div>
<div <div
@@ -120,11 +132,10 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode == 'edit' || mode == 'create'" > <UForm
<template #header v-if="mode === 'edit'"> v-else-if="mode == 'edit' || mode == 'create'"
{{itemInfo.name}} class="p-5"
</template> >
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -179,31 +190,7 @@ setupPage()
</template> </template>
</UInput> </UInput>
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('products',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('products',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,34 +1,54 @@
<template> <template>
<Toolbar> <UDashboardNavbar title="Leistungen" :badge="filteredRows.length">
<UButton @click="router.push(`/services/create/`)">+ Leistung</UButton> <template #right>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</Toolbar> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/services/create`)">+ Leistung</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<div class="table"> <div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="itemColumns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/services/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Leistungen anzuzeigen' }"
> >
<template #sellingPrice-data="{row}"> <template #sellingPrice-data="{row}">
{{row.sellingPrice ? Number(row.sellingPrice).toFixed(2) + " €" : ""}} {{row.sellingPrice ? Number(row.sellingPrice).toFixed(2) + " €" : ""}}
</template> </template>
<!-- <template #tags-data="{row}">
<UBadge
v-if="row.tags.length > 0"
v-for="tag in row.tags"
class="mr-2"
>
{{tag}}
</UBadge>
<span v-else>-</span>
</template>-->
<template #unit-data="{row}"> <template #unit-data="{row}">
{{dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : row.unit}} {{dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : row.unit}}
</template> </template>
@@ -38,15 +58,26 @@
</template> </template>
<script setup> <script setup>
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/services/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient() const supabase = useSupabaseClient()
const router = useRouter() const router = useRouter()
const itemColumns = [ const templateColumns = [
{ {
key: "name", key: "name",
label: "Name", label: "Name",
@@ -68,11 +99,8 @@ const itemColumns = [
sortable: true sortable: true
}*/ }*/
] ]
const selectedColumns = ref(templateColumns)
const selectItem = (item) => { const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
console.log(item)
router.push(`/services/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')
@@ -87,8 +115,6 @@ const filteredRows = computed(() => {
}) })
}) })
}) })
</script> </script>
<style scoped> <style scoped>

View File

@@ -6,17 +6,12 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const id = ref(route.params.id ? route.params.id : null ) const id = ref(route.params.id ? route.params.id : null )
const numberRange = useNumberRange("spaces")
let currentItem = ref(null) let currentItem = ref(null)
let currentNumberRange = null
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
@@ -38,35 +33,16 @@ const setupPage = async () => {
spaceMovements.value.forEach(movement => { spaceMovements.value.forEach(movement => {
if(spaceProducts.value.filter(product => product.id === movement.productId).length === 0) spaceProducts.value.push(dataStore.getProductById(movement.productId)) if(spaceProducts.value.filter(product => product.id === movement.productId).length === 0) spaceProducts.value.push(dataStore.getProductById(movement.productId))
}) })
} }
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
}
const editItem = async () => {
router.push(`/inventory/spaces/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
router.push(`/inventory/spaces/`) if(currentItem.value) {
} router.push(`/spaces/show/${currentItem.value.id}`)
const updateItem = async () => {
const {error} = await supabase
.from("spaces")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
} else { } else {
mode.value = "show" router.push(`/spaces/`)
itemInfo.value = {}
toast.add({title: "Lagerplatz erfolgreich gespeichert"})
dataStore.fetchSpaces()
} }
} }
@@ -76,13 +52,9 @@ function getSpaceProductCount(productId) {
productMovements.forEach(movement => count += movement.quantity) productMovements.forEach(movement => count += movement.quantity)
return count return count
} }
const printSpaceLabel = async () => { const printSpaceLabel = async () => {
axios axios
.post(`http://${dataStore.ownTenant.value.labelPrinterIp}/pstprnt`, `^XA^FO10,20^BCN,100^FD${currentItem.value.spaceNumber}^XZ` ) .post(`http://${dataStore.ownTenant.value.labelPrinterIp}/pstprnt`, `^XA^FO10,20^BCN,100^FD${currentItem.value.spaceNumber}^XZ` )
.then(console.log) .then(console.log)
@@ -94,33 +66,44 @@ setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Lagerplatz erstellen' : 'Lagerplatz bearbeiten')">
class="mb-3 truncate font-bold text-2xl" <template #right>
v-if="currentItem " <UButton
>Lagerplatz: {{currentItem.spaceNumber}}</h1> v-if="mode === 'edit'"
@click="dataStore.updateItem('spaces',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('spaces',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click=" router.push(`/inventory/spaces/edit/${currentItem.id}`)"
>
Bearbeiten
</UButton>
</template>
</UDashboardNavbar>
<UTabs <UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'}]" :items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'}]"
v-if="currentItem && mode == 'show'" v-if="currentItem && mode == 'show'"
class="p-5"
> >
<template #item="{item}"> <template #item="{item}">
<UCard class="mt-5"> <UCard class="mt-5">
<div v-if="item.label === 'Informationen'"> <div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton
v-if="mode == 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
<UButton
v-if="mode == 'show' && currentItem.id"
@click="printSpaceLabel"
class="ml-2"
>
Label Drucken
</UButton>
</Toolbar>
<div class="truncate"> <div class="truncate">
<span>Beschreibung: {{currentItem.description}}</span> <span>Beschreibung: {{currentItem.description}}</span>
</div> </div>
@@ -153,11 +136,10 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode === 'edit' || mode === 'create'" > <UForm
<template #header v-if="mode === 'edit'"> v-else-if="mode === 'edit' || mode === 'create'"
<UBadge>{{itemInfo.spaceNumber}}</UBadge>{{itemInfo.type}} class="p-5"
</template> >
<UFormGroup <UFormGroup
label="Typ:" label="Typ:"
> >
@@ -175,31 +157,7 @@ setupPage()
v-model="itemInfo.description" v-model="itemInfo.description"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('spaces',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('spaces',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,20 +1,50 @@
<template> <template>
<Toolbar> <UDashboardNavbar title="Lagerplätze" :badge="filteredRows.length">
<UButton @click="router.push(`/inventory/spaces/create/`)">+ Lagerplatz</UButton> <template #right>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</Toolbar> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/spaces/create`)">+ Lagerplatz</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<div class="table"> <div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="itemColumns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/spaces/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Lagerplätze anzuzeigen' }"
/> />
</div> </div>
@@ -26,11 +56,21 @@ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/spaces/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
const itemColumns = [ const templateColumns = [
{ {
key: 'spaceNumber', key: 'spaceNumber',
label: "Lagerplatznr.", label: "Lagerplatznr.",
@@ -47,16 +87,10 @@ const itemColumns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const selectItem = (item) => {
console.log(item)
router.push(`/spaces/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')
const filteredRows = computed(() => { const filteredRows = computed(() => {
if(!searchString.value) { if(!searchString.value) {
return dataStore.spaces return dataStore.spaces

View File

@@ -1,12 +1,9 @@
<script setup> <script setup>
import dayjs from "dayjs";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
@@ -14,12 +11,6 @@ const id = ref(route.params.id ? route.params.id : null )
let currentItem = ref(null) let currentItem = ref(null)
/*watch(dataStore.tasks, (oldVal,newVal) => {
console.log("OK")
console.log(dataStore.tasks)
currentItem.value = dataStore.getTaskById(Number(useRoute().params.id))
})*/
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
const itemInfo = ref({}) const itemInfo = ref({})
@@ -44,7 +35,6 @@ const setupPage = () => {
const editItem = async () => { const editItem = async () => {
router.push(`/tasks/edit/${currentItem.value.id}`) router.push(`/tasks/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -55,31 +45,12 @@ const cancelEditorCreate = () => {
} }
} }
const updateItem = async () => {
const {error} = await supabase
.from("tasks")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
}
router.push(`/tasks/show/${currentItem.value.id}`)
toast.add({title: "Aufgabe erfolgreich gespeichert"})
dataStore.fetchTasks()
}
setupPage() setupPage()
</script> </script>
<template> <template>
<UDashboardPage> <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Aufgabe erstellen' : 'Aufgabe bearbeiten')">
<UDashboardPanel grow>
<UDashboardNavbar :title="currentItem ? currentItem.name : ''">
<template #right> <template #right>
<UButton <UButton
v-if="mode === 'edit'" v-if="mode === 'edit'"
@@ -102,45 +73,13 @@ setupPage()
Abbrechen Abbrechen
</UButton> </UButton>
<UButton <UButton
v-if="mode === 'show' && currentItem.id" v-if="mode === 'show'"
@click="editItem" @click="editItem"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</template> </template>
</UDashboardNavbar> </UDashboardNavbar>
<!-- <UDashboardToolbar>
<template #left>
&lt;!&ndash; <UButton @click="router.push(`/tasks/create`)">+ Aufgabe</UButton>
<UInput
v-model="searchString"
placeholder="Suche..."
/>&ndash;&gt;
<UCheckbox
label="Erledigte Anzeigen"
v-model="showDone"
/>
</template>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>-->
<UTabs <UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'}]" :items="[{label: 'Informationen'},{label: 'Logbuch'}]"
v-if="currentItem && mode === 'show'" v-if="currentItem && mode === 'show'"
@@ -241,158 +180,6 @@ setupPage()
/> />
</UFormGroup> </UFormGroup>
</UForm> </UForm>
</UDashboardPanel>
</UDashboardPage>
<!-- <h1
class="mb-3 truncate font-bold text-2xl"
v-if="currentItem"
>Aufgabe: {{currentItem.name}}</h1>
<UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'}]"
v-if="currentItem && mode === 'show'"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton
v-if="mode === 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
<UButton
v-if="currentItem.project"
@click="router.push(`/projects/show/${currentItem.project}`)"
>
Zum Projekt
</UButton>
</Toolbar>
<div class="truncate">
<p>Kategorie: {{currentItem.categorie}}</p>
<p v-if="currentItem.project">Projekt: <nuxt-link :to="`/projects/show/${currentItem.project}`">{{dataStore.getProjectById(currentItem.project).name}}</nuxt-link></p>
<p>Beschreibung: {{currentItem.description}}</p>
</div>
</div>
&lt;!&ndash; TODO: Logbuch Tasks &ndash;&gt;
</UCard>
</template>
</UTabs>
<UCard v-else-if="mode === 'edit' || mode === 'create'" >
<template #header v-if="mode === 'edit'">
{{itemInfo.name}}
</template>
<UFormGroup
label="Name:"
>
<UInput
v-model="itemInfo.name"
/>
</UFormGroup>
<UFormGroup
label="Kategorie:"
>
<USelectMenu
v-model="itemInfo.categorie"
:options="categories"
/>
</UFormGroup>
<UFormGroup
label="Benutzer:"
>
<USelectMenu
v-model="itemInfo.user"
:options="dataStore.profiles"
option-attribute="fullName"
value-attribute="id"
searchable-placeholder="Suche..."
searchable
:search-attributes="['fullName']"
>
<template #label>
{{dataStore.getProfileById(itemInfo.user) ? dataStore.getProfileById(itemInfo.user).fullName : "Kein Benutzer ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Projekt:"
>
<USelectMenu
v-model="itemInfo.project"
:options="dataStore.projects"
option-attribute="name"
value-attribute="id"
searchable-placeholder="Suche..."
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Objekt:"
>
<USelectMenu
v-model="itemInfo.plant"
:options="dataStore.plants"
option-attribute="name"
value-attribute="id"
searchable-placeholder="Suche..."
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.getPlantById(itemInfo.plant) ? dataStore.getPlantById(itemInfo.plant).name : "Kein Objekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Beschreibung:"
>
<UTextarea
v-model="itemInfo.description"
/>
</UFormGroup>
<template #footer>
<UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('tasks',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('tasks',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>-->
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,10 +1,8 @@
<template> <template>
<UDashboardPage>
<UDashboardPanel grow>
<UDashboardNavbar title="Aufgaben" :badge="filteredRows.length"> <UDashboardNavbar title="Aufgaben" :badge="filteredRows.length">
<template #right> <template #right>
<UInput <UInput
ref="input" id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel" icon="i-heroicons-funnel"
autocomplete="off" autocomplete="off"
@@ -23,12 +21,7 @@
<UDashboardToolbar> <UDashboardToolbar>
<template #left> <template #left>
<!-- <UButton @click="router.push(`/tasks/create`)">+ Aufgabe</UButton>
<UInput
v-model="searchString"
placeholder="Suche..."
/>-->
<UCheckbox <UCheckbox
label="Erledigte Anzeigen" label="Erledigte Anzeigen"
@@ -43,6 +36,7 @@
:options="templateColumns" :options="templateColumns"
multiple multiple
class="hidden lg:block" class="hidden lg:block"
by="key"
> >
<template #label> <template #label>
Spalten Spalten
@@ -52,13 +46,12 @@
</UDashboardToolbar> </UDashboardToolbar>
<UTable <UTable
v-model:sort="sort"
:rows="filteredRows" :rows="filteredRows"
:columns="columns" :columns="columns"
sort-mode="manual"
class="w-full" class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/tasks/show/${i.id}`) " @select="(i) => router.push(`/tasks/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Aufgaben anzuzeigen' }"
> >
<template #finish-data="{row}"> <template #finish-data="{row}">
<UButton <UButton
@@ -83,26 +76,23 @@
{{dataStore.getPlantById(row.plant) ? dataStore.getPlantById(row.plant).name : "" }} {{dataStore.getPlantById(row.plant) ? dataStore.getPlantById(row.plant).name : "" }}
</template> </template>
</UTable> </UTable>
</UDashboardPanel>
</UDashboardPage>
</template> </template>
<script lang="ts" setup> <script setup>
import dayjs from "dayjs"; import dayjs from "dayjs";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
const input = ref<{ input: HTMLInputElement }>()
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show")
defineShortcuts({ defineShortcuts({
'/': () => { '/': () => {
input.value?.input?.focus() //console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
}, },
'+': () => { '+': () => {
router.push("/tasks/create") router.push("/tasks/create")
@@ -143,40 +133,30 @@ const templateColumns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns) const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column))) const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const markAsFinished = (item) => {
dataStore.updateItem("tasks", {...item, categorie: "Erledigt"})
}
const searchString = ref('') const searchString = ref('')
const showDone = ref(false) const showDone = ref(false)
const filteredRows = computed(() => { const filteredRows = computed(() => {
let tasks = dataStore.tasks let items = dataStore.tasks
if(!showDone.value) { items = items.filter(i => showDone.value === true ? i.categorie === "Erledigt" : i.categorie !== "Erledigt")
tasks = tasks.filter(i => i.categorie !== "Erledigt")
}
if(!searchString.value) { if(!searchString.value) {
return tasks return items
} }
return tasks.filter(item => { return items.filter(item => {
return Object.values(item).some((value) => { return Object.values(item).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase()) return String(value).toLowerCase().includes(searchString.value.toLowerCase())
}) })
}) })
}) })
const selectItem = (item) => {
router.push(`/tasks/show/${item.id} `)
}
const markAsFinished = (item) => {
dataStore.updateItem("tasks", {...item, categorie: "Erledigt"})
}
</script> </script>
<style scoped> <style scoped>

View File

@@ -1,11 +0,0 @@
<script setup lang="ts">
</script>
<template>
test
</template>
<style scoped>
</style>

View File

@@ -6,7 +6,6 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
@@ -14,8 +13,6 @@ const id = ref(route.params.id ? route.params.id : null )
let currentItem = ref(null) let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
const itemInfo = ref({ const itemInfo = ref({
@@ -65,15 +62,6 @@ const setupPage = () => {
} }
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
}
const editCustomer = async () => {
router.push(`/vehicles/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -85,20 +73,7 @@ const cancelEditorCreate = () => {
} }
const updateItem = async () => {
const {error} = await supabase
.from("vehicles")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
} else {
router.push(`/vehicles/show/${currentItem.value.id}`)
toast.add({title: "Fahrzeug erfolgreich gespeichert"})
dataStore.fetchVehicles()
}
}
const getRowAmount = (row) => { const getRowAmount = (row) => {
let amount = 0 let amount = 0
@@ -115,33 +90,43 @@ setupPage()
</script> </script>
<template> <template>
<div> <UDashboardNavbar :title="currentItem ? currentItem.licensePlate : (mode === 'create' ? 'Fahrzeug erstellen' : 'Fahrzeug bearbeiten')">
<UCard v-if="currentItem && mode == 'show'" > <template #right>
<template #header>
<UBadge
v-if="currentItem.active"
>
Fahrzeug aktiv
</UBadge>
<UBadge
v-else
color="red"
>
Fahrzeug gesperrt
</UBadge>
{{currentItem.licensePlate}}
</template>
<UTabs :items="tabItems">
<template #item="{item}">
<div v-if="item.label === 'Informationen'">
<InputGroup class="mb-3">
<UButton <UButton
@click="editCustomer" v-if="mode === 'edit'"
@click="dataStore.updateItem('vehicles',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('vehicles',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="router.push(`/vehicles/edit/${currentItem.id}`)"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</InputGroup> </template>
</UDashboardNavbar>
<UTabs
:items="tabItems"
v-if="mode === 'show'"
class="p-5"
>
<template #item="{item}">
<div v-if="item.label === 'Informationen'">
Typ: {{currentItem.type}} <br> Typ: {{currentItem.type}} <br>
Fahrer: {{dataStore.profiles.find(profile => profile.id === currentItem.driver) ? dataStore.profiles.find(profile => profile.id === currentItem.driver).fullName : 'Kein Fahrer gewählt'}} <br> Fahrer: {{dataStore.profiles.find(profile => profile.id === currentItem.driver) ? dataStore.profiles.find(profile => profile.id === currentItem.driver).fullName : 'Kein Fahrer gewählt'}} <br>
</div> </div>
@@ -164,12 +149,12 @@ setupPage()
</div> </div>
<div v-else-if="item.label === 'Dokumente'"> <div v-else-if="item.label === 'Dokumente'">
<InputGroup> <Toolbar>
<DocumentUpload <DocumentUpload
type="vehicle" type="vehicle"
:element-id="currentItem.id" :element-id="currentItem.id"
/> />
</InputGroup> </Toolbar>
<DocumentList <DocumentList
:documents="dataStore.getDocumentsByVehicleId(currentItem.id)" :documents="dataStore.getDocumentsByVehicleId(currentItem.id)"
@@ -177,20 +162,10 @@ setupPage()
</div> </div>
</template> </template>
</UTabs> </UTabs>
<UForm
v-else-if="mode == 'edit' || mode == 'create'"
class="p-5"
>
</UCard>
<UCard v-else-if="mode == 'edit' || mode == 'create'" >
<template #header v-if="mode === 'edit'">
{{itemInfo.licensePlate}}
</template>
<UFormGroup <UFormGroup
label="Kennzeichen:" label="Kennzeichen:"
@@ -231,32 +206,7 @@ setupPage()
</template> </template>
</USelectMenu> </USelectMenu>
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('vehicles',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('vehicles',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</div>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,27 +1,51 @@
<template> <template>
<div id="main"> <UDashboardNavbar title="Fahrzeuge" :badge="filteredRows.length">
<template #right>
<div class="flex items-center gap-1">
<UButton @click="router.push(`/vehicles/create/`)">+ Fahrzeug</UButton>
<UInput <UInput
id="searchinput"
v-model="searchString" v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..." placeholder="Suche..."
/> class="hidden lg:block"
</div> @keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/vehicles/create`)">+ Fahrzeug</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<template #right>
<USelectMenu
v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple
class="hidden lg:block"
by="key"
>
<template #label>
Spalten
</template>
</USelectMenu>
</template>
</UDashboardToolbar>
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="itemColumns" :columns="columns"
@select="selectItem" class="w-full"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/vehicles/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Fahrzeuge anzuzeigen' }"
> >
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
@@ -30,12 +54,21 @@ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/tasks/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const {vehicles } = storeToRefs(useDataStore())
const mode = ref("show")
const itemColumns = [ const templateColumns = [
{ {
key: 'licensePlate', key: 'licensePlate',
label: "Kennzeichen:", label: "Kennzeichen:",
@@ -47,12 +80,8 @@ const itemColumns = [
sortable: true sortable: true
} }
] ]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const selectItem = (item) => {
router.push(`/vehicles/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')

View File

@@ -6,12 +6,10 @@ definePageMeta({
}) })
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const id = ref(route.params.id ? route.params.id : null ) const id = ref(route.params.id ? route.params.id : null )
const numberRange = useNumberRange("vendors")
let currentItem = ref(null) let currentItem = ref(null)
@@ -34,7 +32,6 @@ const setupPage = () => {
const editItem = async () => { const editItem = async () => {
router.push(`/vendors/edit/${currentItem.value.id}`) router.push(`/vendors/edit/${currentItem.value.id}`)
setupPage()
} }
const cancelEditorCreate = () => { const cancelEditorCreate = () => {
@@ -43,32 +40,51 @@ const cancelEditorCreate = () => {
} else { } else {
router.push(`/vendors`) router.push(`/vendors`)
} }
} }
setupPage() setupPage()
</script> </script>
<template> <template>
<h1 <UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Lieferant erstellen' : 'Lieferant bearbeiten')">
class=" mb-3 font-bold text-2xl truncate" <template #right>
v-if="currentItem "
>Lieferant: {{currentItem.name}}</h1>
<UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Ansprechpartner'},{label: 'Dokumente'}]"
v-if="currentItem && mode == 'show'"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton <UButton
v-if="mode == 'show' && currentItem.id" v-if="mode === 'edit'"
@click="dataStore.updateItem('vendors',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode === 'create'"
@click="dataStore.createNewItem('vendors',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
v-if="mode === 'edit' || mode === 'create'"
>
Abbrechen
</UButton>
<UButton
v-if="mode === 'show'"
@click="editItem" @click="editItem"
> >
Bearbeiten Bearbeiten
</UButton> </UButton>
</Toolbar> </template>
</UDashboardNavbar>
<UTabs
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Ansprechpartner'},{label: 'Dokumente'}]"
v-if="currentItem && mode == 'show'"
class="p-5"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<div v-if="currentItem.infoData" class="text-wrap"> <div v-if="currentItem.infoData" class="text-wrap">
<p v-if="currentItem.infoData.street">Straße + Hausnummer: {{currentItem.infoData.street}}</p> <p v-if="currentItem.infoData.street">Straße + Hausnummer: {{currentItem.infoData.street}}</p>
@@ -120,11 +136,10 @@ setupPage()
</UCard> </UCard>
</template> </template>
</UTabs> </UTabs>
<UCard v-else-if="mode === 'edit' || mode === 'create'" > <UForm
<template #header v-if="mode === 'edit'"> v-else-if="mode === 'edit' || mode === 'create'"
{{itemInfo.name}} class="p-5"
</template> >
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -198,33 +213,7 @@ setupPage()
v-model="itemInfo.infoData.ustid" v-model="itemInfo.infoData.ustid"
/> />
</UFormGroup> </UFormGroup>
</UForm>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('vendors',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('vendors',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</template> </template>
<style scoped> <style scoped>

View File

@@ -1,60 +1,78 @@
<template> <template>
<Toolbar> <UDashboardNavbar title="Lieferanten" :badge="filteredRows.length">
<template #right>
<UInput
ref="searchinput"
v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
placeholder="Suche..."
class="hidden lg:block"
@keydown.esc="$event.target.blur()"
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
<UButton @click="router.push(`/vendors/create/`)">+ Lieferant</UButton> <UButton @click="router.push(`/vendors/create/`)">+ Lieferant</UButton>
<UInput </template>
v-model="searchString" </UDashboardNavbar>
placeholder="Suche..."
/>
<UDashboardToolbar>
<template #right>
<USelectMenu <USelectMenu
v-model="selectedColumns" v-model="selectedColumns"
icon="i-heroicons-adjustments-horizontal-solid"
:options="templateColumns"
multiple multiple
:options="columnTemplate" class="hidden lg:block"
:uiMenu="{width:'w-40'}"
:popper="{placement: 'bottom-start'}"
by="key" by="key"
> >
<UButton <template #label>
color="gray" Spalten
variant="ghost"
class="flex-1 justify-between"
icon="i-heroicons-view-columns"
/>
<template #option="{ option }">
{{option.label}}
</template> </template>
</USelectMenu> </USelectMenu>
</Toolbar> </template>
</UDashboardToolbar>
<div class="table">
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="selectedColumns" :columns="columns"
@select="selectItem" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }" class="w-full"
@select="(i) => router.push(`/vendors/show/${i.id}`)"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Lieferanten anzuzeigen' }"
> >
<template #address-data="{row}"> <template #address-data="{row}">
{{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{(row.infoData.zip || row.infoData.city) ? `${row.infoData.zip} ${row.infoData.city}, ` : ''}} {{row.infoData.country}} {{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{(row.infoData.zip || row.infoData.city) ? `${row.infoData.zip} ${row.infoData.city}, ` : ''}} {{row.infoData.country}}
</template> </template>
</UTable> </UTable>
</div>
</template> </template>
<script setup> <script setup>
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/vendors/create")
}
})
const dataStore = useDataStore() const dataStore = useDataStore()
const router = useRouter() const router = useRouter()
const mode = ref("show") const mode = ref("show")
const columnTemplate = ref([ const templateColumns = [
{ {
key: 'vendorNumber', key: 'vendorNumber',
label: "Lieferantennr.", label: "Lieferantennr.",
@@ -70,26 +88,9 @@ const columnTemplate = ref([
label: "Adresse", label: "Adresse",
sortable: true sortable: true
} }
]) ]
const selectedColumns = ref([ const selectedColumns = ref(templateColumns)
{ const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
key: 'vendorNumber',
label: "Lieferantennr.",
sortable: true
},
{
key: "name",
label: "Name",
sortable: true
}
])
const selectItem = (item) => {
console.log(item)
router.push(`/vendors/show/${item.id} `)
}
const searchString = ref('') const searchString = ref('')