Changes
This commit is contained in:
@@ -155,7 +155,7 @@ const updateDocumentAssignment = async () => {
|
|||||||
<br>
|
<br>
|
||||||
<UBadge
|
<UBadge
|
||||||
v-if="documentData.vendorInvoice"
|
v-if="documentData.vendorInvoice"
|
||||||
>{{dataStore.incomingInvoices.find(item => item.id === documentData.vendorInvoice) ? dataStore.incomingInvoices.find(item => item.id === documentData.vendorInvoice).reference : ''}}</UBadge>
|
>{{dataStore.incominginvoices.find(item => item.id === documentData.vendorInvoice) ? dataStore.incominginvoices.find(item => item.id === documentData.vendorInvoice).reference : ''}}</UBadge>
|
||||||
<UBadge
|
<UBadge
|
||||||
v-if="documentData.inDatev"
|
v-if="documentData.inDatev"
|
||||||
>DATEV</UBadge>
|
>DATEV</UBadge>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
pages[pageCounter - 1].drawText("Federspiel Technology UG haftungsbeschränkt, Am Schwarzen Brack 14 26452 Sande", {
|
pages[pageCounter - 1].drawText(invoiceData.adressLine, {
|
||||||
...getCoordinatesForPDFLib(21,48, page1),
|
...getCoordinatesForPDFLib(21,48, page1),
|
||||||
size:6,
|
size:6,
|
||||||
color:rgb(0,0,0),
|
color:rgb(0,0,0),
|
||||||
|
|||||||
@@ -289,6 +289,10 @@ const links = [[{
|
|||||||
label: "Artikelstamm",
|
label: "Artikelstamm",
|
||||||
to: "/products",
|
to: "/products",
|
||||||
icon: "i-heroicons-puzzle-piece"
|
icon: "i-heroicons-puzzle-piece"
|
||||||
|
},{
|
||||||
|
label: "Leistungsstamm",
|
||||||
|
to: "/services",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Lagerplätze",
|
label: "Lagerplätze",
|
||||||
@@ -445,13 +449,6 @@ const links = [[{
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</UVerticalNavigation>
|
</UVerticalNavigation>
|
||||||
<UButton
|
|
||||||
:icon="!isLight ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'"
|
|
||||||
color="white"
|
|
||||||
variant="outline"
|
|
||||||
aria-label="Theme"
|
|
||||||
@click="isLight = !isLight"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pl-3 pr-3 mt-3" id="contentContainer">
|
<div class="pl-3 pr-3 mt-3" id="contentContainer">
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import resourceTimelinePlugin from "@fullcalendar/resource-timeline";
|
|||||||
import interactionPlugin from "@fullcalendar/interaction";
|
import interactionPlugin from "@fullcalendar/interaction";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
//Config
|
//Config
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const mode = ref(route.params.mode || "grid")
|
const mode = ref(route.params.mode || "grid")
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ const router = useRouter()
|
|||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
|
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -142,6 +144,15 @@ const addPosition = (mode) => {
|
|||||||
taxPercent: 19,
|
taxPercent: 19,
|
||||||
discountPercent: 0
|
discountPercent: 0
|
||||||
})
|
})
|
||||||
|
} else if(mode === 'service'){
|
||||||
|
itemInfo.value.rows.push({
|
||||||
|
id: lastId +1,
|
||||||
|
mode: "service",
|
||||||
|
quantity: 1,
|
||||||
|
price: 0,
|
||||||
|
taxPercent: 19,
|
||||||
|
discountPercent: 0
|
||||||
|
})
|
||||||
} else if(mode === "pagebreak") {
|
} else if(mode === "pagebreak") {
|
||||||
itemInfo.value.rows.push({
|
itemInfo.value.rows.push({
|
||||||
id: lastId +1,
|
id: lastId +1,
|
||||||
@@ -202,6 +213,7 @@ const getDocumentData = () => {
|
|||||||
let customerData = dataStore.getCustomerById(itemInfo.value.customer)
|
let customerData = dataStore.getCustomerById(itemInfo.value.customer)
|
||||||
let contactData = dataStore.getContactById(itemInfo.value.contact)
|
let contactData = dataStore.getContactById(itemInfo.value.contact)
|
||||||
let userData = dataStore.getProfileById(user.value.id)
|
let userData = dataStore.getProfileById(user.value.id)
|
||||||
|
let businessInfo = dataStore.ownTenant.businessInfo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -236,14 +248,14 @@ const getDocumentData = () => {
|
|||||||
|
|
||||||
|
|
||||||
const returnData = {
|
const returnData = {
|
||||||
|
adressLine: `${businessInfo.name}, ${businessInfo.street}, ${businessInfo.zip} ${businessInfo.city}`,
|
||||||
recipient: {
|
recipient: {
|
||||||
name: customerData.name,
|
name: customerData.name,
|
||||||
contact: contactData ? `${contactData.firstName} ${contactData.lastName}` : "",
|
contact: contactData ? `${contactData.firstName} ${contactData.lastName}` : "",
|
||||||
street: customerData.infoData.street,
|
street: itemInfo.value.address.street || customerData.infoData.street,
|
||||||
special: "",
|
special: itemInfo.value.address.special || customerData.infoData.special,
|
||||||
city: customerData.infoData.city,
|
city: itemInfo.value.address.city || customerData.infoData.city,
|
||||||
zip: customerData.infoData.zip
|
zip: itemInfo.value.address.zip || customerData.infoData.zip
|
||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
customerNumber: customerData.customerNumber,
|
customerNumber: customerData.customerNumber,
|
||||||
@@ -276,12 +288,8 @@ const uri = ref("")
|
|||||||
const generateDocument = async () => {
|
const generateDocument = async () => {
|
||||||
const ownTenant = dataStore.ownTenant
|
const ownTenant = dataStore.ownTenant
|
||||||
const path = ownTenant.letterheadConfig[itemInfo.value.type]
|
const path = ownTenant.letterheadConfig[itemInfo.value.type]
|
||||||
console.log(path)
|
|
||||||
console.log(ownTenant)
|
|
||||||
|
|
||||||
const {data,error} = await supabase.storage.from("files").download(path)
|
const {data,error} = await supabase.storage.from("files").download(path)
|
||||||
console.log(data)
|
|
||||||
console.log(error)
|
|
||||||
|
|
||||||
uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
|
uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
|
||||||
//alert(uri.value)
|
//alert(uri.value)
|
||||||
@@ -297,7 +305,7 @@ const onChangeTab = (index) => {
|
|||||||
const setPosNumbers = () => {
|
const setPosNumbers = () => {
|
||||||
let index = 1
|
let index = 1
|
||||||
let rows = itemInfo.value.rows.map(row => {
|
let rows = itemInfo.value.rows.map(row => {
|
||||||
if(row.mode === 'free' ||row.mode === 'normal') {
|
if(row.mode !== 'pagebreak') {
|
||||||
row.pos = index
|
row.pos = index
|
||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
@@ -480,29 +488,28 @@ setupPage()
|
|||||||
<UInput
|
<UInput
|
||||||
v-model="itemInfo.address.street"
|
v-model="itemInfo.address.street"
|
||||||
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.street : 'Straße + Hausnummer'"
|
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.street : 'Straße + Hausnummer'"
|
||||||
|
:color="itemInfo.address.street ? 'primary' : 'rose'"
|
||||||
/>
|
/>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="itemInfo.address.special"
|
v-model="itemInfo.address.special"
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.special : 'Adresszusatz'"
|
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.special : 'Adresszusatz'"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<InputGroup class="mt-3">
|
<InputGroup class="mt-3">
|
||||||
<UInput
|
<UInput
|
||||||
class="flex-auto"
|
class="flex-auto"
|
||||||
v-model="itemInfo.address.zip"
|
v-model="itemInfo.address.zip"
|
||||||
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.zip : 'PLZ'"
|
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.zip : 'PLZ'"
|
||||||
|
:color="itemInfo.address.zip ? 'primary' : 'rose'"
|
||||||
/>
|
/>
|
||||||
<UInput
|
<UInput
|
||||||
class="flex-auto"
|
class="flex-auto"
|
||||||
v-model="itemInfo.address.city"
|
v-model="itemInfo.address.city"
|
||||||
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.city : 'Ort'"
|
:placeholder="dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).infoData.city : 'Ort'"
|
||||||
|
:color="itemInfo.address.city ? 'primary' : 'rose'"
|
||||||
/>
|
/>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-auto">
|
<div class="flex-auto">
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
@@ -697,7 +704,7 @@ setupPage()
|
|||||||
<UDivider/>
|
<UDivider/>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
>{{row.pos}}</td>
|
>{{row.pos}}</td>
|
||||||
<td
|
<td
|
||||||
class="w-120"
|
class="w-120"
|
||||||
@@ -729,9 +736,29 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="w-120"
|
||||||
|
v-else-if="row.mode === 'service'"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.services"
|
||||||
|
option-attribute="name"
|
||||||
|
value-attribute="id"
|
||||||
|
searchable
|
||||||
|
searchable-placeholder="Suche ..."
|
||||||
|
:search-attributes="['name']"
|
||||||
|
v-model="row.service"
|
||||||
|
@change="row.unit = dataStore.getServiceById(row.service).unit,
|
||||||
|
row.price = dataStore.getServiceById(row.service).sellingPrice || 0"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</td>
|
||||||
<td
|
<td
|
||||||
class="w-20"
|
class="w-20"
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="row.quantity"
|
v-model="row.quantity"
|
||||||
@@ -742,7 +769,7 @@ setupPage()
|
|||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="w-40"
|
class="w-40"
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
v-model="row.unit"
|
v-model="row.unit"
|
||||||
@@ -756,7 +783,7 @@ setupPage()
|
|||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="row.price"
|
v-model="row.price"
|
||||||
@@ -770,7 +797,7 @@ setupPage()
|
|||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="w-40"
|
class="w-40"
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
|
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
@@ -788,7 +815,7 @@ setupPage()
|
|||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="w-40"
|
class="w-40"
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="row.discountPercent"
|
v-model="row.discountPercent"
|
||||||
@@ -802,7 +829,7 @@ setupPage()
|
|||||||
</UInput>
|
</UInput>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode !== 'pagebreak'"
|
||||||
>
|
>
|
||||||
<p class="text-right font-bold whitespace-nowrap">{{getRowAmount(row)}} €</p>
|
<p class="text-right font-bold whitespace-nowrap">{{getRowAmount(row)}} €</p>
|
||||||
</td>
|
</td>
|
||||||
@@ -970,6 +997,12 @@ setupPage()
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
|
<UButton
|
||||||
|
@click="addPosition('service')"
|
||||||
|
class="mt-3"
|
||||||
|
>
|
||||||
|
+ Leistungsposition
|
||||||
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
@click="addPosition('normal')"
|
@click="addPosition('normal')"
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import interactionPlugin from '@fullcalendar/interaction'
|
|||||||
import listPlugin from '@fullcalendar/list';
|
import listPlugin from '@fullcalendar/list';
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
const viewport = useViewport()
|
const viewport = useViewport()
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ import InputGroup from "~/components/InputGroup.vue";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ const searchString = ref('')
|
|||||||
const showDrafts = ref(false)
|
const showDrafts = ref(false)
|
||||||
|
|
||||||
const filteredRows = computed(() => {
|
const filteredRows = computed(() => {
|
||||||
let items = [...dataStore.incomingInvoices.map(i => {return {...i, type: "incomingInvoice"}}),...dataStore.createddocuments]
|
let items = [...dataStore.incominginvoices.map(i => {return {...i, type: "incomingInvoice"}}),...dataStore.createddocuments]
|
||||||
|
|
||||||
console.log(dataStore.createddocuments)
|
console.log(dataStore.createddocuments)
|
||||||
|
|
||||||
|
|||||||
221
spaces/pages/services/[mode]/[[id]].vue
Normal file
221
spaces/pages/services/[mode]/[[id]].vue
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
<script setup>
|
||||||
|
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
||||||
|
import DocumentList from "~/components/DocumentList.vue";
|
||||||
|
import DocumentUpload from "~/components/DocumentUpload.vue";
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataStore = useDataStore()
|
||||||
|
const supabase = useSupabaseClient()
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
const toast = useToast()
|
||||||
|
const id = ref(route.params.id ? route.params.id : null )
|
||||||
|
|
||||||
|
let currentItem = ref(null)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Working
|
||||||
|
const mode = ref(route.params.mode || "show")
|
||||||
|
const itemInfo = ref({
|
||||||
|
unit: 1,
|
||||||
|
tags: []
|
||||||
|
})
|
||||||
|
|
||||||
|
//Functions
|
||||||
|
const setupPage = () => {
|
||||||
|
if(mode.value === "show" || mode.value === "edit"){
|
||||||
|
currentItem.value = dataStore.getServiceById(Number(useRoute().params.id))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode.value === "edit") itemInfo.value = currentItem.value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const editItem = async () => {
|
||||||
|
router.push(`/services/edit/${currentItem.value.id}`)
|
||||||
|
setupPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancelEditorCreate = () => {
|
||||||
|
mode.value = "show"
|
||||||
|
itemInfo.value = {
|
||||||
|
id: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setupPage()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<h1
|
||||||
|
class="mb-3 truncate font-bold text-2xl"
|
||||||
|
v-if="currentItem "
|
||||||
|
>Leistung: {{currentItem.name}}</h1>
|
||||||
|
<UTabs
|
||||||
|
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Dokumente'}]"
|
||||||
|
v-if="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>
|
||||||
|
</Toolbar><!--
|
||||||
|
<UBadge
|
||||||
|
v-for="tag in currentItem.tags"
|
||||||
|
class="mr-2"
|
||||||
|
>
|
||||||
|
{{tag}}
|
||||||
|
</UBadge>
|
||||||
|
<UDivider
|
||||||
|
class="my-2"
|
||||||
|
/>-->
|
||||||
|
<span v-if="currentItem.sellingPrice">Verkaufspreis: {{Number(currentItem.sellingPrice).toFixed(2)}} €<br></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="item.label === 'Logbuch'"
|
||||||
|
>
|
||||||
|
<HistoryDisplay
|
||||||
|
type="product"
|
||||||
|
v-if="currentItem"
|
||||||
|
:element-id="currentItem.id"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="item.label === 'Bestand'"
|
||||||
|
>
|
||||||
|
Bestand: {{dataStore.getStockByProductId(currentItem.id)}} {{dataStore.units.find(unit => unit.id === currentItem.unit) ? dataStore.units.find(unit => unit.id === currentItem.unit).name : ""}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="item.label === 'Dokumente'"
|
||||||
|
>
|
||||||
|
<Toolbar>
|
||||||
|
<DocumentUpload
|
||||||
|
type="product"
|
||||||
|
:element-id="currentItem.id"
|
||||||
|
/>
|
||||||
|
</Toolbar>
|
||||||
|
|
||||||
|
|
||||||
|
<DocumentList :documents="dataStore.getDocumentsByProductId(currentItem.id)"/>
|
||||||
|
</div>
|
||||||
|
</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="Hersteller:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.manufacturer"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Einheit:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
v-model="itemInfo.unit"
|
||||||
|
:options="dataStore.units"
|
||||||
|
option-attribute="name"
|
||||||
|
value-attribute="id"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.units.find(unit => unit.id === itemInfo.unit) ? dataStore.units.find(unit => unit.id === itemInfo.unit).name : itemInfo.unit }}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Tags:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
v-model="itemInfo.tags"
|
||||||
|
:options="dataStore.ownTenant.tags.products"
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="EAN:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.ean"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Barcode:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.barcode"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Einkaufspreis:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.purchasePrice"
|
||||||
|
type="number"
|
||||||
|
steps="0.01"
|
||||||
|
>
|
||||||
|
<template #trailing>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||||
|
</template>
|
||||||
|
</UInput>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
96
spaces/pages/services/index.vue
Normal file
96
spaces/pages/services/index.vue
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<template>
|
||||||
|
<Toolbar>
|
||||||
|
<UButton @click="router.push(`/services/create/`)">+ Leistung</UButton>
|
||||||
|
|
||||||
|
<UInput
|
||||||
|
v-model="searchString"
|
||||||
|
placeholder="Suche..."
|
||||||
|
/>
|
||||||
|
</Toolbar>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="table">
|
||||||
|
<UTable
|
||||||
|
:rows="filteredRows"
|
||||||
|
:columns="itemColumns"
|
||||||
|
@select="selectItem"
|
||||||
|
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
|
||||||
|
>
|
||||||
|
<template #sellingPrice-data="{row}">
|
||||||
|
{{row.sellingPrice ? Number(row.sellingPrice).toFixed(2) + " €" : ""}}
|
||||||
|
</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}">
|
||||||
|
{{dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : row.unit}}
|
||||||
|
</template>
|
||||||
|
</UTable>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
const dataStore = useDataStore()
|
||||||
|
const supabase = useSupabaseClient()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const itemColumns = [
|
||||||
|
{
|
||||||
|
key: "name",
|
||||||
|
label: "Name",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "unit",
|
||||||
|
label: "Einheit",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sellingPrice",
|
||||||
|
label: "Verkaufspreis",
|
||||||
|
sortable: true
|
||||||
|
}/*,
|
||||||
|
{
|
||||||
|
key: "tags",
|
||||||
|
label: "Tags",
|
||||||
|
sortable: true
|
||||||
|
}*/
|
||||||
|
]
|
||||||
|
|
||||||
|
const selectItem = (item) => {
|
||||||
|
console.log(item)
|
||||||
|
router.push(`/services/show/${item.id} `)
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchString = ref('')
|
||||||
|
|
||||||
|
const filteredRows = computed(() => {
|
||||||
|
if(!searchString.value) {
|
||||||
|
return dataStore.services
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataStore.services.filter(product => {
|
||||||
|
return Object.values(product).some((value) => {
|
||||||
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
const phasesTemplates = ref([])
|
const phasesTemplates = ref([])
|
||||||
const emailAccounts = ref([])
|
const emailAccounts = ref([])
|
||||||
const texttemplates =ref([])
|
const texttemplates =ref([])
|
||||||
|
const services =ref([])
|
||||||
|
|
||||||
|
|
||||||
const rights = ref({
|
const rights = ref({
|
||||||
@@ -279,6 +280,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
await fetchPhasesTemplates()
|
await fetchPhasesTemplates()
|
||||||
await fetchEmailAccounts()
|
await fetchEmailAccounts()
|
||||||
await fetchTextTemplates()
|
await fetchTextTemplates()
|
||||||
|
await fetchServices()
|
||||||
loaded.value = true
|
loaded.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,6 +323,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
phasesTemplates.value = []
|
phasesTemplates.value = []
|
||||||
emailAccounts.value = []
|
emailAccounts.value = []
|
||||||
texttemplates.value = []
|
texttemplates.value = []
|
||||||
|
services.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasRight (right) {
|
function hasRight (right) {
|
||||||
@@ -600,6 +603,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
texttemplates.value = (await supabase.from("textTemplates").select().eq('tenant', currentTenant.value)).data
|
texttemplates.value = (await supabase.from("textTemplates").select().eq('tenant', currentTenant.value)).data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchServices() {
|
||||||
|
services.value = (await supabase.from("services").select().eq('tenant', currentTenant.value)).data
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchDocuments () {
|
async function fetchDocuments () {
|
||||||
let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
|
let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
|
||||||
|
|
||||||
@@ -915,6 +922,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
return products.value.find(item => item.id === itemId)
|
return products.value.find(item => item.id === itemId)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getServiceById = computed(() => (itemId) => {
|
||||||
|
return services.value.find(item => item.id === itemId)
|
||||||
|
})
|
||||||
|
|
||||||
const getVendorById = computed(() => (itemId) => {
|
const getVendorById = computed(() => (itemId) => {
|
||||||
return vendors.value.find(item => item.id === itemId)
|
return vendors.value.find(item => item.id === itemId)
|
||||||
})
|
})
|
||||||
@@ -1041,6 +1052,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
phasesTemplates,
|
phasesTemplates,
|
||||||
emailAccounts,
|
emailAccounts,
|
||||||
texttemplates,
|
texttemplates,
|
||||||
|
services,
|
||||||
documentTypesForCreation,
|
documentTypesForCreation,
|
||||||
|
|
||||||
//Functions
|
//Functions
|
||||||
@@ -1112,6 +1124,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
getEventsByResource,
|
getEventsByResource,
|
||||||
getCostCentresComposed,
|
getCostCentresComposed,
|
||||||
getProductById,
|
getProductById,
|
||||||
|
getServiceById,
|
||||||
getVendorById,
|
getVendorById,
|
||||||
getIncomingInvoiceById,
|
getIncomingInvoiceById,
|
||||||
getContractById,
|
getContractById,
|
||||||
|
|||||||
Reference in New Issue
Block a user