Restructured Project Rep

This commit is contained in:
2024-04-07 22:25:16 +02:00
parent 895f508c29
commit d51ad2c4eb
150 changed files with 19358 additions and 7318 deletions

View File

@@ -0,0 +1,204 @@
<script setup>
import axios from "axios";
const dataStore = useDataStore()
const route = useRoute()
const supabase = useSupabaseClient()
const toast = useToast()
const showAddBankRequisition = ref(false)
const bicBankToAdd = ref("")
const bankData = ref({})
const reqData = ref({})
const axiosBaseUrl = "https://backend.spaces.software"
const setupPage = async () => {
if(route.query.reqId) {
const {data,error} = await axios({
url:`${axiosBaseUrl}/banking/requisitions/${route.query.reqId}`,
method: "GET",
auth: {
username: "frontend",
password: "Xt9Zn9RDSpdbr"
}
})
if(data) {
reqData.value = data
}
}
}
const checkBIC = async () => {
const {data,error} = await axios({
url:`${axiosBaseUrl}/banking/institutions/${bicBankToAdd.value}`,
method: "GET",
auth: {
username: "frontend",
password: "Xt9Zn9RDSpdbr"
}
})
if(data) {
bankData.value = data
}
console.log(data)
console.log(error)
}
const generateLink = async () => {
const {data,error} = await axios({
url:`${axiosBaseUrl}/banking/link?tenant=${dataStore.currentTenant}&institution_id=${bankData.value.id}`,
method: "POST",
auth: {
username: "frontend",
password: "Xt9Zn9RDSpdbr"
}
})
console.log(data)
console.log(error)
if(data) {
await navigateTo(data.link, {
open: {
target: "_blank"
}
})
}
}
const addAccount = async (account) => {
let accountData = {
accountId: account.id,
ownerName: account.owner_name,
iban: account.iban,
tenant: dataStore.currentTenant,
bankId: account.institution_id
}
const {data,error} = await supabase.from("bankaccounts").insert(accountData).select()
if(error) {
toast.add({title: "Es gab einen Fehler bei hinzufügen des Accounts", color:"rose"})
} else if(data) {
toast.add({title: "Account erfolgreich hinzugefügt"})
}
}
setupPage()
</script>
<template>
<UDashboardNavbar title="Bankkonten">
<template #right>
<UButton
@click="showAddBankRequisition = true"
>
+ Bankverbindung
</UButton>
<USlideover
v-model="showAddBankRequisition"
>
<UCard
class="h-full"
>
<template #header>
<p>Bankverbindung hinzufügen</p>
</template>
<UFormGroup
label="BIC:"
class="flex-auto"
>
<InputGroup class="w-full">
<UInput
v-model="bicBankToAdd"
class="flex-auto"
/>
<UButton
@click="checkBIC"
>
Check
</UButton>
</InputGroup>
</UFormGroup>
<UAlert
v-if="bankData.id && bankData.countries.includes('DE')"
title="Bank gefunden"
icon="i-heroicons-check"
color="primary"
variant="outline"
class="mt-3"
/>
<UButton
@click="generateLink"
class="mt-3"
>
Verbinden
</UButton>
</UCard>
</USlideover>
</template>
</UDashboardNavbar>
<div
v-for="account in reqData.accounts"
class="p-2 m-3 flex justify-between"
>
{{account.iban}} - {{account.owner_name}}
<UButton
@click="addAccount(account)"
v-if="!dataStore.bankAccounts.find(i => i.accountId === account.id)"
>
+ Konto
</UButton>
</div>
<!-- <UButton @click="setupPage">Setup</UButton>
<div v-if="route.query.reqId">
{{reqData}}
</div>-->
<UTable
:rows="dataStore.bankAccounts"
:columns="[
{
key: 'name',
label: 'Name'
},{
key: 'iban',
label: 'IBAN'
},{
key: 'bankId',
label: 'Bank'
},{
key: 'ownerName',
label: 'Kontoinhaber'
},{
key: 'balance',
label: 'Saldo'
},
]"
>
</UTable>
</template>
<style scoped>
</style>

View File

