Added Features to Mobile Styling
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import {useTempStore} from "~/stores/temp.js";
|
import {useTempStore} from "~/stores/temp.js";
|
||||||
import FloatingActionButton from "~/components/mobile/FloatingActionButton.vue";
|
import FloatingActionButton from "~/components/mobile/FloatingActionButton.vue";
|
||||||
import EntityTable from "~/components/EntityTable.vue";
|
import EntityTable from "~/components/EntityTable.vue";
|
||||||
|
import EntityListMobile from "~/components/EntityListMobile.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
@@ -181,7 +182,14 @@ const filteredRows = computed(() => {
|
|||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</template>
|
</template>
|
||||||
</UDashboardToolbar>
|
</UDashboardToolbar>
|
||||||
|
<EntityListMobile
|
||||||
|
v-if="platform === 'mobile'"
|
||||||
|
:type="props.type"
|
||||||
|
:columns="columns"
|
||||||
|
:rows="filteredRows"
|
||||||
|
/>
|
||||||
<EntityTable
|
<EntityTable
|
||||||
|
v-else
|
||||||
:type="props.type"
|
:type="props.type"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="filteredRows"
|
:rows="filteredRows"
|
||||||
|
|||||||
129
components/EntityListMobile.vue
Normal file
129
components/EntityListMobile.vue
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<script setup>
|
||||||
|
/*defineShortcuts({
|
||||||
|
/!*'/': () => {
|
||||||
|
//console.log(searchinput)
|
||||||
|
//searchinput.value.focus()
|
||||||
|
document.getElementById("searchinput").focus()
|
||||||
|
},*!/
|
||||||
|
'Enter': {
|
||||||
|
usingInput: true,
|
||||||
|
handler: () => {
|
||||||
|
router.push(`/standardEntity/${props.type}/show/${props.rows.value[selectedItem.value].id}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'arrowdown': () => {
|
||||||
|
if(selectedItem.value < props.rows.length - 1) {
|
||||||
|
selectedItem.value += 1
|
||||||
|
} else {
|
||||||
|
selectedItem.value = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'arrowup': () => {
|
||||||
|
if(selectedItem.value === 0) {
|
||||||
|
selectedItem.value = props.rows.length - 1
|
||||||
|
} else {
|
||||||
|
selectedItem.value -= 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})*/
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
rows: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataStore = useDataStore()
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const dataType = dataStore.dataTypes[props.type]
|
||||||
|
|
||||||
|
const selectedItem = ref(0)
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UDashboardPanelContent class="w-full">
|
||||||
|
<a
|
||||||
|
v-for="item in props.rows"
|
||||||
|
class="my-1"
|
||||||
|
@click="router.push(`/standardEntity/${type}/show/${item.id}`)"
|
||||||
|
>
|
||||||
|
<p class="truncate text-left text-primary text-xl">{{dataType.templateColumns.find(i => i.title).key ? item[dataType.templateColumns.find(i => i.title).key] : null}}</p>
|
||||||
|
<p class="text-sm">
|
||||||
|
{{ dataType.numberRangeHolder ? item[dataType.numberRangeHolder] : null}}
|
||||||
|
|
||||||
|
<span v-for="secondInfo in dataType.templateColumns.filter(i => i.secondInfo)">{{(secondInfo.secondInfoKey && item[secondInfo.key]) ? item[secondInfo.key][secondInfo.secondInfoKey] : item[secondInfo.key]}}</span>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</UDashboardPanelContent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <UTable
|
||||||
|
v-if="dataType && columns"
|
||||||
|
:rows="props.rows"
|
||||||
|
:columns="props.columns"
|
||||||
|
class="w-full"
|
||||||
|
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||||
|
@select="(i) => router.push(`/standardEntity/${type}/show/${i.id}`) "
|
||||||
|
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: `Keine ${dataType.label} anzuzeigen` }"
|
||||||
|
>
|
||||||
|
<template
|
||||||
|
v-for="column in dataType.templateColumns.filter(i => !i.disabledInTable)"
|
||||||
|
v-slot:[`${column.key}-header`]="{row}">
|
||||||
|
<span class="text-nowrap">{{column.label}}</span>
|
||||||
|
</template>
|
||||||
|
<template #name-data="{row}">
|
||||||
|
<span
|
||||||
|
v-if="row.id === props.rows[selectedItem].id"
|
||||||
|
class="text-primary-500 font-bold">{{row.name}}
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{row.name}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template #fullName-data="{row}">
|
||||||
|
<span
|
||||||
|
v-if="row.id === props.rows[selectedItem].id"
|
||||||
|
class="text-primary-500 font-bold">{{row.fullName}}
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{row.fullName}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template #licensePlate-data="{row}">
|
||||||
|
<span
|
||||||
|
v-if="row.id === props.rows[selectedItem].id"
|
||||||
|
class="text-primary-500 font-bold">{{row.licensePlate}}
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{row.licensePlate}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
v-for="column in dataType.templateColumns.filter(i => i.key !== 'name' && i.key !== 'fullName' && i.key !== 'licensePlate' && !i.disabledInTable)"
|
||||||
|
v-slot:[`${column.key}-data`]="{row}">
|
||||||
|
<component v-if="column.component" :is="column.component" :row="row"></component>
|
||||||
|
<span v-else>{{row[column.key] ? `${row[column.key]} ${column.unit ? column.unit : ''}`: ''}}</span>
|
||||||
|
</template>
|
||||||
|
</UTable>-->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -167,12 +167,12 @@ const footerLinks = [/*{
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
:color="route.fullPath === '/standardEntity/projects' ? 'primary' : 'gray'"
|
:color="route.fullPath === '/standardEntity/projects' ? 'primary' : 'gray'"
|
||||||
/>
|
/>
|
||||||
<UButton
|
<!-- <UButton
|
||||||
icon="i-heroicons-clock"
|
icon="i-heroicons-clock"
|
||||||
to="/workingtimes"
|
to="/workingtimes"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
:color="route.fullPath === '/workingtimes' ? 'primary' : 'gray'"
|
:color="route.fullPath === '/workingtimes' ? 'primary' : 'gray'"
|
||||||
/>
|
/>-->
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-heroicons-bars-4"
|
icon="i-heroicons-bars-4"
|
||||||
to="/mobile/menu"
|
to="/mobile/menu"
|
||||||
|
|||||||
@@ -10,32 +10,58 @@ const profileStore = useProfileStore()
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDashboardPanelContent>
|
<UDashboardPanelContent>
|
||||||
|
<UDivider class="mb-3">Weiteres</UDivider>
|
||||||
|
<UButton
|
||||||
|
class="w-full my-1"
|
||||||
|
to="/times"
|
||||||
|
icon="i-heroicons-clock"
|
||||||
|
>
|
||||||
|
Zeiten
|
||||||
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
class="w-full my-1"
|
class="w-full my-1"
|
||||||
to="/standardEntity/absencerequests"
|
to="/standardEntity/absencerequests"
|
||||||
|
icon="i-heroicons-document-text"
|
||||||
>
|
>
|
||||||
Abwesenheiten
|
Abwesenheiten
|
||||||
</UButton>
|
</UButton>
|
||||||
|
|
||||||
<UButton
|
<UButton
|
||||||
|
class="w-full my-1"
|
||||||
|
to="/workingtimes"
|
||||||
|
icon="i-heroicons-clock"
|
||||||
|
>
|
||||||
|
Anwesenheiten
|
||||||
|
</UButton>
|
||||||
|
<!-- <UButton
|
||||||
class="w-full my-1">
|
class="w-full my-1">
|
||||||
Kalender
|
Kalender
|
||||||
</UButton>
|
</UButton>-->
|
||||||
<UButton
|
<UButton
|
||||||
class="w-full my-1"
|
class="w-full my-1"
|
||||||
to="/standardEntity/customers"
|
to="/standardEntity/customers"
|
||||||
|
icon="i-heroicons-user-group"
|
||||||
>
|
>
|
||||||
Kunden
|
Kunden
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
class="w-full my-1"
|
class="w-full my-1"
|
||||||
to="/standardEntity/vendors"
|
to="/standardEntity/vendors"
|
||||||
|
icon="i-heroicons-truck"
|
||||||
>
|
>
|
||||||
Lieferanten
|
Lieferanten
|
||||||
</UButton>
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
class="w-full my-1"
|
||||||
|
to="/standardEntity/contacts"
|
||||||
|
icon="i-heroicons-user-group"
|
||||||
|
>
|
||||||
|
Ansprechpartner
|
||||||
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
class="w-full my-1"
|
class="w-full my-1"
|
||||||
to="/standardEntity/plants"
|
to="/standardEntity/plants"
|
||||||
|
icon="i-heroicons-clipboard-document"
|
||||||
>
|
>
|
||||||
Objekte
|
Objekte
|
||||||
</UButton>
|
</UButton>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import VueDatePicker from '@vuepic/vue-datepicker'
|
import VueDatePicker from '@vuepic/vue-datepicker'
|
||||||
import '@vuepic/vue-datepicker/dist/main.css'
|
import '@vuepic/vue-datepicker/dist/main.css'
|
||||||
|
import {setPageLayout} from "#app";
|
||||||
|
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
@@ -32,9 +33,16 @@ const runningTimeInfo = ref({})
|
|||||||
const showConfigTimeModal = ref(false)
|
const showConfigTimeModal = ref(false)
|
||||||
const configTimeMode = ref("create")
|
const configTimeMode = ref("create")
|
||||||
|
|
||||||
|
const platform = ref("default")
|
||||||
|
|
||||||
const setup = async () => {
|
const setup = async () => {
|
||||||
times.value = await useSupabaseSelect("times","*, profile(*), project(id, name)")
|
times.value = await useSupabaseSelect("times","*, profile(*), project(id, name)")
|
||||||
|
|
||||||
|
if(await useCapacitor().getIsPhone()) {
|
||||||
|
platform.value = "mobile"
|
||||||
|
setPageLayout("mobile")
|
||||||
|
}
|
||||||
|
|
||||||
runningTimeInfo.value = (await supabase
|
runningTimeInfo.value = (await supabase
|
||||||
.from("times")
|
.from("times")
|
||||||
.select()
|
.select()
|
||||||
@@ -209,11 +217,23 @@ const setState = async (newState) => {
|
|||||||
await updateTime()
|
await updateTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getSecondInfo = (item) => {
|
||||||
|
let returnArray = []
|
||||||
|
|
||||||
|
if(item.type) returnArray.push(item.type)
|
||||||
|
if(item.project) returnArray.push(item.project.name)
|
||||||
|
if(item.notes) returnArray.push(item.notes)
|
||||||
|
|
||||||
|
return returnArray
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDashboardNavbar title="Zeiterfassung">
|
<UDashboardNavbar title="Zeiterfassung">
|
||||||
|
<template #toggle>
|
||||||
|
<div v-if="platform === 'mobile'"></div>
|
||||||
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<UDashboardToolbar>
|
<UDashboardToolbar>
|
||||||
<template #left>
|
<template #left>
|
||||||
@@ -230,11 +250,13 @@ const setState = async (newState) => {
|
|||||||
Stop
|
Stop
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
|
v-if="platform !== 'mobile'"
|
||||||
@click="configTimeMode = 'create'; itemInfo = {start: new Date(), end: new Date(), user: user.id}; showConfigTimeModal = true"
|
@click="configTimeMode = 'create'; itemInfo = {start: new Date(), end: new Date(), user: user.id}; showConfigTimeModal = true"
|
||||||
>
|
>
|
||||||
Erstellen
|
Erstellen
|
||||||
</UButton>
|
</UButton>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
|
v-if="platform !== 'mobile'"
|
||||||
:options="profileStore.profiles"
|
:options="profileStore.profiles"
|
||||||
option-attribute="fullName"
|
option-attribute="fullName"
|
||||||
value-attribute="id"
|
value-attribute="id"
|
||||||
@@ -412,7 +434,24 @@ const setState = async (newState) => {
|
|||||||
</UCard>
|
</UCard>
|
||||||
</UModal>
|
</UModal>
|
||||||
|
|
||||||
|
<UDashboardPanelContent class="w-full" v-if="platform === 'mobile'">
|
||||||
|
<a
|
||||||
|
v-for="item in filteredRows"
|
||||||
|
class="my-1"
|
||||||
|
>
|
||||||
|
<p class="truncate text-left text-primary text-xl">{{dayjs(item.startDate).format("DD.MM.YYYY HH:mm")}} - {{dayjs(item.endDate).format("HH:mm")}}</p>
|
||||||
|
<p class="text-sm">
|
||||||
|
<span v-for="(i,index) in getSecondInfo(item)">
|
||||||
|
{{i}}{{index < getSecondInfo(item).length - 1 ? " - " : ""}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</UDashboardPanelContent>
|
||||||
|
|
||||||
|
|
||||||
<UTable
|
<UTable
|
||||||
|
v-else
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="filteredRows"
|
:rows="filteredRows"
|
||||||
|
|||||||
@@ -1061,6 +1061,8 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
selectDataType: "customers",
|
selectDataType: "customers",
|
||||||
selectOptionAttribute: "name",
|
selectOptionAttribute: "name",
|
||||||
selectSearchAttributes: ['name'],
|
selectSearchAttributes: ['name'],
|
||||||
|
secondInfo: true,
|
||||||
|
secondInfoKey: "name",
|
||||||
},{
|
},{
|
||||||
key: "plant",
|
key: "plant",
|
||||||
label: "Objekt",
|
label: "Objekt",
|
||||||
|
|||||||
Reference in New Issue
Block a user