Ideenbox (0.33.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m16s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m12s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m52s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m6s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m53s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m16s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m12s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m52s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m6s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m53s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bd7536ab82
commit
858e248d26
160 changed files with 1543 additions and 348 deletions
67
plugins-core/ideen/resources/js/components/IdeaDialog.vue
Normal file
67
plugins-core/ideen/resources/js/components/IdeaDialog.vue
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<script setup>
|
||||
import { watch } from 'vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
|
||||
/**
|
||||
* Idee einreichen bzw. (solange sie neu ist) bearbeiten.
|
||||
*/
|
||||
const props = defineProps({
|
||||
idea: { type: Object, default: null },
|
||||
});
|
||||
|
||||
const open = defineModel('open', { type: Boolean, default: false });
|
||||
const form = useForm({ title: '', body: '', anonymous: false });
|
||||
|
||||
watch(open, (value) => {
|
||||
if (!value) return;
|
||||
|
||||
form.clearErrors();
|
||||
form.defaults({ title: props.idea?.title ?? '', body: props.idea?.body ?? '', anonymous: false });
|
||||
form.reset();
|
||||
});
|
||||
|
||||
function submit() {
|
||||
const options = { preserveScroll: true, onSuccess: () => (open.value = false) };
|
||||
props.idea ? form.put(`/ideen/${props.idea.id}`, options) : form.post('/ideen', options);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog v-model:open="open">
|
||||
<DialogContent class="sm:max-w-xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ idea ? 'Idee bearbeiten' : 'Idee einreichen' }}</DialogTitle>
|
||||
<DialogDescription>Was ließe sich verbessern? Beschreiben Sie kurz das Problem und Ihren Vorschlag.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form id="idea-form" class="grid gap-5" @submit.prevent="submit">
|
||||
<FormField id="idea-title" label="Titel" :error="form.errors.title">
|
||||
<Input id="idea-title" v-model="form.title" maxlength="160" placeholder="z. B. Fahrradständer mit Überdachung" />
|
||||
</FormField>
|
||||
<FormField id="idea-body" label="Beschreibung" :error="form.errors.body">
|
||||
<Textarea id="idea-body" v-model="form.body" rows="7" maxlength="5000" placeholder="Was ist heute schwierig? Was schlagen Sie vor? Wem würde es helfen?" />
|
||||
</FormField>
|
||||
<label v-if="!idea" class="flex items-start justify-between gap-4 rounded-md border p-3 text-sm">
|
||||
<span>
|
||||
<span class="font-medium">Anonym einreichen</span>
|
||||
<span class="block text-xs text-muted-foreground">Ihr Name wird nicht gespeichert – auch nicht für das Gremium. Dann können Sie die Idee später nicht mehr bearbeiten und bekommen keine Rückmeldung per Benachrichtigung.</span>
|
||||
</span>
|
||||
<Switch v-model="form.anonymous" />
|
||||
</label>
|
||||
</form>
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" @click="open = false">Abbrechen</Button>
|
||||
<Button type="submit" form="idea-form" :disabled="form.processing">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
{{ idea ? 'Speichern' : 'Einreichen' }}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
17
plugins-core/ideen/resources/js/components/StatusBadge.vue
Normal file
17
plugins-core/ideen/resources/js/components/StatusBadge.vue
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<script setup>
|
||||
defineProps({
|
||||
status: { type: String, required: true },
|
||||
label: { type: String, required: true },
|
||||
});
|
||||
|
||||
const styles = {
|
||||
new: 'bg-brand-soft text-brand-text',
|
||||
review: 'bg-accent2/15 text-accent2-text',
|
||||
done: 'bg-brand text-brand-foreground',
|
||||
rejected: 'bg-muted text-muted-foreground',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[11px] font-medium" :class="styles[status]">{{ label }}</span>
|
||||
</template>
|
||||
55
plugins-core/ideen/resources/js/components/SupportButton.vue
Normal file
55
plugins-core/ideen/resources/js/components/SupportButton.vue
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { ThumbsUp } from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* „Unterstützen“ mit Zähler – schaltet sofort um, der Server bestätigt im Hintergrund.
|
||||
*/
|
||||
const props = defineProps({
|
||||
idea: { type: Object, required: true },
|
||||
disabled: { type: Boolean, default: false },
|
||||
large: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const supported = ref(!!props.idea.supported);
|
||||
const count = ref(props.idea.supports);
|
||||
watch(() => [props.idea.supported, props.idea.supports], ([s, c]) => {
|
||||
supported.value = !!s;
|
||||
count.value = c;
|
||||
});
|
||||
|
||||
function toggle() {
|
||||
const next = !supported.value;
|
||||
supported.value = next;
|
||||
count.value += next ? 1 : -1;
|
||||
router.visit(`/ideen/${props.idea.id}/unterstuetzen`, {
|
||||
method: next ? 'post' : 'delete',
|
||||
preserveScroll: true,
|
||||
preserveState: true,
|
||||
onError: () => {
|
||||
supported.value = !next;
|
||||
count.value += next ? -1 : 1;
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="disabled"
|
||||
:aria-pressed="supported"
|
||||
:title="disabled ? 'Ihre eigene Idee' : supported ? 'Unterstützung zurücknehmen' : 'Idee unterstützen'"
|
||||
class="flex shrink-0 flex-col items-center justify-center rounded-md border tabular-nums transition-colors disabled:cursor-default disabled:opacity-70"
|
||||
:class="[
|
||||
large ? 'min-w-20 gap-1 px-3 py-2.5' : 'size-14 gap-0.5',
|
||||
supported ? 'border-brand bg-brand text-brand-foreground' : 'bg-card hover:border-brand/50 hover:bg-brand-soft',
|
||||
]"
|
||||
@click="toggle"
|
||||
>
|
||||
<ThumbsUp :class="[large ? 'size-5' : 'size-4', supported ? 'fill-current' : '']" />
|
||||
<span class="text-sm font-semibold">{{ count }}</span>
|
||||
<span v-if="large" class="text-[11px]">{{ supported ? 'Unterstützt' : 'Unterstützen' }}</span>
|
||||
</button>
|
||||
</template>
|
||||
30
plugins-core/ideen/resources/js/editorial/EditorialIdeas.vue
Normal file
30
plugins-core/ideen/resources/js/editorial/EditorialIdeas.vue
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { MessageCircle, ThumbsUp } from '@lucide/vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import { formatRelative } from '@/lib/format';
|
||||
import StatusBadge from '../components/StatusBadge.vue';
|
||||
|
||||
defineProps({
|
||||
ideas: { type: Array, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Panel title="Ideenbox – zu sichten" action-label="Alle Ideen" action-href="/ideen">
|
||||
<ul v-if="ideas.length" class="-mx-5 divide-y border-t">
|
||||
<li v-for="idea in ideas" :key="idea.id" class="flex items-center gap-3 px-5 py-2.5">
|
||||
<div class="min-w-0 flex-1">
|
||||
<Link :href="idea.url" class="block truncate text-sm font-medium hover:underline">{{ idea.title }}</Link>
|
||||
<p class="truncate text-xs text-muted-foreground">{{ idea.author?.name ?? 'Anonym' }} · {{ formatRelative(idea.created_at) }}</p>
|
||||
</div>
|
||||
<span class="inline-flex shrink-0 items-center gap-2.5 text-xs text-muted-foreground tabular-nums">
|
||||
<span class="inline-flex items-center gap-1"><ThumbsUp class="size-3.5" /> {{ idea.supports }}</span>
|
||||
<span class="inline-flex items-center gap-1"><MessageCircle class="size-3.5" /> {{ idea.comments }}</span>
|
||||
</span>
|
||||
<StatusBadge :status="idea.status" :label="idea.status_label" />
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="text-sm text-muted-foreground">Keine offenen Ideen.</p>
|
||||
</Panel>
|
||||
</template>
|
||||
107
plugins-core/ideen/resources/js/pages/Index.vue
Normal file
107
plugins-core/ideen/resources/js/pages/Index.vue
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { Lightbulb, MessageCircle, Plus, Search } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { formatRelative } from '@/lib/format';
|
||||
import IdeaDialog from '../components/IdeaDialog.vue';
|
||||
import StatusBadge from '../components/StatusBadge.vue';
|
||||
import SupportButton from '../components/SupportButton.vue';
|
||||
|
||||
const props = defineProps({
|
||||
ideas: { type: Array, required: true },
|
||||
pagination: { type: Object, required: true },
|
||||
filters: { type: Object, required: true },
|
||||
statuses: { type: Object, required: true },
|
||||
counts: { type: Object, default: () => ({}) },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
const creating = ref(false);
|
||||
const query = ref(props.filters.q);
|
||||
|
||||
function apply(changes) {
|
||||
const params = { ...props.filters, ...changes };
|
||||
router.get('/ideen', Object.fromEntries(Object.entries(params).filter(([key, value]) => value && !(key === 'sortierung' && value === 'neu'))), { preserveState: true, preserveScroll: true });
|
||||
}
|
||||
|
||||
let timer;
|
||||
watch(query, (value) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => apply({ q: value }), 300);
|
||||
});
|
||||
|
||||
const total = () => Object.values(props.counts).reduce((sum, n) => sum + n, 0);
|
||||
const sorts = { neu: 'Neueste', beliebt: 'Meiste Unterstützung', diskutiert: 'Meiste Kommentare' };
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Ideenbox">
|
||||
<PageHeader title="Ideenbox" description="Gute Ideen machen den Alltag leichter. Reichen Sie Vorschläge ein, unterstützen Sie andere – das Gremium prüft und gibt Rückmeldung.">
|
||||
<template #actions>
|
||||
<Button @click="creating = true"><Plus /> Idee einreichen</Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div class="mb-4 flex flex-wrap items-center gap-2">
|
||||
<div class="flex flex-wrap gap-1 rounded-md bg-muted p-1" role="tablist" aria-label="Status">
|
||||
<button type="button" role="tab" :aria-selected="!filters.status" class="rounded px-3 py-1 text-sm font-medium" :class="!filters.status ? 'bg-card shadow-xs' : 'text-muted-foreground hover:text-foreground'" @click="apply({ status: null })">
|
||||
Alle <span class="text-xs text-muted-foreground tabular-nums">{{ total() }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-for="(label, key) in statuses"
|
||||
:key="key"
|
||||
type="button"
|
||||
role="tab"
|
||||
:aria-selected="filters.status === key"
|
||||
class="rounded px-3 py-1 text-sm font-medium"
|
||||
:class="filters.status === key ? 'bg-card shadow-xs' : 'text-muted-foreground hover:text-foreground'"
|
||||
@click="apply({ status: key })"
|
||||
>
|
||||
{{ label }} <span class="text-xs text-muted-foreground tabular-nums">{{ counts[key] ?? 0 }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<span class="flex-1" />
|
||||
<select :value="filters.sortierung" class="h-9 rounded-md border bg-card px-2 text-sm" aria-label="Sortierung" @change="apply({ sortierung: $event.target.value })">
|
||||
<option v-for="(label, key) in sorts" :key="key" :value="key">{{ label }}</option>
|
||||
</select>
|
||||
<div class="relative w-full sm:w-56">
|
||||
<Search class="pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<Input v-model="query" type="search" placeholder="Ideen durchsuchen" class="h-9 bg-card pl-8" aria-label="Ideen durchsuchen" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul v-if="ideas.length" class="grid gap-3">
|
||||
<li v-for="idea in ideas" :key="idea.id" class="flex gap-4 rounded-lg border bg-card p-4 shadow-xs">
|
||||
<SupportButton :idea="idea" :disabled="idea.author?.id === page.props.auth.user.id" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Link :href="idea.url" class="font-semibold hover:underline">{{ idea.title }}</Link>
|
||||
<StatusBadge :status="idea.status" :label="idea.status_label" />
|
||||
</div>
|
||||
<p class="mt-1 line-clamp-2 text-sm text-muted-foreground">{{ idea.excerpt }}</p>
|
||||
<p class="mt-2 flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground">
|
||||
<span>{{ idea.author?.name ?? 'Anonym' }} · {{ formatRelative(idea.created_at) }}</span>
|
||||
<Link :href="`${idea.url}#kommentare`" class="inline-flex items-center gap-1 hover:text-foreground"><MessageCircle class="size-3.5" /> {{ idea.comments }}</Link>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<EmptyState v-else :icon="Lightbulb" :title="filters.q || filters.status ? 'Keine passenden Ideen' : 'Noch keine Ideen'" text="Machen Sie den Anfang – jede Verbesserung zählt." class="rounded-lg border bg-card py-12" />
|
||||
|
||||
<nav v-if="pagination.last > 1" class="mt-6 flex items-center justify-between text-sm" aria-label="Seiten">
|
||||
<Link v-if="pagination.prev" :href="pagination.prev" preserve-scroll class="font-medium text-brand-text hover:underline">← Zurück</Link><span v-else />
|
||||
<span class="text-muted-foreground">Seite {{ pagination.current }} von {{ pagination.last }}</span>
|
||||
<Link v-if="pagination.next" :href="pagination.next" preserve-scroll class="font-medium text-brand-text hover:underline">Weiter →</Link><span v-else />
|
||||
</nav>
|
||||
|
||||
<IdeaDialog v-model:open="creating" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
142
plugins-core/ideen/resources/js/pages/Show.vue
Normal file
142
plugins-core/ideen/resources/js/pages/Show.vue
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Link, router, useForm, usePage } from '@inertiajs/vue3';
|
||||
import { BadgeCheck, LoaderCircle, PencilLine, Trash2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { formatDate, formatRelative } from '@/lib/format';
|
||||
import IdeaDialog from '../components/IdeaDialog.vue';
|
||||
import StatusBadge from '../components/StatusBadge.vue';
|
||||
import SupportButton from '../components/SupportButton.vue';
|
||||
|
||||
const props = defineProps({
|
||||
idea: { type: Object, required: true },
|
||||
statuses: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
const editing = ref(false);
|
||||
|
||||
// Kommentare
|
||||
const commentForm = useForm({ body: '', official: false });
|
||||
function comment() {
|
||||
commentForm.post(`/ideen/${props.idea.id}/kommentare`, { preserveScroll: true, onSuccess: () => commentForm.reset() });
|
||||
}
|
||||
function deleteComment(c) {
|
||||
if (window.confirm('Kommentar löschen?')) router.delete(`/ideen/${props.idea.id}/kommentare/${c.id}`, { preserveScroll: true });
|
||||
}
|
||||
|
||||
// Gremium
|
||||
const statusForm = useForm({ status: props.idea.status, status_note: props.idea.status_note ?? '' });
|
||||
function saveStatus() {
|
||||
statusForm.put(`/ideen/${props.idea.id}/status`, { preserveScroll: true });
|
||||
}
|
||||
|
||||
function remove() {
|
||||
if (window.confirm(`Idee „${props.idea.title}“ löschen?`)) router.delete(`/ideen/${props.idea.id}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout :title="idea.title">
|
||||
<PageHeader :title="idea.title" :breadcrumbs="[{ label: 'Ideenbox', href: '/ideen' }]">
|
||||
<template #description>
|
||||
<span class="inline-flex flex-wrap items-center gap-2">
|
||||
<StatusBadge :status="idea.status" :label="idea.status_label" />
|
||||
eingereicht {{ formatRelative(idea.created_at) }}<template v-if="!idea.author"> · anonym</template>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="idea.can_edit || idea.can_manage" #actions>
|
||||
<Button v-if="idea.can_edit" variant="outline" size="sm" @click="editing = true"><PencilLine /> Bearbeiten</Button>
|
||||
<Button variant="ghost" size="sm" class="text-destructive hover:text-destructive" @click="remove"><Trash2 /> Löschen</Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div class="grid items-start gap-6 lg:grid-cols-12">
|
||||
<div class="grid min-w-0 gap-6 lg:col-span-8">
|
||||
<Panel>
|
||||
<div class="flex gap-5">
|
||||
<SupportButton :idea="idea" :disabled="idea.mine" large />
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="text-[15px] leading-relaxed whitespace-pre-line">{{ idea.body }}</p>
|
||||
<div v-if="idea.author" class="mt-5 flex items-center gap-2.5 border-t pt-4 text-sm">
|
||||
<PersonAvatar :person="idea.author" class="size-8" />
|
||||
<Link :href="`/personen/${idea.author.id}`" class="font-medium hover:underline">{{ idea.author.name }}</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<!-- Rückmeldung des Gremiums -->
|
||||
<section v-if="idea.status_note" class="rounded-lg border border-brand/30 bg-brand-soft/60 p-5">
|
||||
<h2 class="flex items-center gap-2 text-sm font-semibold text-brand-text"><BadgeCheck class="size-4" /> Rückmeldung: {{ idea.status_label }}</h2>
|
||||
<p class="mt-2 text-sm leading-relaxed whitespace-pre-line">{{ idea.status_note }}</p>
|
||||
<p v-if="idea.status_changed_at" class="mt-2 text-xs text-muted-foreground">{{ formatDate(idea.status_changed_at) }}</p>
|
||||
</section>
|
||||
|
||||
<Panel id="kommentare" :title="`Kommentare (${idea.comment_list.length})`">
|
||||
<ul v-if="idea.comment_list.length" class="-mx-5 mb-5 divide-y border-y">
|
||||
<li v-for="c in idea.comment_list" :key="c.id" class="flex gap-3 px-5 py-4" :class="{ 'bg-brand-soft/40': c.official }">
|
||||
<PersonAvatar v-if="c.author" :person="c.author" class="size-9" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="flex flex-wrap items-center gap-x-2 text-sm">
|
||||
<span class="font-semibold">{{ c.author?.name ?? 'Gelöschtes Konto' }}</span>
|
||||
<span v-if="c.official" class="inline-flex items-center gap-1 text-xs font-medium text-brand-text"><BadgeCheck class="size-3.5" /> Gremium</span>
|
||||
<span class="text-xs text-muted-foreground">{{ formatRelative(c.created_at) }}</span>
|
||||
</p>
|
||||
<p class="mt-1 text-sm leading-relaxed whitespace-pre-line">{{ c.body }}</p>
|
||||
</div>
|
||||
<Button v-if="c.can_delete" variant="ghost" size="icon" class="size-7 shrink-0 text-muted-foreground hover:text-destructive" aria-label="Kommentar löschen" @click="deleteComment(c)"><Trash2 class="size-3.5" /></Button>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="grid gap-3" @submit.prevent="comment">
|
||||
<Textarea v-model="commentForm.body" rows="3" maxlength="3000" placeholder="Ihre Meinung, Ergänzungen oder Erfahrungen …" aria-label="Kommentar" />
|
||||
<p v-if="commentForm.errors.body" class="text-[13px] text-destructive">{{ commentForm.errors.body }}</p>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<label v-if="idea.can_manage" class="flex items-center gap-2 text-sm"><Switch v-model="commentForm.official" /> Als Antwort des Gremiums</label>
|
||||
<span v-else />
|
||||
<Button type="submit" :disabled="commentForm.processing || !commentForm.body.trim()">
|
||||
<LoaderCircle v-if="commentForm.processing" class="animate-spin" /> Kommentieren
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<aside class="grid gap-6 lg:col-span-4">
|
||||
<Panel v-if="idea.can_manage" title="Bewertung (Gremium)">
|
||||
<form class="grid gap-4" @submit.prevent="saveStatus">
|
||||
<FormField id="idea-status" label="Status">
|
||||
<select id="idea-status" v-model="statusForm.status" class="h-9 w-full rounded-md border bg-background px-2 text-sm">
|
||||
<option v-for="(label, key) in statuses" :key="key" :value="key">{{ label }}</option>
|
||||
</select>
|
||||
</FormField>
|
||||
<FormField id="idea-note" label="Rückmeldung (für alle sichtbar)" :error="statusForm.errors.status_note">
|
||||
<Textarea id="idea-note" v-model="statusForm.status_note" rows="5" maxlength="3000" placeholder="z. B. Wird im Frühjahr umgesetzt. / Leider nicht möglich, weil …" />
|
||||
</FormField>
|
||||
<p class="text-xs text-muted-foreground">Bei einem neuen Status bekommen die einreichende Person und alle Unterstützenden Bescheid.</p>
|
||||
<Button type="submit" :disabled="statusForm.processing || !statusForm.isDirty"><LoaderCircle v-if="statusForm.processing" class="animate-spin" /> Speichern</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
<Panel title="So funktioniert’s">
|
||||
<ol class="grid list-decimal gap-2 pl-4 text-[13px] text-muted-foreground">
|
||||
<li>Ideen sind für alle sichtbar und lassen sich unterstützen und kommentieren.</li>
|
||||
<li>Das Gremium sichtet neue Ideen, prüft sie und gibt eine Rückmeldung.</li>
|
||||
<li>Wer eine Idee eingereicht oder unterstützt hat, erfährt, wie es ausgeht.</li>
|
||||
</ol>
|
||||
</Panel>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<IdeaDialog v-if="idea.can_edit" v-model:open="editing" :idea="idea" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
24
plugins-core/ideen/resources/js/widgets/Popular.vue
Normal file
24
plugins-core/ideen/resources/js/widgets/Popular.vue
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ThumbsUp } from '@lucide/vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
|
||||
defineProps({
|
||||
ideas: { type: Array, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Panel title="Ideenbox" action-label="Alle Ideen" action-href="/ideen">
|
||||
<ul class="-my-1 grid gap-1">
|
||||
<li v-for="idea in ideas" :key="idea.id">
|
||||
<Link :href="idea.url" class="group -mx-2 flex items-center gap-3 rounded-md p-2 hover:bg-accent/50">
|
||||
<span class="flex size-10 shrink-0 flex-col items-center justify-center rounded-md bg-brand-soft text-brand-text tabular-nums">
|
||||
<ThumbsUp class="size-3.5" /><span class="text-xs font-semibold">{{ idea.supports }}</span>
|
||||
</span>
|
||||
<span class="line-clamp-2 min-w-0 text-sm leading-snug font-medium group-hover:underline">{{ idea.title }}</span>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</Panel>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue