Many Changes
This commit is contained in:
@@ -29,6 +29,33 @@ const navLinks = [
|
|||||||
to: "/",
|
to: "/",
|
||||||
icon: 'i-heroicons-home'
|
icon: 'i-heroicons-home'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Kontakte",
|
||||||
|
icon: 'i-heroicons-user-group',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: "Kunden",
|
||||||
|
to: "/customers",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Lieferanten",
|
||||||
|
to: "/vendors",
|
||||||
|
icon: "i-heroicons-truck"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Buchhaltung",
|
||||||
|
icon: 'i-heroicons-document-chart-bar',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: "Eingangsrechnungen",
|
||||||
|
to: "/vendorinvoices",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Aufgaben",
|
label: "Aufgaben",
|
||||||
to: "/tasks",
|
to: "/tasks",
|
||||||
@@ -39,25 +66,16 @@ const navLinks = [
|
|||||||
to: "/planningBoard",
|
to: "/planningBoard",
|
||||||
icon: "i-heroicons-calendar-days"
|
icon: "i-heroicons-calendar-days"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Kunden",
|
|
||||||
to: "/customers",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Projekte",
|
label: "Projekte",
|
||||||
to: "/projects",
|
to: "/projects",
|
||||||
icon: "i-heroicons-clipboard-document-check"
|
icon: "i-heroicons-clipboard-document-check"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Zeiterfassung",
|
label: "Jobs",
|
||||||
to: "/timetracking",
|
to: "/jobs",
|
||||||
icon: "i-heroicons-clock"
|
icon: "i-heroicons-square-3-stack-3d"
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Artikel",
|
|
||||||
to: "/products",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Dokumente",
|
label: "Dokumente",
|
||||||
@@ -65,15 +83,32 @@ const navLinks = [
|
|||||||
icon: "i-heroicons-document"
|
icon: "i-heroicons-document"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Inventar",
|
label: "Mitarbeiter",
|
||||||
to: "/inventory",
|
icon: 'i-heroicons-user',
|
||||||
icon: "i-heroicons-square-3-stack-3d"
|
children: [
|
||||||
|
{
|
||||||
|
label: "Zeiterfassung",
|
||||||
|
to: "/timetracking",
|
||||||
|
icon: "i-heroicons-clock"
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Jobs",
|
label: "Lager",
|
||||||
to: "/jobs",
|
icon: 'i-heroicons-home',
|
||||||
icon: "i-heroicons-square-3-stack-3d"
|
children: [
|
||||||
}
|
{
|
||||||
|
label: "Artikel",
|
||||||
|
to: "/products",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Inventar",
|
||||||
|
to: "/inventory",
|
||||||
|
icon: "i-heroicons-square-3-stack-3d"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const linksForBreadcrumbs = ref([])
|
const linksForBreadcrumbs = ref([])
|
||||||
@@ -141,6 +176,10 @@ const items = [
|
|||||||
slot: 'account',
|
slot: 'account',
|
||||||
disabled: true
|
disabled: true
|
||||||
}], [{
|
}], [{
|
||||||
|
label: 'Externe Geräte',
|
||||||
|
icon: 'i-heroicons-cog-8-tooth',
|
||||||
|
to: "/settings/externalDevices"
|
||||||
|
},{
|
||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
icon: 'i-heroicons-cog-8-tooth'
|
icon: 'i-heroicons-cog-8-tooth'
|
||||||
}], /*[{
|
}], /*[{
|
||||||
@@ -181,6 +220,11 @@ const items = [
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #panel>
|
||||||
|
<UNavigationTree :links="navLinks"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #right v-if="user">
|
<template #right v-if="user">
|
||||||
<UColorModeButton/>
|
<UColorModeButton/>
|
||||||
<UDropdown :items="items" :ui="{ item: { disabled: 'cursor-text select-text' } }" :popper="{ placement: 'bottom-start' }">
|
<UDropdown :items="items" :ui="{ item: { disabled: 'cursor-text select-text' } }" :popper="{ placement: 'bottom-start' }">
|
||||||
|
|||||||
48
spaces/components/DatePicker.vue
Normal file
48
spaces/components/DatePicker.vue
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { DatePicker as VCalendarDatePicker } from 'v-calendar'
|
||||||
|
import 'v-calendar/dist/style.css'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: {
|
||||||
|
type: Date,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:model-value', 'close'])
|
||||||
|
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
|
const isDark = computed(() => colorMode.value === 'dark')
|
||||||
|
|
||||||
|
const date = computed({
|
||||||
|
get: () => props.modelValue,
|
||||||
|
set: (value) => {
|
||||||
|
emit('update:model-value', value)
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const attrs = [{
|
||||||
|
key: 'today',
|
||||||
|
highlight: {
|
||||||
|
color: 'blue',
|
||||||
|
fillMode: 'outline',
|
||||||
|
class: '!bg-gray-100 dark:!bg-gray-800'
|
||||||
|
},
|
||||||
|
dates: new Date()
|
||||||
|
}]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VCalendarDatePicker
|
||||||
|
v-model="date"
|
||||||
|
transparent
|
||||||
|
borderless
|
||||||
|
:attributes="attrs"
|
||||||
|
:is-dark="isDark"
|
||||||
|
title-position="left"
|
||||||
|
trim-weeks
|
||||||
|
:first-day-of-week="2"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -11,7 +11,6 @@ export default defineNuxtConfig({
|
|||||||
'@pinia/nuxt',
|
'@pinia/nuxt',
|
||||||
'@nuxt/ui',
|
'@nuxt/ui',
|
||||||
'@nuxt/content',
|
'@nuxt/content',
|
||||||
'@nuxtjs/strapi',
|
|
||||||
'@nuxtjs/supabase',
|
'@nuxtjs/supabase',
|
||||||
"nuxt-editorjs",
|
"nuxt-editorjs",
|
||||||
'@nuxtjs/fontaine',
|
'@nuxtjs/fontaine',
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
"@nuxtjs/google-fonts": "^3.1.0",
|
"@nuxtjs/google-fonts": "^3.1.0",
|
||||||
"@nuxtjs/strapi": "^1.9.3",
|
"@nuxtjs/strapi": "^1.9.3",
|
||||||
"@pinia/nuxt": "^0.5.1",
|
"@pinia/nuxt": "^0.5.1",
|
||||||
|
"@popperjs/core": "^2.11.8",
|
||||||
"@vicons/ionicons5": "^0.12.0",
|
"@vicons/ionicons5": "^0.12.0",
|
||||||
"@zip.js/zip.js": "^2.7.32",
|
"@zip.js/zip.js": "^2.7.32",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
@@ -42,6 +43,8 @@
|
|||||||
"nuxt-viewport": "^2.0.6",
|
"nuxt-viewport": "^2.0.6",
|
||||||
"papaparse": "^5.4.1",
|
"papaparse": "^5.4.1",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"uuidv4": "^6.2.13"
|
"socket.io-client": "^4.7.2",
|
||||||
|
"uuidv4": "^6.2.13",
|
||||||
|
"v-calendar": "^3.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,19 @@
|
|||||||
<div id="main">
|
<div id="main">
|
||||||
<!-- TODO: Kontakte erstellen und dem Kunden zuweisen -->
|
<!-- TODO: Kontakte erstellen und dem Kunden zuweisen -->
|
||||||
|
|
||||||
<UButton @click="router.push(`/customers/create/`)">+ Kunde</UButton>
|
<div class="flex items-center gap-1">
|
||||||
|
<UButton @click="router.push(`/customers/create/`)">+ Kunde</UButton>
|
||||||
|
|
||||||
|
<UInput
|
||||||
|
v-model="searchString"
|
||||||
|
placeholder="Suche..."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<UTable
|
<UTable
|
||||||
:rows="customers"
|
:rows="filteredRows"
|
||||||
:columns="customerColumns"
|
:columns="customerColumns"
|
||||||
@select="selectCustomer"
|
@select="selectCustomer"
|
||||||
|
|
||||||
@@ -20,6 +29,7 @@ definePageMeta({
|
|||||||
middleware: "auth"
|
middleware: "auth"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const {customers } = storeToRefs(useDataStore())
|
const {customers } = storeToRefs(useDataStore())
|
||||||
const mode = ref("show")
|
const mode = ref("show")
|
||||||
@@ -42,6 +52,21 @@ const selectCustomer = (customer) => {
|
|||||||
console.log(customer)
|
console.log(customer)
|
||||||
router.push(`/customers/show/${customer.id} `)
|
router.push(`/customers/show/${customer.id} `)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const searchString = ref('')
|
||||||
|
|
||||||
|
const filteredRows = computed(() => {
|
||||||
|
if(!searchString.value) {
|
||||||
|
return customers.value
|
||||||
|
}
|
||||||
|
|
||||||
|
return customers.value.filter(item => {
|
||||||
|
return Object.values(item).some((value) => {
|
||||||
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import * as JSPM from 'jsprintmanager'
|
import * as JSPM from 'jsprintmanager'
|
||||||
|
|
||||||
let printers = []
|
|
||||||
let scanners = []
|
let printers = ref([])
|
||||||
|
let scanners = ref([])
|
||||||
|
|
||||||
|
|
||||||
|
find().then(devices => {
|
||||||
|
console.log(devices)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
const doScanning = () => {
|
const doScanning = () => {
|
||||||
|
|
||||||
@@ -36,16 +43,15 @@ const doPrintZPL = () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const getPrinters = () => {
|
/*const getPrinters = () => {
|
||||||
return new Promise((ok, err) => {
|
return new Promise((ok, err) => {
|
||||||
let printers = [];
|
let temp = [];
|
||||||
if(JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open) {
|
if(JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open) {
|
||||||
JSPM.JSPrintManager.getPrinters().then(function (myPrinters) {
|
JSPM.JSPrintManager.getPrinters().then(function (myPrinters) {
|
||||||
printers = myPrinters;
|
temp = myPrinters;
|
||||||
console.log(printers);
|
ok(temp);
|
||||||
ok(printers);
|
|
||||||
}).catch((e)=>err(e));
|
}).catch((e)=>err(e));
|
||||||
} else { console.warn("JSPM WS not open"); ok(printers); }
|
} else { console.warn("JSPM WS not open"); ok(temp); }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const getScanners = () => {
|
const getScanners = () => {
|
||||||
@@ -59,19 +65,28 @@ const getScanners = () => {
|
|||||||
}).catch((e)=>err(e));
|
}).catch((e)=>err(e));
|
||||||
} else { console.warn("JSPM WS not open"); ok(printers); }
|
} else { console.warn("JSPM WS not open"); ok(printers); }
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
const initJSPM = () => {
|
const initJSPM = async () => {
|
||||||
JSPM.JSPrintManager.auto_reconnect = true
|
JSPM.JSPrintManager.auto_reconnect = true
|
||||||
JSPM.JSPrintManager.start();
|
await JSPM.JSPrintManager.start();
|
||||||
|
|
||||||
JSPM.JSPrintManager.WS.onStatusChanged = () => {
|
JSPM.JSPrintManager.WS.onStatusChanged = async () => {
|
||||||
console.log("Status Changed")
|
console.log("Status Changed")
|
||||||
getPrinters().then(p => printers = p)
|
|
||||||
getScanners().then(s => scanners = s)
|
if(JSPM.JSPrintManager.websocket_status === JSPM.WSStatus.Open){
|
||||||
|
printers.value = await JSPM.JSPrintManager.getPrinters()
|
||||||
|
scanners.value = await JSPM.JSPrintManager.getScanners()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initJSPM()
|
initJSPM()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -81,6 +96,8 @@ initJSPM()
|
|||||||
|
|
||||||
<UButton @click="doPrintZPL">Print</UButton>
|
<UButton @click="doPrintZPL">Print</UButton>
|
||||||
|
|
||||||
|
<UButton @click="initJSPM">Init</UButton>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<UButton @click="router.push(`/products/create/`)">+ Artikel</UButton>
|
<div class="flex items-center gap-1">
|
||||||
|
<UButton @click="router.push(`/products/create/`)">+ Artikel</UButton>
|
||||||
|
|
||||||
|
<UInput
|
||||||
|
v-model="searchString"
|
||||||
|
placeholder="Suche..."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<UInput
|
|
||||||
v-model="searchString"
|
|
||||||
placeholder="Suche..."
|
|
||||||
/>
|
|
||||||
|
|
||||||
<UTable
|
<UTable
|
||||||
:rows="filteredRows"
|
:rows="filteredRows"
|
||||||
|
|||||||
22
spaces/pages/settings/externalDevices.vue
Normal file
22
spaces/pages/settings/externalDevices.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UPage>
|
||||||
|
<UCard>
|
||||||
|
<template #header>
|
||||||
|
Etikettendrucker
|
||||||
|
</template>
|
||||||
|
</UCard>
|
||||||
|
<UCard>
|
||||||
|
<template #header>
|
||||||
|
A4 Drucker
|
||||||
|
</template>
|
||||||
|
</UCard>
|
||||||
|
</UPage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import * as dayjs from "dayjs";
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: "auth"
|
middleware: "auth"
|
||||||
})
|
})
|
||||||
@@ -7,7 +9,7 @@ const supabase = useSupabaseClient()
|
|||||||
const user = useSupabaseUser()
|
const user = useSupabaseUser()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
const {times, projects} = storeToRefs(useDataStore())
|
const {times, projects, profiles} = storeToRefs(useDataStore())
|
||||||
const {fetchTimes, getTimeTypes} = useDataStore()
|
const {fetchTimes, getTimeTypes} = useDataStore()
|
||||||
const timeTypes = getTimeTypes
|
const timeTypes = getTimeTypes
|
||||||
const timeInfo = ref({
|
const timeInfo = ref({
|
||||||
@@ -212,7 +214,7 @@ const selectStartedTime = () => {
|
|||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
Aktuelle gestarteter Eintrag:
|
Aktuelle gestarteter Eintrag:
|
||||||
{{runningTimeInfo.id ? runningTimeInfo : "Keine Zeit gewählt"}}
|
{{runningTimeInfo.id ? runningTimeInfo : "Keine Zeit gestartet"}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -268,7 +270,18 @@ const selectStartedTime = () => {
|
|||||||
v-if="times && user"
|
v-if="times && user"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="times.filter(time => time.user === user.id)"
|
:rows="times.filter(time => time.user === user.id)"
|
||||||
/>
|
>
|
||||||
|
<template #user-data="{row}">
|
||||||
|
{{profiles.find(profile => profile.id === row.user) ? profiles.find(profile => profile.id === row.user).firstName + " " + profiles.find(profile => profile.id === row.user).lastName : row.user }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #start-data="{row}">
|
||||||
|
{{dayjs(row.start).format("DD.MM.YY HH:mm")}}
|
||||||
|
</template>
|
||||||
|
<template #end-data="{row}">
|
||||||
|
{{dayjs(row.end).format("DD.MM.YY HH:mm")}}
|
||||||
|
</template>
|
||||||
|
</UTable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,73 +1,80 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div id="left">
|
|
||||||
|
|
||||||
<router-link to="/vendorinvoices/edit"><UButton>+ Lieferantenrechnung</UButton></router-link>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a v-for="item in dataStore.getVendorInvoiceList" @click="selectItem(item)">
|
|
||||||
<UCard class="listItem">
|
|
||||||
<UBadge>{{item.id}}</UBadge> {{item.date}}
|
|
||||||
</UCard>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flex items-center gap-1">
|
||||||
|
<UButton @click="router.push(`/vendorinvoices/create/`)">+ Eingangsrechnung</UButton>
|
||||||
|
|
||||||
|
<UInput
|
||||||
|
v-model="searchString"
|
||||||
|
placeholder="Suche..."
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div id="right">
|
|
||||||
|
|
||||||
<UCard v-if="selectedItem.id">
|
|
||||||
<template #header>
|
|
||||||
<UBadge>{{selectedItem.id}}</UBadge> {{selectedItem.name}}
|
|
||||||
</template>
|
|
||||||
<UTable :rows="selectedItem.lineItems"></UTable>
|
|
||||||
{{selectedItem}}
|
|
||||||
|
|
||||||
|
|
||||||
</UCard>
|
|
||||||
</div>
|
<UTable
|
||||||
|
:rows="filteredRows"
|
||||||
|
:columns="itemColumns"
|
||||||
|
@select="selectItem"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import {useDataStore} from "~/stores/data.ts";
|
definePageMeta({
|
||||||
import {storeToRefs} from "pinia"
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
const showCreateProject = ref(false)
|
const router = useRouter()
|
||||||
const showCreateCustomer = ref(false)
|
const {vendorInvoices } = storeToRefs(useDataStore())
|
||||||
const projectData = ref({})
|
const mode = ref("show")
|
||||||
|
|
||||||
|
const itemColumns = [
|
||||||
|
{
|
||||||
|
key: 'vendor',
|
||||||
|
label: "Lieferantennr.",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "reference",
|
||||||
|
label: "Referenz",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "date",
|
||||||
|
label: "Datum",
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
const dataStore = useDataStore()
|
|
||||||
|
|
||||||
const {projects} = storeToRefs(dataStore)
|
|
||||||
const {addCustomer} = dataStore
|
|
||||||
const {addProject} = dataStore
|
|
||||||
let selectedItem = ref({})
|
|
||||||
|
|
||||||
const selectItem = (item) => {
|
const selectItem = (item) => {
|
||||||
selectedItem.value = item
|
|
||||||
console.log(item)
|
console.log(item)
|
||||||
|
router.push(`/vendorinvoices/show/${item.id} `)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const searchString = ref('')
|
||||||
|
|
||||||
|
const filteredRows = computed(() => {
|
||||||
|
if(!searchString.value) {
|
||||||
|
return vendorInvoices.value
|
||||||
|
}
|
||||||
|
|
||||||
|
return vendorInvoices.value.filter(item => {
|
||||||
|
return Object.values(item).some((value) => {
|
||||||
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
#main {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
#left {
|
|
||||||
width: 25vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
#right {
|
|
||||||
width: 60vw;
|
|
||||||
padding-left: 3vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
167
spaces/pages/vendors/[mode]/[[id]].vue
vendored
Normal file
167
spaces/pages/vendors/[mode]/[[id]].vue
vendored
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
//
|
||||||
|
const supabase = useSupabaseClient()
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
const toast = useToast()
|
||||||
|
const id = ref(route.params.id ? route.params.id : null )
|
||||||
|
|
||||||
|
|
||||||
|
//Store
|
||||||
|
const {vendors } = storeToRefs(useDataStore())
|
||||||
|
const {fetchVendors, getVendorById} = useDataStore()
|
||||||
|
|
||||||
|
let currentItem = null
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Working
|
||||||
|
const mode = ref(route.params.mode || "show")
|
||||||
|
const itemInfo = ref({})
|
||||||
|
|
||||||
|
//Functions
|
||||||
|
const setupPage = () => {
|
||||||
|
if(mode.value === "show" || mode.value === "edit"){
|
||||||
|
currentItem = getVendorById(Number(useRoute().params.id))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode.value === "edit") itemInfo.value = currentItem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const createItem = async () => {
|
||||||
|
const {data,error} = await supabase
|
||||||
|
.from("vendors")
|
||||||
|
.insert([itemInfo.value])
|
||||||
|
.select()
|
||||||
|
|
||||||
|
if(error) {
|
||||||
|
console.log(error)
|
||||||
|
} else {
|
||||||
|
mode.value = "show"
|
||||||
|
itemInfo.value = {}
|
||||||
|
toast.add({title: "Lieferant erfolgreich erstellt"})
|
||||||
|
await fetchVendors()
|
||||||
|
router.push(`/vendors/show/${data[0].id}`)
|
||||||
|
setupPage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const editItem = async () => {
|
||||||
|
router.push(`/vendors/edit/${currentItem.id}`)
|
||||||
|
setupPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancelEditorCreate = () => {
|
||||||
|
router.push(`/vendors/`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateItem = async () => {
|
||||||
|
const {error} = await supabase
|
||||||
|
.from("vendors")
|
||||||
|
.update(itemInfo.value)
|
||||||
|
.eq('id',itemInfo.value.id)
|
||||||
|
|
||||||
|
if(error) {
|
||||||
|
console.log(error)
|
||||||
|
} else {
|
||||||
|
mode.value = "show"
|
||||||
|
itemInfo.value = {}
|
||||||
|
toast.add({title: "Lieferant erfolgreich gespeichert"})
|
||||||
|
fetchVendors()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setupPage()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<UCard v-if="currentItem && mode == 'show'" >
|
||||||
|
<template #header>
|
||||||
|
{{currentItem.name}}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
{{currentItem}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<UButton
|
||||||
|
v-if="mode == 'show' && currentItem.id"
|
||||||
|
@click="editItem"
|
||||||
|
>
|
||||||
|
Bearbeiten
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
color="red"
|
||||||
|
class="ml-2"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
Archivieren
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</UCard>
|
||||||
|
<UCard v-else-if="mode == 'edit' || mode == 'create'" >
|
||||||
|
<template #header>
|
||||||
|
{{itemInfo.name}}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Name:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.name"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Lieferantennr.:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.vendorNumber"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<UButton
|
||||||
|
v-if="mode == 'edit'"
|
||||||
|
@click="updateItem"
|
||||||
|
>
|
||||||
|
Speichern
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
v-else-if="mode == 'create'"
|
||||||
|
@click="createItem"
|
||||||
|
>
|
||||||
|
Erstellen
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
@click="cancelEditorCreate"
|
||||||
|
color="red"
|
||||||
|
class="ml-2"
|
||||||
|
>
|
||||||
|
Abbrechen
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</UCard>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
74
spaces/pages/vendors/index.vue
vendored
Normal file
74
spaces/pages/vendors/index.vue
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<template>
|
||||||
|
<div id="main">
|
||||||
|
<!-- TODO: Kontakte erstellen und dem Lieferanten zuweisen -->
|
||||||
|
|
||||||
|
<div class="flex items-center gap-1">
|
||||||
|
<UButton @click="router.push(`/vendors/create/`)">+ Lieferant</UButton>
|
||||||
|
|
||||||
|
<UInput
|
||||||
|
v-model="searchString"
|
||||||
|
placeholder="Suche..."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<UTable
|
||||||
|
:rows="filteredRows"
|
||||||
|
:columns="itemColumns"
|
||||||
|
@select="selectItem"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const {vendors } = storeToRefs(useDataStore())
|
||||||
|
const mode = ref("show")
|
||||||
|
|
||||||
|
const itemColumns = [
|
||||||
|
{
|
||||||
|
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 filteredRows = computed(() => {
|
||||||
|
if(!searchString.value) {
|
||||||
|
return vendors.value
|
||||||
|
}
|
||||||
|
|
||||||
|
return vendors.value.filter(item => {
|
||||||
|
return Object.values(item).some((value) => {
|
||||||
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -32,6 +32,8 @@ export const useDataStore = defineStore('data', {
|
|||||||
formSubmits: [] as any[],
|
formSubmits: [] as any[],
|
||||||
contacts: [] as any[],
|
contacts: [] as any[],
|
||||||
vehicles: [] as any[],
|
vehicles: [] as any[],
|
||||||
|
vendors: [] as any[],
|
||||||
|
vendorInvoices: [] as any[]
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
@@ -54,6 +56,8 @@ export const useDataStore = defineStore('data', {
|
|||||||
await this.fetchMovements()
|
await this.fetchMovements()
|
||||||
await this.fetchSpaces()
|
await this.fetchSpaces()
|
||||||
await this.fetchVehicles()
|
await this.fetchVehicles()
|
||||||
|
await this.fetchVendors()
|
||||||
|
await this.fetchVendorInvoices()
|
||||||
|
|
||||||
},
|
},
|
||||||
async fetchOwnTenant() {
|
async fetchOwnTenant() {
|
||||||
@@ -117,6 +121,14 @@ export const useDataStore = defineStore('data', {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.jobs = (await supabase.from("jobs").select()).data
|
this.jobs = (await supabase.from("jobs").select()).data
|
||||||
},
|
},
|
||||||
|
async fetchVendors() {
|
||||||
|
// @ts-ignore
|
||||||
|
this.vendors = (await supabase.from("vendors").select()).data
|
||||||
|
},
|
||||||
|
async fetchVendorInvoices() {
|
||||||
|
// @ts-ignore
|
||||||
|
this.vendorInvoices = (await supabase.from("vendorinvoices").select()).data
|
||||||
|
},
|
||||||
async fetchDocuments() {
|
async fetchDocuments() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.documents = (await supabase.from("documents").select()).data
|
this.documents = (await supabase.from("documents").select()).data
|
||||||
@@ -142,6 +154,8 @@ export const useDataStore = defineStore('data', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
|
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
|
||||||
|
getVendorById: (state) => (itemId:number) => state.vendors.find(item => item.id === itemId),
|
||||||
|
getVendorInvoiceById: (state) => (itemId:number) => state.vendorInvoices.find(item => item.id === itemId),
|
||||||
getProjectById: (state) => (projectId:number) => {
|
getProjectById: (state) => (projectId:number) => {
|
||||||
let project = state.projects.find(project => project.id === projectId)
|
let project = state.projects.find(project => project.id === projectId)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user