Merge branch 'refs/heads/beta'

This commit is contained in:
2025-05-31 20:45:35 +02:00
13 changed files with 265 additions and 44 deletions

13
app.vue
View File

@@ -12,6 +12,15 @@ const viewport = useViewport()
console.log('Breakpoint updated:', oldBreakpoint, '->', newBreakpoint)
})*/
const platform = ref('default')
const setup = async () => {
if(await useCapacitor().getIsPhone()) {
platform.value = "mobile"
}
}
setup()
const dev = process.dev
Sentry.init({
@@ -55,9 +64,9 @@ useSeoMeta({
<NuxtPage/>
</NuxtLayout>
<UNotifications/>
<UNotifications :class="platform === 'mobile' ? ['mb-14'] : []"/>
<USlideovers />
<UModals />
<UModals/>
<VitePwaManifest/>
</div>

View File

@@ -21,6 +21,9 @@ const props = defineProps({
},
inModal: {
type: Boolean,
},
platform: {
type: String,
}
})
@@ -233,6 +236,9 @@ const updateItem = async () => {
v-if="!props.inModal"
:ui="{center: 'flex items-stretch gap-1.5 min-w-0'}"
>
<template #toggle>
<div v-if="platform === 'mobile'"></div>
</template>
<template #left>
<UButton
icon="i-heroicons-chevron-left"
@@ -245,11 +251,12 @@ const updateItem = async () => {
<template #center>
<h1
v-if="item"
:class="['text-xl','font-medium']"
:class="['text-xl','font-medium', 'text-center']"
>{{item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}</h1>
</template>
<template #right>
<ButtonWithConfirm
v-if="platform !== 'mobile'"
color="rose"
variant="outline"
@confirmed="dataStore.updateItem(type,{...item,archived: true}, oldItem)"
@@ -279,7 +286,7 @@ const updateItem = async () => {
<UButton
@click="router.push(item.id ? `/standardEntity/${type}/show/${item.id}` : `/standardEntity/${type}`)"
color="red"
class="ml-2"
class="ml-1"
>
Abbrechen
</UButton>
@@ -323,10 +330,10 @@ const updateItem = async () => {
<UForm
class="p-5"
>
<div class="flex flex-row">
<div :class="platform === 'mobile' ?['flex','flex-col'] : ['flex','flex-row']">
<div
v-for="(columnName,index) in dataType.inputColumns"
:class="['w-1/2', ... index < dataType.inputColumns.length -1 ? ['mr-5'] : []]"
:class="platform === 'mobile' ? ['w-full'] : [`w-1/${dataType.inputColumns.length}`, ... index < dataType.inputColumns.length -1 ? ['mr-5'] : []]"
>
<UDivider>{{columnName}}</UDivider>

View File

@@ -108,7 +108,7 @@ const filteredRows = computed(() => {
:label="`+ ${dataType.labelSingle}`"
variant="outline"
v-if="platform === 'mobile'"
@click="router.push(`/mobile/standardEntity/${type}/create`)"
@click="router.push(`/standardEntity/${type}/create`)"
/>
<UDashboardNavbar :title="dataType.label" :badge="filteredRows.length">
<template #toggle>

View File

@@ -21,9 +21,12 @@ const showAddHistoryItemModal = ref(false)
const colorMode = useColorMode()
const items = ref([])
const platform = ref("default")
const setup = async () => {
if(await useCapacitor().getIsPhone()) platform.value = "mobile"
if(props.type && props.elementId){
items.value = (await supabase.from("historyitems").select().eq(props.type,props.elementId).order("created_at",{ascending: true})).data || []
} else {
@@ -102,10 +105,16 @@ const renderText = (text) => {
<template>
<UModal
v-model="showAddHistoryItemModal"
>
<UCard>
<UCard class="h-full">
<template #header>
Eintrag hinzufügen
<div class="flex items-center justify-between">
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
Eintrag hinzufügen
</h3>
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showAddHistoryItemModal = false" />
</div>
</template>
<UFormGroup

View File

@@ -160,29 +160,66 @@ export const useCreateWorkingTimesPdf = async (input,backgroundSourceBuffer) =>
let rowHeight = 115
input.times.forEach(time => {
pages[pageCounter - 1].drawText(`${dayjs(time.startDate).format("HH:mm DD.MM.YY")}`,{
x: getCoordinatesForPDFLib(20,rowHeight,pages[pageCounter -1]).x,
y: getCoordinatesForPDFLib(20,rowHeight,pages[pageCounter -1]).y,
size: 10,
let splitted = []
let reversedInput = input.times.slice().reverse()
const splittedLength = Math.floor((reversedInput.length - 25) / 40)
splitted.push(reversedInput.slice(0,25))
let lastIndex = 25
for (let i = 0; i < splittedLength; ++i ) {
splitted.push(reversedInput.slice(lastIndex, lastIndex + (i + 1) * 40))
lastIndex = lastIndex + (i + 1) * 40 + 1
}
splitted.push(reversedInput.slice(lastIndex, reversedInput.length))
splitted.forEach((chunk,index) => {
if(index > 0) {
const page = pdfDoc.addPage()
page.drawPage(secondPageBackground, {
x: 0,
y: 0,
})
pages.push(page)
pageCounter++
rowHeight = 20
}
chunk.forEach(time => {
pages[pageCounter - 1].drawText(`${dayjs(time.startDate).format("HH:mm DD.MM.YY")}`,{
x: getCoordinatesForPDFLib(20,rowHeight,pages[pageCounter -1]).x,
y: getCoordinatesForPDFLib(20,rowHeight,pages[pageCounter -1]).y,
size: 10,
})
pages[pageCounter - 1].drawText(`${dayjs(time.endDate).format("HH:mm DD.MM.YY")}`,{
x: getCoordinatesForPDFLib(60,rowHeight,pages[pageCounter -1]).x,
y: getCoordinatesForPDFLib(60,rowHeight,pages[pageCounter -1]).y,
size: 10,
})
pages[pageCounter - 1].drawText(`${getDuration(time).composed}`,{
x: getCoordinatesForPDFLib(100,rowHeight,pages[pageCounter -1]).x,
y: getCoordinatesForPDFLib(100,rowHeight,pages[pageCounter -1]).y,
size: 10,
})
rowHeight += 6
})
pages[pageCounter - 1].drawText(`${dayjs(time.endDate).format("HH:mm DD.MM.YY")}`,{
x: getCoordinatesForPDFLib(60,rowHeight,pages[pageCounter -1]).x,
y: getCoordinatesForPDFLib(60,rowHeight,pages[pageCounter -1]).y,
size: 10,
})
pages[pageCounter - 1].drawText(`${getDuration(time).composed}`,{
x: getCoordinatesForPDFLib(100,rowHeight,pages[pageCounter -1]).x,
y: getCoordinatesForPDFLib(100,rowHeight,pages[pageCounter -1]).y,
size: 10,
})
rowHeight += 6
})
uri.value = await pdfDoc.saveAsBase64({dataUri: true})
}

View File

@@ -25,7 +25,7 @@ export default defineNuxtConfig({
transpile: ['@vuepic/vue-datepicker']
},
modules: ['@pinia/nuxt', '@nuxt/ui', '@nuxt/content', '@nuxtjs/supabase', "nuxt-editorjs", '@nuxtjs/fontaine', '@vite-pwa/nuxt', 'nuxt-viewport', 'nuxt-tiptap-editor', '@nuxtjs/leaflet'],
modules: ['@pinia/nuxt', '@nuxt/ui', '@nuxt/content', '@nuxtjs/supabase', "nuxt-editorjs", '@nuxtjs/fontaine', 'nuxt-viewport', 'nuxt-tiptap-editor', '@nuxtjs/leaflet'],
routeRules: {
'/printing': {ssr: false}

View File

@@ -12,7 +12,6 @@
"devDependencies": {
"@nuxtjs/leaflet": "^1.2.3",
"@nuxtjs/supabase": "^1.1.4",
"@vite-pwa/nuxt": "^0.3.3",
"nuxt": "^3.14.1592",
"nuxt-tiptap-editor": "^1.2.0",
"vite-plugin-pwa": "^0.17.3",

View File

@@ -716,10 +716,10 @@ const documentReport = computed(() => {
let totalHoursSellingPrice = 0
itemInfo.value.rows.forEach(row => {
itemInfo.value.rows.filter(i => !i.optional && !i.alternative).forEach(row => {
if(row.product) {
let product = products.value.find(i => i.id === row.product)
console.log(product)
console.log(product.purchasePrice)
totalProductsPurchasePrice += product.purchasePrice * row.quantity

View File

@@ -10,7 +10,9 @@ definePageMeta({
<UDashboardPanelContent>
<UButton
class="w-full my-1">
class="w-full my-1"
to="/standardEntity/absencerequests"
>
Abwesenheiten
</UButton>
<UButton
@@ -18,15 +20,21 @@ definePageMeta({
Kalender
</UButton>
<UButton
class="w-full my-1">
class="w-full my-1"
to="/standardEntity/customers"
>
Kunden
</UButton>
<UButton
class="w-full my-1">
class="w-full my-1"
to="/standardEntity/vendors"
>
Lieferanten
</UButton>
<UButton
class="w-full my-1">
class="w-full my-1"
to="/standardEntity/plants"
>
Objekte
</UButton>

View File

@@ -7,6 +7,7 @@ import isoWeek from "dayjs/plugin/isoWeek"
import isBetween from "dayjs/plugin/isBetween"
import DocumentList from "~/components/DocumentList.vue";
import DocumentUpload from "~/components/DocumentUpload.vue";
import { v4 as uuidv4 } from 'uuid';
dayjs.extend(customParseFormat)
dayjs.extend(isoWeek)
dayjs.extend(isBetween)
@@ -131,6 +132,10 @@ const saveProfile = async () => {
await dataStore.updateItem('profiles',data,oldItemInfo.value)
}
const addAutomaticHourCorrection = async () => {
itemInfo.value.automaticHourCorrections.push({mode: 'correct', id: uuidv4(), weekday: 1, bookingTimeUTC: {hour: 0, minute: 0}, rangeStartUTC: {hour: 0, minute: 0}, rangeEndUTC: {hour: 0, minute: 0}})
}
</script>
<template>
@@ -161,9 +166,9 @@ const saveProfile = async () => {
label: 'Informationen'
},{
label: 'Logbuch'
},/*{
},{
label: 'Zeiterfassung'
},*/{
},{
label: 'Vertragsdaten'
},{
label: 'Dokumente'
@@ -326,9 +331,9 @@ const saveProfile = async () => {
:preloadedContent="emailSignature"
/>
<UDivider>Newsletter</UDivider>
<!--<UDivider>Newsletter</UDivider>
<!-- <UButton
<UButton
@click="addToNewsletter"
variant="outline"
>
@@ -501,6 +506,127 @@ const saveProfile = async () => {
</template>
</UTable>
</div>
<div v-else-if="item.label === 'Zeiterfassung'">
<UButton
@click="addAutomaticHourCorrection"
>
+ Korrektur
</UButton>
<UButton
@click="saveProfile"
class="ml-3"
>
Speichern
</UButton>
<UDivider class="my-3" />
<InputGroup class="w-full" v-for="item in itemInfo.automaticHourCorrections">
<UFormGroup
label="Modus"
>
<USelectMenu
v-model="item.mode"
:options="[{key: 'correct', label: 'Korrigieren'},{key: 'automatic-checkout', label: 'Automatisches ausbuchen'}]"
option-attribute="label"
value-attribute="key"
class="w-80"
/>
</UFormGroup>
<UFormGroup
label="Wochentag"
>
<USelectMenu
v-model="item.weekday"
:options="[{key: 1, label: 'Montag'},{key: 2, label: 'Dienstag'},{key: 3, label: 'Mittwoch'},{key: 4, label: 'Donnerstag'},{key: 5, label: 'Freitag'},{key: 6, label: 'Samstag'},{key: 7, label: 'Sonntag'},]"
option-attribute="label"
value-attribute="key"
class="w-40"
/>
</UFormGroup>
<UFormGroup
label="Zeitraum Start"
v-if="item.mode === 'correct'"
>
<InputGroup>
<UInput
v-model="item.rangeStartUTC.hour"
placeholder="Stunde UTC"
class="w-20"
/>
<UInput
v-model="item.rangeStartUTC.minute"
placeholder="Minute UTC"
class="w-20"
/>
</InputGroup>
</UFormGroup>
<UFormGroup
label="Zeitraum Ende"
v-if="item.mode === 'correct'"
>
<InputGroup>
<UInput
v-model="item.rangeEndUTC.hour"
placeholder="Stunde UTC"
class="w-20"
/>
<UInput
v-model="item.rangeEndUTC.minute"
placeholder="Minute UTC"
class="w-20"
/>
</InputGroup>
</UFormGroup>
<UFormGroup
label="Korrigieren zu"
v-if="item.mode === 'correct'"
>
<InputGroup>
<UInput
v-model="item.bookingTimeUTC.hour"
placeholder="Stunde UTC"
class="w-20"
/>
<UInput
v-model="item.bookingTimeUTC.minute"
placeholder="Minute UTC"
class="w-20"
/>
</InputGroup>
</UFormGroup>
<UFormGroup
label="Ausbuchen"
v-if="item.mode === 'automatic-checkout'"
>
<InputGroup>
<UInput
v-model="item.bookingTimeUTC.hour"
placeholder="Stunde UTC"
class="w-20"
/>
<UInput
v-model="item.bookingTimeUTC.minute"
placeholder="Minute UTC"
class="w-20"
/>
</InputGroup>
</UFormGroup>
<UFormGroup
label="Entfernen"
>
<UButton
icon="i-heroicons-x-mark"
variant="outline"
color="red"
@click="itemInfo.automaticHourCorrections = itemInfo.automaticHourCorrections.filter(i => i.id !== item.id)"
/>
</UFormGroup>
</InputGroup>
</div>
</UCard>
</template>
</UTabs>

View File

@@ -70,6 +70,7 @@ setupPage()
:type="route.params.type"
:item="item"
:mode="mode"
:platform="platform"
/>
<EntityList
v-else-if="loaded && mode === 'list'"

View File

@@ -903,14 +903,36 @@ export const useDataStore = defineStore('data', () => {
label: "Einkaufspreis",
component: purchasePrice,
inputType: "number",
inputTrailing: "EUR"
inputTrailing: "EUR",
inputChangeFunction: function (row) {
if(row.markupPercentage) {
row.sellingPrice = row.purchasePrice * (1+row.markupPercentage/100);
} else {
row.sellingPrice = row.purchasePrice;
}
}
},{
key: "markupPercentage",
label: "Aufschlag",
inputType: "number",
inputTrailing: "%",
inputChangeFunction: function (row) {
if(row.sellingPrice) {
row.sellingPrice = row.purchasePrice * (1+row.markupPercentage/100);
}
}
},{
key: "sellingPrice",
label: "Verkaufpreispreis",
required: true,
component: sellingPrice,
inputType: "number",
inputTrailing: "EUR"
inputTrailing: "EUR",
inputChangeFunction: function (row) {
if(row.markupPercentage) {
row.purchasePrice = (row.sellingPrice / (1+row.markupPercentage/100)).toFixed(4);
}
}
},{
key: "taxPercentage",
label: "Umsatzsteuer",

View File

@@ -40,7 +40,10 @@ export const useProfileStore = defineStore('profile', () => {
let profiles = (await supabase.from("profiles").select("*, role(*)")).data
let activeProfileConnection = profileconnections.find(i => i.active)
if(activeProfileConnection) {
toast.add({title: 'Aktives Profil ausgewählt'})
if(!await useCapacitor().getIsPhone()) {
toast.add({title: 'Aktives Profil ausgewählt'})
}
console.log("Active Profile selected")
activeProfile.value = profiles.find(i => i.id === activeProfileConnection.profile_id)
currentTenant.value = activeProfile.value.tenant