@@ -0,0 +1,66 @@
<script setup>
import axios from "axios"
const {ownTenant} = storeToRefs(useDataStore())
const setupPrinter = async () => {
console.log(ownTenant.value.labelPrinterIp)
let printerUri = `http://${ownTenant.value.labelPrinterIp}/pstprnt`
labelPrinterURI.value = printerUri
console.log(printerUri)
}
/*const printLabel = async () => {
axios
.post(labelPrinterURI.value, `^XA^FO10,20^BCN,100^FD${}^XZ` )
.then(console.log)
.catch(console.log)
}*/
const labelPrinterURI = ref("")
</script>
<template>
<UPage>
<UCard>
<template #header>
Etikettendrucker
</template>
<UFormGroup
label="IP-Adresse:"
>
<UInput
v-model="labelPrinterURI"
/>
</UFormGroup>
<UButton
@click="setupPrinter"
>
Drucker Setup
</UButton>
<UButton
@click="printLabel"
>
Druck
</UButton>
</UCard>
<!-- <UCard>
<template #header>
A4 Drucker
</template>
</UCard>-->
</UPage>
</template>
<style scoped>
</style>

91
pages/settings/index.vue Normal file
View File

@@ -0,0 +1,91 @@
<script setup>
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const supabase = useSupabaseClient()
const router = useRouter()
const items = [{
label: 'Profil',
},{
label: 'Projekte',
content: 'This is the content shown for Tab1'
}, {
label: 'E-Mail',
content: 'And, this is the content for Tab2'
}, {
label: 'Dokumente'
}]
const colorMode = useColorMode()
const isLight = computed({
get() {
return colorMode.value !== 'dark'
},
set() {
colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark'
}
})
</script>
<template>
<UDashboardNavbar title="Einstellungen">
</UDashboardNavbar>
<UTabs
:items="items"
class="h-100 p-5"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Profil'">
<UDivider
class="my-3"
label="Profil"
/>
<InputGroup>
<UButton
:icon="!isLight ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'"
color="white"
variant="outline"
aria-label="Theme"
@click="isLight = !isLight"
/>
</InputGroup>
</div>
<div v-else-if="item.label === 'Projekte'">
<UDivider
label="Phasenvorlagen"
/>
</div>
<div v-else-if="item.label === 'Dokumente'">
<UDivider
label="Tags"
class="mb-3"
/>
<InputGroup>
<UBadge
v-for="tag in dataStore.ownTenant.tags.documents"
>
{{tag}}
</UBadge>
</InputGroup>
{{dataStore.ownTenant.tags}}
</div>
</UCard>
</template>
</UTabs>
</template>
<style scoped>
</style>

View File

@@ -0,0 +1,101 @@
<script setup>
definePageMeta({
middleware: "auth"
})
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const showAddModal = ref(false)
const columns = [
{
key: "resourceType",
label: "Typ"
},{
key: "prefix",
label: "Prefix"
},{
key:"nextNumber",
label:"Nächste Nummer"
},{
key: "suffix",
label: "Suffix"
}
]
const resources = {
customers: {
label: "Kunden"
},
vendors: {
label: "Lieferanten"
},
products: {
label: "Artikel"
},
spaces: {
label: "Lagerplätze"
},
invoices: {
label: "Rechnungen"
},
quotes: {
label: "Angebote"
}
}
const updateNumberRange = async (range) => {
const {data,error} = await supabase
.from("numberranges")
.update(range)
.eq('id',range.id)
await dataStore.fetchNumberRanges()
}
</script>
<template>
<UDashboardToolbar>
<UAlert
title="Änderungen an diesen Werten betreffen nur neu Erstellte Einträge."
color="rose"
variant="outline"
icon="i-heroicons-exclamation-triangle"
/>
</UDashboardToolbar>
<UTable
:rows="dataStore.numberRanges"
:columns="columns"
>
<template #resourceType-data="{row}">
{{resources[row.resourceType] ? resources[row.resourceType].label : ""}}
</template>
<template #prefix-data="{row}">
<UInput
v-model="row.prefix"
@focusout="updateNumberRange(row)"
/>
</template>
<template #suffix-data="{row}">
<UInput
v-model="row.suffix"
@focusout="updateNumberRange(row)"
/>
</template>
<template #nextNumber-data="{row}">
<UInput
v-model="row.nextNumber"
@focusout="updateNumberRange(row)"
/>
</template>
</UTable>
</template>
<style scoped>
</style>

78
pages/settings/rights.vue Normal file
View File

