Changed Backend to Supabase
This commit is contained in:
59
docker-compose.yml
Normal file
59
docker-compose.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
web:
|
||||
image: registry.gitlab.com/cmykmedia/spaces:main-WEB
|
||||
restart: always
|
||||
networks:
|
||||
- traefik
|
||||
environment:
|
||||
STRAPI_URL: "http://federspiel-tech.spaces.software:1337"
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=traefik"
|
||||
- "traefik.port=3000"
|
||||
# Middlewares
|
||||
- "traefik.http.middlewares.spaces-frontend-redirect-web-secure.redirectscheme.scheme=https"
|
||||
# Web Entrypoint
|
||||
- "traefik.http.routers.spaces-frontend.middlewares=spaces-frontend-redirect-web-secure"
|
||||
- "traefik.http.routers.spaces-frontend.rule=Host(`ft.spaces.software`)"
|
||||
- "traefik.http.routers.spaces-frontend.entrypoints=web"
|
||||
# Web Secure Entrypoint
|
||||
- "traefik.http.routers.spaces-frontend-secure.rule=Host(`ft.spaces.software`)"
|
||||
- "traefik.http.routers.spaces-frontend-secure.entrypoints=web-secured" #
|
||||
- "traefik.http.routers.spaces-frontend-secure.tls.certresolver=mytlschallenge"
|
||||
|
||||
# backend:
|
||||
# image: registry.gitlab.com/cmykmedia/manordsonne:master-BACKEND
|
||||
# restart: always
|
||||
# networks:
|
||||
# - traefik
|
||||
# expose:
|
||||
# - 8080
|
||||
# environment:
|
||||
# COMPANY_RECIPIENT: "info@ma-nordsonne.de"
|
||||
# REQUEST_PORT: 8080
|
||||
# SMTP_USER: "info@ma-nordsonne.de"
|
||||
# SMTP_HOST: "stmp.strato.de"
|
||||
# SMTP_PASSWORD: "nM.-XiPM9rJd4y_Qk4*sTAeBr.GdVkAJxuUkzH2gugEU@BfsaYf-mf4ith6b7khXXFD29ZfmmRZfR@TTtb*WXKHYGLbBE3ubc7@4"
|
||||
# SMTP_PORT: 465
|
||||
# SMTP_SSL: "false"
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
# - "traefik.docker.network=traefik"
|
||||
# - "traefik.port=8080"
|
||||
# # Middlewares
|
||||
# - "traefik.http.middlewares.manordsonne-backend-redirect-web-secure.redirectscheme.scheme=https"
|
||||
# ###
|
||||
# - "traefik.http.routers.manordsonne-backend.middlewares=manordsonne-backend-redirect-web-secure"
|
||||
# - "traefik.http.routers.manordsonne-backend.rule=Host(`backend.ma-nordsonne.de`)"
|
||||
# - "traefik.http.routers.manordsonne-backend.entrypoints=web"
|
||||
# ####
|
||||
# - "traefik.http.routers.manordsonne-backend-secure.rule=Host(`backend.ma-nordsonne.de`)"
|
||||
# - "traefik.http.routers.manordsonne-backend-secure.entrypoints=web-secured"
|
||||
# - "traefik.http.routers.manordsonne-backend-secure.tls.certresolver=mytlschallenge"
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
|
||||
2
docu
2
docu
@@ -8,6 +8,8 @@ Hetzner PW: iV5HTgj4Xt
|
||||
|
||||
DO PW: 3Rtp39VFEr
|
||||
|
||||
Supabase PW: MuP74MreBSMuP74MreBS
|
||||
|
||||
|
||||
|
||||
Banking Test:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:17-alpine
|
||||
FROM node:18-alpine
|
||||
|
||||
RUN mkdir -p /usr/src/nuxt-app
|
||||
WORKDIR /usr/src/nuxt-app
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
const user = useStrapiUser()
|
||||
<script setup>
|
||||
const user = useSupabaseUser()
|
||||
const router = useRouter()
|
||||
const {logout} = useStrapiAuth()
|
||||
const supabase = useSupabaseClient()
|
||||
const tenants = (await supabase.from("tenants").select()).data
|
||||
|
||||
|
||||
const userTenant = ref({})
|
||||
if(user) userTenant.value = tenants.find(tenant => tenant.id === user.value.app_metadata.tenant)
|
||||
const userDropdownItems = [
|
||||
[
|
||||
{
|
||||
label: user.value ? user.value.username : "Profil",
|
||||
label: user.value ? user.value.email : "Profil",
|
||||
|
||||
},{
|
||||
label: userTenant.value.id ? userTenant.value.name : "",
|
||||
|
||||
}
|
||||
],
|
||||
@@ -14,7 +21,7 @@ const userDropdownItems = [
|
||||
{
|
||||
label: "Logout",
|
||||
click: () => {
|
||||
logout()
|
||||
|
||||
router.push("/login")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
export default defineNuxtRouteMiddleware((to, _from) => {
|
||||
const user = useStrapiUser()
|
||||
const user = useSupabaseUser()
|
||||
const router = useRouter()
|
||||
if (!user.value) {
|
||||
useCookie('redirect', { path: '/' }).value = to.fullPath
|
||||
return navigateTo('/login')
|
||||
//useCookie('redirect', { path: '/' }).value = to.fullPath
|
||||
return router.push("/login")
|
||||
}
|
||||
})
|
||||
@@ -4,13 +4,13 @@ export default defineNuxtConfig({
|
||||
modules: [
|
||||
'@pinia/nuxt',
|
||||
'@nuxt/ui',
|
||||
'@nuxtjs/strapi'
|
||||
'@nuxtjs/strapi',
|
||||
'@nuxtjs/supabase'
|
||||
],
|
||||
routeRules: {
|
||||
'/printing': {ssr:false}
|
||||
|
||||
}
|
||||
//Test
|
||||
|
||||
})
|
||||
|
||||
|
||||
943
spaces/package-lock.json
generated
943
spaces/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/devtools": "latest",
|
||||
"@nuxtjs/supabase": "^1.1.4",
|
||||
"nuxt": "^3.8.0",
|
||||
"vue": "^3.3.7",
|
||||
"vue-router": "^4.2.5"
|
||||
@@ -22,7 +23,8 @@
|
||||
"@pinia/nuxt": "^0.5.1",
|
||||
"@tato30/vue-pdf": "^1.8.1",
|
||||
"@vicons/ionicons5": "^0.12.0",
|
||||
"axios": "^1.6.0",
|
||||
"axios": "^1.6.2",
|
||||
"buffer": "^6.0.3",
|
||||
"jsprintmanager": "^6.0.3",
|
||||
"pinia": "^2.1.7",
|
||||
"uuidv4": "^6.2.13",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<a v-for="item in customers" @click="selectItem(item)">
|
||||
<UCard class="listItem">
|
||||
<UBadge>{{item.attributes.customerNumber}}</UBadge> {{item.attributes.name}}
|
||||
<UBadge>{{item.customerNumber}}</UBadge> {{item.name}}
|
||||
</UCard>
|
||||
</a>
|
||||
|
||||
@@ -39,19 +39,19 @@
|
||||
|
||||
<UCard v-if="selectedItem.id">
|
||||
<template #header>
|
||||
<UBadge>{{selectedItem.attributes.customerNumber}}</UBadge> {{selectedItem.attributes.name}}
|
||||
<UBadge>{{selectedItem.customerNumber}}</UBadge> {{selectedItem.name}}
|
||||
</template>
|
||||
|
||||
Kontakte:<br>
|
||||
<ul>
|
||||
<li v-for="contact in selectedItem.attributes.contacts.data">{{contact.attributes.lastName}}, {{contact.attributes.firstName}}</li>
|
||||
</ul>
|
||||
<!-- {{selectedItem.attributes.contacts.data}}-->
|
||||
<!-- <ul>
|
||||
<li v-for="contact in selectedItem.contacts.data">{{contact.lastName}}, {{contact.firstName}}</li>
|
||||
</ul>-->
|
||||
<!-- {{selectedItem.contacts.data}}-->
|
||||
<br>
|
||||
Projekte:<br>
|
||||
<ul>
|
||||
<li v-for="project in selectedItem.attributes.projects.data"><router-link :to="'/projects?id=' + project.id">{{project.attributes.name}}</router-link></li>
|
||||
</ul>
|
||||
<!-- <ul>
|
||||
<li v-for="project in selectedItem.projects.data"><router-link :to="'/projects?id=' + project.id">{{project.name}}</router-link></li>
|
||||
</ul>-->
|
||||
|
||||
<br><br>
|
||||
|
||||
@@ -68,8 +68,13 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create} = useStrapi4()
|
||||
const customers = (await find('customers',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
//const {find,create} = useStrapi4()
|
||||
//const customers = (await find('customers',{populate: "*"})).data
|
||||
|
||||
const customers = (await supabase.from("customers").select()).data
|
||||
|
||||
|
||||
|
||||
let showCreateCustomer = ref(false)
|
||||
@@ -86,8 +91,15 @@ const selectItem = (item) => {
|
||||
}
|
||||
|
||||
const createCustomer = async () => {
|
||||
await create('customers', customerInfo.value)
|
||||
console.log("Create")
|
||||
//await create('customers', customerInfo.value)
|
||||
const {data,error} = await supabase
|
||||
.from("customers")
|
||||
.insert([customerInfo.value])
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
|
||||
|
||||
customerInfo.value = {}
|
||||
showCreateCustomer.value = false
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
id="fileUploadInput"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
<!-- <UFormGroup
|
||||
label="Name:"
|
||||
class="mt-3"
|
||||
>
|
||||
<UInput
|
||||
v-model="fileUploadFormData.name"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormGroup>-->
|
||||
<UFormGroup
|
||||
label="Tags:"
|
||||
class="mt-3"
|
||||
@@ -39,6 +39,17 @@
|
||||
v-model="fileUploadFormData.tags"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Ordner:"
|
||||
class="mt-3"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="folders"
|
||||
v-model="fileUploadFormData.folder"
|
||||
value-attribute="label"
|
||||
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<template #footer>
|
||||
<UButton
|
||||
@@ -51,21 +62,18 @@
|
||||
</UCard>
|
||||
|
||||
</UModal>
|
||||
<!-- <USelectMenu :options="sortOptions"/>-->
|
||||
</div>
|
||||
<div class="documentList">
|
||||
<div >
|
||||
<USlideover
|
||||
v-model="showDocumentModal"
|
||||
fullscreen
|
||||
>
|
||||
<UCard>
|
||||
<template #header>
|
||||
{{selectedDocument.attributes.name}}
|
||||
</template>
|
||||
|
||||
<!-- <a
|
||||
v-if="selectedDocument.attributes"
|
||||
v-if="selectedDocument"
|
||||
target="_blank"
|
||||
:href="`http://localhost:1337${selectedDocument.attributes.file.data.attributes.url}`"
|
||||
:href="`http://localhost:1337${selectedDocument.file.data.url}`"
|
||||
class="p-2"
|
||||
>
|
||||
Anzeigen
|
||||
@@ -73,17 +81,24 @@
|
||||
|
||||
</a>-->
|
||||
|
||||
<UFormGroup
|
||||
{{selectedDocument}}
|
||||
|
||||
<embed
|
||||
:src="pdfSource"
|
||||
>
|
||||
|
||||
|
||||
<!-- <UFormGroup
|
||||
label="Tags:"
|
||||
>
|
||||
<USelectMenu
|
||||
v-if="selectedDocument.attributes"
|
||||
v-if="selectedDocument"
|
||||
multiple
|
||||
searchable
|
||||
searchable-placeholder="Suchen..."
|
||||
:options="tags"
|
||||
v-on:change="update('documents',selectedDocument.id, {tags: selectedDocument.attributes.tags})"
|
||||
v-model="selectedDocument.attributes.tags"
|
||||
v-on:change="update('documents',selectedDocument.id, {tags: selectedDocument.tags})"
|
||||
v-model="selectedDocument.tags"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
@@ -93,10 +108,10 @@
|
||||
>
|
||||
<USelectMenu
|
||||
:options="states"
|
||||
v-model="selectedDocument.attributes.state"
|
||||
v-on:change="update('documents',selectedDocument.id,{state: selectedDocument.attributes.state})"
|
||||
v-model="selectedDocument.state"
|
||||
v-on:change="update('documents',selectedDocument.id,{state: selectedDocument.state})"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormGroup>-->
|
||||
|
||||
<div>
|
||||
<VuePDF
|
||||
@@ -118,55 +133,55 @@
|
||||
|
||||
</UCard>
|
||||
</USlideover>
|
||||
<a
|
||||
v-for="document in documents.filter(doc => doc.attributes.state != 'Archiviert')" class="documentListItem"
|
||||
@click="openDocument(document)"
|
||||
>
|
||||
<div>
|
||||
{{document.attributes.name}}<br>
|
||||
<UBadge
|
||||
v-for="tag in document.attributes.tags"
|
||||
variant="outline"
|
||||
color="primary"
|
||||
>{{tag}}</UBadge>
|
||||
<UBadge
|
||||
color="rose"
|
||||
variant="outline"
|
||||
>{{document.attributes.state}}</UBadge>
|
||||
|
||||
</div>
|
||||
</a>
|
||||
<UTabs
|
||||
:items="folders"
|
||||
orientation="vertical"
|
||||
v-model="tabOpen"
|
||||
:ui="{ wrapper: 'flex items-top gap-4', list: { width: 'w-72', padding: 'p-3' } }"
|
||||
>
|
||||
<template #item="{item}">
|
||||
<div class="documentList">
|
||||
<div
|
||||
v-if="documentsComposed.filter(doc => doc.folder === item.label).length > 0"
|
||||
v-for="document in documentsComposed.filter(doc => doc.folder === item.label)"
|
||||
class="documentListItem"
|
||||
>
|
||||
<embed
|
||||
:src="document.url"
|
||||
class="previewEmbed"
|
||||
/>
|
||||
<UButton
|
||||
@click="openDocument(document)"
|
||||
class="mt-3"
|
||||
>
|
||||
<UIcon name="i-heroicons-eye-solid" />
|
||||
</UButton>
|
||||
|
||||
<!-- {{document.name}}<br>-->
|
||||
<!-- <UBadge
|
||||
v-for="tag in document.tags"
|
||||
variant="outline"
|
||||
color="primary"
|
||||
>{{tag}}</UBadge>
|
||||
<UBadge
|
||||
color="rose"
|
||||
variant="outline"
|
||||
>{{document.state}}</UBadge>-->
|
||||
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Keine Dokumente in diesem Ordner</p>
|
||||
<UButton
|
||||
@click="uploadModalOpen = true"
|
||||
>
|
||||
Hochladen
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</UTabs>
|
||||
</div>
|
||||
|
||||
<!-- <div class="documentPreview" v-if="selectedDocument.attributes">
|
||||
<UFormGroup
|
||||
label="Tags:"
|
||||
>
|
||||
<USelectMenu
|
||||
v-if="selectedDocument.attributes"
|
||||
multiple
|
||||
searchable
|
||||
searchable-placeholder="Suchen..."
|
||||
:options="tags"
|
||||
v-on:change="update('documents',selectedDocument.id, {tags: selectedDocument.attributes.tags})"
|
||||
v-model="selectedDocument.attributes.tags"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Status:"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="states"
|
||||
v-model="selectedDocument.attributes.state"
|
||||
v-on:change="update('documents',selectedDocument.id,{state: selectedDocument.attributes.state})"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<h4 v-if="selectedDocument.attributes">{{selectedDocument.attributes.name}}</h4>
|
||||
<!– <embed src="http://localhost:1337/uploads/RE_1748755_cb0b16cd30.pdf">–>
|
||||
{{selectedDocument}}
|
||||
|
||||
</div>-->
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@@ -175,96 +190,114 @@
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
const supabase = useSupabaseClient()
|
||||
const user = useSupabaseUser()
|
||||
|
||||
const sortOptions = ['Hinzugefügt',"Bearbeitet","Name"]
|
||||
const documents = (await supabase.from("documents").select()).data
|
||||
|
||||
const {find,create, update} = useStrapi4()
|
||||
const client = useStrapiClient()
|
||||
const strapiMediaUrl = useStrapiMedia()
|
||||
const documents = (await find('documents',{populate: "*"})).data
|
||||
const documentsComposed = ref([])
|
||||
async function composeDocs () {
|
||||
for(const doc of documents){
|
||||
let fileurl = (await supabase.storage.from('documents').createSignedUrl(doc.path,60*60)).data.signedUrl
|
||||
|
||||
import { VuePDF, usePDF } from '@tato30/vue-pdf'
|
||||
documentsComposed.value.push({...doc, url: fileurl})
|
||||
|
||||
const page = ref(1)
|
||||
const vuePDFRef = ref(null)
|
||||
const pdfSource = ref("https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf")
|
||||
const { pdf, pages } = usePDF(pdfSource)
|
||||
}
|
||||
}
|
||||
|
||||
await composeDocs()
|
||||
|
||||
const tabOpen = ref(0)
|
||||
const uploadModalOpen = ref(false)
|
||||
let fileUploadData = null
|
||||
const fileUploadFormData = ref({
|
||||
name: "",
|
||||
tags: ["Dokument"]
|
||||
tags: [],
|
||||
folder: "",
|
||||
object: "",
|
||||
path: ""
|
||||
})
|
||||
|
||||
let tags = ["Eingangsrechnung","Ausgangrechnung","Mahnung", "Dokument"]
|
||||
let states = ["Eingang", "Zugeordnet", "Archiviert"]
|
||||
|
||||
const uploadFile = async () => {
|
||||
try {
|
||||
|
||||
fileUploadData = document.getElementById("fileUploadInput").files[0]
|
||||
|
||||
let formData = new FormData()
|
||||
formData.append('files.file', fileUploadData)
|
||||
|
||||
formData.append('data', JSON.stringify(fileUploadFormData.value))
|
||||
|
||||
const {data} = await client("/documents", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
})
|
||||
const folders = [
|
||||
{
|
||||
label: "Eingang",
|
||||
},
|
||||
{
|
||||
label: "Eingangsrechnungen"
|
||||
},
|
||||
{
|
||||
label: "Ausgangsrechnungen"
|
||||
},
|
||||
{
|
||||
label: "Fahrzeuge"
|
||||
},
|
||||
{
|
||||
label: "Dokumente"
|
||||
},
|
||||
{
|
||||
label: "Archiv"
|
||||
}
|
||||
catch (error) { alert(error)}
|
||||
]
|
||||
const uploadFile = async () => {
|
||||
const file = document.getElementById("fileUploadInput").files[0]
|
||||
|
||||
const {data,error} = await supabase
|
||||
.storage
|
||||
.from("documents")
|
||||
.upload(`${user.value.app_metadata.tenant}/${fileUploadFormData.value.folder}/${file.name}`,file)
|
||||
|
||||
const returnPath = data.path
|
||||
|
||||
if(error) {
|
||||
|
||||
} else {
|
||||
console.log(returnPath)
|
||||
const files = (await supabase.storage.from('documents').list(`${user.value.app_metadata.tenant}/${fileUploadFormData.value.folder}/`, {limit: 100, offset: 0, sortBy: { column: 'name', order: 'asc' }})).data
|
||||
console.log(files)
|
||||
const fileId = files.find(temp => returnPath.includes(temp.name)).id
|
||||
|
||||
fileUploadFormData.value.object = fileId
|
||||
fileUploadFormData.value.path = returnPath
|
||||
console.log(fileUploadFormData.value)
|
||||
|
||||
const {data,error} = await supabase
|
||||
.from("documents")
|
||||
.insert([fileUploadFormData.value])
|
||||
.select()
|
||||
console.log(data)
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
uploadModalOpen.value = false;
|
||||
console.log("test")
|
||||
}
|
||||
|
||||
const updateDocument = async () => {
|
||||
await update('documents', selectedDocument.id, {tags: selectedDocument.attributes.tags, state: selectedDocument.attributes.state})
|
||||
await update('documents', selectedDocument.id, {tags: selectedDocument.tags, state: selectedDocument.state})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const selectedDocument = ref({})
|
||||
const showDocumentModal = ref(false)
|
||||
const openDocument = (document) => {
|
||||
|
||||
const openDocument = async (document) => {
|
||||
console.log("open")
|
||||
selectedDocument.value = document
|
||||
pdfSource.value = `${strapiMediaUrl}${document.attributes.file.data.attributes.url}`
|
||||
showDocumentModal.value = true
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.controlHeader {
|
||||
grid-area: headerleft;
|
||||
}
|
||||
|
||||
.documentList {
|
||||
grid-area: main;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
max-width: 80vw;
|
||||
min-height: 75vh;
|
||||
margin-right: 5vw;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.documentListItem {
|
||||
display:block;
|
||||
width: 15vw;
|
||||
height: 15vh;
|
||||
margin-right: 1em;
|
||||
height: 25vh;
|
||||
padding:1em;
|
||||
margin: 0.7em;
|
||||
border: 1px solid lightgrey;
|
||||
border-radius: 15px;
|
||||
}
|
||||
@@ -274,8 +307,15 @@ const openDocument = (document) => {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.documentPreview {
|
||||
grid-area: right;
|
||||
width: 30vw;
|
||||
.previewEmbed {
|
||||
width: 100%;
|
||||
height: 18vh;
|
||||
overflow: hidden;
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
|
||||
.previewEmbed::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -6,9 +6,16 @@
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
const {find} = useStrapi4()
|
||||
const response = await find('customers')
|
||||
console.log(response)
|
||||
|
||||
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const tasks = (await supabase.from("tasks").select()).data
|
||||
|
||||
const user = useSupabaseUser()
|
||||
console.log(user)
|
||||
|
||||
console.log(tasks)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -3,10 +3,13 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create} = useStrapi4()
|
||||
const spaces = (await find('spaces',{populate: "*"})).data
|
||||
const products = (await find('products',{populate: "*"})).data
|
||||
const movements = (await find('movements',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const spaces = (await supabase.from("spaces").select()).data
|
||||
const movements = (await supabase.from("movements").select()).data
|
||||
const products = (await supabase.from("products").select()).data
|
||||
|
||||
|
||||
|
||||
const searchinput = ref("")
|
||||
const mode = ref("")
|
||||
@@ -21,10 +24,26 @@ const inventoryChangeData = ref({
|
||||
|
||||
const createMovement = async () => {
|
||||
if(mode.value === 'incoming'){
|
||||
await create('movements', inventoryChangeData.value)
|
||||
//await create('movements', inventoryChangeData.value)
|
||||
|
||||
const {data,error} = await supabase
|
||||
.from("movements")
|
||||
.insert([inventoryChangeData.value])
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
|
||||
|
||||
} else if (mode.value === 'outgoing'){
|
||||
inventoryChangeData.value.quantity *= -1
|
||||
await create('movements', inventoryChangeData.value)
|
||||
//await create('movements', inventoryChangeData.value)
|
||||
|
||||
const {data,error} = await supabase
|
||||
.from("movements")
|
||||
.insert([inventoryChangeData.value])
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
} else if (mode.value === 'change'){}
|
||||
|
||||
inventoryChangeData.value = {
|
||||
@@ -39,7 +58,7 @@ function checkArticle(productId) {
|
||||
return products.filter(product => product.id === Number(productId)).length > 0;
|
||||
}
|
||||
function checkSpaceId(spaceId) {
|
||||
return spaces.filter(space => space.attributes.spaceNumber === spaceId).length > 0;
|
||||
return spaces.filter(space => space.id === spaceId).length > 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -75,12 +94,14 @@ function checkSpaceId(spaceId) {
|
||||
<UFormGroup
|
||||
label="Lagerplatz:"
|
||||
class="mt-3"
|
||||
>
|
||||
<UInput
|
||||
variant="outline"
|
||||
:color="checkSpaceId(inventoryChangeData.spaceId) ? 'primary' : 'rose'"
|
||||
placeholder="Barcode / Suche"
|
||||
v-model="inventoryChangeData.spaceId"
|
||||
><!--.map(space => {return {id: space.id, name: space.spaceNumber}}-->
|
||||
<USelectMenu
|
||||
:options="spaces"
|
||||
searchable
|
||||
option-attribute="spaceNumber"
|
||||
:color="checkSpaceId(inventoryChangeData.spaceId) ? 'primary' : 'rose'"
|
||||
v-model="inventoryChangeData.spaceId"
|
||||
value-attribute="id"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<script setup>
|
||||
import {move} from "@antfu/utils";
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create, update} = useStrapi4()
|
||||
const spaces = (await find('spaces',{populate: "*"})).data
|
||||
const movements = (await find('movements',{populate: "*"})).data
|
||||
const products = (await find('products',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const spaces = (await supabase.from("spaces").select()).data
|
||||
const movements = (await supabase.from("movements").select()).data
|
||||
const products = (await supabase.from("products").select()).data
|
||||
const units = (await supabase.from("units").select()).data
|
||||
|
||||
|
||||
|
||||
|
||||
let selectedItem = ref({})
|
||||
@@ -14,9 +20,10 @@ const showCreateSpace = ref(false)
|
||||
|
||||
const selectItem = (item) => {
|
||||
selectedItem.value = item
|
||||
spaceMovements.value = movements.filter(movement => movement.attributes.spaceId === selectedItem.value.attributes.spaceNumber)
|
||||
spaceMovements.value = movements.filter(movement => movement.spaceId === selectedItem.value.id)
|
||||
spaceProducts.value = []
|
||||
spaceMovements.value.forEach(movement => {
|
||||
if(!spaceProducts.value.includes(movement.attributes.productId)) spaceProducts.value.push(movement.attributes.productId)
|
||||
if(spaceProducts.value.filter(product => product.id === movement.productId).length === 0) spaceProducts.value.push(products.find(product => product.id === movement.productId))
|
||||
})
|
||||
|
||||
|
||||
@@ -30,10 +37,16 @@ const createSpaceData = ref({})
|
||||
const createSpace = async () => {
|
||||
let lastSpaceNumber = 0
|
||||
spaces.forEach(space => {
|
||||
if(space.attributes.spaceNumber > lastSpaceNumber) lastSpaceNumber = space.attributes.spaceNumber
|
||||
if(space.spaceNumber > lastSpaceNumber) lastSpaceNumber = space.spaceNumber
|
||||
})
|
||||
|
||||
await create('spaces', {...createSpaceData.value, spaceNumber: String(Number(lastSpaceNumber)+1)})
|
||||
const {data,error} = await supabase
|
||||
.from("spaces")
|
||||
.insert([ {...createSpaceData.value, spaceNumber: String(Number(lastSpaceNumber)+1)}])
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
|
||||
showCreateSpace.value = false
|
||||
createSpaceData.value = {}
|
||||
|
||||
@@ -43,9 +56,9 @@ const spaceProducts = ref([])
|
||||
const spaceMovements = ref([])
|
||||
|
||||
function getSpaceProductCount(productId) {
|
||||
let productMovements = spaceMovements.value.filter(movement => movement.attributes.productId === productId)
|
||||
let productMovements = spaceMovements.value.filter(movement => movement.productId === productId)
|
||||
let count = 0;
|
||||
productMovements.forEach(movement => count += movement.attributes.quantity)
|
||||
productMovements.forEach(movement => count += movement.quantity)
|
||||
|
||||
return count
|
||||
|
||||
@@ -87,24 +100,26 @@ function getSpaceProductCount(productId) {
|
||||
</UModal>
|
||||
<a v-for="item in spaces" @click="selectItem(item)">
|
||||
<UCard class="listItem">
|
||||
{{item.attributes.spaceNumber}} - {{item.attributes.type}}
|
||||
{{item.spaceNumber}} - {{item.type}}
|
||||
</UCard>
|
||||
</a>
|
||||
</div>
|
||||
<div id="right">
|
||||
<UCard v-if="selectedItem.attributes">
|
||||
<template #header>
|
||||
<UBadge class="mr-1">{{selectedItem.attributes.spaceNumber}}</UBadge>{{selectedItem.attributes.type}}
|
||||
</template>
|
||||
{{selectedItem.attributes.description}}
|
||||
<div v-if="selectedItem.id">
|
||||
<UCard>
|
||||
<template #header>
|
||||
<UBadge class="mr-1">{{selectedItem.spaceNumber}}</UBadge>{{selectedItem.type}}
|
||||
</template>
|
||||
{{selectedItem.description}}
|
||||
|
||||
|
||||
</UCard>
|
||||
|
||||
|
||||
<p class="mt-5">Artikel in diesem Lagerplatz</p>
|
||||
<p v-for="product in spaceProducts">{{products.find(productItem => Number(productItem.id) === Number(product)).attributes.name}} - {{getSpaceProductCount(product)}} {{products.find(productItem => Number(productItem.id) === Number(product)).attributes.unit}}</p>
|
||||
</div>
|
||||
</UCard>
|
||||
<div v-if="spaceProducts.length > 0">
|
||||
<p class="mt-5">Artikel in diesem Lagerplatz</p>
|
||||
<p v-for="product in spaceProducts">{{product.name}} - {{getSpaceProductCount(product.id)}} {{units.find(unit => unit.id === product.unit).name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
<script setup >
|
||||
|
||||
const { login } = useStrapiAuth()
|
||||
const supabase = useSupabaseClient()
|
||||
const user = useSupabaseUser()
|
||||
const router = useRouter()
|
||||
|
||||
const username = ref("flfeders")
|
||||
const email = ref("f.federspiel@federspiel.tech")
|
||||
const password = ref("Open@all4me!")
|
||||
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
await login({identifier: username.value, password: password.value})
|
||||
console.log("Successfully Logged In")
|
||||
router.push("/tasks")
|
||||
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
const { error } = await supabase.auth.signInWithPassword({
|
||||
email: email.value,
|
||||
password: password.value
|
||||
})
|
||||
if(error) {
|
||||
console.log(error)
|
||||
} else {
|
||||
console.log("Login Successful")
|
||||
router.push("/")
|
||||
}
|
||||
}
|
||||
|
||||
const user = useStrapiUser()
|
||||
console.log(user)
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="loginSite">
|
||||
<div id="loginForm">
|
||||
<UFormGroup
|
||||
label="Username:"
|
||||
label="E-Mail:"
|
||||
>
|
||||
<UInput
|
||||
v-model="username"
|
||||
v-model="email"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="listContainer">
|
||||
<a v-for="item in products" @click="selectItem(item)">
|
||||
<UCard class="listItem">
|
||||
<UBadge>{{item.id}}</UBadge> {{item.attributes.name}} - {{item.attributes.manufacturer}}
|
||||
<UBadge>{{item.id}}</UBadge> {{item.name}} - {{item.manufacturer}}
|
||||
</UCard>
|
||||
</a>
|
||||
</div>
|
||||
@@ -52,30 +52,30 @@
|
||||
<div id="right">
|
||||
<div v-if="false">
|
||||
<img
|
||||
v-if="selectedItem.attributes.image"
|
||||
:src="'http://localhost:1337' + selectedItem.attributes.image.data.attributes.url"/>
|
||||
{{selectedItem.attributes.image.data.attributes.url}}
|
||||
v-if="selectedItem.image"
|
||||
:src="'http://localhost:1337' + selectedItem.image.data.url"/>
|
||||
{{selectedItem.image.data.url}}
|
||||
</div>
|
||||
|
||||
<UCard v-if="selectedItem.attributes">
|
||||
<UCard v-if="selectedItem.id">
|
||||
<template #header>
|
||||
<UBadge>{{selectedItem.id}}</UBadge> {{selectedItem.attributes.name}}
|
||||
<UBadge>{{selectedItem.id}}</UBadge> {{selectedItem.name}}
|
||||
</template>
|
||||
<!-- <UBadge
|
||||
<UBadge
|
||||
v-for="tag in selectedItem.tags"
|
||||
class="mr-2"
|
||||
>
|
||||
{{tag}}
|
||||
</UBadge>-->
|
||||
</UBadge>
|
||||
<UDivider class="my-3"/>
|
||||
<div v-if="selectedItem.attributes">
|
||||
Hersteller: {{selectedItem.attributes.manufacturer}}<br>
|
||||
Einkaufspreis: {{selectedItem.attributes.purchasePriceNet.toFixed(2)}} €<br>
|
||||
Aufschlag: {{selectedItem.attributes.profitPercentage}} %<br>
|
||||
Verkaufspreis: {{selectedItem.attributes.retailPriceNet.toFixed(2)}} €<br>
|
||||
<div v-if="selectedItem">
|
||||
Hersteller: {{selectedItem.manufacturer}}<br>
|
||||
Einkaufspreis: {{selectedItem.purchasePriceNet}} €<br>
|
||||
Aufschlag: {{selectedItem.profitPercentage}} %<br>
|
||||
Verkaufspreis: {{selectedItem.retailPriceNet}} €<br>
|
||||
</div>
|
||||
|
||||
<UDivider class="my-3"/>
|
||||
<!--<UDivider class="my-3"/>
|
||||
<p>Verlauf:</p>
|
||||
|
||||
<table>
|
||||
@@ -97,7 +97,7 @@
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</table>-->
|
||||
|
||||
|
||||
<!-- <div
|
||||
@@ -122,8 +122,11 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create} = useStrapi4()
|
||||
const products = (await find('products',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
|
||||
|
||||
const products = (await supabase.from("products").select()).data
|
||||
|
||||
const showCreateProduct = ref(false)
|
||||
const createProductData = ref({})
|
||||
|
||||
@@ -13,6 +13,9 @@ const tabItems = [
|
||||
},{
|
||||
key: "forms",
|
||||
label: "Formulare"
|
||||
},{
|
||||
key: "timetracking",
|
||||
label: "Zeiterfassung"
|
||||
}
|
||||
]
|
||||
const selectedPhase = ref({})
|
||||
@@ -51,8 +54,35 @@ const addPhase = async (phaseBefore) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="main">
|
||||
<div id="left">
|
||||
<div>
|
||||
<UTabs :items="tabItems" class="w-full">
|
||||
<template #item="{ item }">
|
||||
<div v-if="item.key === 'phases'" class="space-y-3">
|
||||
<div id="phaseList">
|
||||
<a
|
||||
v-for="phase in project.attributes.phases"
|
||||
@click="selectedPhase = phase"
|
||||
>
|
||||
<div
|
||||
class="phaseContainer"
|
||||
>
|
||||
<span>{{phase.name}} - {{phase.position}}</span>
|
||||
</div>
|
||||
|
||||
<a class="plusIcon" @click="addPhase(phase)">
|
||||
|
||||
<UDivider icon="i-heroicons-plus-circle"/>
|
||||
</a>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-else-if="item.key === 'password'" class="space-y-3">
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</UTabs>
|
||||
<!-- <div id="left">
|
||||
<a
|
||||
v-for="phase in project.attributes.phases"
|
||||
@click="selectedPhase = phase"
|
||||
@@ -64,7 +94,7 @@ const addPhase = async (phaseBefore) => {
|
||||
</div>
|
||||
|
||||
<a class="plusIcon" @click="addPhase(phase)">
|
||||
<!-- <UIcon name="i-heroicons-plus-circle" />-->
|
||||
<!– <UIcon name="i-heroicons-plus-circle" />–>
|
||||
<UDivider icon="i-heroicons-plus-circle"/>
|
||||
</a>
|
||||
</a>
|
||||
@@ -101,7 +131,7 @@ const addPhase = async (phaseBefore) => {
|
||||
</UButton>
|
||||
|
||||
{{selectedPhase}}
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -134,6 +164,17 @@ const addPhase = async (phaseBefore) => {
|
||||
.phaseContainer:hover {
|
||||
border: 1px solid #69c350;
|
||||
}
|
||||
#phaseList {
|
||||
height: 70vh;
|
||||
overflow: auto;
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
|
||||
#phaseList::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.notesTextarea {
|
||||
margin-top: 1em
|
||||
|
||||
@@ -4,14 +4,51 @@
|
||||
|
||||
<UButton @click="showCreateProject = true">+ Projekt</UButton>
|
||||
<UModal v-model="showCreateProject">
|
||||
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Projekt erstellen
|
||||
</template>
|
||||
|
||||
<UFormGroup
|
||||
label="Name:"
|
||||
>
|
||||
<UInput
|
||||
v-model="createProjectData.name"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Kunde:"
|
||||
>
|
||||
<USelectMenu
|
||||
v-model="createProjectData.customer"
|
||||
:options="customers"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
searchable
|
||||
:search-attributes="['name']"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Notizen:"
|
||||
>
|
||||
<UTextarea
|
||||
v-model="createProjectData.notes"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<template #footer>
|
||||
<UButton
|
||||
@click="createProject"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
</template>
|
||||
</UCard>
|
||||
</UModal>
|
||||
|
||||
<router-link v-for="item in projects" :to="`/projects/${item.id}`">
|
||||
<UCard class="listItem">
|
||||
<UBadge>{{item.id}}</UBadge> {{item.attributes.name}}
|
||||
<UBadge>{{item.id}}</UBadge> {{item.name}}
|
||||
</UCard>
|
||||
</router-link>
|
||||
|
||||
@@ -21,14 +58,14 @@
|
||||
{{selectedItem}}
|
||||
<UCard v-if="selectedItem.id">
|
||||
<template #header>
|
||||
<UBadge>{{selectedItem.id}}</UBadge> {{selectedItem.attributes.name}}
|
||||
<UBadge>{{selectedItem.id}}</UBadge> {{selectedItem.name}}
|
||||
</template>
|
||||
|
||||
Kunde:<br>
|
||||
{{selectedItem.attributes.customer.data.attributes.name}}<br>
|
||||
{{selectedItem.customer.data.name}}<br>
|
||||
|
||||
Notizen: <br>
|
||||
{{selectedItem.attributes.notes}}
|
||||
{{selectedItem.notes}}
|
||||
|
||||
<!-- Lieferantenrechnungen: <br>
|
||||
<UTable :rows="dataStore.getVendorInvoicesByProjectId(selectedItem.id)"></UTable>
|
||||
@@ -50,11 +87,15 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create} = useStrapi4()
|
||||
const projects = (await find('projects',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const projects = (await supabase.from("projects").select()).data
|
||||
const customers = (await supabase.from("customers").select()).data
|
||||
|
||||
const showCreateProject = ref(false)
|
||||
const projectData = ref({})
|
||||
const createProjectData = ref({
|
||||
phases: []
|
||||
})
|
||||
|
||||
let selectedItem = ref({})
|
||||
|
||||
@@ -63,6 +104,19 @@ const selectItem = (item) => {
|
||||
console.log(item)
|
||||
}
|
||||
|
||||
const createProject = async () => {
|
||||
const {data,error} = await supabase
|
||||
.from("projects")
|
||||
.insert([createProjectData.value])
|
||||
.select()
|
||||
|
||||
if(error) console.log(error)
|
||||
|
||||
showCreateProject.value = false
|
||||
createProjectData.value = {phases: []}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -64,12 +64,12 @@
|
||||
>
|
||||
<UCard>
|
||||
<template #header>
|
||||
{{taskData.attributes.name}}
|
||||
{{taskData.name}}
|
||||
</template>
|
||||
<p>{{taskData.attributes.description}}</p>
|
||||
<p>Erstellt am: {{taskData.attributes.createdAt}}</p>
|
||||
<p>{{taskData.description}}</p>
|
||||
<p>Erstellt am: {{taskData.created_at}}</p>
|
||||
<UBadge
|
||||
v-for="user in taskData.attributes.users"
|
||||
v-for="user in taskData.users"
|
||||
class="mr-2"
|
||||
>
|
||||
{{user}}
|
||||
@@ -114,13 +114,13 @@
|
||||
<h3>Neue Aufgaben</h3>
|
||||
<div class="taskScrollList">
|
||||
<a
|
||||
v-for="taskNew in refTasks.filter(task => task.attributes.categorie == 'Neu')"
|
||||
v-for="taskNew in tasks.filter(task => task.categorie == 'Neu')"
|
||||
@click="inspectTask(taskNew)"
|
||||
>
|
||||
<UCard class="listItem">
|
||||
{{taskNew.attributes.name}}
|
||||
{{taskNew.name}}
|
||||
<UBadge
|
||||
v-for="user in taskNew.attributes.users"
|
||||
v-for="user in taskNew.users"
|
||||
class="mr-2"
|
||||
>
|
||||
{{user}}
|
||||
@@ -136,13 +136,13 @@
|
||||
<h3>Aufgaben in Bearbeitung</h3>
|
||||
<div class="taskScrollList">
|
||||
<a
|
||||
v-for="taskNew in refTasks.filter(task => task.attributes.categorie == 'In Bearbeitung')"
|
||||
v-for="taskNew in tasks.filter(task => task.categorie == 'In Bearbeitung')"
|
||||
@click="inspectTask(taskNew)"
|
||||
>
|
||||
<UCard class="listItem">
|
||||
{{taskNew.attributes.name}}
|
||||
{{taskNew.name}}
|
||||
<UBadge
|
||||
v-for="user in taskNew.attributes.users"
|
||||
v-for="user in taskNew.users"
|
||||
class="mr-2"
|
||||
>
|
||||
{{user}}
|
||||
@@ -156,13 +156,13 @@
|
||||
<h3>Dringende Aufgaben</h3>
|
||||
<div class="taskScrollList">
|
||||
<a
|
||||
v-for="taskNew in refTasks.filter(task => task.attributes.categorie == 'Dringend')"
|
||||
v-for="taskNew in tasks.filter(task => task.categorie == 'Dringend')"
|
||||
@click="inspectTask(taskNew)"
|
||||
>
|
||||
<UCard class="listItem">
|
||||
{{taskNew.attributes.name}}
|
||||
{{taskNew.name}}
|
||||
<UBadge
|
||||
v-for="user in taskNew.attributes.users"
|
||||
v-for="user in taskNew.users"
|
||||
class="mr-2"
|
||||
>
|
||||
{{user}}
|
||||
@@ -182,16 +182,19 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create, update} = useStrapi4()
|
||||
|
||||
let tasks = (await find('tasks',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const tasks = (await supabase.from("tasks").select()).data
|
||||
|
||||
|
||||
let refTasks = ref([])
|
||||
|
||||
|
||||
const users = (await find('users',{populate: "*"}))
|
||||
//const users = (await find('users',{populate: "*"}))
|
||||
//const users = (await supabase.from("users").select()).data
|
||||
let usersForList = []
|
||||
users.forEach(user => usersForList.push(user.username))
|
||||
//users.forEach(user => usersForList.push(user.username))
|
||||
const usersSelected = ref([])
|
||||
usersSelected.value = usersForList
|
||||
|
||||
@@ -202,21 +205,35 @@ const taskCategories = ["Neu","In Bearbeitung", "Dringend"]
|
||||
const createTaskData = ref({
|
||||
name: "",
|
||||
description: "",
|
||||
categorie: "Neu",
|
||||
users: []
|
||||
categorie: "Neu"
|
||||
/*users: ["86e67794-0ea8-41b0-985a-1072e84f56e9"]*/
|
||||
})
|
||||
|
||||
const taskData = ref({})
|
||||
const showTaskModal = ref(false)
|
||||
|
||||
const createTask = async () => {
|
||||
await create('tasks', createTaskData.value)
|
||||
//await create('tasks', createTaskData.value)
|
||||
const {data,error} = await supabase
|
||||
.from("tasks")
|
||||
.insert([createTaskData.value])
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
|
||||
showCreateTask.value = false
|
||||
createTaskData.value = {}
|
||||
}
|
||||
|
||||
const updateTask = async () => {
|
||||
await update('tasks', taskData.value.id, taskData.value.attributes)
|
||||
//await update('tasks', taskData.value.id, taskData.value)
|
||||
const {data,error} = await supabase
|
||||
.from("tasks")
|
||||
.update([taskData.value])
|
||||
.eq('id',taskData.value.id)
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
|
||||
}
|
||||
|
||||
@@ -227,13 +244,14 @@ const inspectTask = (task) => {
|
||||
}
|
||||
|
||||
const filterTasks = () => {
|
||||
refTasks.value = tasks.filter(task => usersSelected.value.some(user => (task.attributes.users ? (task.attributes.users.includes(user)) : true )))
|
||||
refTasks.value = tasks.filter(task => usersSelected.value.some(user => (task.users ? (task.users.includes(user)) : true )))
|
||||
|
||||
}
|
||||
|
||||
const finishTask = () => {
|
||||
taskData.value.attributes.categorie = "Erledigt"
|
||||
taskData.value.categorie = "Erledigt"
|
||||
updateTask()
|
||||
showTaskModal.value = false
|
||||
}
|
||||
|
||||
filterTasks()
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const times = (await supabase.from("times").select()).data
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -15,6 +19,10 @@ definePageMeta({
|
||||
<UButton class="controlButton" disabled>
|
||||
Pause
|
||||
</UButton>
|
||||
|
||||
|
||||
{{times}}
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"info": {
|
||||
"singularName": "tenant",
|
||||
"pluralName": "tenants",
|
||||
"displayName": "Tenants"
|
||||
"displayName": "Tenants",
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
@@ -16,6 +17,15 @@
|
||||
},
|
||||
"short": {
|
||||
"type": "string"
|
||||
},
|
||||
"users": {
|
||||
"type": "relation",
|
||||
"relation": "oneToMany",
|
||||
"target": "plugin::users-permissions.user",
|
||||
"mappedBy": "tenant"
|
||||
},
|
||||
"modules": {
|
||||
"type": "json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
"displayName": "User"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"timestamps": true
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"attributes": {
|
||||
"username": {
|
||||
@@ -65,6 +64,12 @@
|
||||
"target": "plugin::users-permissions.role",
|
||||
"inversedBy": "users",
|
||||
"configurable": false
|
||||
},
|
||||
"tenant": {
|
||||
"type": "relation",
|
||||
"relation": "manyToOne",
|
||||
"target": "api::tenant.tenant",
|
||||
"inversedBy": "users"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
strapi/types/generated/contentTypes.d.ts
vendored
13
strapi/types/generated/contentTypes.d.ts
vendored
@@ -631,7 +631,6 @@ export interface PluginUsersPermissionsUser extends Schema.CollectionType {
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
timestamps: true;
|
||||
};
|
||||
attributes: {
|
||||
username: Attribute.String &
|
||||
@@ -660,6 +659,11 @@ export interface PluginUsersPermissionsUser extends Schema.CollectionType {
|
||||
'manyToOne',
|
||||
'plugin::users-permissions.role'
|
||||
>;
|
||||
tenant: Attribute.Relation<
|
||||
'plugin::users-permissions.user',
|
||||
'manyToOne',
|
||||
'api::tenant.tenant'
|
||||
>;
|
||||
createdAt: Attribute.DateTime;
|
||||
updatedAt: Attribute.DateTime;
|
||||
createdBy: Attribute.Relation<
|
||||
@@ -999,6 +1003,7 @@ export interface ApiTenantTenant extends Schema.CollectionType {
|
||||
singularName: 'tenant';
|
||||
pluralName: 'tenants';
|
||||
displayName: 'Tenants';
|
||||
description: '';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: true;
|
||||
@@ -1006,6 +1011,12 @@ export interface ApiTenantTenant extends Schema.CollectionType {
|
||||
attributes: {
|
||||
name: Attribute.String;
|
||||
short: Attribute.String;
|
||||
users: Attribute.Relation<
|
||||
'api::tenant.tenant',
|
||||
'oneToMany',
|
||||
'plugin::users-permissions.user'
|
||||
>;
|
||||
modules: Attribute.JSON;
|
||||
createdAt: Attribute.DateTime;
|
||||
updatedAt: Attribute.DateTime;
|
||||
publishedAt: Attribute.DateTime;
|
||||
|
||||
Reference in New Issue
Block a user