diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue
index 16b9024..151fa33 100644
--- a/pages/createDocument/edit/[[id]].vue
+++ b/pages/createDocument/edit/[[id]].vue
@@ -13,6 +13,9 @@ definePageMeta({
middleware: "auth"
})
+const showProductSelectionModal = ref(false)
+const showServiceSelectionModal = ref(false)
+
const itemInfo = ref({
type: "invoices",
@@ -58,11 +61,23 @@ const itemInfo = ref({
const letterheads = ref([])
const createdDocuments = ref([])
+const products = ref([])
+const productcategories = ref([])
+const selectedProductcategorie = ref(null)
+const services = ref([])
+const servicecategories = ref([])
+const selectedServicecategorie = ref(null)
const setupPage = async () => {
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
createdDocuments.value = (await useSupabaseSelect("createddocuments","*"))
+ services.value = (await useSupabaseSelect("services","*"))
+ servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
+ products.value = (await useSupabaseSelect("products","*"))
+ productcategories.value = (await useSupabaseSelect("productcategories","*"))
+ if(productcategories.value.length > 0) selectedProductcategorie.value = productcategories.value[0].id
+ if(servicecategories.value.length > 0) selectedServicecategorie.value = servicecategories.value[0].id
if(route.params) {
if(route.params.id) itemInfo.value = dataStore.getCreatedDocumentById(Number(route.params.id))
@@ -1215,24 +1230,67 @@ setupPage()
class="w-120"
v-else-if="row.mode === 'normal'"
>
-
+
-
- {{row.product ? dataStore.getProductById(row.product).name : "Kein Produkt ausgewählt" }}
-
-
+ >
+
+ {{row.product ? dataStore.getProductById(row.product).name : "Kein Produkt ausgewählt" }}
+
+
+
+
+
+
+ Artikel Auswählen
+
+
+
+
+
+
+
+ {
+ row.product = i.id
+ row.unit = dataStore.getProductById(row.product).unit,
+ row.price = (dataStore.getProductById(row.product).sellingPrice || 0),
+ row.description = dataStore.getProductById(row.product).description
+ showProductSelectionModal = false}"
+ >
+
+
+
+
+
+
@@ -1241,23 +1299,65 @@ setupPage()
class="w-120"
v-else-if="row.mode === 'service'"
>
-
-
- {{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}
-
-
+
+
+
+ {{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}
+
+
+
+
+
+
+ Leistung Auswählen
+
+
+
+
+
+
+
+ {
+ row.service = i.id
+ row.unit = dataStore.getServiceById(row.service).unit,
+ row.price = dataStore.getServiceById(row.service).sellingPrice || 0,
+ row.description = dataStore.getServiceById(row.service).description
+ showServiceSelectionModal = false}"
+ >
+
+
+
+
+
+import HistoryDisplay from "~/components/HistoryDisplay.vue";
+import DocumentList from "~/components/DocumentList.vue";
+import DocumentUpload from "~/components/DocumentUpload.vue";
+import {useSupabaseSelect} from "~/composables/useSupabase.js";
+import dayjs from "dayjs";
+
+definePageMeta({
+ middleware: "auth"
+})
+
+defineShortcuts({
+ 'backspace': () => {
+ router.push("/servicecategories")
+ },
+ 'arrowleft': () => {
+ if(openTab.value > 0){
+ openTab.value -= 1
+ }
+ },
+ 'arrowright': () => {
+ if(openTab.value < 3) {
+ openTab.value += 1
+ }
+ },
+})
+
+const dataStore = useDataStore()
+const route = useRoute()
+const router = useRouter()
+const toast = useToast()
+const id = ref(route.params.id ? route.params.id : null )
+
+//Working
+const mode = ref(route.params.mode || "show")
+const itemInfo = ref({})
+const openTab = ref(0)
+
+//Functions
+const setupPage = async () => {
+ if(mode.value === "show" || mode.value === "edit"){
+ itemInfo.value = await useSupabaseSelectSingle("servicecategories",route.params.id,"*")
+ }
+
+
+}
+
+const cancelEditorCreate = () => {
+ if(itemInfo.value) {
+ router.push(`/servicecategories/show/${itemInfo.value.id}`)
+ } else {
+ router.push(`/servicecategories/`)
+ }
+}
+
+
+
+
+setupPage()
+
+
+
+
+
+
+ Leistungskategorien
+
+
+
+ {{itemInfo.name ? `Leistungskategorie: ${itemInfo.name}` : (mode === 'create' ? 'Leistungskategorie erstellen' : 'Leistungskategorie bearbeiten')}}
+
+
+
+ Speichern
+
+
+ Erstellen
+
+
+ Abbrechen
+
+
+ Bearbeiten
+
+
+
+
+
+
+
+
+
+
+ | Name: |
+ {{itemInfo.name}} |
+
+
+ | Beschreibung: |
+ {{itemInfo.description}} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/servicecategories/index.vue b/pages/servicecategories/index.vue
new file mode 100644
index 0000000..6ab2eac
--- /dev/null
+++ b/pages/servicecategories/index.vue
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+ + Leistungskategorie
+
+
+
+
+
+
+
+ Spalten
+
+
+
+
+ router.push(`/servicecategories/show/${i.id}`) "
+ :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Leistungskategorien anzuzeigen' }"
+ >
+
+ {{row.name}}
+
+ {{row.name}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/services/[mode]/[[id]].vue b/pages/services/[mode]/[[id]].vue
index a249585..4646e7f 100644
--- a/pages/services/[mode]/[[id]].vue
+++ b/pages/services/[mode]/[[id]].vue
@@ -23,6 +23,7 @@ const dataStore = useDataStore()
const route = useRoute()
const router = useRouter()
const toast = useToast()
+const supabase = useSupabaseClient()
const id = ref(route.params.id ? route.params.id : null )
//Working
@@ -34,11 +35,20 @@ const itemInfo = ref({
const openTab = ref(0)
+const servicecategories = ref([])
+const units = ref([])
+
//Functions
-const setupPage = () => {
- if(mode.value === "show" || mode.value === "edit"){
- itemInfo.value = dataStore.getServiceById(Number(useRoute().params.id))
+const setupPage = async () => {
+ if(mode.value === "show"){
+ itemInfo.value = await useSupabaseSelectSingle("services",useRoute().params.id, "*")
+ } else if(mode.value === "edit") {
+ itemInfo.value = await useSupabaseSelectSingle("services",useRoute().params.id)
}
+
+ servicecategories.value = await useSupabaseSelect("servicecategories","*")
+ units.value = (await supabase.from("units").select()).data
+
}
setupPage()
@@ -76,42 +86,62 @@ setupPage()
-
-
-
- Verkaufspreis: {{String(Number(itemInfo.sellingPrice).toFixed(2)).replace(".",",")}} €
- Beschreibung:
- {{itemInfo.description}}
-
-
-
+
+
+
+
+
+ | Name: |
+ {{itemInfo.name}} |
+
+
+ | Leistungsnummer: |
+ {{itemInfo.serviceNumber}} |
+
+
+ | Verkaufpreis: |
+ {{itemInfo.sellingPrice && itemInfo.sellingPrice.toFixed(2).replace(".", ",") + " €"}} |
+
+
+ | Einheit: |
+ {{units.find(i => i.id === itemInfo.unit) ? units.find(i => i.id === itemInfo.unit).name : itemInfo.unit}} |
+
+
+ | Tags: |
+ {{itemInfo.tags.join(", ")}} |
+
+
+ | Leistungskategorien: |
+ {{itemInfo.servicecategories ? itemInfo.servicecategories.map(i => servicecategories.find(x => x.id === i).name).join(", ") : ""}} |
+
+
+ | Beschreibung: |
+ {{itemInfo.description}} |
+
+
+
-
-
+
+
+
+
-
- Bestand: {{dataStore.getStockByProductId(itemInfo.id)}} {{dataStore.units.find(unit => unit.id === itemInfo.unit) ? dataStore.units.find(unit => unit.id === itemInfo.unit).name : ""}}
-
-
-
+
+ class="mt-5"
+ >
+
-
-
+
+
+
+ v-model="itemInfo.servicecategories"
+ multiple
+ >
+
+ {{itemInfo.servicecategories && itemInfo.servicecategories.length > 0 ? itemInfo.servicecategories.map(i => servicecategories.find(x => x.id === i).name).join(", ") : "Keine Kategorien ausgewählt"}}
+
+
\ No newline at end of file
|