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

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