Changes
This commit is contained in:
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@@ -2,5 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/website" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -81,7 +81,7 @@ const addHistoryItem = async () => {
|
|||||||
|
|
||||||
const {data,error} = await supabase
|
const {data,error} = await supabase
|
||||||
.from("historyitems")
|
.from("historyitems")
|
||||||
.insert([addHistoryItemData.value])
|
.insert([{...addHistoryItemData.value, tenant: dataStore.currentTenant}])
|
||||||
.select()
|
.select()
|
||||||
|
|
||||||
if(error) {
|
if(error) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import TenantDropdown from "~/components/TenantDropdown.vue";
|
|||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
const { isHelpSlideoverOpen } = useDashboard()
|
const { isHelpSlideoverOpen } = useDashboard()
|
||||||
const userProfile = dataStore.getOwnProfile
|
|
||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@@ -175,142 +174,7 @@ const navLinks = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const showUserMenu = ref(false)
|
|
||||||
const userMenuItems = ref([
|
|
||||||
/*{
|
|
||||||
label: "Profil",
|
|
||||||
badge: dataStore.notifications.filter(item => item.read).length,
|
|
||||||
icon: "i-heroicons-user-20-solid"
|
|
||||||
},*/
|
|
||||||
{
|
|
||||||
label: "Nummernkreise",
|
|
||||||
icon: "i-heroicons-cog-8-tooth",
|
|
||||||
to: "/settings/numberRanges"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Einstellungen",
|
|
||||||
icon: "i-heroicons-cog-8-tooth",
|
|
||||||
to: "/settings"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Benutzer',
|
|
||||||
icon: 'i-heroicons-user-group',
|
|
||||||
to: "/users"
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
const linksold = [[{
|
|
||||||
label: "Dashboard",
|
|
||||||
to: "/",
|
|
||||||
icon: "i-heroicons-home"
|
|
||||||
}],
|
|
||||||
[{
|
|
||||||
label: "Aufgaben",
|
|
||||||
to: "/tasks",
|
|
||||||
icon: "i-heroicons-rectangle-stack"
|
|
||||||
}, {
|
|
||||||
label: "Plantafel",
|
|
||||||
to: "/calendar/timeline",
|
|
||||||
icon: "i-heroicons-calendar-days"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Kalender",
|
|
||||||
to: "/calendar/grid",
|
|
||||||
icon: "i-heroicons-calendar-days"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Dokumente",
|
|
||||||
to: "/documents",
|
|
||||||
icon: "i-heroicons-document"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "E-Mail",
|
|
||||||
to: "/email",
|
|
||||||
icon: "i-heroicons-envelope"
|
|
||||||
}],[{
|
|
||||||
label: "Kunden",
|
|
||||||
to: "/customers",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Lieferanten",
|
|
||||||
to: "/vendors",
|
|
||||||
icon: "i-heroicons-truck"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Ansprechpartner",
|
|
||||||
to: "/contacts",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
}], [{
|
|
||||||
label: "Belege",
|
|
||||||
to: "/receipts",
|
|
||||||
icon: "i-heroicons-document-text"
|
|
||||||
},
|
|
||||||
/* {
|
|
||||||
label: "Bank",
|
|
||||||
to: "/banking",
|
|
||||||
icon: "i-heroicons-currency-euro"
|
|
||||||
}*/], [{
|
|
||||||
label: "Projekte",
|
|
||||||
to: "/projects",
|
|
||||||
icon: "i-heroicons-clipboard-document-check"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Verträge",
|
|
||||||
to: "/contracts",
|
|
||||||
icon: "i-heroicons-clipboard-document"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Objekte",
|
|
||||||
to: "/plants",
|
|
||||||
icon: "i-heroicons-clipboard-document"
|
|
||||||
}],[{
|
|
||||||
label: "Zeiterfassung",
|
|
||||||
to: "/employees/timetracking",
|
|
||||||
icon: "i-heroicons-clock"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Anwesenheiten",
|
|
||||||
to: "/workingtimes",
|
|
||||||
icon: "i-heroicons-clock"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Abwesenheiten",
|
|
||||||
to: "/absenceRequests",
|
|
||||||
icon: "i-heroicons-document-text"
|
|
||||||
}],[{
|
|
||||||
label: "Steuerung",
|
|
||||||
to: "/inventory",
|
|
||||||
icon: "i-heroicons-square-3-stack-3d"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Artikelstamm",
|
|
||||||
to: "/products",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
},{
|
|
||||||
label: "Leistungsstamm",
|
|
||||||
to: "/services",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Lagerplätze",
|
|
||||||
to: "/spaces",
|
|
||||||
icon: "i-heroicons-square-3-stack-3d"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Fahrzeuge",
|
|
||||||
to: "/vehicles",
|
|
||||||
icon: "i-heroicons-truck"
|
|
||||||
}, {
|
|
||||||
label: "Inventar",
|
|
||||||
to: "/inventoryitems",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
},],[{
|
|
||||||
label: "Einstellungen",
|
|
||||||
to:"/settings",
|
|
||||||
icon: "i-heroicons-cog-8-tooth"
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
|
|
||||||
let links = [
|
let links = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -397,8 +397,8 @@ setupPage()
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UCard class="h-fit">
|
<UDashboardNavbar>
|
||||||
<InputGroup class="mb-3">
|
<template #right>
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-mdi-content-save"
|
icon="i-mdi-content-save"
|
||||||
@click="saveDocument"
|
@click="saveDocument"
|
||||||
@@ -410,9 +410,14 @@ setupPage()
|
|||||||
>
|
>
|
||||||
Fertigstellen
|
Fertigstellen
|
||||||
</UButton>
|
</UButton>
|
||||||
</InputGroup>
|
</template>
|
||||||
<UTabs :items="tabItems" @change="onChangeTab">
|
</UDashboardNavbar>
|
||||||
|
|
||||||
|
<UDashboardPanelContent>
|
||||||
|
<UTabs class="p-5" :items="tabItems" @change="onChangeTab">
|
||||||
<template #item="{item}">
|
<template #item="{item}">
|
||||||
|
|
||||||
|
|
||||||
<div v-if="item.label === 'Editor'">
|
<div v-if="item.label === 'Editor'">
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<div class="flex-auto mr-5">
|
<div class="flex-auto mr-5">
|
||||||
@@ -451,7 +456,7 @@ setupPage()
|
|||||||
|
|
||||||
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
|
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
|
||||||
</UButton>
|
</UButton>
|
||||||
<!-- <template #label>
|
<!-- <template #label>
|
||||||
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||||
</template>-->
|
</template>-->
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
@@ -844,156 +849,6 @@ setupPage()
|
|||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
</draggable>
|
</draggable>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <template v-for="row in itemInfo.rows">
|
|
||||||
<tr
|
|
||||||
|
|
||||||
>
|
|
||||||
<td
|
|
||||||
v-if="row.mode === 'pagebreak'"
|
|
||||||
colspan="8"
|
|
||||||
>
|
|
||||||
<UDivider/>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
rowspan="2"
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
>{{row.pos}}</td>
|
|
||||||
<td
|
|
||||||
class="w-120"
|
|
||||||
v-if="row.mode === 'free'"
|
|
||||||
>
|
|
||||||
<UInput
|
|
||||||
v-model="row.text"
|
|
||||||
maxlength="40"
|
|
||||||
placeholder="Name"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
class="w-120"
|
|
||||||
v-else-if="row.mode === 'normal'"
|
|
||||||
>
|
|
||||||
<USelectMenu
|
|
||||||
:options="dataStore.products"
|
|
||||||
option-attribute="name"
|
|
||||||
value-attribute="id"
|
|
||||||
searchable
|
|
||||||
searchable-placeholder="Suche ..."
|
|
||||||
:search-attributes="['name']"
|
|
||||||
v-model="row.product"
|
|
||||||
@change="row.unit = dataStore.getProductById(row.product).unit,
|
|
||||||
row.price = dataStore.getProductById(row.product).sellingPrice || 0"
|
|
||||||
>
|
|
||||||
<template #label>
|
|
||||||
{{dataStore.getProductById(row.product) ?dataStore.getProductById(row.product).name : "Kein Produkt ausgewählt" }}
|
|
||||||
</template>
|
|
||||||
</USelectMenu>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
class="w-20"
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
>
|
|
||||||
<UInput
|
|
||||||
v-model="row.quantity"
|
|
||||||
type="number"
|
|
||||||
:step="dataStore.units.find(i => i.id === row.unit) ? dataStore.units.find(i => i.id === row.unit).step : '1' "
|
|
||||||
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
class="w-40"
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
>
|
|
||||||
<USelectMenu
|
|
||||||
v-model="row.unit"
|
|
||||||
:options="dataStore.units"
|
|
||||||
option-attribute="name"
|
|
||||||
value-attribute="id"
|
|
||||||
>
|
|
||||||
<template #label>
|
|
||||||
{{dataStore.units.find(i => i.id === row.unit) ? dataStore.units.find(i => i.id === row.unit).name : "Keine Einheit gewählt"}}
|
|
||||||
</template>
|
|
||||||
</USelectMenu>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
>
|
|
||||||
<UInput
|
|
||||||
v-model="row.price"
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
>
|
|
||||||
<template #trailing>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
|
||||||
</template>
|
|
||||||
</UInput>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
class="w-40"
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
|
|
||||||
>
|
|
||||||
<USelectMenu
|
|
||||||
:options="['19','7','0']"
|
|
||||||
v-model="row.taxPercent"
|
|
||||||
>
|
|
||||||
<template #option="{option}">
|
|
||||||
{{option}} %
|
|
||||||
</template>
|
|
||||||
<template #label>
|
|
||||||
{{row.taxPercent}} %
|
|
||||||
</template>
|
|
||||||
</USelectMenu>
|
|
||||||
<!– <UInput
|
|
||||||
v-model="row.taxPercent"
|
|
||||||
>
|
|
||||||
<template #trailing>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400 text-xs">%</span>
|
|
||||||
</template>
|
|
||||||
</UInput>–>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
class="w-40"
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
>
|
|
||||||
<UInput
|
|
||||||
v-model="row.discountPercent"
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
placeholder="0"
|
|
||||||
>
|
|
||||||
<template #trailing>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400 text-xs">%</span>
|
|
||||||
</template>
|
|
||||||
</UInput>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
|
||||||
rowspan="2"
|
|
||||||
>
|
|
||||||
<div class="text-right font-bold">{{getRowAmount(row)}} €</div>
|
|
||||||
</td>
|
|
||||||
<td rowspan="2">
|
|
||||||
<UButton
|
|
||||||
variant="ghost"
|
|
||||||
color="rose"
|
|
||||||
icon="i-heroicons-x-mark-16-solid"
|
|
||||||
@click="removePosition(row.pos)"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="6">
|
|
||||||
<UTextarea
|
|
||||||
v-model="row.description"
|
|
||||||
placeholder="Beschreibung"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</template>-->
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
@@ -1072,7 +927,7 @@ setupPage()
|
|||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.label === 'Vorschau'">
|
<div v-else-if="item.label === 'Vorschau'">
|
||||||
<!-- <UButton
|
<!-- <UButton
|
||||||
@click="generateDocument"
|
@click="generateDocument"
|
||||||
>
|
>
|
||||||
Show
|
Show
|
||||||
@@ -1086,9 +941,9 @@ setupPage()
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</UTabs>
|
</UTabs>
|
||||||
|
</UDashboardPanelContent>
|
||||||
|
|
||||||
|
|
||||||
</UCard>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ if(dataStore.times.find(time => time.user == user.value.id && !time.end)) {
|
|||||||
const createTime = async () => {
|
const createTime = async () => {
|
||||||
const {data,error} = await supabase
|
const {data,error} = await supabase
|
||||||
.from("times")
|
.from("times")
|
||||||
.insert([itemInfo.value])
|
.insert({...itemInfo.value, tenant: dataStore.currentTenant})
|
||||||
.select()
|
.select()
|
||||||
|
|
||||||
if(error) {
|
if(error) {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
</UButton>
|
</UButton>
|
||||||
</UTooltip>
|
</UTooltip>
|
||||||
|
|
||||||
<UDropdown :items="items">
|
<!-- <UDropdown :items="items">
|
||||||
<UButton icon="i-heroicons-plus" size="md" class="ml-1.5 rounded-full" />
|
<UButton icon="i-heroicons-plus" size="md" class="ml-1.5 rounded-full" />
|
||||||
</UDropdown>
|
</UDropdown>-->
|
||||||
</template>
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
|
|
||||||
|
|||||||
@@ -84,11 +84,17 @@ const onSubmit = async (data) => {
|
|||||||
|
|
||||||
</div>-->
|
</div>-->
|
||||||
<UCard class="max-w-sm w-full mx-auto mt-5">
|
<UCard class="max-w-sm w-full mx-auto mt-5">
|
||||||
<img
|
|
||||||
|
<UColorModeImage
|
||||||
|
light="/spaces_hell.svg"
|
||||||
|
dark="/spaces.svg"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <img
|
||||||
:src="!isLight ? '/spaces.svg' : '/spaces_hell.svg'"
|
:src="!isLight ? '/spaces.svg' : '/spaces_hell.svg'"
|
||||||
alt="Logo"
|
alt="Logo"
|
||||||
class="w-full mx-auto"
|
class="w-full mx-auto"
|
||||||
/>
|
/>-->
|
||||||
|
|
||||||
<UAuthForm
|
<UAuthForm
|
||||||
title="Login"
|
title="Login"
|
||||||
|
|||||||
@@ -81,23 +81,7 @@ setupPage()
|
|||||||
<div
|
<div
|
||||||
v-if="item.label === 'Informationen'"
|
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: {{String(Number(currentItem.sellingPrice).toFixed(2)).replace(".",",")}} €<br></span>
|
<span v-if="currentItem.sellingPrice">Verkaufspreis: {{String(Number(currentItem.sellingPrice).toFixed(2)).replace(".",",")}} €<br></span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -143,6 +127,13 @@ setupPage()
|
|||||||
v-model="itemInfo.name"
|
v-model="itemInfo.name"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Leistungsnummer:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.serviceNumber"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Einheit:"
|
label="Einheit:"
|
||||||
>
|
>
|
||||||
@@ -174,6 +165,7 @@ setupPage()
|
|||||||
:options="dataStore.serviceCategories"
|
:options="dataStore.serviceCategories"
|
||||||
option-attribute="name"
|
option-attribute="name"
|
||||||
value-attribute="id"
|
value-attribute="id"
|
||||||
|
v-model="itemInfo.serviceCategorie"
|
||||||
></USelectMenu>
|
></USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
@@ -190,6 +182,14 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
</UInput>
|
</UInput>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Beschreibung:"
|
||||||
|
>
|
||||||
|
<UTextarea
|
||||||
|
v-model="itemInfo.description"
|
||||||
|
:rows="6"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
</UForm>
|
</UForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
|
|
||||||
if(supabaseError) {
|
if(supabaseError) {
|
||||||
console.log(supabaseError)
|
console.log(supabaseError)
|
||||||
|
toast.add({title: "Es ist ein Fehler bei der Erstellung aufgetreten", color: "rose"})
|
||||||
} else if (supabaseData) {
|
} else if (supabaseData) {
|
||||||
await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')')
|
await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')')
|
||||||
toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`})
|
toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`})
|
||||||
@@ -425,7 +426,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
} else if(supabaseData) {
|
} else if(supabaseData) {
|
||||||
await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0]))
|
await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0]))
|
||||||
toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`})
|
toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`})
|
||||||
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${supabaseData[0].id}`)
|
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${data.id}`)
|
||||||
return supabaseData
|
return supabaseData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,27 +20,27 @@ app.get("/", async (req,res) => {
|
|||||||
app.post("/executeTimeCommand", async (req,res) => {
|
app.post("/executeTimeCommand", async (req,res) => {
|
||||||
console.log(req.body)
|
console.log(req.body)
|
||||||
let body = req.body
|
let body = req.body
|
||||||
let deviceData = (await supabase.from("devices").select().eq("id",body.id).single()).data
|
let deviceData = (await supabase.from("devices").select().eq("id",body.deviceId).single()).data
|
||||||
let currentTenant = deviceData.tenant
|
let currentTenant = deviceData.tenant
|
||||||
console.log(deviceData)
|
console.log(deviceData)
|
||||||
console.log(currentTenant)
|
console.log(currentTenant)
|
||||||
|
|
||||||
|
|
||||||
if(deviceData.password === body.password) {
|
if(deviceData.password === body.devicePassword) {
|
||||||
let userId = ""
|
let user = {}
|
||||||
if(!body.tokenId && !body.userId) {
|
if(!body.tokenId && !body.userId) {
|
||||||
res.sendStatus(400)
|
res.sendStatus(400)
|
||||||
}
|
}
|
||||||
else if(body.tokenId && !body.userId) {
|
else if(body.tokenId && !body.userId) {
|
||||||
userId = ((await supabase.from("profiles").select().eq("tokenId",body.tokenId).single()).data).id
|
user = ((await supabase.from("profiles").select().eq("tokenId",body.tokenId).single()).data)
|
||||||
console.log(userId)
|
console.log(user)
|
||||||
} else {
|
} else {
|
||||||
userId = body.userId
|
user.id = body.userId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let startedWorkingTime = (await supabase.from("workingtimes").select().eq("user",userId).is("end",null).single()).data
|
let startedWorkingTime = (await supabase.from("workingtimes").select().eq("user",user.id).is("end",null).single()).data
|
||||||
|
|
||||||
if(startedWorkingTime) {
|
if(startedWorkingTime) {
|
||||||
//Stop Time
|
//Stop Time
|
||||||
@@ -55,7 +55,7 @@ app.post("/executeTimeCommand", async (req,res) => {
|
|||||||
console.log("Time Stopped")
|
console.log("Time Stopped")
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
message: "Zeit gestoppt",
|
message: `Deine Zeit wurde gestoppt, bis bald ${user.firstName}`,
|
||||||
type: "stopped"
|
type: "stopped"
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ app.post("/executeTimeCommand", async (req,res) => {
|
|||||||
|
|
||||||
const {data,error} = await supabase.from("workingtimes")
|
const {data,error} = await supabase.from("workingtimes")
|
||||||
.insert([{
|
.insert([{
|
||||||
user: userId,
|
user: user.id,
|
||||||
date: dayjs().format("YYYY-MM-DD"),
|
date: dayjs().format("YYYY-MM-DD"),
|
||||||
start: String(dayjs().format("HH:mm:ss"))+ "+01",
|
start: String(dayjs().format("HH:mm:ss"))+ "+01",
|
||||||
tenant: currentTenant,
|
tenant: currentTenant,
|
||||||
@@ -78,7 +78,7 @@ app.post("/executeTimeCommand", async (req,res) => {
|
|||||||
console.log("Time Started")
|
console.log("Time Started")
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
message: "Zeit gestartet",
|
message: `Hallo ${user.firstName}, deine Zeit wurde gestartet`,
|
||||||
type: "started"
|
type: "started"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user