@@ -0,0 +1,78 @@
<script setup>
const supabase = useSupabaseClient()
const data = await supabase.from("profiles").select('* , tenants (id, name)')
console.log(data)
let rights = {
createUser: {label: "Benutzer erstellen"},
modifyUser: {label: "Benutzer bearbeiten"},
deactivateUser: {label: "Benutzer sperren"},
createProject: {label: "Projekt erstellen"},
viewOwnProjects: {label: "Eigene Projekte sehen"},
viewAllProjects: {label: "Alle Projekte sehen"},
createTask: {label: "Aufgabe erstellen"},
viewOwnTasks: {label:"Eigene Aufgaben sehen"},
viewAllTasks: {label: "Alle Aufgaben sehen"},
trackOwnTime: {label:"Eigene Zeite erfassen"},
createOwnTime: {label:"Eigene Zeiten erstellen"},
createTime: {label:"Zeiten erstellen"},
viewOwnTimes: {label:"Eigene Zeiten anzeigen"},
viewTimes: {label:"Zeiten anzeigen"},
}
let roles = [
{
key: "tenantAdmin",
label: "Firmenadministrator",
rights: [
...Object.keys(rights)
]
},
{
key:"worker",
label: "Monteur",
rights: [
"viewOwnProjects",
"createTasks",
"viewOwnTasks"
]
},
{
key:"manager",
label: "Vorarbeiter",
rights: [
"createProjects",
"viewOwnProjects",
"createTasks",
"viewOwnTasks",
]
},
{
key:"booker",
label: "Buchhalter",
rights: [
"createTasks",
"viewOwnTasks",
"createTime",
"viewAllTimes"
]
}
]
</script>
<template>
</template>
<style scoped>
</style>

117
pages/settings/tenant.vue Normal file
View File

@@ -0,0 +1,117 @@
<script setup>
const dataStore = useDataStore()
const supabase = useSupabaseClient()
const features = ref(dataStore.ownTenant.features)
const businessInfo = ref(dataStore.ownTenant.businessInfo)
const updateTenant = async (newData) => {
const {data,error} = await supabase.from("tenants")
.update(newData)
.eq("id",dataStore.currentTenant)
.select()
if (error) console.log(error)
}
</script>
<template>
<UDashboardNavbar title="Firmeneinstellungen">
</UDashboardNavbar>
<UTabs
class="p-5"
:items="[
{
label: 'Rechnung & Kontakt'
},{
label: 'Lizenz'
},{
label: 'Funktionen'
},{
label: 'Bankkonten'
},{
label: 'Tags'
}
]"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Rechnung & Kontakt'">
<UForm class="w-1/2">
<UFormGroup
label="Firmenname:"
>
<UInput v-model="businessInfo.name"/>
</UFormGroup>
<UFormGroup
label="Straße + Hausnummer:"
>
<UInput v-model="businessInfo.street"/>
</UFormGroup>
<UFormGroup
label="PLZ + Ort"
class="w-full"
>
<InputGroup class="w-full">
<UInput v-model="businessInfo.zip"/>
<UInput v-model="businessInfo.city" class="flex-auto"/>
</InputGroup>
</UFormGroup>
<UButton
class="mt-3"
@click="updateTenant({businessInfo: businessInfo})"
>
Speichern
</UButton>
</UForm>
</div>
<div v-else-if="item.label === 'Funktionen'">
<UAlert
title="Funktionen ausblenden"
description="Nur Funktionen mit gesetztem Haken sind im Unternehmen verfügbar. Diese Einstellungen gelten für alle Mitarbeiter und sind unabhängig von Berechtigungen."
color="rose"
variant="outline"
class="mb-5"
/>
<UCheckbox
label="Kalendar"
v-model="features.calendar"
@change="updateTenant({features: features})"
/>
<UCheckbox
label="Plantafel"
v-model="features.planningBoard"
@change="updateTenant({features: features})"
/>
<UCheckbox
label="Zeiterfassung"
v-model="features.timeTracking"
@change="updateTenant({features: features})"
/>
<UCheckbox
label="Anwesenheiten"
v-model="features.workingTimeTracking"
@change="updateTenant({features: features})"
/>
<UCheckbox
label="Verträge"
v-model="features.contracts"
@change="updateTenant({features: features})"
/>
<UCheckbox
label="Fahrzeuge"
v-model="features.vehicles"
@change="updateTenant({features: features})"
/>
</div>
</UCard>
</template>
</UTabs>
</template>
<style scoped>
</style>