Neues Plugin IT-Service (OpenNIT); Abteilung bei „Geschrieben von“
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m41s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m32s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m30s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m35s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m41s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m32s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m30s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m35s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c713194a83
commit
c1117829c3
139 changed files with 2455 additions and 398 deletions
|
|
@ -0,0 +1,130 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { ChevronLeft, ChevronRight } from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* Zwei Monate zum Wählen eines Zeitraums; belegte Tage (slots) sind gesperrt.
|
||||
* v-model:start / v-model:end als „YYYY-MM-DD“.
|
||||
*/
|
||||
const props = defineProps({
|
||||
slots: { type: Array, default: () => [] },
|
||||
start: { type: String, default: '' },
|
||||
end: { type: String, default: '' },
|
||||
maxDays: { type: Number, default: 180 },
|
||||
});
|
||||
const emit = defineEmits(['update:start', 'update:end']);
|
||||
|
||||
const iso = (date) => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
||||
const today = iso(new Date());
|
||||
const cursor = ref(new Date(new Date().getFullYear(), new Date().getMonth(), 1));
|
||||
|
||||
const booked = computed(() => {
|
||||
const days = new Set();
|
||||
|
||||
for (const slot of props.slots) {
|
||||
const day = new Date(`${slot.start}T12:00:00`);
|
||||
const last = new Date(`${slot.end || slot.start}T12:00:00`);
|
||||
|
||||
for (let i = 0; day <= last && i < 400; i++) {
|
||||
days.add(iso(day));
|
||||
day.setDate(day.getDate() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return days;
|
||||
});
|
||||
|
||||
const monthFormat = new Intl.DateTimeFormat('de-DE', { month: 'long', year: 'numeric' });
|
||||
const months = computed(() => [0, 1].map((offset) => {
|
||||
const first = new Date(cursor.value.getFullYear(), cursor.value.getMonth() + offset, 1);
|
||||
const days = [];
|
||||
const lead = (first.getDay() + 6) % 7; // Montag zuerst
|
||||
|
||||
for (let i = 0; i < lead; i++) days.push(null);
|
||||
|
||||
for (let d = 1; d <= new Date(first.getFullYear(), first.getMonth() + 1, 0).getDate(); d++) {
|
||||
days.push(iso(new Date(first.getFullYear(), first.getMonth(), d)));
|
||||
}
|
||||
|
||||
return { label: monthFormat.format(first), days };
|
||||
}));
|
||||
|
||||
function rangeFree(from, to) {
|
||||
for (const day of booked.value) {
|
||||
if (day >= from && day <= to) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function pick(day) {
|
||||
if (!day || day < today || booked.value.has(day)) return;
|
||||
|
||||
if (!props.start || props.end || day < props.start) {
|
||||
emit('update:start', day);
|
||||
emit('update:end', '');
|
||||
} else if (rangeFree(props.start, day)) {
|
||||
emit('update:end', day);
|
||||
} else {
|
||||
emit('update:start', day);
|
||||
emit('update:end', '');
|
||||
}
|
||||
}
|
||||
|
||||
function state(day) {
|
||||
if (!day) return 'empty';
|
||||
if (booked.value.has(day)) return 'booked';
|
||||
if (day < today) return 'past';
|
||||
if (day === props.start || day === props.end) return 'edge';
|
||||
if (props.start && props.end && day > props.start && day < props.end) return 'inside';
|
||||
|
||||
return 'free';
|
||||
}
|
||||
|
||||
const classes = {
|
||||
booked: 'bg-red-50 text-red-400 line-through cursor-not-allowed dark:bg-red-950/30',
|
||||
past: 'text-muted-foreground/40 cursor-not-allowed',
|
||||
edge: 'bg-brand text-brand-foreground font-semibold',
|
||||
inside: 'bg-brand-soft text-brand-soft-foreground',
|
||||
free: 'hover:bg-accent',
|
||||
empty: '',
|
||||
};
|
||||
|
||||
function shift(step) {
|
||||
cursor.value = new Date(cursor.value.getFullYear(), cursor.value.getMonth() + step, 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<button type="button" class="grid size-8 place-items-center rounded-md hover:bg-accent" aria-label="Früher" @click="shift(-1)"><ChevronLeft class="size-4" /></button>
|
||||
<span class="text-xs text-muted-foreground">Beginn und Ende anklicken</span>
|
||||
<button type="button" class="grid size-8 place-items-center rounded-md hover:bg-accent" aria-label="Später" @click="shift(1)"><ChevronRight class="size-4" /></button>
|
||||
</div>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<div v-for="month in months" :key="month.label">
|
||||
<p class="mb-1.5 text-center text-sm font-medium">{{ month.label }}</p>
|
||||
<div class="grid grid-cols-7 gap-0.5 text-center text-xs">
|
||||
<span v-for="w in ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']" :key="w" class="py-1 text-muted-foreground">{{ w }}</span>
|
||||
<button
|
||||
v-for="(day, i) in month.days"
|
||||
:key="day ?? `e${i}`"
|
||||
type="button"
|
||||
class="aspect-square rounded-md tabular-nums transition-colors"
|
||||
:class="classes[state(day)]"
|
||||
:disabled="!day || state(day) === 'booked' || state(day) === 'past'"
|
||||
:title="state(day) === 'booked' ? 'Belegt' : undefined"
|
||||
@click="pick(day)"
|
||||
>
|
||||
{{ day ? Number(day.slice(8)) : '' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mt-2 flex items-center gap-3 text-[11px] text-muted-foreground">
|
||||
<span class="inline-flex items-center gap-1"><span class="size-2.5 rounded-sm bg-red-100 dark:bg-red-950" /> belegt</span>
|
||||
<span class="inline-flex items-center gap-1"><span class="size-2.5 rounded-sm bg-brand" /> Ihr Zeitraum</span>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
label: { type: String, required: true },
|
||||
tone: { type: String, default: 'neutral' }, // open | progress | waiting | done | neutral
|
||||
});
|
||||
|
||||
const classes = computed(() => ({
|
||||
open: 'bg-sky-100 text-sky-800 dark:bg-sky-900/50 dark:text-sky-200',
|
||||
progress: 'bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-200',
|
||||
waiting: 'bg-violet-100 text-violet-800 dark:bg-violet-900/50 dark:text-violet-200',
|
||||
done: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-200',
|
||||
neutral: 'bg-muted text-muted-foreground',
|
||||
})[props.tone]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-semibold whitespace-nowrap" :class="classes">{{ label }}</span>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue