Some Corrections For Mobile

This commit is contained in:
2025-05-31 20:09:36 +02:00
parent cad2ed9dba
commit eb37257ae8
7 changed files with 51 additions and 14 deletions

13
app.vue
View File

@@ -12,6 +12,15 @@ const viewport = useViewport()
console.log('Breakpoint updated:', oldBreakpoint, '->', newBreakpoint) 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 const dev = process.dev
Sentry.init({ Sentry.init({
@@ -55,9 +64,9 @@ useSeoMeta({
<NuxtPage/> <NuxtPage/>
</NuxtLayout> </NuxtLayout>
<UNotifications/> <UNotifications :class="platform === 'mobile' ? ['mb-14'] : []"/>
<USlideovers /> <USlideovers />
<UModals /> <UModals/>
<VitePwaManifest/> <VitePwaManifest/>
</div> </div>

View File

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

View File

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

View File

@@ -21,9 +21,12 @@ const showAddHistoryItemModal = ref(false)
const colorMode = useColorMode() const colorMode = useColorMode()
const items = ref([]) const items = ref([])
const platform = ref("default")
const setup = async () => { const setup = async () => {
if(await useCapacitor().getIsPhone()) platform.value = "mobile"
if(props.type && props.elementId){ if(props.type && props.elementId){
items.value = (await supabase.from("historyitems").select().eq(props.type,props.elementId).order("created_at",{ascending: true})).data || [] items.value = (await supabase.from("historyitems").select().eq(props.type,props.elementId).order("created_at",{ascending: true})).data || []
} else { } else {
@@ -102,10 +105,16 @@ const renderText = (text) => {
<template> <template>
<UModal <UModal
v-model="showAddHistoryItemModal" v-model="showAddHistoryItemModal"
> >
<UCard> <UCard class="h-full">
<template #header> <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> </template>
<UFormGroup <UFormGroup

View File

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

View File

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

View File

@@ -40,7 +40,10 @@ export const useProfileStore = defineStore('profile', () => {
let profiles = (await supabase.from("profiles").select("*, role(*)")).data let profiles = (await supabase.from("profiles").select("*, role(*)")).data
let activeProfileConnection = profileconnections.find(i => i.active) let activeProfileConnection = profileconnections.find(i => i.active)
if(activeProfileConnection) { 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") console.log("Active Profile selected")
activeProfile.value = profiles.find(i => i.id === activeProfileConnection.profile_id) activeProfile.value = profiles.find(i => i.id === activeProfileConnection.profile_id)
currentTenant.value = activeProfile.value.tenant currentTenant.value = activeProfile.value.tenant