fix workflows
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import { parseDate } from '@internationalized/date'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
context: { type: Object, required: true },
|
context: { type: Object, required: true },
|
||||||
@@ -28,6 +29,23 @@ const form = ref({
|
|||||||
const isSubmitting = ref(false)
|
const isSubmitting = ref(false)
|
||||||
const errors = ref({})
|
const errors = ref({})
|
||||||
|
|
||||||
|
const deliveryDateValue = computed({
|
||||||
|
get: () => {
|
||||||
|
if (!form.value.deliveryDate) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return parseDate(form.value.deliveryDate)
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
set: (value) => {
|
||||||
|
form.value.deliveryDate = value ? value.toString() : ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Validierung basierend auf JSON Config & neuen Anforderungen
|
// Validierung basierend auf JSON Config & neuen Anforderungen
|
||||||
const validate = () => {
|
const validate = () => {
|
||||||
errors.value = {}
|
errors.value = {}
|
||||||
@@ -109,30 +127,64 @@ const setDeliveryDateToToday = () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UCard :ui="{ body: { padding: 'p-6 sm:p-8' } }" v-if="props.context && props.token">
|
<UCard
|
||||||
|
v-if="props.context && props.token"
|
||||||
|
class="overflow-hidden border-white/70 shadow-xl ring-1 ring-black/5"
|
||||||
|
:ui="{ body: { padding: 'p-6 sm:p-8' }, header: { padding: 'p-6 sm:p-8 pb-0' }, footer: { padding: 'p-6 sm:p-8 pt-0' } }"
|
||||||
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="text-center">
|
<div class="space-y-3 text-center">
|
||||||
<h1 class="text-xl font-bold text-gray-900">{{ config?.ui?.title || 'Erfassung' }}</h1>
|
<div class="mx-auto flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 text-primary ring-1 ring-primary/15">
|
||||||
<p v-if="config?.ui?.description" class="text-sm text-gray-500 mt-1">{{ config?.ui?.description }}</p>
|
<UIcon name="i-heroicons-clipboard-document-check" class="h-7 w-7" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1 class="text-xl font-semibold text-highlighted">{{ config?.ui?.title || 'Erfassung' }}</h1>
|
||||||
|
<p v-if="config?.ui?.description" class="mt-1 text-sm text-muted">{{ config?.ui?.description }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="space-y-5">
|
<div class="space-y-5">
|
||||||
|
<UAlert
|
||||||
|
color="primary"
|
||||||
|
variant="soft"
|
||||||
|
icon="i-heroicons-sparkles"
|
||||||
|
title="Schnelle Erfassung"
|
||||||
|
description="Alle Angaben werden direkt dem passenden Workflow zugeordnet."
|
||||||
|
/>
|
||||||
|
|
||||||
<UFormField
|
<UFormField
|
||||||
label="Datum der Ausführung"
|
label="Datum der Ausführung"
|
||||||
:error="errors.deliveryDate"
|
:error="errors.deliveryDate"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex gap-2">
|
||||||
<UInput
|
<UPopover>
|
||||||
v-model="form.deliveryDate"
|
<UButton
|
||||||
type="date"
|
color="neutral"
|
||||||
size="lg"
|
variant="outline"
|
||||||
icon="i-heroicons-calendar-days"
|
size="lg"
|
||||||
class="flex-1"
|
icon="i-heroicons-calendar-days"
|
||||||
/>
|
class="min-w-0 flex-1 justify-between"
|
||||||
<UButton color="gray" variant="soft" size="lg" label="Heute" @click="setDeliveryDateToToday" />
|
>
|
||||||
|
<span class="truncate text-left">
|
||||||
|
{{ form.deliveryDate ? dayjs(form.deliveryDate).format('DD.MM.YYYY') : 'Kein Datum' }}
|
||||||
|
</span>
|
||||||
|
</UButton>
|
||||||
|
|
||||||
|
<template #content>
|
||||||
|
<div class="p-2">
|
||||||
|
<UCalendar v-model="deliveryDateValue" />
|
||||||
|
<div class="flex justify-end border-t border-default pt-2">
|
||||||
|
<UButton color="neutral" variant="ghost" size="sm" @click="setDeliveryDateToToday">
|
||||||
|
Heute
|
||||||
|
</UButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</UPopover>
|
||||||
|
|
||||||
|
<UButton color="neutral" variant="soft" size="lg" label="Heute" @click="setDeliveryDateToToday" />
|
||||||
</div>
|
</div>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
@@ -148,8 +200,10 @@ const setDeliveryDateToToday = () => {
|
|||||||
label-key="fullName"
|
label-key="fullName"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
placeholder="Name auswählen..."
|
placeholder="Name auswählen..."
|
||||||
searchable
|
|
||||||
size="lg"
|
size="lg"
|
||||||
|
class="w-full"
|
||||||
|
:search-input="{ placeholder: 'Mitarbeiter suchen...' }"
|
||||||
|
:filter-fields="['fullName']"
|
||||||
/>
|
/>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
@@ -165,8 +219,10 @@ const setDeliveryDateToToday = () => {
|
|||||||
label-key="name"
|
label-key="name"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
placeholder="Wählen..."
|
placeholder="Wählen..."
|
||||||
searchable
|
|
||||||
size="lg"
|
size="lg"
|
||||||
|
class="w-full"
|
||||||
|
:search-input="{ placeholder: 'Projekt suchen...' }"
|
||||||
|
:filter-fields="['name']"
|
||||||
/>
|
/>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
@@ -182,8 +238,10 @@ const setDeliveryDateToToday = () => {
|
|||||||
label-key="name"
|
label-key="name"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
placeholder="Wählen..."
|
placeholder="Wählen..."
|
||||||
searchable
|
|
||||||
size="lg"
|
size="lg"
|
||||||
|
class="w-full"
|
||||||
|
:search-input="{ placeholder: 'Tätigkeit suchen...' }"
|
||||||
|
:filter-fields="['name']"
|
||||||
/>
|
/>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
@@ -198,9 +256,10 @@ const setDeliveryDateToToday = () => {
|
|||||||
step="0.25"
|
step="0.25"
|
||||||
size="lg"
|
size="lg"
|
||||||
placeholder="0.00"
|
placeholder="0.00"
|
||||||
|
class="w-full"
|
||||||
>
|
>
|
||||||
<template #trailing>
|
<template #trailing>
|
||||||
<span class="text-gray-500 text-sm pr-2">{{ currentUnit }}</span>
|
<span class="pr-2 text-sm text-muted">{{ currentUnit }}</span>
|
||||||
</template>
|
</template>
|
||||||
</UInput>
|
</UInput>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
@@ -211,23 +270,23 @@ const setDeliveryDateToToday = () => {
|
|||||||
:error="errors.diesel"
|
:error="errors.diesel"
|
||||||
:required="config?.validation?.requireDiesel"
|
:required="config?.validation?.requireDiesel"
|
||||||
>
|
>
|
||||||
<UInput v-model="form.dieselUsage" type="number" step="0.1" placeholder="0.0" size="lg">
|
<UInput v-model="form.dieselUsage" type="number" step="0.1" placeholder="0.0" size="lg" class="w-full">
|
||||||
<template #trailing>
|
<template #trailing>
|
||||||
<span class="text-gray-500 text-xs">Liter</span>
|
<span class="text-xs text-muted">Liter</span>
|
||||||
</template>
|
</template>
|
||||||
</UInput>
|
</UInput>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
<UFormField :label="config?.ui?.labels?.description || 'Notiz / Vorkommnisse'">
|
<UFormField :label="config?.ui?.labels?.description || 'Notiz / Vorkommnisse'">
|
||||||
<UTextarea v-model="form.description" :rows="3" placeholder="Optional..." />
|
<UTextarea v-model="form.description" :rows="4" autoresize class="w-full" placeholder="Optional..." />
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<UButton
|
<UButton
|
||||||
block
|
|
||||||
size="xl"
|
size="xl"
|
||||||
|
block
|
||||||
:loading="isSubmitting"
|
:loading="isSubmitting"
|
||||||
@click="submit"
|
@click="submit"
|
||||||
:label="config?.ui?.submitButtonText || 'Speichern'"
|
:label="config?.ui?.submitButtonText || 'Speichern'"
|
||||||
|
|||||||
Reference in New Issue
Block a user