Merge pull request 'Neues Modul: Qualitätsmanagement' (#13) from qm into main
Some checks are pending
CI / PHP 8.3 / mariadb:10.6 (push) Waiting to run
CI / PHP 8.4 / mariadb:10.6 (push) Waiting to run
CI / PHP 8.3 / mariadb:11.4 (push) Waiting to run
CI / PHP 8.4 / mariadb:11.4 (push) Waiting to run
CI / PHP 8.3 / mysql:8.0 (push) Waiting to run
CI / PHP 8.4 / mysql:8.0 (push) Waiting to run
CI / PHP 8.3 / mysql:8.4 (push) Waiting to run
CI / PHP 8.4 / mysql:8.4 (push) Waiting to run
CI / Build-Artefakte aktuell (push) Waiting to run
Some checks are pending
CI / PHP 8.3 / mariadb:10.6 (push) Waiting to run
CI / PHP 8.4 / mariadb:10.6 (push) Waiting to run
CI / PHP 8.3 / mariadb:11.4 (push) Waiting to run
CI / PHP 8.4 / mariadb:11.4 (push) Waiting to run
CI / PHP 8.3 / mysql:8.0 (push) Waiting to run
CI / PHP 8.4 / mysql:8.0 (push) Waiting to run
CI / PHP 8.3 / mysql:8.4 (push) Waiting to run
CI / PHP 8.4 / mysql:8.4 (push) Waiting to run
CI / Build-Artefakte aktuell (push) Waiting to run
This commit is contained in:
commit
1334e2379e
333 changed files with 15404 additions and 362 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -4,6 +4,18 @@ Neueste Version oben. Jeder Abschnitt beginnt mit `## MAJOR.MINOR.PATCH` und
|
|||
enthält kurze Stichpunkte für Anwenderinnen und Anwender – keine Commit-Texte.
|
||||
Der Self-Updater zeigt diese Abschnitte bei neuen Versionen an.
|
||||
|
||||
## 0.11.0
|
||||
|
||||
- **Neues Modul „Qualitätsmanagement“** (Menüpunkt „Qualitätsmanagement“, Adresse /qm):
|
||||
- Startseite mit Einführungstext, Hauptansprechpartner*innen, Kategorien (durch Linien getrennt), farbigen Ordnerkacheln und der Liste aller QM-Beauftragten (mit Zuständigkeit und Ordner); jeder Ordner mit Farbe und Symbol – aus der Symbolauswahl oder selbst hochgeladen –, Unterordner übernehmen beides
|
||||
- Ordnerseite mit Einführungstext, Ansprechpartner*innen (Foto und frei wählbare Profilfelder), Unterordnern und Dokumentenliste
|
||||
- Einträge als Datei, Link oder Online-Formular; Liste mit Dokument, Version, Stand, Größe und Aktion
|
||||
- Dateien: Lesefassung (PDF öffnet sich direkt im Portal) und optional eine bearbeitbare Vorlage; neue Fassungen schieben die bisherigen ins Archiv
|
||||
- Eigene Suche nur im QM – auch im Text von PDF, Word, Excel und PowerPoint, mit Textausschnitt; eingescannte PDFs per Texterkennung, wenn der Server sie bietet
|
||||
- Rollen lassen sich vom ganzen Modul ausschließen (z. B. Klient*innen); pflegen darf, wer „Qualitätsmanagement pflegen“ hat; Kategorien können auf Zielgruppen beschränkt werden
|
||||
- Vorbereitet: Wiedervorlage, Verantwortliche, Lesebestätigungen
|
||||
- Seitenkopf mit optionalem Symbol links; Dateityp-Symbol als gemeinsamer Baustein
|
||||
|
||||
## 0.10.0
|
||||
|
||||
- **„Dokumente“ heißt jetzt „Downloads“** (Adresse /downloads, alte Links leiten weiter). Der Name „Dokumente“ ist für das kommende QM-Modul mit QM-Dokumenten und Formularen vorgesehen. Ordner, Dateien, Rechte, Sichtbarkeiten, Favoriten, Menüpunkte und eingebundene Blöcke werden beim Update automatisch übernommen
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ namespace App;
|
|||
*/
|
||||
final class Version
|
||||
{
|
||||
public const VERSION = '0.10.0';
|
||||
public const VERSION = '0.11.0';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
"laravel/framework": "^13.17",
|
||||
"league/commonmark": "^2.10",
|
||||
"onelogin/php-saml": "^4.3",
|
||||
"smalot/pdfparser": "^2.12",
|
||||
"symfony/html-sanitizer": "^7.4"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
|||
53
composer.lock
generated
53
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6d9154cd3a1a14d3c801025c7efbeda5",
|
||||
"content-hash": "72f7525a1e66b25ed25efb76099164be",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anourvalar/eloquent-serialize",
|
||||
|
|
@ -5844,6 +5844,57 @@
|
|||
],
|
||||
"time": "2022-12-17T21:53:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "smalot/pdfparser",
|
||||
"version": "v2.12.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/smalot/pdfparser.git",
|
||||
"reference": "2cfa0d92bd557875c9f52a75fde0e8392302a354"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/2cfa0d92bd557875c9f52a75fde0e8392302a354",
|
||||
"reference": "2cfa0d92bd557875c9f52a75fde0e8392302a354",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-iconv": "*",
|
||||
"ext-zlib": "*",
|
||||
"php": ">=7.1",
|
||||
"symfony/polyfill-mbstring": "^1.18"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Smalot\\PdfParser\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastien MALOT",
|
||||
"email": "sebastien@malot.fr"
|
||||
}
|
||||
],
|
||||
"description": "Pdf parser library. Can read and extract information from pdf file.",
|
||||
"homepage": "https://www.pdfparser.org",
|
||||
"keywords": [
|
||||
"extract",
|
||||
"parse",
|
||||
"parser",
|
||||
"pdf",
|
||||
"text"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/smalot/pdfparser/issues",
|
||||
"source": "https://github.com/smalot/pdfparser/tree/v2.12.5"
|
||||
},
|
||||
"time": "2026-04-17T11:37:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/invade",
|
||||
"version": "2.1.1",
|
||||
|
|
|
|||
|
|
@ -102,6 +102,23 @@ ein Plugin (unter „Plugins“ abschaltbar); mehrere Verfahren gleichzeitig sin
|
|||
Nach der ersten Anmeldung zeigt das Formular unter „Zuletzt empfangene Angaben“, welche
|
||||
Attribute und Gruppen der Anbieter liefert.
|
||||
|
||||
## Qualitätsmanagement: Texterkennung (optional)
|
||||
|
||||
Der Text von PDF-, Word-, Excel- und PowerPoint-Dateien wird ohne weitere Voraussetzungen
|
||||
durchsuchbar gemacht. **Eingescannte PDFs** (Bilder ohne Textebene) brauchen eine
|
||||
Texterkennung. Dafür gibt es kein Apache- oder PHP-Modul; das Portal ruft das Programm
|
||||
**Tesseract** auf und wandelt PDF-Seiten mit `pdftoppm` (poppler-utils) oder PHP-Imagick in Bilder um.
|
||||
|
||||
Auf einem eigenen Server (Debian/Ubuntu):
|
||||
|
||||
apt install tesseract-ocr tesseract-ocr-deu poppler-utils
|
||||
|
||||
Dann unter **Administration → Qualitätsmanagement → QM-Einstellungen** die Texterkennung
|
||||
einschalten. Die Seite zeigt, was der Server bereitstellt. Erkannt wird im Hintergrund
|
||||
(Hintergrundaufgaben), einige Dateien je Durchgang. PHP muss Programme starten dürfen
|
||||
(`proc_open` nicht in `disable_functions`). Auf Shared Hosting ist das meist nicht möglich –
|
||||
eingescannte PDFs sind dort nur über Titel und Beschreibung auffindbar.
|
||||
|
||||
## Erscheinungsbild
|
||||
|
||||
Unter **Administration → Portal → Erscheinungsbild** lassen sich Name, Logos,
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ Kantinenplan, Ideenbox, Urlaubsanträge.
|
|||
| **4 – CMS** ✅ | Seitenbaum, Pagebuilder (Layout-, Inhalts-, Medien- und dynamische Blöcke, Sichtbarkeit je Block), Entwürfe, Versionen, Zeitsteuerung, Bearbeitungssperre, Freigaben; News-Freigabe-Workflow und Redaktion im Portal; Benachrichtigungen. Offen: Vorlagen und wiederverwendbare Blöcke |
|
||||
| **4b – Formulare & Umstieg** ✅ | Formular-Plugin (visueller Baukasten im Portal, Bedingungen, Uploads, anonyme Formulare, Mail + Backend, Ergebnis-Rechte je Formular und Rolle, CSV, Löschfristen; eingebunden per Pagebuilder-Block und unter Beiträgen, kein eigener Menüpunkt); WordPress-Import (Beiträge, Kategorien, Bilder, Seiten); E-Mail-Versand im Admin; anpassbare Startseite mit eigenen Kacheln; Geburtstage (optionales Plugin) |
|
||||
| **5 – Branding & Theming** ✅ | Vollständige Seite „Erscheinungsbild“: Logo-Varianten, Farben inkl. Farbtreue & Kontrastprüfung, Schriften, Form, Login-Seite, E-Mails, Live-Vorschau, Entwurf/Veröffentlichen, Export/Import |
|
||||
| **6 – Weitere Plugins & IdPs** | ✅ Organigramm (aus Vorgesetzten, im Admin pflegbar), ✅ Downloads (Ordner mit vererbten Rechten und Sichtbarkeit, Versionen, Suche, Favoriten, Pagebuilder-Block – früher „Dokumente“); geplant: QM-Modul für QM-Dokumente und -Formulare; ✅ OIDC generisch, LDAP/AD, SAML 2 (als Plugins auf gemeinsamem Treiber-Unterbau); offen: Lasttests 5.000 User |
|
||||
| **6 – Weitere Plugins & IdPs** | ✅ Organigramm (aus Vorgesetzten, im Admin pflegbar), ✅ Downloads (Ordner mit vererbten Rechten und Sichtbarkeit, Versionen, Suche, Favoriten, Pagebuilder-Block – früher „Dokumente“); ✅ Qualitätsmanagement (Kategorien, farbige Ordner mit Symbolen, Einführung, Ansprechpartner, Versionen mit Stand und Archiv, Volltextsuche inkl. OCR-Anbindung, PDF-Betrachter, Rollen-Ausschluss; vorbereitet: Wiedervorlage, Lesebestätigung); ✅ OIDC generisch, LDAP/AD, SAML 2 (als Plugins auf gemeinsamem Treiber-Unterbau); offen: Lasttests 5.000 User |
|
||||
| **7 – Plugin-SDK öffentlich** | Doku, Generator, Beispiel-Plugins (kein Plugin-Verzeichnis) |
|
||||
| **8 – Mobil** | REST-API (Sanctum), Web-Push, native App |
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ChevronRight, Download } from '@lucide/vue';
|
||||
import FileIcon from '../components/FileIcon.vue';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
|
||||
defineProps({ block: { type: Object, required: true } });
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import FileIcon from './FileIcon.vue';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
|
||||
/**
|
||||
* Kurze Liste für Seitenspalten (Meine Downloads, Häufig genutzt).
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { formatRelative } from '@/lib/format';
|
|||
import { folderSummary, formatSize } from '../lib';
|
||||
import DownloadMenu from './DownloadMenu.vue';
|
||||
import FavoriteButton from './FavoriteButton.vue';
|
||||
import FileIcon from './FileIcon.vue';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
|
||||
/**
|
||||
* Listenansicht wie in einer Dateiablage: Ordner oben, Dateien darunter,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import FileIcon from './FileIcon.vue';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
|
||||
/**
|
||||
* Kopf einer Datei-Kachel: Vorschaubild (Bild oder erste PDF-Seite), sonst Dateitypsymbol.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { Star } from '@lucide/vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import FileIcon from '../components/FileIcon.vue';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
|
||||
/**
|
||||
* Startseite: gemerkte Dateien (Stern) – ohne Favoriten die meistgenutzten.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('gemeinsam_entries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('section', 20); // welcome | transfer | jubilee | farewell | memoriam
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); // Person aus dem Portal …
|
||||
$table->string('name', 150)->nullable(); // … oder freier Name
|
||||
$table->date('date'); // Eintritt, Wechsel ab, Jubiläum, letzter Tag, Todestag – bestimmt den Monat
|
||||
$table->date('born_on')->nullable(); // nur Gedenken
|
||||
$table->string('department', 150)->nullable();
|
||||
$table->string('location', 150)->nullable();
|
||||
$table->string('from', 150)->nullable(); // Wechsel: bisher
|
||||
$table->string('to', 150)->nullable(); // Wechsel: künftig
|
||||
$table->string('label', 150)->nullable(); // Jubiläum („25 Jahre“), Anlass („Ruhestand“)
|
||||
$table->string('text', 1000)->nullable();
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['date', 'section']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('gemeinsam_entries');
|
||||
}
|
||||
};
|
||||
14
plugins-core/gemeinsam/plugin.json
Normal file
14
plugins-core/gemeinsam/plugin.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"slug": "gemeinsam",
|
||||
"name": "Gemeinsam feiern, erinnern und willkommen heißen",
|
||||
"version": "1.0.0",
|
||||
"description": "Personalnachrichten auf einer Seite: neue Mitarbeitende, Wechsel des Einsatzorts, Geburtstage (aus dem Geburtstags-Plugin), Jubilare, Verabschiedungen und Gedenken – gepflegt von der Personalabteilung, nach Monaten.",
|
||||
"author": "Inhaus",
|
||||
"namespace": "Inhaus\\Plugins\\Gemeinsam\\",
|
||||
"class": "Inhaus\\Plugins\\Gemeinsam\\GemeinsamPlugin",
|
||||
"enabled_by_default": false,
|
||||
"requires": {
|
||||
"core": ">=0.12.0",
|
||||
"php": ">=8.3"
|
||||
}
|
||||
}
|
||||
139
plugins-core/gemeinsam/resources/js/components/EntryDialog.vue
Normal file
139
plugins-core/gemeinsam/resources/js/components/EntryDialog.vue
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { LoaderCircle, X } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import { http } from '@/lib/http';
|
||||
|
||||
const props = defineProps({
|
||||
open: { type: Boolean, default: false },
|
||||
section: { type: Object, default: null }, // { key, title }
|
||||
entry: { type: Object, default: null },
|
||||
month: { type: String, required: true },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:open']);
|
||||
|
||||
// Feldbeschriftungen je Abschnitt
|
||||
const config = {
|
||||
welcome: { date: 'Eintritt am', fields: ['department', 'location', 'text'] },
|
||||
transfer: { date: 'Wechsel ab', fields: ['from', 'to', 'text'] },
|
||||
jubilee: { date: 'Jubiläum am', fields: ['label', 'department', 'text'], label: 'Jubiläum', labelPlaceholder: 'z. B. 25 Jahre' },
|
||||
farewell: { date: 'Letzter Arbeitstag', fields: ['department', 'label', 'text'], label: 'Anlass (optional)', labelPlaceholder: 'z. B. Ruhestand' },
|
||||
memoriam: { date: 'Verstorben am', fields: ['born_on', 'department', 'text'] },
|
||||
};
|
||||
|
||||
const current = computed(() => config[props.section?.key] ?? config.welcome);
|
||||
const has = (field) => current.value.fields.includes(field);
|
||||
|
||||
const form = useForm({ section: '', user_id: null, name: '', date: '', born_on: '', department: '', location: '', from: '', to: '', label: '', text: '' });
|
||||
const person = ref(null);
|
||||
const freeName = ref(false);
|
||||
const query = ref('');
|
||||
const results = ref([]);
|
||||
|
||||
watch(() => props.open, (open) => {
|
||||
if (!open) return;
|
||||
const e = props.entry;
|
||||
form.clearErrors();
|
||||
form.defaults({
|
||||
section: props.section.key,
|
||||
user_id: e?.user_id ?? null,
|
||||
name: e?.free_name ?? '',
|
||||
date: e?.date ?? `${props.month}-01`,
|
||||
born_on: e?.born_on ?? '',
|
||||
department: e?.raw?.department ?? '',
|
||||
location: e?.raw?.location ?? '',
|
||||
from: e?.from ?? '',
|
||||
to: e?.to ?? '',
|
||||
label: e?.label ?? '',
|
||||
text: e?.text ?? '',
|
||||
});
|
||||
form.reset();
|
||||
person.value = e?.person ?? null;
|
||||
freeName.value = !!e && !e.user_id;
|
||||
query.value = '';
|
||||
results.value = [];
|
||||
});
|
||||
|
||||
let timer;
|
||||
watch(query, (value) => {
|
||||
clearTimeout(timer);
|
||||
if (value.trim().length < 2) return (results.value = []);
|
||||
timer = setTimeout(async () => (results.value = (await http.get(`/personen/suche?q=${encodeURIComponent(value.trim())}`)).people), 250);
|
||||
});
|
||||
|
||||
function choose(p) {
|
||||
person.value = p;
|
||||
form.user_id = p.id;
|
||||
query.value = '';
|
||||
results.value = [];
|
||||
}
|
||||
|
||||
function clearPerson() {
|
||||
person.value = null;
|
||||
form.user_id = null;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if (freeName.value) form.user_id = null;
|
||||
const options = { preserveScroll: true, onSuccess: () => emit('update:open', false) };
|
||||
props.entry ? form.put(`/gemeinsam/eintraege/${props.entry.id}`, options) : form.post('/gemeinsam/eintraege', options);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog :open="open" @update:open="(v) => emit('update:open', v)">
|
||||
<DialogContent class="sm:max-w-lg">
|
||||
<DialogHeader><DialogTitle>{{ section?.title }}</DialogTitle></DialogHeader>
|
||||
<form class="grid gap-4" @submit.prevent="submit">
|
||||
<FormField id="g-person" label="Person" :error="form.errors.name || form.errors.user_id">
|
||||
<div v-if="!freeName">
|
||||
<div v-if="person" class="flex items-center gap-2 rounded-md border px-2 py-1.5">
|
||||
<PersonAvatar :person="person" class="size-7 text-[10px]" />
|
||||
<span class="min-w-0 flex-1 truncate text-sm">{{ person.name }}</span>
|
||||
<button type="button" class="grid size-6 place-items-center rounded hover:bg-accent" aria-label="Auswahl entfernen" @click="clearPerson"><X class="size-3.5" /></button>
|
||||
</div>
|
||||
<div v-else class="relative">
|
||||
<Input id="g-person" v-model="query" placeholder="Name im Portal suchen …" autocomplete="off" />
|
||||
<ul v-if="results.length" class="absolute inset-x-0 top-full z-30 mt-1 max-h-60 overflow-y-auto rounded-md border bg-popover p-1 shadow-md">
|
||||
<li v-for="p in results" :key="p.id">
|
||||
<button type="button" class="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm hover:bg-accent" @click="choose(p)">
|
||||
<PersonAvatar :person="p" class="size-7 text-[10px]" /> <span class="truncate">{{ p.name }}</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<Input v-else id="g-person" v-model="form.name" maxlength="150" placeholder="Vor- und Nachname" />
|
||||
<button type="button" class="mt-1 justify-self-start text-xs text-brand-text hover:underline" @click="freeName = !freeName">
|
||||
{{ freeName ? 'Stattdessen Person aus dem Portal wählen' : 'Nicht im Portal? Namen frei eintragen' }}
|
||||
</button>
|
||||
</FormField>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<FormField id="g-date" :label="current.date" :error="form.errors.date"><Input id="g-date" v-model="form.date" type="date" /></FormField>
|
||||
<FormField v-if="has('born_on')" id="g-born" label="Geboren am (optional)" :error="form.errors.born_on"><Input id="g-born" v-model="form.born_on" type="date" /></FormField>
|
||||
<FormField v-if="has('label')" id="g-label" :label="current.label" :error="form.errors.label"><Input id="g-label" v-model="form.label" maxlength="150" :placeholder="current.labelPlaceholder" /></FormField>
|
||||
<FormField v-if="has('from')" id="g-from" label="Bisher" :error="form.errors.from"><Input id="g-from" v-model="form.from" maxlength="150" placeholder="z. B. Werkstatt Nord" /></FormField>
|
||||
<FormField v-if="has('to')" id="g-to" label="Künftig" :error="form.errors.to"><Input id="g-to" v-model="form.to" maxlength="150" placeholder="z. B. Verwaltung" /></FormField>
|
||||
<FormField v-if="has('department')" id="g-dep" label="Bereich" :error="form.errors.department"><Input id="g-dep" v-model="form.department" maxlength="150" :placeholder="person?.department || ''" /></FormField>
|
||||
<FormField v-if="has('location')" id="g-loc" label="Standort" :error="form.errors.location"><Input id="g-loc" v-model="form.location" maxlength="150" :placeholder="person?.location || ''" /></FormField>
|
||||
</div>
|
||||
<p v-if="person && (has('department') || has('location'))" class="-mt-2 text-xs text-muted-foreground">Leer gelassen, gilt die Angabe aus dem Profil.</p>
|
||||
|
||||
<FormField v-if="has('text')" id="g-text" label="Text (optional)" :error="form.errors.text"><Textarea id="g-text" v-model="form.text" rows="2" maxlength="1000" /></FormField>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" @click="emit('update:open', false)">Abbrechen</Button>
|
||||
<Button type="submit" :disabled="form.processing"><LoaderCircle v-if="form.processing" class="animate-spin" /> Speichern</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
|
||||
defineProps({
|
||||
entry: { type: Object, required: true },
|
||||
muted: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const initials = (name) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((p) => p[0]).join('').toUpperCase();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<PersonAvatar :person="entry.person ?? { id: entry.name, name: entry.name, initials: initials(entry.name) }" class="size-9 shrink-0" :class="{ 'grayscale': muted }" />
|
||||
<div class="min-w-0">
|
||||
<Link v-if="entry.person?.url" :href="entry.person.url" class="block truncate text-sm font-medium hover:underline">{{ entry.name }}</Link>
|
||||
<span v-else class="block truncate text-sm font-medium">{{ entry.name }}</span>
|
||||
<span v-if="entry.person?.job_title" class="block truncate text-xs text-muted-foreground">{{ entry.person.job_title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
132
plugins-core/gemeinsam/resources/js/pages/Index.vue
Normal file
132
plugins-core/gemeinsam/resources/js/pages/Index.vue
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { ArrowRightLeft, Award, Cake, ChevronLeft, ChevronRight, EllipsisVertical, Flower2, Hand, PencilLine, Plus, Sparkles, Trash2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import EntryDialog from '../components/EntryDialog.vue';
|
||||
import PersonCell from '../components/PersonCell.vue';
|
||||
|
||||
const props = defineProps({
|
||||
month: { type: String, required: true },
|
||||
monthLabel: { type: String, required: true },
|
||||
previous: { type: String, required: true },
|
||||
next: { type: String, required: true },
|
||||
isCurrent: { type: Boolean, default: true },
|
||||
sections: { type: Array, required: true },
|
||||
canManage: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
const icons = { welcome: Sparkles, transfer: ArrowRightLeft, birthdays: Cake, jubilee: Award, farewell: Hand, memoriam: Flower2 };
|
||||
|
||||
// Spalten je Abschnitt (die Person steht immer vorne)
|
||||
const columns = {
|
||||
welcome: [['department', 'Bereich'], ['location', 'Standort'], ['date', 'Eintritt']],
|
||||
transfer: [['from', 'Bisher'], ['to', 'Künftig'], ['date', 'Ab']],
|
||||
birthdays: [['department', 'Bereich'], ['location', 'Standort'], ['date', 'Geburtstag']],
|
||||
jubilee: [['label', 'Jubiläum'], ['department', 'Bereich'], ['date', 'Datum']],
|
||||
farewell: [['department', 'Bereich'], ['label', 'Anlass'], ['date', 'Letzter Arbeitstag']],
|
||||
memoriam: [['lifespan', 'Lebensdaten'], ['department', 'Bereich']],
|
||||
};
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||
const dayFormat = new Intl.DateTimeFormat('de-DE', { day: 'numeric', month: 'long' });
|
||||
const format = (iso, section) => (iso ? (section === 'birthdays' ? dayFormat : dateFormat).format(new Date(`${iso}T12:00:00`)) : '–');
|
||||
|
||||
function value(entry, key, section) {
|
||||
if (key === 'date') return format(entry.date, section);
|
||||
if (key === 'lifespan') return [entry.born_on && `* ${format(entry.born_on)}`, `† ${format(entry.date)}`].filter(Boolean).join(' ');
|
||||
|
||||
return entry[key] || '–';
|
||||
}
|
||||
|
||||
const visible = computed(() => props.sections.filter((s) => s.entries.length || (props.canManage && !s.automatic)));
|
||||
const empty = computed(() => props.sections.every((s) => !s.entries.length));
|
||||
|
||||
const dialog = ref({ open: false, section: null, entry: null });
|
||||
const add = (section) => (dialog.value = { open: true, section, entry: null });
|
||||
const edit = (section, entry) => (dialog.value = { open: true, section, entry });
|
||||
|
||||
function remove(entry) {
|
||||
if (window.confirm(`Eintrag „${entry.name}“ entfernen?`)) router.delete(`/gemeinsam/eintraege/${entry.id}`, { preserveScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Gemeinsam feiern, erinnern und willkommen heißen">
|
||||
<PageHeader title="Gemeinsam feiern, erinnern und willkommen heißen" :description="monthLabel">
|
||||
<template #actions>
|
||||
<div class="flex items-center gap-1 rounded-md border bg-card p-0.5">
|
||||
<Button variant="ghost" size="icon" class="size-8" as-child><Link :href="`/gemeinsam?monat=${previous}`" aria-label="Vorheriger Monat" preserve-scroll><ChevronLeft /></Link></Button>
|
||||
<span class="min-w-32 text-center text-sm font-medium">{{ monthLabel }}</span>
|
||||
<Button variant="ghost" size="icon" class="size-8" as-child><Link :href="`/gemeinsam?monat=${next}`" aria-label="Nächster Monat" preserve-scroll><ChevronRight /></Link></Button>
|
||||
</div>
|
||||
<Button v-if="!isCurrent" variant="outline" as-child><Link href="/gemeinsam">Aktueller Monat</Link></Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div v-if="visible.length && !(empty && !canManage)" class="grid max-w-5xl gap-6">
|
||||
<section
|
||||
v-for="section in visible"
|
||||
:key="section.key"
|
||||
class="overflow-hidden rounded-lg border bg-card"
|
||||
:class="section.key === 'memoriam' ? 'border-t-4 border-t-foreground/70' : 'border-t-4 border-t-brand'"
|
||||
>
|
||||
<header class="flex items-center justify-between gap-3 border-b px-5 py-3">
|
||||
<h2 class="flex items-center gap-2.5 text-base font-semibold" :class="{ 'text-foreground/85': section.key === 'memoriam' }">
|
||||
<component :is="icons[section.key]" class="size-5" :class="section.key === 'memoriam' ? 'text-muted-foreground' : 'text-brand-text'" />
|
||||
{{ section.title }}
|
||||
</h2>
|
||||
<Button v-if="canManage && !section.automatic" size="sm" variant="outline" @click="add(section)"><Plus /> Hinzufügen</Button>
|
||||
<span v-else-if="section.automatic && canManage" class="text-xs text-muted-foreground">aus dem Geburtstagskalender</span>
|
||||
</header>
|
||||
|
||||
<div v-if="section.entries.length" class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-muted/40 text-left text-xs text-muted-foreground">
|
||||
<tr>
|
||||
<th class="px-5 py-2 font-medium">Name</th>
|
||||
<th v-for="[key, label] in columns[section.key]" :key="key" class="px-3 py-2 font-medium whitespace-nowrap">{{ label }}</th>
|
||||
<th v-if="canManage && !section.automatic" class="w-12"><span class="sr-only">Aktionen</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y">
|
||||
<template v-for="entry in section.entries" :key="entry.id">
|
||||
<tr>
|
||||
<td class="px-5 py-2.5"><PersonCell :entry="entry" :muted="section.key === 'memoriam'" /></td>
|
||||
<td v-for="[key] in columns[section.key]" :key="key" class="px-3 py-2.5 whitespace-nowrap" :class="{ 'tabular-nums': key === 'date' || key === 'lifespan' }">{{ value(entry, key, section.key) }}</td>
|
||||
<td v-if="canManage && !section.automatic" class="pr-3 text-right">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger as-child><Button variant="ghost" size="icon" class="size-8 text-muted-foreground" :aria-label="`Aktionen für ${entry.name}`"><EllipsisVertical /></Button></DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem @select="edit(section, entry)"><PencilLine /> Bearbeiten</DropdownMenuItem>
|
||||
<DropdownMenuItem class="text-destructive" @select="remove(entry)"><Trash2 /> Entfernen</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="entry.text">
|
||||
<td :colspan="columns[section.key].length + 2" class="-mt-1 px-5 pb-3 text-[13px] text-muted-foreground" :class="{ italic: section.key === 'memoriam' }">{{ entry.text }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p v-else class="px-5 py-4 text-[13px] text-muted-foreground">Noch keine Einträge in diesem Monat.</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div v-else class="max-w-5xl rounded-lg border bg-card">
|
||||
<EmptyState :icon="Sparkles" title="Keine Einträge in diesem Monat" text="Hier stehen neue Kolleginnen und Kollegen, Wechsel, Geburtstage, Jubiläen, Verabschiedungen und Gedenken." />
|
||||
</div>
|
||||
|
||||
<EntryDialog v-if="canManage" v-model:open="dialog.open" :section="dialog.section" :entry="dialog.entry" :month="month" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
13
plugins-core/gemeinsam/routes/web.php
Normal file
13
plugins-core/gemeinsam/routes/web.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inhaus\Plugins\Gemeinsam\Http\Controllers\GemeinsamController;
|
||||
|
||||
Route::middleware('auth')->prefix('gemeinsam')->name('gemeinsam.')->controller(GemeinsamController::class)
|
||||
->where(['entry' => '[0-9]+'])
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/eintraege', 'store')->name('store');
|
||||
Route::put('/eintraege/{entry}', 'update')->name('update');
|
||||
Route::delete('/eintraege/{entry}', 'destroy')->name('destroy');
|
||||
});
|
||||
16
plugins-core/gemeinsam/src/GemeinsamPlugin.php
Normal file
16
plugins-core/gemeinsam/src/GemeinsamPlugin.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Gemeinsam;
|
||||
|
||||
use App\Plugins\Plugin;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
|
||||
class GemeinsamPlugin extends Plugin
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->make(Navigation::class)->add('gemeinsam', 'Gemeinsam', '/gemeinsam', active: 'gemeinsam.*', sort: 65);
|
||||
$this->app->make(Abilities::class)->define('gemeinsam.manage', 'Personalnachrichten pflegen (Gemeinsam feiern …)', 'Gemeinsam');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Gemeinsam\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Plugins\PluginManager;
|
||||
use App\Support\Audit;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Inhaus\Plugins\Birthdays\BirthdayList;
|
||||
use Inhaus\Plugins\Gemeinsam\Models\Entry;
|
||||
|
||||
class GemeinsamController extends Controller
|
||||
{
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$month = $this->month((string) $request->query('monat', ''));
|
||||
$entries = Entry::query()->with('user')
|
||||
->whereBetween('date', [$month->copy()->startOfMonth()->toDateString(), $month->copy()->endOfMonth()->toDateString()])
|
||||
->orderBy('date')->orderBy('id')->get();
|
||||
|
||||
$sections = [];
|
||||
|
||||
foreach (Entry::SECTIONS as $key => $title) {
|
||||
if ($key === 'birthdays') {
|
||||
if (! app(PluginManager::class)->isLoaded('birthdays')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rows = app(BirthdayList::class)->inMonth($month->year, $month->month);
|
||||
$sections[] = ['key' => $key, 'title' => $title, 'automatic' => true, 'entries' => array_map(fn ($row) => [
|
||||
'id' => 'b'.$row['person']['id'],
|
||||
'date' => $row['date'],
|
||||
'person' => $row['person'] + ['url' => '/personen/'.$row['person']['id']],
|
||||
'name' => $row['person']['name'],
|
||||
'department' => $row['person']['department'] ?? null,
|
||||
'location' => $row['person']['location'] ?? null,
|
||||
], $rows)];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$sections[] = [
|
||||
'key' => $key,
|
||||
'title' => $title,
|
||||
'automatic' => false,
|
||||
'entries' => $entries->where('section', $key)->values()->map(fn (Entry $entry) => $this->present($entry))->all(),
|
||||
];
|
||||
}
|
||||
|
||||
return Inertia::render('gemeinsam::Index', [
|
||||
'month' => $month->format('Y-m'),
|
||||
'monthLabel' => $month->locale('de')->isoFormat('MMMM YYYY'),
|
||||
'previous' => $month->copy()->subMonth()->format('Y-m'),
|
||||
'next' => $month->copy()->addMonth()->format('Y-m'),
|
||||
'isCurrent' => $month->isSameMonth(now()),
|
||||
'sections' => $sections,
|
||||
'canManage' => (bool) $request->user()->can('gemeinsam.manage'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
abort_unless($request->user()->can('gemeinsam.manage'), 403);
|
||||
$entry = Entry::query()->create([...$this->validated($request), 'created_by' => $request->user()->id]);
|
||||
Audit::log('gemeinsam.created', ['section' => $entry->section, 'entry' => $entry->id]);
|
||||
|
||||
return redirect()->route('gemeinsam.index', ['monat' => $entry->date->format('Y-m')])->with('status', 'Eintrag gespeichert.');
|
||||
}
|
||||
|
||||
public function update(Request $request, Entry $entry): RedirectResponse
|
||||
{
|
||||
abort_unless($request->user()->can('gemeinsam.manage'), 403);
|
||||
$entry->update($this->validated($request));
|
||||
|
||||
return redirect()->route('gemeinsam.index', ['monat' => $entry->date->format('Y-m')])->with('status', 'Eintrag gespeichert.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, Entry $entry): RedirectResponse
|
||||
{
|
||||
abort_unless($request->user()->can('gemeinsam.manage'), 403);
|
||||
$entry->delete();
|
||||
Audit::log('gemeinsam.deleted', ['section' => $entry->section, 'entry' => $entry->id]);
|
||||
|
||||
return back()->with('status', 'Eintrag entfernt.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function present(Entry $entry): array
|
||||
{
|
||||
$user = $entry->user;
|
||||
|
||||
return [
|
||||
'id' => $entry->id,
|
||||
'section' => $entry->section,
|
||||
'user_id' => $entry->user_id,
|
||||
'name' => $entry->displayName(),
|
||||
'free_name' => $entry->name,
|
||||
'person' => $user ? [
|
||||
'id' => $user->id,
|
||||
'name' => $user->name,
|
||||
'initials' => $user->initials,
|
||||
'avatar_url' => $user->avatarUrl(96),
|
||||
'job_title' => $user->job_title,
|
||||
'url' => '/personen/'.$user->id,
|
||||
] : null,
|
||||
'date' => $entry->date->toDateString(),
|
||||
'born_on' => $entry->born_on?->toDateString(),
|
||||
// Leere Felder aus dem Profil ergänzen
|
||||
'department' => $entry->department ?? $user?->department,
|
||||
'location' => $entry->location ?? $user?->location,
|
||||
'from' => $entry->from,
|
||||
'to' => $entry->to,
|
||||
'label' => $entry->label,
|
||||
'text' => $entry->text,
|
||||
'raw' => [
|
||||
'department' => $entry->department,
|
||||
'location' => $entry->location,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function validated(Request $request): array
|
||||
{
|
||||
$data = $request->validate([
|
||||
'section' => ['required', Rule::in(Entry::MANUAL)],
|
||||
'user_id' => ['nullable', 'integer', Rule::exists('users', 'id')],
|
||||
'name' => ['required_without:user_id', 'nullable', 'string', 'max:150'],
|
||||
'date' => ['required', 'date'],
|
||||
'born_on' => ['nullable', 'date', 'before_or_equal:date'],
|
||||
'department' => ['nullable', 'string', 'max:150'],
|
||||
'location' => ['nullable', 'string', 'max:150'],
|
||||
'from' => ['nullable', 'string', 'max:150'],
|
||||
'to' => ['nullable', 'string', 'max:150'],
|
||||
'label' => ['nullable', 'string', 'max:150'],
|
||||
'text' => ['nullable', 'string', 'max:1000'],
|
||||
], ['name.required_without' => 'Bitte eine Person auswählen oder einen Namen eintragen.'], [
|
||||
'date' => 'Datum', 'born_on' => 'Geburtsdatum', 'department' => 'Bereich', 'location' => 'Standort', 'label' => 'Anlass',
|
||||
]);
|
||||
|
||||
if (! empty($data['user_id'])) {
|
||||
$data['name'] = null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function month(string $value): Carbon
|
||||
{
|
||||
return preg_match('/^\d{4}-\d{2}$/', $value) && checkdate((int) substr($value, 5, 2), 1, (int) substr($value, 0, 4))
|
||||
? Carbon::createFromFormat('Y-m-d', $value.'-01')->startOfDay()
|
||||
: Carbon::today()->startOfMonth();
|
||||
}
|
||||
}
|
||||
44
plugins-core/gemeinsam/src/Models/Entry.php
Normal file
44
plugins-core/gemeinsam/src/Models/Entry.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Gemeinsam\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable(['section', 'user_id', 'name', 'date', 'born_on', 'department', 'location', 'from', 'to', 'label', 'text', 'created_by'])]
|
||||
class Entry extends Model
|
||||
{
|
||||
protected $table = 'gemeinsam_entries';
|
||||
|
||||
/** Abschnitte in der Reihenfolge der Seite (Geburtstage kommen aus dem Geburtstags-Plugin). */
|
||||
public const SECTIONS = [
|
||||
'welcome' => 'Wir begrüßen die neuen Mitarbeitenden',
|
||||
'transfer' => 'Den Einsatzort wechseln',
|
||||
'birthdays' => 'Geburtstage',
|
||||
'jubilee' => 'Jubilare',
|
||||
'farewell' => 'Wir verabschieden',
|
||||
'memoriam' => 'In Gedenken an',
|
||||
];
|
||||
|
||||
public const MANUAL = ['welcome', 'transfer', 'jubilee', 'farewell', 'memoriam'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['date' => 'date', 'born_on' => 'date'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function displayName(): string
|
||||
{
|
||||
return $this->user?->name ?? (string) $this->name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('qm_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 120);
|
||||
$table->unsignedInteger('sort')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('qm_folders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('category_id')->nullable()->constrained('qm_categories')->nullOnDelete();
|
||||
$table->foreignId('parent_id')->nullable()->constrained('qm_folders')->restrictOnDelete();
|
||||
$table->string('name', 120);
|
||||
$table->string('color', 20)->nullable(); // null = vom übergeordneten Ordner erben
|
||||
$table->string('icon', 60)->nullable(); // Symbol aus der Auswahl (wie im Menü)
|
||||
$table->string('icon_path')->nullable(); // oder eigenes, hochgeladenes Symbol
|
||||
$table->boolean('icon_mono')->default(true); // eigenes Symbol einfarbig darstellen
|
||||
$table->text('intro')->nullable();
|
||||
$table->unsignedInteger('sort')->default(0);
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['parent_id', 'sort']);
|
||||
});
|
||||
|
||||
Schema::create('qm_folder_contacts', function (Blueprint $table) {
|
||||
$table->foreignId('folder_id')->constrained('qm_folders')->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('sort')->default(0);
|
||||
|
||||
$table->primary(['folder_id', 'user_id']);
|
||||
});
|
||||
|
||||
Schema::create('qm_entries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('folder_id')->constrained('qm_folders')->restrictOnDelete();
|
||||
$table->string('type', 10); // file | link | form
|
||||
$table->string('title');
|
||||
$table->string('description', 1000)->nullable();
|
||||
$table->string('version', 30)->nullable();
|
||||
$table->date('valid_from')->nullable(); // „Stand“
|
||||
$table->string('url', 1000)->nullable();
|
||||
$table->unsignedBigInteger('form_id')->nullable();
|
||||
$table->unsignedInteger('sort')->default(0);
|
||||
// Vorgesehen für später: Wiedervorlage, Verantwortliche, Lesebestätigung
|
||||
$table->date('review_due_at')->nullable();
|
||||
$table->foreignId('responsible_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->boolean('requires_acknowledgement')->default(false);
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['folder_id', 'sort']);
|
||||
});
|
||||
|
||||
Schema::create('qm_files', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('entry_id')->constrained('qm_entries')->cascadeOnDelete();
|
||||
$table->string('kind', 10); // reading = Lesefassung, editable = bearbeitbare Vorlage
|
||||
$table->string('version', 30)->nullable();
|
||||
$table->date('valid_from')->nullable();
|
||||
$table->string('name');
|
||||
$table->string('path');
|
||||
$table->string('mime', 150)->nullable();
|
||||
$table->unsignedBigInteger('size')->default(0);
|
||||
$table->longText('text')->nullable();
|
||||
$table->string('text_status', 20)->default('pending'); // pending | ok | empty | needs_ocr | ocr | failed | unsupported
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
||||
$table->index(['entry_id', 'archived_at']);
|
||||
$table->index('text_status');
|
||||
});
|
||||
|
||||
// Volltextindex für die Suche im Inhalt (MySQL und MariaDB, InnoDB)
|
||||
if (in_array(DB::getDriverName(), ['mysql', 'mariadb'], true)) {
|
||||
DB::statement('ALTER TABLE qm_files ADD FULLTEXT qm_files_text_fulltext (text)');
|
||||
}
|
||||
|
||||
// Vorgesehen für später: Lesebestätigungen
|
||||
Schema::create('qm_acknowledgements', function (Blueprint $table) {
|
||||
$table->foreignId('entry_id')->constrained('qm_entries')->cascadeOnDelete();
|
||||
$table->foreignId('file_id')->nullable()->constrained('qm_files')->nullOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamp('acknowledged_at');
|
||||
|
||||
$table->primary(['entry_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('qm_acknowledgements');
|
||||
Schema::dropIfExists('qm_files');
|
||||
Schema::dropIfExists('qm_entries');
|
||||
Schema::dropIfExists('qm_folder_contacts');
|
||||
Schema::dropIfExists('qm_folders');
|
||||
Schema::dropIfExists('qm_categories');
|
||||
}
|
||||
};
|
||||
13
plugins-core/qm/plugin.json
Normal file
13
plugins-core/qm/plugin.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"slug": "qm",
|
||||
"name": "Qualitätsmanagement",
|
||||
"version": "1.0.0",
|
||||
"description": "QM-Dokumente und -Formulare in farbigen Ordnern mit Einführungstext und Ansprechpartnern, Versionen mit Gültigkeitsdatum, Archiv, Volltextsuche (auch im Inhalt von PDF, Word, Excel; optional mit Texterkennung) und Lesen direkt im Browser.",
|
||||
"author": "Inhaus",
|
||||
"namespace": "Inhaus\\Plugins\\Qm\\",
|
||||
"class": "Inhaus\\Plugins\\Qm\\QmPlugin",
|
||||
"requires": {
|
||||
"core": ">=0.11.0",
|
||||
"php": ">=8.3"
|
||||
}
|
||||
}
|
||||
20
plugins-core/qm/resources/js/colors.js
Normal file
20
plugins-core/qm/resources/js/colors.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Ordnerfarben – passend zu Inhaus\Plugins\Qm\Colors (gleiche Töne, weiße Schrift lesbar).
|
||||
* Klassen ausgeschrieben, damit Tailwind sie findet.
|
||||
*/
|
||||
const palette = {
|
||||
blue: { tile: 'bg-blue-600', text: 'text-blue-700 dark:text-blue-300', soft: 'bg-blue-50 dark:bg-blue-950/60', dot: 'bg-blue-600' },
|
||||
sky: { tile: 'bg-sky-700', text: 'text-sky-700 dark:text-sky-300', soft: 'bg-sky-50 dark:bg-sky-950/60', dot: 'bg-sky-700' },
|
||||
teal: { tile: 'bg-teal-700', text: 'text-teal-700 dark:text-teal-300', soft: 'bg-teal-50 dark:bg-teal-950/60', dot: 'bg-teal-700' },
|
||||
emerald: { tile: 'bg-emerald-700', text: 'text-emerald-700 dark:text-emerald-300', soft: 'bg-emerald-50 dark:bg-emerald-950/60', dot: 'bg-emerald-700' },
|
||||
green: { tile: 'bg-green-700', text: 'text-green-700 dark:text-green-300', soft: 'bg-green-50 dark:bg-green-950/60', dot: 'bg-green-700' },
|
||||
amber: { tile: 'bg-amber-700', text: 'text-amber-700 dark:text-amber-300', soft: 'bg-amber-50 dark:bg-amber-950/60', dot: 'bg-amber-700' },
|
||||
orange: { tile: 'bg-orange-700', text: 'text-orange-700 dark:text-orange-300', soft: 'bg-orange-50 dark:bg-orange-950/60', dot: 'bg-orange-700' },
|
||||
red: { tile: 'bg-red-600', text: 'text-red-700 dark:text-red-300', soft: 'bg-red-50 dark:bg-red-950/60', dot: 'bg-red-600' },
|
||||
rose: { tile: 'bg-rose-600', text: 'text-rose-700 dark:text-rose-300', soft: 'bg-rose-50 dark:bg-rose-950/60', dot: 'bg-rose-600' },
|
||||
violet: { tile: 'bg-violet-600', text: 'text-violet-700 dark:text-violet-300', soft: 'bg-violet-50 dark:bg-violet-950/60', dot: 'bg-violet-600' },
|
||||
indigo: { tile: 'bg-indigo-600', text: 'text-indigo-700 dark:text-indigo-300', soft: 'bg-indigo-50 dark:bg-indigo-950/60', dot: 'bg-indigo-600' },
|
||||
slate: { tile: 'bg-slate-600', text: 'text-slate-700 dark:text-slate-300', soft: 'bg-slate-100 dark:bg-slate-900', dot: 'bg-slate-600' },
|
||||
};
|
||||
|
||||
export const qmColor = (key) => palette[key] ?? palette.blue;
|
||||
51
plugins-core/qm/resources/js/components/ArchiveDialog.vue
Normal file
51
plugins-core/qm/resources/js/components/ArchiveDialog.vue
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Download } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { http } from '@/lib/http';
|
||||
import { formatSize, formatStand } from '../format';
|
||||
|
||||
const props = defineProps({
|
||||
open: { type: Boolean, default: false },
|
||||
entry: { type: Object, default: null },
|
||||
});
|
||||
|
||||
defineEmits(['update:open']);
|
||||
|
||||
const files = ref(null);
|
||||
|
||||
watch(() => props.open, async (open) => {
|
||||
if (!open || !props.entry) return;
|
||||
files.value = null;
|
||||
files.value = (await http.get(`/qm/eintraege/${props.entry.id}/archiv`)).files;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog :open="open" @update:open="(v) => $emit('update:open', v)">
|
||||
<DialogContent class="sm:max-w-2xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Fassungen</DialogTitle>
|
||||
<DialogDescription>{{ entry?.title }} – frühere Fassungen sieht nur das QM-Team.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div v-if="!files" class="grid gap-2" aria-busy="true"><Skeleton v-for="n in 3" :key="n" class="h-10" /></div>
|
||||
<ul v-else class="-mx-2 divide-y">
|
||||
<li v-for="file in files" :key="file.id" class="flex items-center gap-3 px-2 py-2.5">
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="truncate text-sm">
|
||||
{{ file.name }}
|
||||
<span class="ml-1 rounded px-1.5 py-0.5 text-[11px]" :class="file.archived ? 'bg-muted text-muted-foreground' : 'bg-brand-soft text-brand-soft-foreground'">{{ file.archived ? 'Archiv' : 'aktuell' }}</span>
|
||||
<span v-if="file.kind === 'editable'" class="ml-1 text-[11px] text-muted-foreground">Vorlage</span>
|
||||
</p>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
Version {{ file.version || '–' }} · Stand {{ formatStand(file.valid_from) }} · {{ formatSize(file.size) }}<template v-if="file.uploader"> · {{ file.uploader }}</template>
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon" as-child :title="`${file.name} herunterladen`"><a :href="file.url"><Download /></a></Button>
|
||||
</li>
|
||||
</ul>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
28
plugins-core/qm/resources/js/components/ContactCard.vue
Normal file
28
plugins-core/qm/resources/js/components/ContactCard.vue
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Mail, Phone, Smartphone } from '@lucide/vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
|
||||
defineProps({
|
||||
contact: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const href = (field) => (field.type === 'phone' ? `tel:${field.value}` : field.type === 'email' ? `mailto:${field.value}` : null);
|
||||
const icon = (field) => (field.key === 'mobile' ? Smartphone : field.type === 'phone' ? Phone : field.type === 'email' ? Mail : null);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex gap-3">
|
||||
<Link :href="`/personen/${contact.id}`" class="shrink-0"><PersonAvatar :person="contact" class="size-14 text-base" /></Link>
|
||||
<div class="min-w-0 pt-0.5">
|
||||
<Link :href="`/personen/${contact.id}`" class="block truncate text-sm font-semibold hover:underline">{{ contact.name }}</Link>
|
||||
<ul class="mt-1 grid gap-0.5 text-[13px]">
|
||||
<li v-for="field in contact.fields" :key="field.key" class="flex min-w-0 items-center gap-1.5">
|
||||
<component :is="icon(field)" v-if="icon(field)" class="size-3.5 shrink-0 text-muted-foreground" />
|
||||
<a v-if="href(field)" :href="href(field)" class="truncate text-brand-text hover:underline">{{ field.value }}</a>
|
||||
<span v-else class="truncate text-muted-foreground">{{ field.value }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
135
plugins-core/qm/resources/js/components/EntryDialog.vue
Normal file
135
plugins-core/qm/resources/js/components/EntryDialog.vue
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<script setup>
|
||||
import { computed, watch } from 'vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { ClipboardList, FileText, Link2, LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import NativeSelect from '@/components/NativeSelect.vue';
|
||||
import FilePick from './FilePick.vue';
|
||||
|
||||
/**
|
||||
* Eintrag anlegen oder bearbeiten. mode: create | edit | version (neue Fassung).
|
||||
*/
|
||||
const props = defineProps({
|
||||
open: { type: Boolean, default: false },
|
||||
mode: { type: String, default: 'create' },
|
||||
entry: { type: Object, default: null },
|
||||
folderId: { type: Number, required: true },
|
||||
forms: { type: Array, default: () => [] },
|
||||
maxUploadMb: { type: Number, default: 20 },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:open']);
|
||||
|
||||
const today = () => new Date().toISOString().slice(0, 10);
|
||||
const form = useForm({ type: 'file', title: '', description: '', version: '', valid_from: today(), url: '', form_id: null, reading: null, editable: null, remove_editable: false });
|
||||
|
||||
watch(() => props.open, (open) => {
|
||||
if (!open) return;
|
||||
|
||||
form.clearErrors();
|
||||
const e = props.entry;
|
||||
form.defaults({
|
||||
type: e?.type ?? 'file',
|
||||
title: e?.title ?? '',
|
||||
description: e?.description ?? '',
|
||||
version: e?.version ?? '',
|
||||
valid_from: props.mode === 'version' ? today() : e?.valid_from ?? today(),
|
||||
url: e?.url ?? '',
|
||||
form_id: e?.form_id ?? null,
|
||||
reading: null,
|
||||
editable: null,
|
||||
remove_editable: false,
|
||||
});
|
||||
form.reset();
|
||||
});
|
||||
|
||||
const types = [
|
||||
{ value: 'file', label: 'Datei', icon: FileText },
|
||||
{ value: 'link', label: 'Link', icon: Link2 },
|
||||
{ value: 'form', label: 'Online-Formular', icon: ClipboardList },
|
||||
];
|
||||
|
||||
const title = computed(() => ({ create: 'Eintrag hinzufügen', edit: 'Eintrag bearbeiten', version: 'Neue Fassung hochladen' })[props.mode]);
|
||||
|
||||
function submit() {
|
||||
const url = props.mode === 'create' ? `/qm/ordner/${props.folderId}/eintraege` : `/qm/eintraege/${props.entry.id}`;
|
||||
form.post(url, { forceFormData: true, preserveScroll: true, onSuccess: () => emit('update:open', false) });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog :open="open" @update:open="(v) => emit('update:open', v)">
|
||||
<DialogContent class="sm:max-w-xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ title }}</DialogTitle>
|
||||
<DialogDescription v-if="mode === 'version'">„{{ entry?.title }}“ – die bisherige Fassung kommt ins Archiv und bleibt für das QM-Team abrufbar.</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<form class="grid gap-4" @submit.prevent="submit">
|
||||
<div v-if="mode === 'create'" class="grid grid-cols-3 gap-2" role="radiogroup" aria-label="Art des Eintrags">
|
||||
<button
|
||||
v-for="type in types"
|
||||
:key="type.value"
|
||||
type="button"
|
||||
role="radio"
|
||||
:aria-checked="form.type === type.value"
|
||||
class="flex items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm"
|
||||
:class="form.type === type.value ? 'border-brand-400 bg-brand-soft font-medium text-brand-soft-foreground' : 'hover:bg-accent'"
|
||||
@click="form.type = type.value"
|
||||
>
|
||||
<component :is="type.icon" class="size-4" /> {{ type.label }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<FormField id="qm-title" label="Titel" :error="form.errors.title">
|
||||
<Input id="qm-title" v-model="form.title" maxlength="250" placeholder="z. B. Urlaubsantrag" />
|
||||
</FormField>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<FormField id="qm-version" label="Version" :error="form.errors.version">
|
||||
<Input id="qm-version" v-model="form.version" maxlength="30" placeholder="z. B. 2.1" />
|
||||
</FormField>
|
||||
<FormField id="qm-valid" label="Stand (gültig ab)" :error="form.errors.valid_from">
|
||||
<Input id="qm-valid" v-model="form.valid_from" type="date" />
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
<FormField id="qm-description" label="Beschreibung (optional)" :error="form.errors.description">
|
||||
<Input id="qm-description" v-model="form.description" maxlength="1000" />
|
||||
</FormField>
|
||||
|
||||
<template v-if="form.type === 'file'">
|
||||
<FormField id="qm-reading" :label="mode === 'edit' ? 'Datei ersetzen (optional – neue Fassung)' : 'Datei (PDF empfohlen – öffnet sich direkt zum Lesen)'" :error="form.errors.reading">
|
||||
<FilePick id="qm-reading" v-model="form.reading" accept=".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.odt,.ods,.odp,.rtf,.txt,.csv,.png,.jpg,.jpeg,.gif,.webp,.zip" />
|
||||
</FormField>
|
||||
<FormField id="qm-editable" label="Bearbeitbare Vorlage (optional, z. B. Word oder Excel zum Ausfüllen)" :error="form.errors.editable">
|
||||
<FilePick id="qm-editable" v-model="form.editable" accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.odt,.ods,.odp,.rtf,.txt,.csv,.pdf,.zip" />
|
||||
</FormField>
|
||||
<label v-if="mode !== 'create' && entry?.editable && !form.editable" class="flex items-center gap-2 text-[13px]">
|
||||
<input v-model="form.remove_editable" type="checkbox" /> Bisherige Vorlage „{{ entry.editable.name }}“ entfernen
|
||||
</label>
|
||||
<p class="text-xs text-muted-foreground">Bis {{ maxUploadMb }} MB je Datei. Der Inhalt wird für die Suche erfasst.</p>
|
||||
</template>
|
||||
|
||||
<FormField v-if="form.type === 'link'" id="qm-url" label="Adresse" :error="form.errors.url">
|
||||
<Input id="qm-url" v-model="form.url" placeholder="https://… oder /seiten/…" />
|
||||
</FormField>
|
||||
|
||||
<FormField v-if="form.type === 'form'" id="qm-form" label="Formular" :error="form.errors.form_id">
|
||||
<NativeSelect id="qm-form" v-model="form.form_id" :options="[{ value: null, label: 'Bitte wählen …' }, ...forms]" />
|
||||
</FormField>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" @click="emit('update:open', false)">Abbrechen</Button>
|
||||
<Button type="submit" :disabled="form.processing || (mode === 'version' && !form.reading && !form.editable)">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" /> Speichern
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
<div v-if="form.progress" class="h-1 overflow-hidden rounded-full bg-muted"><div class="h-full bg-brand" :style="{ width: `${form.progress.percentage}%` }" /></div>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
100
plugins-core/qm/resources/js/components/EntryTable.vue
Normal file
100
plugins-core/qm/resources/js/components/EntryTable.vue
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Archive, ClipboardList, Download, EllipsisVertical, ExternalLink, FileUp, PencilLine, ScanText, Trash2 } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
import { formatSize, formatStand } from '../format';
|
||||
|
||||
/**
|
||||
* Dokumentenliste: Dokument, Version, Stand, Größe und Aktion.
|
||||
* Ein Klick auf den Titel öffnet das Dokument zum Lesen (PDF im Portal).
|
||||
*/
|
||||
defineProps({
|
||||
entries: { type: Array, required: true },
|
||||
canManage: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
defineEmits(['edit', 'new-version', 'archive', 'remove']);
|
||||
|
||||
const actionLabel = { view: 'Lesen', download: 'Herunterladen', link: 'Öffnen', form: 'Ausfüllen' };
|
||||
const isExternal = (entry) => entry.open_kind === 'link' || entry.open_kind === 'download';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="overflow-hidden rounded-lg border bg-card">
|
||||
<div class="hidden grid-cols-[minmax(0,1fr)_6rem_7rem_6rem_9.5rem] items-center gap-4 border-b bg-muted/40 px-4 py-2 text-xs font-medium text-muted-foreground md:grid" :class="{ 'md:grid-cols-[minmax(0,1fr)_6rem_7rem_6rem_11.5rem]': canManage }">
|
||||
<span>Dokument</span>
|
||||
<span>Version</span>
|
||||
<span>Stand</span>
|
||||
<span class="text-right">Größe</span>
|
||||
<span class="sr-only">Aktion</span>
|
||||
</div>
|
||||
<ul class="divide-y">
|
||||
<li
|
||||
v-for="entry in entries"
|
||||
:key="entry.id"
|
||||
class="grid items-center gap-x-4 gap-y-1 px-4 py-2.5 hover:bg-accent/50 md:grid-cols-[minmax(0,1fr)_6rem_7rem_6rem_9.5rem]"
|
||||
:class="{ 'md:grid-cols-[minmax(0,1fr)_6rem_7rem_6rem_11.5rem]': canManage }"
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<FileIcon v-if="entry.type === 'file'" :extension="entry.extension" size="sm" />
|
||||
<span v-else class="grid size-8 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground">
|
||||
<ClipboardList v-if="entry.type === 'form'" class="size-4" />
|
||||
<ExternalLink v-else class="size-4" />
|
||||
</span>
|
||||
<div class="min-w-0">
|
||||
<component
|
||||
:is="isExternal(entry) ? 'a' : Link"
|
||||
v-if="entry.open_url"
|
||||
:href="entry.open_url"
|
||||
:target="entry.open_kind === 'link' ? '_blank' : undefined"
|
||||
:rel="entry.open_kind === 'link' ? 'noopener' : undefined"
|
||||
class="block truncate text-sm font-medium hover:underline"
|
||||
>
|
||||
{{ entry.title }}
|
||||
</component>
|
||||
<span v-else class="block truncate text-sm font-medium">{{ entry.title }}</span>
|
||||
<p v-if="entry.description" class="truncate text-xs text-muted-foreground">{{ entry.description }}</p>
|
||||
<p class="flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground">
|
||||
<span class="md:hidden">{{ entry.version ? `Version ${entry.version} · ` : '' }}Stand {{ formatStand(entry.valid_from) }}</span>
|
||||
<a v-if="entry.editable" :href="entry.editable.url" class="inline-flex items-center gap-1 text-brand-text hover:underline" :title="entry.editable.name">
|
||||
<Download class="size-3" /> Vorlage ({{ entry.editable.extension }})
|
||||
</a>
|
||||
<span v-if="canManage && entry.text_status === 'needs_ocr'" class="inline-flex items-center gap-1 text-amber-700 dark:text-amber-400" title="Eingescanntes PDF – Inhalt erst nach Texterkennung durchsuchbar">
|
||||
<ScanText class="size-3" /> Scan, Inhalt nicht durchsuchbar
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<span class="hidden text-[13px] md:block">{{ entry.version || '–' }}</span>
|
||||
<span class="hidden text-[13px] tabular-nums md:block">{{ formatStand(entry.valid_from) }}</span>
|
||||
<span class="hidden text-right text-[13px] text-muted-foreground tabular-nums md:block">{{ entry.type === 'file' ? formatSize(entry.size) : '–' }}</span>
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<Button v-if="entry.open_url" size="sm" variant="outline" class="h-8 min-w-28" as-child>
|
||||
<component :is="isExternal(entry) ? 'a' : Link" :href="entry.open_url" :target="entry.open_kind === 'link' ? '_blank' : undefined" :rel="entry.open_kind === 'link' ? 'noopener' : undefined">
|
||||
<ExternalLink v-if="entry.open_kind === 'link'" /><ClipboardList v-else-if="entry.open_kind === 'form'" /><Download v-else-if="entry.open_kind === 'download'" />
|
||||
{{ actionLabel[entry.open_kind] }}
|
||||
</component>
|
||||
</Button>
|
||||
<Button v-if="entry.open_kind === 'view' && entry.download_url" size="icon" variant="ghost" class="size-8 text-muted-foreground" as-child :title="`${entry.title} herunterladen`">
|
||||
<a :href="entry.download_url" :aria-label="`${entry.title} herunterladen`"><Download /></a>
|
||||
</Button>
|
||||
<span v-else class="hidden size-8 md:block" aria-hidden="true" />
|
||||
<DropdownMenu v-if="canManage">
|
||||
<DropdownMenuTrigger as-child>
|
||||
<Button variant="ghost" size="icon" class="size-8 text-muted-foreground" :aria-label="`Aktionen für ${entry.title}`"><EllipsisVertical /></Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-56">
|
||||
<DropdownMenuItem @select="$emit('edit', entry)"><PencilLine /> Bearbeiten</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="entry.type === 'file'" @select="$emit('new-version', entry)"><FileUp /> Neue Fassung hochladen</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="entry.type === 'file'" @select="$emit('archive', entry)"><Archive /> Archiv (frühere Fassungen)</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem class="text-destructive" @select="$emit('remove', entry)"><Trash2 /> Löschen</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
38
plugins-core/qm/resources/js/components/FilePick.vue
Normal file
38
plugins-core/qm/resources/js/components/FilePick.vue
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { Paperclip, X } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
/**
|
||||
* Dateiauswahl im Stil des Portals statt des Browser-Standards.
|
||||
*/
|
||||
const model = defineModel({ type: [Object, null], default: null });
|
||||
|
||||
defineProps({
|
||||
id: { type: String, required: true },
|
||||
accept: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const input = ref(null);
|
||||
|
||||
function pick(event) {
|
||||
model.value = event.target.files[0] ?? null;
|
||||
}
|
||||
|
||||
function clear() {
|
||||
model.value = null;
|
||||
if (input.value) input.value.value = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<input :id="id" ref="input" type="file" class="sr-only" :accept="accept" @change="pick" />
|
||||
<Button type="button" variant="outline" size="sm" @click="input?.click()"><Paperclip /> Datei auswählen</Button>
|
||||
<span v-if="model" class="flex min-w-0 items-center gap-1 text-[13px]">
|
||||
<span class="truncate">{{ model.name }}</span>
|
||||
<button type="button" class="grid size-6 shrink-0 place-items-center rounded text-muted-foreground hover:bg-accent" aria-label="Auswahl entfernen" @click="clear"><X class="size-3.5" /></button>
|
||||
</span>
|
||||
<span v-else class="text-[13px] text-muted-foreground">Keine Datei ausgewählt</span>
|
||||
</div>
|
||||
</template>
|
||||
40
plugins-core/qm/resources/js/components/FolderTile.vue
Normal file
40
plugins-core/qm/resources/js/components/FolderTile.vue
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { qmColor } from '../colors';
|
||||
import QmIcon from './QmIcon.vue';
|
||||
|
||||
/**
|
||||
* Farbige Ordnerkachel.
|
||||
*/
|
||||
const props = defineProps({
|
||||
folder: { type: Object, required: true },
|
||||
small: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const summary = () => {
|
||||
const parts = [];
|
||||
if (props.folder.folders) parts.push(`${props.folder.folders} ${props.folder.folders === 1 ? 'Ordner' : 'Ordner'}`);
|
||||
if (props.folder.entries) parts.push(`${props.folder.entries} ${props.folder.entries === 1 ? 'Dokument' : 'Dokumente'}`);
|
||||
|
||||
return parts.join(' · ') || 'Noch leer';
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Link
|
||||
:href="folder.url"
|
||||
class="group relative flex flex-col justify-between overflow-hidden rounded-lg text-white shadow-xs transition hover:shadow-md hover:brightness-110 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none"
|
||||
:class="[qmColor(folder.color).tile, small ? 'min-h-24 p-3.5' : 'min-h-32 p-4']"
|
||||
>
|
||||
<span class="pointer-events-none absolute -right-4 -bottom-5 opacity-15 transition-transform group-hover:scale-105" aria-hidden="true">
|
||||
<QmIcon :icon="folder.icon" :class="small ? 'size-20' : 'size-24'" />
|
||||
</span>
|
||||
<span class="grid place-items-center rounded-md bg-white/15" :class="small ? 'size-9' : 'size-11'">
|
||||
<QmIcon :icon="folder.icon" :class="small ? 'size-5' : 'size-6'" />
|
||||
</span>
|
||||
<span class="relative mt-3">
|
||||
<span class="block leading-tight font-semibold" :class="small ? 'text-sm' : 'text-[15px]'">{{ folder.name }}</span>
|
||||
<span class="mt-0.5 block text-xs text-white/80">{{ summary() }}</span>
|
||||
</span>
|
||||
</Link>
|
||||
</template>
|
||||
110
plugins-core/qm/resources/js/components/PdfViewer.vue
Normal file
110
plugins-core/qm/resources/js/components/PdfViewer.vue
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<script setup>
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, shallowRef } from 'vue';
|
||||
import { LoaderCircle, Minus, Plus } from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* PDF lesen im Portal (pdf.js): Seiten werden erst gezeichnet, wenn sie ins Bild kommen.
|
||||
*/
|
||||
const props = defineProps({
|
||||
url: { type: String, required: true },
|
||||
});
|
||||
|
||||
const container = ref(null);
|
||||
const pdf = shallowRef(null);
|
||||
const pages = ref([]); // { number, width, height }
|
||||
const scale = ref(1);
|
||||
const current = ref(1);
|
||||
const error = ref(false);
|
||||
const rendered = new Map();
|
||||
let observer;
|
||||
let lib;
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
const [pdfjs, worker] = await Promise.all([import('pdfjs-dist'), import('pdfjs-dist/build/pdf.worker.min.mjs?url')]);
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = worker.default;
|
||||
lib = pdfjs;
|
||||
pdf.value = await pdfjs.getDocument({ url: props.url, isEvalSupported: false, enableXfa: false }).promise;
|
||||
|
||||
const first = (await pdf.value.getPage(1)).getViewport({ scale: 1 });
|
||||
const available = Math.min(container.value.clientWidth - 48, 860);
|
||||
scale.value = Math.max(0.5, available / first.width);
|
||||
pages.value = Array.from({ length: pdf.value.numPages }, (_, i) => ({ number: i + 1, width: first.width, height: first.height }));
|
||||
await nextTick();
|
||||
observe();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
error.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
function observe() {
|
||||
observer?.disconnect();
|
||||
rendered.clear();
|
||||
observer = new IntersectionObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
const number = Number(entry.target.dataset.page);
|
||||
if (entry.isIntersecting) {
|
||||
current.value = number;
|
||||
render(number, entry.target.querySelector('canvas'));
|
||||
}
|
||||
}
|
||||
}, { root: container.value, rootMargin: '400px 0px' });
|
||||
container.value.querySelectorAll('[data-page]').forEach((el) => observer.observe(el));
|
||||
}
|
||||
|
||||
async function render(number, canvas) {
|
||||
const key = `${number}@${scale.value}`;
|
||||
if (!canvas || rendered.get(number) === key) return;
|
||||
rendered.set(number, key);
|
||||
|
||||
const page = await pdf.value.getPage(number);
|
||||
const viewport = page.getViewport({ scale: scale.value });
|
||||
const ratio = window.devicePixelRatio || 1;
|
||||
canvas.width = Math.floor(viewport.width * ratio);
|
||||
canvas.height = Math.floor(viewport.height * ratio);
|
||||
canvas.style.width = `${Math.floor(viewport.width)}px`;
|
||||
canvas.style.height = `${Math.floor(viewport.height)}px`;
|
||||
await page.render({ canvasContext: canvas.getContext('2d'), viewport, transform: ratio !== 1 ? [ratio, 0, 0, ratio, 0, 0] : null }).promise;
|
||||
}
|
||||
|
||||
async function zoom(step) {
|
||||
scale.value = Math.min(3, Math.max(0.4, Math.round((scale.value + step) * 10) / 10));
|
||||
await nextTick();
|
||||
observe();
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
onBeforeUnmount(() => {
|
||||
observer?.disconnect();
|
||||
pdf.value?.destroy();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative flex h-full min-h-0 flex-col">
|
||||
<div class="flex items-center justify-between gap-3 border-b bg-card px-3 py-1.5 text-[13px] text-muted-foreground">
|
||||
<span class="tabular-nums">{{ pages.length ? `Seite ${current} von ${pages.length}` : '' }}</span>
|
||||
<div class="flex items-center rounded-md border">
|
||||
<button type="button" class="grid size-8 place-items-center hover:text-foreground" aria-label="Verkleinern" @click="zoom(-0.2)"><Minus class="size-4" /></button>
|
||||
<span class="w-12 text-center tabular-nums">{{ Math.round(scale * 100) }} %</span>
|
||||
<button type="button" class="grid size-8 place-items-center hover:text-foreground" aria-label="Vergrößern" @click="zoom(0.2)"><Plus class="size-4" /></button>
|
||||
</div>
|
||||
</div>
|
||||
<div ref="container" class="min-h-0 flex-1 overflow-auto bg-muted/60 px-4 py-6">
|
||||
<div v-if="error" class="mx-auto max-w-md rounded-lg border bg-card p-6 text-center text-sm">Die Datei lässt sich hier nicht anzeigen. Bitte herunterladen.</div>
|
||||
<div v-else-if="!pages.length" class="grid h-full place-items-center"><LoaderCircle class="size-6 animate-spin text-muted-foreground" /></div>
|
||||
<div v-else class="grid justify-center gap-4">
|
||||
<div
|
||||
v-for="p in pages"
|
||||
:key="p.number"
|
||||
:data-page="p.number"
|
||||
class="bg-white shadow-md"
|
||||
:style="{ width: `${Math.floor(p.width * scale)}px`, height: `${Math.floor(p.height * scale)}px` }"
|
||||
>
|
||||
<canvas :aria-label="`Seite ${p.number}`" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
24
plugins-core/qm/resources/js/components/QmIcon.vue
Normal file
24
plugins-core/qm/resources/js/components/QmIcon.vue
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<script setup>
|
||||
import AppIcon from '@/components/AppIcon.vue';
|
||||
|
||||
/**
|
||||
* Ordnersymbol: aus der Symbolauswahl ({ name }) oder hochgeladen ({ url, mono }).
|
||||
* Einfarbige eigene Symbole übernehmen die Textfarbe (CSS-Maske).
|
||||
*/
|
||||
defineProps({
|
||||
icon: { type: Object, default: () => ({ name: 'folder' }) },
|
||||
strokeWidth: { type: [Number, String], default: 1.75 },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppIcon v-if="icon?.name" :name="icon.name" :stroke-width="strokeWidth" />
|
||||
<span
|
||||
v-else-if="icon?.url && icon.mono"
|
||||
class="inline-block bg-current"
|
||||
:style="{ maskImage: `url('${icon.url}')`, WebkitMaskImage: `url('${icon.url}')`, maskSize: 'contain', WebkitMaskSize: 'contain', maskRepeat: 'no-repeat', WebkitMaskRepeat: 'no-repeat', maskPosition: 'center', WebkitMaskPosition: 'center' }"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<img v-else-if="icon?.url" :src="icon.url" alt="" class="object-contain" />
|
||||
<AppIcon v-else name="folder" :stroke-width="strokeWidth" />
|
||||
</template>
|
||||
23
plugins-core/qm/resources/js/components/QmSearchBox.vue
Normal file
23
plugins-core/qm/resources/js/components/QmSearchBox.vue
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { Search } from '@lucide/vue';
|
||||
import { Input } from '@/components/ui/input';
|
||||
|
||||
const props = defineProps({
|
||||
initial: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const query = ref(props.initial);
|
||||
|
||||
function submit() {
|
||||
if (query.value.trim()) router.get('/qm/suche', { q: query.value.trim() });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form class="relative w-full sm:w-80" role="search" @submit.prevent="submit">
|
||||
<Search class="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<Input v-model="query" type="search" class="h-10 bg-card pl-9" placeholder="QM durchsuchen – auch im Text …" aria-label="Qualitätsmanagement durchsuchen" />
|
||||
</form>
|
||||
</template>
|
||||
10
plugins-core/qm/resources/js/format.js
Normal file
10
plugins-core/qm/resources/js/format.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const dateFormat = new Intl.DateTimeFormat('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||
|
||||
export const formatStand = (date) => (date ? dateFormat.format(new Date(`${date}T12:00:00`)) : '–');
|
||||
|
||||
export const formatSize = (bytes) => {
|
||||
if (!bytes) return '–';
|
||||
if (bytes >= 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(1).replace('.', ',')} MB`;
|
||||
|
||||
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
||||
};
|
||||
106
plugins-core/qm/resources/js/pages/Folder.vue
Normal file
106
plugins-core/qm/resources/js/pages/Folder.vue
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { router, usePage } from '@inertiajs/vue3';
|
||||
import { FilePlus2, Files, FolderCog, Users } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { qmColor } from '../colors';
|
||||
import ArchiveDialog from '../components/ArchiveDialog.vue';
|
||||
import ContactCard from '../components/ContactCard.vue';
|
||||
import EntryDialog from '../components/EntryDialog.vue';
|
||||
import EntryTable from '../components/EntryTable.vue';
|
||||
import FolderTile from '../components/FolderTile.vue';
|
||||
import QmIcon from '../components/QmIcon.vue';
|
||||
import QmSearchBox from '../components/QmSearchBox.vue';
|
||||
|
||||
const props = defineProps({
|
||||
folder: { type: Object, required: true },
|
||||
breadcrumbs: { type: Array, default: () => [] },
|
||||
children: { type: Array, default: () => [] },
|
||||
entries: { type: Array, default: () => [] },
|
||||
canManage: { type: Boolean, default: false },
|
||||
forms: { type: Array, default: () => [] },
|
||||
maxUploadMb: { type: Number, default: 20 },
|
||||
adminUrl: { type: String, default: null },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
const color = computed(() => qmColor(props.folder.color));
|
||||
const crumbs = computed(() => [{ label: 'Qualitätsmanagement', href: '/qm' }, ...props.breadcrumbs.map((b) => ({ label: b.name, href: `/qm/ordner/${b.id}` }))]);
|
||||
const hasAside = computed(() => props.folder.contacts.length > 0);
|
||||
|
||||
// Pflege
|
||||
const dialog = ref({ open: false, mode: 'create', entry: null });
|
||||
const archive = ref({ open: false, entry: null });
|
||||
const openDialog = (mode, entry = null) => (dialog.value = { open: true, mode, entry });
|
||||
|
||||
function remove(entry) {
|
||||
if (window.confirm(`„${entry.title}“ mit allen Fassungen löschen?`)) {
|
||||
router.delete(`/qm/eintraege/${entry.id}`, { preserveScroll: true });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout :title="folder.name">
|
||||
<PageHeader :title="folder.name" :breadcrumbs="crumbs">
|
||||
<template #leading>
|
||||
<span class="grid size-12 shrink-0 place-items-center rounded-lg text-white shadow-xs" :class="color.tile"><QmIcon :icon="folder.icon" class="size-6" /></span>
|
||||
</template>
|
||||
<template #actions>
|
||||
<Button v-if="adminUrl" variant="outline" class="h-10" as-child><a :href="adminUrl"><FolderCog /> Ordner bearbeiten</a></Button>
|
||||
<QmSearchBox />
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div class="grid items-start gap-6" :class="{ 'lg:grid-cols-[minmax(0,1fr)_20rem]': hasAside }">
|
||||
<div class="grid min-w-0 gap-6">
|
||||
<section v-if="folder.intro" class="relative overflow-hidden rounded-lg border bg-card p-5 pl-6">
|
||||
<span class="absolute inset-y-0 left-0 w-1.5" :class="color.tile" aria-hidden="true" />
|
||||
<div class="prose prose-sm max-w-none dark:prose-invert" v-html="folder.intro" />
|
||||
</section>
|
||||
|
||||
<section v-if="children.length">
|
||||
<h2 class="mb-3 text-sm font-semibold text-muted-foreground">Unterordner</h2>
|
||||
<div class="grid grid-cols-[repeat(auto-fill,minmax(11.5rem,1fr))] gap-3">
|
||||
<FolderTile v-for="child in children" :key="child.id" :folder="child" small />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div class="mb-3 flex items-center justify-between gap-3">
|
||||
<h2 class="text-sm font-semibold text-muted-foreground">Dokumente <span v-if="entries.length" class="font-normal">({{ entries.length }})</span></h2>
|
||||
<Button v-if="canManage" size="sm" @click="openDialog('create')"><FilePlus2 /> Eintrag hinzufügen</Button>
|
||||
</div>
|
||||
<EntryTable
|
||||
v-if="entries.length"
|
||||
:entries="entries"
|
||||
:can-manage="canManage"
|
||||
@edit="(e) => openDialog('edit', e)"
|
||||
@new-version="(e) => openDialog('version', e)"
|
||||
@archive="(e) => (archive = { open: true, entry: e })"
|
||||
@remove="remove"
|
||||
/>
|
||||
<div v-else class="rounded-lg border border-dashed bg-card">
|
||||
<EmptyState :icon="Files" title="Noch keine Dokumente" :text="canManage ? 'Mit „Eintrag hinzufügen“ Dateien, Links oder Formulare ergänzen.' : ''" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<aside v-if="hasAside" class="rounded-lg border bg-card">
|
||||
<h2 class="flex items-center gap-2 border-b px-4 py-2.5 text-sm font-semibold"><Users class="size-4" :class="color.text" /> {{ folder.contacts.length === 1 ? 'Ansprechpartner*in' : 'Ansprechpartner*innen' }}</h2>
|
||||
<div class="grid gap-4 p-4">
|
||||
<ContactCard v-for="contact in folder.contacts" :key="contact.id" :contact="contact" />
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<EntryDialog v-if="canManage" v-model:open="dialog.open" :mode="dialog.mode" :entry="dialog.entry" :folder-id="folder.id" :forms="forms" :max-upload-mb="maxUploadMb" />
|
||||
<ArchiveDialog v-if="canManage" v-model:open="archive.open" :entry="archive.entry" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
80
plugins-core/qm/resources/js/pages/Index.vue
Normal file
80
plugins-core/qm/resources/js/pages/Index.vue
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { FolderCog, ShieldCheck, Users } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { qmColor } from '../colors';
|
||||
import ContactCard from '../components/ContactCard.vue';
|
||||
import FolderTile from '../components/FolderTile.vue';
|
||||
import QmSearchBox from '../components/QmSearchBox.vue';
|
||||
|
||||
defineProps({
|
||||
intro: { type: String, default: '' },
|
||||
contacts: { type: Array, default: () => [] },
|
||||
officers: { type: Array, default: () => [] },
|
||||
categories: { type: Array, required: true },
|
||||
canManage: { type: Boolean, default: false },
|
||||
adminUrl: { type: String, default: null },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Qualitätsmanagement">
|
||||
<PageHeader title="Qualitätsmanagement" description="Verfahrensanweisungen, Standards und Formulare – immer in der gültigen Fassung.">
|
||||
<template #actions>
|
||||
<Button v-if="adminUrl" variant="outline" class="h-10" as-child><a :href="adminUrl"><FolderCog /> Ordner verwalten</a></Button>
|
||||
<QmSearchBox />
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div v-if="intro || contacts.length" class="mb-8 grid items-start gap-6" :class="{ 'lg:grid-cols-[minmax(0,1fr)_20rem]': intro && contacts.length }">
|
||||
<section v-if="intro" class="relative overflow-hidden rounded-lg border bg-card p-5 pl-6">
|
||||
<span class="absolute inset-y-0 left-0 w-1.5 bg-brand" aria-hidden="true" />
|
||||
<div class="prose prose-sm max-w-none dark:prose-invert" v-html="intro" />
|
||||
</section>
|
||||
<aside v-if="contacts.length" class="rounded-lg border bg-card">
|
||||
<h2 class="flex items-center gap-2 border-b px-4 py-2.5 text-sm font-semibold"><Users class="size-4 text-brand-text" /> {{ contacts.length === 1 ? 'Ansprechpartner*in QM' : 'Ansprechpartner*innen QM' }}</h2>
|
||||
<div class="grid gap-4 p-4" :class="{ 'sm:grid-cols-2 lg:grid-cols-1': !intro }">
|
||||
<ContactCard v-for="contact in contacts" :key="contact.id" :contact="contact" />
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<div v-if="categories.length" class="grid gap-8">
|
||||
<section v-for="category in categories" :key="category.id ?? 'rest'">
|
||||
<div class="mb-3 flex items-center gap-3">
|
||||
<h2 class="text-sm font-semibold tracking-wide whitespace-nowrap text-muted-foreground uppercase">{{ category.name }}</h2>
|
||||
<span class="h-px flex-1 bg-border" aria-hidden="true" />
|
||||
</div>
|
||||
<div class="grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-4">
|
||||
<FolderTile v-for="folder in category.folders" :key="folder.id" :folder="folder" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<section v-if="officers.length" class="mt-10">
|
||||
<div class="mb-3 flex items-center gap-3">
|
||||
<h2 class="text-sm font-semibold tracking-wide whitespace-nowrap text-muted-foreground uppercase">QM-Beauftragte</h2>
|
||||
<span class="h-px flex-1 bg-border" aria-hidden="true" />
|
||||
</div>
|
||||
<ul class="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||||
<li v-for="(officer, index) in officers" :key="`${officer.id}-${index}`" class="rounded-lg border bg-card p-4">
|
||||
<div class="mb-3 flex flex-wrap items-center gap-2">
|
||||
<span v-if="officer.area" class="rounded bg-brand-soft px-2 py-0.5 text-xs font-medium text-brand-soft-foreground">{{ officer.area }}</span>
|
||||
<Link v-if="officer.folder" :href="officer.folder.url" class="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:underline">
|
||||
<span class="size-2 rounded-sm" :class="qmColor(officer.folder.color).dot" />{{ officer.folder.path }}
|
||||
</Link>
|
||||
</div>
|
||||
<ContactCard :contact="officer" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<div v-if="!categories.length" class="rounded-lg border bg-card">
|
||||
<EmptyState :icon="ShieldCheck" title="Noch keine Ordner" :text="canManage ? 'Legen Sie Kategorien und Ordner im Admin-Bereich unter „Qualitätsmanagement“ an.' : 'Hier erscheinen bald die QM-Dokumente.'">
|
||||
<Button v-if="adminUrl" class="mt-4" as-child><a :href="adminUrl">Ordner anlegen</a></Button>
|
||||
</EmptyState>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
67
plugins-core/qm/resources/js/pages/Search.vue
Normal file
67
plugins-core/qm/resources/js/pages/Search.vue
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ClipboardList, ExternalLink, SearchX, TextSearch } from '@lucide/vue';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import FileIcon from '@/components/FileIcon.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { qmColor } from '../colors';
|
||||
import QmSearchBox from '../components/QmSearchBox.vue';
|
||||
import { formatStand } from '../format';
|
||||
|
||||
defineProps({
|
||||
query: { type: String, default: '' },
|
||||
results: { type: Array, default: () => [] },
|
||||
});
|
||||
|
||||
// Lesen im Portal: Suchbegriff mitgeben
|
||||
const openUrl = (result, query) => (result.open_kind === 'view' ? `${result.open_url}?suche=${encodeURIComponent(query)}` : result.open_url);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout :title="`Suche: ${query}`">
|
||||
<PageHeader :title="query ? `Suche: ${query}` : 'Suche'" :breadcrumbs="[{ label: 'Qualitätsmanagement', href: '/qm' }]" :description="query ? `${results.length} ${results.length === 1 ? 'Treffer' : 'Treffer'} im Qualitätsmanagement – in Titeln und im Text der Dokumente` : ''">
|
||||
<template #actions><QmSearchBox :key="query" :initial="query" /></template>
|
||||
</PageHeader>
|
||||
|
||||
<ul v-if="results.length" class="divide-y overflow-hidden rounded-lg border bg-card">
|
||||
<li v-for="result in results" :key="result.id" class="flex gap-3 px-4 py-3.5 hover:bg-accent/40">
|
||||
<FileIcon v-if="result.type === 'file'" :extension="result.extension" />
|
||||
<span v-else class="grid size-10 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground">
|
||||
<ClipboardList v-if="result.type === 'form'" class="size-5" /><ExternalLink v-else class="size-5" />
|
||||
</span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex flex-wrap items-baseline gap-x-2">
|
||||
<component
|
||||
:is="result.open_kind === 'view' ? Link : 'a'"
|
||||
:href="openUrl(result, query)"
|
||||
:target="result.open_kind === 'link' ? '_blank' : undefined"
|
||||
class="text-[15px] font-semibold hover:underline"
|
||||
>
|
||||
{{ result.title }}
|
||||
</component>
|
||||
<span v-if="result.version" class="text-xs text-muted-foreground">Version {{ result.version }}</span>
|
||||
<span class="text-xs text-muted-foreground">Stand {{ formatStand(result.valid_from) }}</span>
|
||||
</div>
|
||||
<Link :href="result.folder.url" class="mt-0.5 inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:underline">
|
||||
<span class="size-2 rounded-sm" :class="qmColor(result.folder.color).dot" />{{ result.folder.path }}
|
||||
</Link>
|
||||
<p v-if="result.snippet" class="qm-snippet mt-1.5 text-[13px] leading-relaxed text-muted-foreground" v-html="result.snippet" />
|
||||
<p v-if="result.in_content" class="mt-1 inline-flex items-center gap-1 text-[11px] font-medium text-brand-text"><TextSearch class="size-3" /> im Text gefunden</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-else-if="query" class="rounded-lg border bg-card">
|
||||
<EmptyState :icon="SearchX" title="Nichts gefunden" text="Gesucht wird in Titeln, Beschreibungen, Dateinamen und im Text der Dokumente. Eingescannte PDFs sind nur durchsuchbar, wenn die Texterkennung eingerichtet ist." />
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.qm-snippet mark {
|
||||
background: color-mix(in srgb, var(--brand, #f59e0b) 22%, transparent);
|
||||
color: var(--foreground);
|
||||
border-radius: 2px;
|
||||
padding: 0 1px;
|
||||
}
|
||||
</style>
|
||||
44
plugins-core/qm/resources/js/pages/Viewer.vue
Normal file
44
plugins-core/qm/resources/js/pages/Viewer.vue
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<script setup>
|
||||
import { Head, Link } from '@inertiajs/vue3';
|
||||
import { ArrowLeft, Download, ExternalLink, FileDown } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { qmColor } from '../colors';
|
||||
import PdfViewer from '../components/PdfViewer.vue';
|
||||
import { formatSize, formatStand } from '../format';
|
||||
|
||||
defineProps({
|
||||
entry: { type: Object, required: true },
|
||||
file: { type: Object, required: true },
|
||||
query: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout :title="entry.title">
|
||||
<Head :title="entry.title" />
|
||||
<div class="flex h-[calc(100vh-9.5rem)] min-h-[32rem] flex-col overflow-hidden rounded-lg border bg-card">
|
||||
<header class="flex flex-wrap items-center gap-x-4 gap-y-2 border-b px-4 py-3">
|
||||
<Link :href="entry.folder.url" class="grid size-9 place-items-center rounded-md hover:bg-accent" :aria-label="`Zurück zu ${entry.folder.path}`"><ArrowLeft class="size-5" /></Link>
|
||||
<div class="min-w-0 flex-1">
|
||||
<Link :href="entry.folder.url" class="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:underline">
|
||||
<span class="size-2 rounded-sm" :class="qmColor(entry.folder.color).dot" />{{ entry.folder.path }}
|
||||
</Link>
|
||||
<h1 class="truncate text-lg leading-tight font-semibold">{{ entry.title }}</h1>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
<template v-if="entry.version">Version {{ entry.version }} · </template>Stand {{ formatStand(entry.valid_from) }} · {{ formatSize(entry.size) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Button v-if="entry.editable" variant="outline" size="sm" as-child><a :href="entry.editable.url"><FileDown /> Vorlage ({{ entry.editable.extension }})</a></Button>
|
||||
<Button variant="outline" size="sm" as-child><a :href="file.url" target="_blank" rel="noopener"><ExternalLink /> In neuem Tab</a></Button>
|
||||
<Button size="sm" as-child><a :href="entry.download_url"><Download /> Herunterladen</a></Button>
|
||||
</div>
|
||||
</header>
|
||||
<PdfViewer v-if="file.kind === 'pdf'" :url="file.url" class="min-h-0 flex-1" />
|
||||
<div v-else class="grid min-h-0 flex-1 place-items-center overflow-auto bg-muted/60 p-6">
|
||||
<img :src="file.url" :alt="entry.title" class="max-h-full max-w-full rounded shadow-md" />
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
21
plugins-core/qm/routes/web.php
Normal file
21
plugins-core/qm/routes/web.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inhaus\Plugins\Qm\Http\Controllers\QmController;
|
||||
use Inhaus\Plugins\Qm\Http\EnsureQmAccess;
|
||||
|
||||
Route::middleware(['auth', EnsureQmAccess::class])->prefix('qm')->name('qm.')->controller(QmController::class)
|
||||
->where(['folder' => '[0-9]+', 'entry' => '[0-9]+', 'file' => '[0-9]+'])
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::get('/suche', 'search')->name('search');
|
||||
Route::get('/ordner/{folder}', 'folder')->name('folder');
|
||||
Route::get('/lesen/{entry}', 'view')->name('view');
|
||||
Route::get('/datei/{file}/{name}', 'file')->name('file');
|
||||
|
||||
// Pflege (Recht „qm.manage“)
|
||||
Route::post('/ordner/{folder}/eintraege', 'store')->name('entries.store');
|
||||
Route::post('/eintraege/{entry}', 'update')->name('entries.update'); // POST wegen Datei-Upload
|
||||
Route::delete('/eintraege/{entry}', 'destroy')->name('entries.destroy');
|
||||
Route::get('/eintraege/{entry}/archiv', 'archive')->name('entries.archive');
|
||||
});
|
||||
43
plugins-core/qm/src/Colors.php
Normal file
43
plugins-core/qm/src/Colors.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
/**
|
||||
* Feste Farbpalette für QM-Ordner – abgestimmt auf gut lesbare weiße Schrift
|
||||
* (Kontrast ≥ 4,5:1) in hellem und dunklem Modus. Unterordner erben die Farbe.
|
||||
*/
|
||||
final class Colors
|
||||
{
|
||||
public const DEFAULT = 'blue';
|
||||
|
||||
/** Schlüssel => [Bezeichnung, Hex] – die Hex-Werte entsprechen den Tailwind-Klassen im Frontend. */
|
||||
public const PALETTE = [
|
||||
'blue' => ['Blau', '#2563eb'],
|
||||
'sky' => ['Himmelblau', '#0369a1'],
|
||||
'teal' => ['Petrol', '#0f766e'],
|
||||
'emerald' => ['Smaragd', '#047857'],
|
||||
'green' => ['Grün', '#15803d'],
|
||||
'amber' => ['Bernstein', '#b45309'],
|
||||
'orange' => ['Orange', '#c2410c'],
|
||||
'red' => ['Rot', '#dc2626'],
|
||||
'rose' => ['Rosé', '#e11d48'],
|
||||
'violet' => ['Violett', '#7c3aed'],
|
||||
'indigo' => ['Indigo', '#4f46e5'],
|
||||
'slate' => ['Schiefer', '#475569'],
|
||||
];
|
||||
|
||||
public static function has(?string $key): bool
|
||||
{
|
||||
return $key !== null && isset(self::PALETTE[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Für Filament-Select mit ->allowHtml(): Farbfeld und Name.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function options(): array
|
||||
{
|
||||
return collect(self::PALETTE)->map(fn (array $color) => '<span style="display:inline-flex;align-items:center;gap:8px"><span style="width:16px;height:16px;border-radius:4px;background:'.$color[1].'"></span>'.e($color[0]).'</span>')->all();
|
||||
}
|
||||
}
|
||||
163
plugins-core/qm/src/Filament/Pages/QmSettings.php
Normal file
163
plugins-core/qm/src/Filament/Pages/QmSettings.php
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Pages;
|
||||
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Settings;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Inhaus\Plugins\Qm\Presenter;
|
||||
use Inhaus\Plugins\Qm\QmAccess;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
use Inhaus\Plugins\Qm\Text\Ocr;
|
||||
use UnitEnum;
|
||||
|
||||
class QmSettings extends Page
|
||||
{
|
||||
protected string $view = 'filament.pages.settings-form';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedAdjustmentsHorizontal;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Qualitätsmanagement';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected static ?string $navigationLabel = 'QM-Einstellungen';
|
||||
|
||||
protected static ?string $title = 'QM-Einstellungen';
|
||||
|
||||
protected static ?string $slug = 'qm-einstellungen';
|
||||
|
||||
/** @var array<string, mixed>|null */
|
||||
public ?array $data = [];
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()?->can('qm.manage') ?? false;
|
||||
}
|
||||
|
||||
public function mount(Settings $settings): void
|
||||
{
|
||||
$this->form->fill([
|
||||
'home_intro' => (string) $settings->get(Presenter::HOME_INTRO, ''),
|
||||
'home_contacts' => array_map('strval', (array) $settings->get(Presenter::HOME_CONTACTS, [])),
|
||||
'officers' => array_values(array_map(fn ($row) => ['user_id' => (string) ($row['user_id'] ?? ''), 'area' => $row['area'] ?? null, 'folder_id' => isset($row['folder_id']) ? (string) $row['folder_id'] : null], (array) $settings->get(Presenter::OFFICERS, []))),
|
||||
'contact_fields' => (array) $settings->get(Presenter::CONTACT_FIELDS, Presenter::DEFAULT_CONTACT_FIELDS),
|
||||
'excluded_roles' => array_map('strval', (array) $settings->get(QmAccess::EXCLUDED_ROLES, [])),
|
||||
'ocr_enabled' => (bool) $settings->get(Ocr::SETTING_ENABLED, false),
|
||||
'ocr_binary' => (string) $settings->get(Ocr::SETTING_BINARY, ''),
|
||||
]);
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
$people = fn () => User::query()->where('is_active', true)->orderBy('last_name')->orderBy('first_name')->get()
|
||||
->mapWithKeys(fn (User $u) => [(string) $u->id => $u->name.($u->job_title ? ' – '.$u->job_title : '')])->all();
|
||||
|
||||
return $schema->statePath('data')->components([
|
||||
Section::make('Startseite des Qualitätsmanagements')
|
||||
->description('Einführungstext, Hauptansprechpartner und die Liste der QM-Beauftragten auf /qm.')
|
||||
->schema([
|
||||
RichEditor::make('home_intro')->label('Einführungstext')
|
||||
->toolbarButtons(['bold', 'italic', 'link', 'bulletList', 'orderedList', 'h3', 'blockquote', 'undo', 'redo']),
|
||||
Select::make('home_contacts')->label('Hauptansprechpartner')->multiple()->searchable()->native(false)
|
||||
->options($people)
|
||||
->helperText('Erscheinen neben dem Einführungstext – z. B. die QM-Leitung.'),
|
||||
Repeater::make('officers')->label('QM-Beauftragte')
|
||||
->addActionLabel('QM-Beauftragte*n hinzufügen')
|
||||
->reorderableWithDragAndDrop()
|
||||
->defaultItems(0)
|
||||
->columns(3)
|
||||
->schema([
|
||||
Select::make('user_id')->label('Person')->required()->searchable()->native(false)->options($people),
|
||||
TextInput::make('area')->label('Zuständigkeit')->maxLength(120)->placeholder('z. B. Pflege, Standort Nord'),
|
||||
Select::make('folder_id')->label('Ordner (optional)')->searchable()->native(false)
|
||||
->options(fn () => collect(app(QmTree::class)->options())->mapWithKeys(fn ($name, $id) => [(string) $id => $name])->all()),
|
||||
]),
|
||||
]),
|
||||
|
||||
Section::make('Ansprechpartner')
|
||||
->description('Welche Angaben aus dem Profil bei Ansprechpartnern und QM-Beauftragten erscheinen. Name und Foto werden immer gezeigt.')
|
||||
->schema([
|
||||
CheckboxList::make('contact_fields')->hiddenLabel()->columns(3)
|
||||
->options(fn () => app(Presenter::class)->contactFieldOptions()),
|
||||
]),
|
||||
|
||||
Section::make('Zugang')
|
||||
->description('Grundsätzlich sehen alle angemeldeten Personen das Qualitätsmanagement; pflegen darf nur, wer das Recht „Qualitätsmanagement pflegen“ hat (ohne Vergabe: die Administration).')
|
||||
->schema([
|
||||
Select::make('excluded_roles')->label('Ausgeschlossene Rollen')->multiple()->native(false)
|
||||
->options(fn () => Role::query()->orderBy('name')->pluck('name', 'id')->mapWithKeys(fn ($name, $id) => [(string) $id => $name])->all())
|
||||
->helperText('Wer eine dieser Rollen hat, sieht das Modul nicht – weder im Menü noch über Links (z. B. Klient*innen, Gäste). Der Ausschluss geht anderen Rollen vor.'),
|
||||
]),
|
||||
|
||||
Section::make('Texterkennung (OCR) für eingescannte PDFs')
|
||||
->description('Text aus PDF, Word, Excel und PowerPoint wird immer durchsuchbar gemacht. Eingescannte PDFs ohne Textebene brauchen dafür eine Texterkennung auf dem Server.')
|
||||
->columns(2)
|
||||
->schema([
|
||||
Text::make(fn () => $this->ocrStatus())->columnSpanFull(),
|
||||
Toggle::make('ocr_enabled')->label('Texterkennung verwenden')
|
||||
->helperText('Läuft im Hintergrund (Hintergrundaufgaben), einige Dateien je Durchgang.'),
|
||||
TextInput::make('ocr_binary')->label('Pfad zu Tesseract')->placeholder('tesseract')->maxLength(200)
|
||||
->regex('#^(/[\w./-]+|[\w.-]+)$#')
|
||||
->helperText('Nur nötig, wenn das Programm nicht im Suchpfad liegt, z. B. /usr/bin/tesseract.'),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function save(Settings $settings): void
|
||||
{
|
||||
$data = $this->form->getState();
|
||||
$options = app(Presenter::class)->contactFieldOptions();
|
||||
|
||||
$settings->setMany([
|
||||
Presenter::HOME_INTRO => (string) ($data['home_intro'] ?? ''),
|
||||
Presenter::HOME_CONTACTS => array_values(array_map('intval', (array) ($data['home_contacts'] ?? []))),
|
||||
Presenter::OFFICERS => array_values(array_map(fn ($row) => [
|
||||
'user_id' => (int) $row['user_id'],
|
||||
'area' => filled($row['area'] ?? null) ? trim($row['area']) : null,
|
||||
'folder_id' => filled($row['folder_id'] ?? null) ? (int) $row['folder_id'] : null,
|
||||
], array_filter((array) ($data['officers'] ?? []), fn ($row) => filled($row['user_id'] ?? null)))),
|
||||
Presenter::CONTACT_FIELDS => array_values(array_intersect((array) $data['contact_fields'], array_keys($options))),
|
||||
QmAccess::EXCLUDED_ROLES => array_values(array_map('intval', (array) $data['excluded_roles'])),
|
||||
Ocr::SETTING_ENABLED => (bool) $data['ocr_enabled'],
|
||||
Ocr::SETTING_BINARY => trim((string) $data['ocr_binary']),
|
||||
]);
|
||||
|
||||
Audit::log('qm.settings_saved', ['excluded_roles' => count((array) $data['excluded_roles'])]);
|
||||
Notification::make()->success()->title('Gespeichert')->send();
|
||||
}
|
||||
|
||||
private function ocrStatus(): HtmlString
|
||||
{
|
||||
$status = app(Ocr::class)->status();
|
||||
$pending = DB::table('qm_files')->where('text_status', 'needs_ocr')->whereNull('archived_at')->count();
|
||||
$ok = fn (bool $v) => $v ? '<span style="color:rgb(22 163 74)">✔</span>' : '<span style="color:rgb(220 38 38)">✘</span>';
|
||||
|
||||
return new HtmlString(
|
||||
'<div style="display:grid;gap:4px;font-size:13px">'
|
||||
.'<div>'.$ok($status['exec']).' Programme aufrufen erlaubt (PHP-Funktion proc_open)</div>'
|
||||
.'<div>'.$ok($status['tesseract'] !== null).' Tesseract: '.e($status['tesseract'] ?? 'nicht gefunden')
|
||||
.($status['languages'] ? ' · Sprachen: '.e(implode(', ', array_slice($status['languages'], 0, 8))) : '').'</div>'
|
||||
.'<div>'.$ok($status['rasterizer'] !== null).' PDF-Seiten in Bilder umwandeln: '.e($status['rasterizer'] ?? 'weder pdftoppm noch Imagick mit Ghostscript').'</div>'
|
||||
.'<div style="margin-top:4px">'.$pending.' eingescannte Datei(en) warten auf Texterkennung.</div>'
|
||||
.'<div style="margin-top:6px;opacity:.75">Einrichtung auf eigenem Server (Debian/Ubuntu): <code>apt install tesseract-ocr tesseract-ocr-deu poppler-utils</code>. Ein Apache-Modul gibt es dafür nicht; Tesseract ist ein eigenständiges Programm, das PHP aufruft.</div>'
|
||||
.'</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmCategories\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmCategories\QmCategoryResource;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
|
||||
class ManageQmCategories extends ManageRecords
|
||||
{
|
||||
protected static string $resource = QmCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [CreateAction::make()->label('Kategorie anlegen')->after(fn () => QmTree::flush())];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmCategories;
|
||||
|
||||
use App\Filament\Components\AudienceSection;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmCategories\Pages\ManageQmCategories;
|
||||
use Inhaus\Plugins\Qm\Models\QmCategory;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* Kategorien der QM-Startseite (Überschrift mit Trennlinie über den Ordnerkacheln).
|
||||
*/
|
||||
class QmCategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = QmCategory::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Qualitätsmanagement';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $modelLabel = 'QM-Kategorie';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Kategorien';
|
||||
|
||||
protected static ?string $slug = 'qm-kategorien';
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()?->can('qm.manage') ?? false;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->columns(2)->components([
|
||||
TextInput::make('name')->label('Name')->required()->maxLength(120)->placeholder('z. B. Allgemein'),
|
||||
TextInput::make('sort')->label('Reihenfolge')->numeric()->default(0),
|
||||
AudienceSection::make('qm_category', 'Wer die Kategorie samt allen Ordnern sieht. Leer lassen = alle, die das QM-Modul sehen.')->columnSpanFull()->collapsed(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('sort')
|
||||
->reorderable('sort')
|
||||
->modifyQueryUsing(fn ($query) => $query->withCount('folders'))
|
||||
->columns([
|
||||
TextColumn::make('name')->label('Name')->weight('medium'),
|
||||
TextColumn::make('folders_count')->label('Ordner'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->after(fn () => QmTree::flush()),
|
||||
DeleteAction::make()->modalDescription('Die Ordner bleiben erhalten und erscheinen unter „Weitere“.'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return ['index' => ManageQmCategories::route('/')];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmFolders\Pages;
|
||||
|
||||
use App\Support\Theme\SvgSanitizer;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmFolders\QmFolderResource;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
|
||||
class CreateQmFolder extends CreateRecord
|
||||
{
|
||||
protected static string $resource = QmFolderResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['created_by'] = auth()->id();
|
||||
|
||||
if (filled($data['parent_id'] ?? null)) {
|
||||
$data['category_id'] = null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
SvgSanitizer::sanitizeFile($this->record->icon_path);
|
||||
QmTree::flush();
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return QmFolderResource::getUrl('index');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmFolders\Pages;
|
||||
|
||||
use App\Support\Theme\SvgSanitizer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmFolders\QmFolderResource;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
|
||||
class EditQmFolder extends EditRecord
|
||||
{
|
||||
protected static string $resource = QmFolderResource::class;
|
||||
|
||||
private ?string $previousIcon = null;
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
$this->previousIcon = $this->record->icon_path;
|
||||
|
||||
if (filled($data['parent_id'] ?? null)) {
|
||||
$data['category_id'] = null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function afterSave(): void
|
||||
{
|
||||
if ($this->previousIcon && $this->previousIcon !== $this->record->icon_path) {
|
||||
Storage::disk('uploads')->delete($this->previousIcon);
|
||||
}
|
||||
|
||||
SvgSanitizer::sanitizeFile($this->record->icon_path);
|
||||
QmTree::flush();
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('open')->label('Im Portal ansehen')->icon(Heroicon::OutlinedEye)->color('gray')
|
||||
->url(fn () => route('qm.folder', $this->record))->openUrlInNewTab(),
|
||||
DeleteAction::make()->visible(fn () => ! $this->record->entries()->exists() && ! $this->record->children()->exists()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmFolders\Pages;
|
||||
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmFolders\QmFolderResource;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
|
||||
class ListQmFolders extends ListRecords
|
||||
{
|
||||
protected static string $resource = QmFolderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('portal')->label('QM im Portal')->icon(Heroicon::OutlinedEye)->color('gray')->url('/qm')->openUrlInNewTab(),
|
||||
CreateAction::make()->label('Ordner anlegen'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* In Baumreihenfolge: jeder Ordner direkt unter seinem übergeordneten.
|
||||
*/
|
||||
protected function applySortingToTableQuery(Builder $query): Builder
|
||||
{
|
||||
$order = array_keys(app(QmTree::class)->options());
|
||||
|
||||
return $order === [] ? $query : $query->orderByRaw('FIELD(id, '.implode(',', array_map('intval', $order)).')');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmFolders;
|
||||
|
||||
use App\Support\Icons;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Inhaus\Plugins\Qm\Colors;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmFolders\Pages\CreateQmFolder;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmFolders\Pages\EditQmFolder;
|
||||
use Inhaus\Plugins\Qm\Filament\Resources\QmFolders\Pages\ListQmFolders;
|
||||
use Inhaus\Plugins\Qm\Models\QmCategory;
|
||||
use Inhaus\Plugins\Qm\Models\QmFolder;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* QM-Ordner: Struktur, Farbe und Symbol (werden vererbt), Einführungstext und
|
||||
* Ansprechpartner. Dokumente pflegt das QM-Team direkt im Portal.
|
||||
*/
|
||||
class QmFolderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = QmFolder::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedFolder;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Qualitätsmanagement';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static ?string $modelLabel = 'QM-Ordner';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Ordner';
|
||||
|
||||
protected static ?string $slug = 'qm-ordner';
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()?->can('qm.manage') ?? false;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->columns(1)->components([
|
||||
Section::make('Ordner')->columns(2)->schema([
|
||||
TextInput::make('name')->label('Name')->required()->maxLength(120),
|
||||
Select::make('parent_id')->label('Übergeordneter Ordner')->placeholder('– oberste Ebene –')->searchable()->native(false)->live()
|
||||
->options(fn (?QmFolder $record) => collect(app(QmTree::class)->options())
|
||||
->except($record ? [$record->id, ...app(QmTree::class)->descendantIds([$record->id])] : [])->all()),
|
||||
Select::make('category_id')->label('Kategorie auf der QM-Startseite')->native(false)
|
||||
->options(fn () => QmCategory::query()->orderBy('sort')->pluck('name', 'id')->all())
|
||||
->required(fn (Get $get) => blank($get('parent_id')))
|
||||
->visible(fn (Get $get) => blank($get('parent_id')))
|
||||
->helperText('Nur für Ordner der obersten Ebene. Kategorien legen Sie unter „Kategorien“ an.'),
|
||||
TextInput::make('sort')->label('Reihenfolge')->numeric()->default(0),
|
||||
]),
|
||||
|
||||
Section::make('Farbe und Symbol')
|
||||
->description('Unterordner übernehmen Farbe und Symbol, solange dort nichts eigenes gewählt ist.')
|
||||
->columns(2)
|
||||
->schema([
|
||||
Select::make('color')->label('Farbe')->native(false)->allowHtml()
|
||||
->options(Colors::options())
|
||||
->placeholder(fn (Get $get) => blank($get('parent_id')) ? 'Standard (Blau)' : 'Vom übergeordneten Ordner übernehmen'),
|
||||
Select::make('icon')->label('Symbol')->native(false)->allowHtml()->searchable()
|
||||
->options(Icons::options())
|
||||
->getSearchResultsUsing(fn (string $search) => Icons::search($search))
|
||||
->getOptionLabelUsing(fn (?string $value) => $value ? Icons::option($value) : null)
|
||||
->placeholder(fn (Get $get) => blank($get('parent_id')) ? 'Ordner' : 'Vom übergeordneten Ordner übernehmen')
|
||||
->helperText('Alle 1.800+ Symbole über die Suche (englische Namen).'),
|
||||
FileUpload::make('icon_path')->label('Oder eigenes Symbol hochladen')
|
||||
->disk('uploads')->directory('qm-icons')->visibility('public')
|
||||
->acceptedFileTypes(['image/svg+xml', 'image/png', 'image/webp', 'image/jpeg'])->maxSize(1024)
|
||||
->helperText('SVG (empfohlen), PNG, WebP oder JPG, quadratisch. Ersetzt das Symbol aus der Auswahl.')
|
||||
->live(),
|
||||
Toggle::make('icon_mono')->label('Eigenes Symbol einfarbig darstellen')->default(true)
|
||||
->helperText('Wie die mitgelieferten Symbole: weiß auf der Kachel. Für farbige Logos ausschalten.')
|
||||
->visible(fn (Get $get) => filled($get('icon_path'))),
|
||||
]),
|
||||
|
||||
Section::make('Einführungstext')->schema([
|
||||
RichEditor::make('intro')->hiddenLabel()
|
||||
->toolbarButtons(['bold', 'italic', 'link', 'bulletList', 'orderedList', 'h3', 'blockquote', 'undo', 'redo']),
|
||||
]),
|
||||
|
||||
Section::make('Ansprechpartner')
|
||||
->description('Welche Angaben aus dem Profil erscheinen (Telefon, E-Mail …), legen Sie unter „QM-Einstellungen“ fest.')
|
||||
->schema([
|
||||
Select::make('contacts')->hiddenLabel()->multiple()->searchable()->preload()
|
||||
->relationship('contacts', 'name', fn ($query) => $query->where('is_active', true)->orderBy('last_name'))
|
||||
->getOptionLabelFromRecordUsing(fn ($record) => $record->name.($record->job_title ? ' – '.$record->job_title : '')),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
$tree = app(QmTree::class);
|
||||
|
||||
return $table
|
||||
->modifyQueryUsing(fn ($query) => $query->withCount('entries'))
|
||||
->defaultSort('name')
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('name')->label('Ordner')->weight('medium')->searchable()
|
||||
->formatStateUsing(function (string $state, QmFolder $record) use ($tree) {
|
||||
$node = $tree->folder($record->id);
|
||||
$depth = max(0, count($tree->path($record->id)) - 1);
|
||||
$hex = Colors::PALETTE[$node['color'] ?? Colors::DEFAULT][1];
|
||||
|
||||
return new HtmlString(str_repeat('<span style="display:inline-block;width:20px"></span>', $depth)
|
||||
.'<span style="display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:8px;background:'.$hex.'"></span>'.e($state));
|
||||
}),
|
||||
TextColumn::make('category.name')->label('Kategorie')->placeholder('–'),
|
||||
TextColumn::make('entries_count')->label('Einträge'),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('open')->label('Im Portal')->icon(Heroicon::OutlinedArrowTopRightOnSquare)->iconButton()
|
||||
->url(fn (QmFolder $record) => route('qm.folder', $record))->openUrlInNewTab(),
|
||||
EditAction::make(),
|
||||
DeleteAction::make()->visible(fn (QmFolder $record) => $record->entries_count === 0 && ! $record->children()->exists()),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListQmFolders::route('/'),
|
||||
'create' => CreateQmFolder::route('/neu'),
|
||||
'edit' => EditQmFolder::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
259
plugins-core/qm/src/Http/Controllers/QmController.php
Normal file
259
plugins-core/qm/src/Http/Controllers/QmController.php
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Audit;
|
||||
use App\Support\RichText;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Inhaus\Plugins\Qm\Library;
|
||||
use Inhaus\Plugins\Qm\Models\QmEntry;
|
||||
use Inhaus\Plugins\Qm\Models\QmFile;
|
||||
use Inhaus\Plugins\Qm\Models\QmFolder;
|
||||
use Inhaus\Plugins\Qm\Presenter;
|
||||
use Inhaus\Plugins\Qm\QmAccess;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
use Inhaus\Plugins\Qm\Search;
|
||||
use Symfony\Component\HttpFoundation\Response as HttpResponse;
|
||||
|
||||
class QmController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly QmTree $tree,
|
||||
private readonly Presenter $presenter,
|
||||
private readonly QmAccess $access,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$counts = $this->entryCounts();
|
||||
|
||||
$settings = app(Settings::class);
|
||||
|
||||
return Inertia::render('qm::Index', [
|
||||
'intro' => app(RichText::class)->sanitize((string) $settings->get(Presenter::HOME_INTRO, '')),
|
||||
'contacts' => $this->presenter->homeContacts($request->user()),
|
||||
'officers' => $this->presenter->officers($request->user()),
|
||||
'categories' => collect($this->tree->categories($request->user()))->map(fn (array $category) => [
|
||||
'id' => $category['id'],
|
||||
'name' => $category['name'],
|
||||
'folders' => array_map(fn (int $id) => $this->presenter->tile($id, $counts), $category['folders']),
|
||||
])->values(),
|
||||
'canManage' => $this->access->canManage($request->user()),
|
||||
'adminUrl' => $this->access->canManage($request->user()) ? url('/admin/qm-ordner') : null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function folder(Request $request, QmFolder $folder): Response
|
||||
{
|
||||
abort_unless($this->tree->isVisible($folder->id, $request->user()), 404);
|
||||
|
||||
$counts = $this->entryCounts();
|
||||
$canManage = $this->access->canManage($request->user());
|
||||
$entries = $folder->entries()->with(['readingFile', 'editableFile'])->orderBy('sort')->orderBy('title')->get();
|
||||
$node = $this->tree->folder($folder->id);
|
||||
|
||||
return Inertia::render('qm::Folder', [
|
||||
'folder' => [
|
||||
'id' => $folder->id,
|
||||
'name' => $folder->name,
|
||||
'color' => $node['color'],
|
||||
'icon' => $node['icon'],
|
||||
'intro' => app(RichText::class)->sanitize($folder->intro),
|
||||
'contacts' => $this->presenter->contacts($folder->contacts()->get(), $request->user()),
|
||||
],
|
||||
'breadcrumbs' => array_map(fn (array $f) => ['id' => $f['id'], 'name' => $f['name'], 'color' => $f['color']], array_slice($this->tree->path($folder->id), 0, -1)),
|
||||
'children' => array_map(fn (int $id) => $this->presenter->tile($id, $counts), $this->tree->childIds($folder->id)),
|
||||
'entries' => $entries->map(fn (QmEntry $entry) => $this->presenter->entry($entry)),
|
||||
'canManage' => $canManage,
|
||||
'forms' => $canManage ? $this->formOptions() : [],
|
||||
'maxUploadMb' => (int) floor(min(Library::MAX_KB / 1024, self::phpUploadLimitMb())),
|
||||
'adminUrl' => $canManage ? url('/admin/qm-ordner/'.$folder->id.'/edit') : null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function search(Request $request, Search $search): Response
|
||||
{
|
||||
$query = trim((string) $request->query('q', ''));
|
||||
|
||||
return Inertia::render('qm::Search', [
|
||||
'query' => $query,
|
||||
'results' => $query === '' ? [] : $search->run($query, $request->user())->map(fn (array $hit) => [
|
||||
...$this->presenter->entry($hit['entry'], withFolder: true),
|
||||
'snippet' => $hit['snippet'],
|
||||
'in_content' => $hit['in_content'],
|
||||
])->values(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Datei zum Lesen im Portal (PDF-Betrachter bzw. Bild).
|
||||
*/
|
||||
public function view(Request $request, QmEntry $entry): Response|RedirectResponse
|
||||
{
|
||||
abort_unless($this->tree->isVisible($entry->folder_id, $request->user()), 404);
|
||||
|
||||
$entry->load(['readingFile', 'editableFile']);
|
||||
$file = $entry->readingFile ?? $entry->editableFile;
|
||||
abort_unless($file, 404);
|
||||
|
||||
if (! $file->isViewable()) {
|
||||
return redirect($file->url());
|
||||
}
|
||||
|
||||
return Inertia::render('qm::Viewer', [
|
||||
'entry' => $this->presenter->entry($entry, withFolder: true),
|
||||
'file' => ['url' => $file->url(inline: true), 'kind' => $file->mime === 'application/pdf' ? 'pdf' : 'image', 'name' => $file->name],
|
||||
'query' => (string) $request->query('suche', ''),
|
||||
]);
|
||||
}
|
||||
|
||||
public function file(Request $request, QmFile $file): HttpResponse
|
||||
{
|
||||
$entry = $file->entry;
|
||||
abort_unless($entry && $this->tree->isVisible($entry->folder_id, $request->user()), 404);
|
||||
// Archivierte Fassungen sieht nur das QM-Team.
|
||||
abort_if($file->archived_at && ! $this->access->canManage($request->user()), 404);
|
||||
|
||||
$headers = ['X-Content-Type-Options' => 'nosniff', 'Cache-Control' => 'private, max-age=300'];
|
||||
|
||||
if ($request->boolean('lesen') && $file->isViewable()) {
|
||||
// Bilder abgeschottet; PDFs ohne sandbox, sonst blockiert Chrome seinen PDF-Betrachter.
|
||||
return Storage::disk(QmFile::DISK)->response($file->path, $file->name, [
|
||||
...$headers,
|
||||
'Content-Type' => $file->mime,
|
||||
...($file->mime === 'application/pdf' ? [] : ['Content-Security-Policy' => "default-src 'none'; sandbox"]),
|
||||
]);
|
||||
}
|
||||
|
||||
return Storage::disk(QmFile::DISK)->download($file->path, $file->name, [...$headers, 'Content-Type' => $file->mime ?: 'application/octet-stream']);
|
||||
}
|
||||
|
||||
public function store(Request $request, QmFolder $folder, Library $library): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$data = $this->validated($request, null);
|
||||
|
||||
$entry = $library->create($folder, $data, $request->file('reading'), $request->file('editable'), $request->user());
|
||||
Audit::log('qm.entry_created', ['entry' => $entry->id, 'title' => $entry->title, 'folder' => $folder->id]);
|
||||
|
||||
return back()->with('status', 'Eintrag „'.$entry->title.'“ angelegt.');
|
||||
}
|
||||
|
||||
public function update(Request $request, QmEntry $entry, Library $library): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$data = $this->validated($request, $entry);
|
||||
|
||||
$library->update($entry, $data, $request->file('reading'), $request->file('editable'), $request->boolean('remove_editable'), $request->user());
|
||||
Audit::log('qm.entry_updated', ['entry' => $entry->id, 'title' => $entry->title, 'new_version' => $request->hasFile('reading') || $request->hasFile('editable')]);
|
||||
|
||||
return back()->with('status', $request->hasFile('reading') || $request->hasFile('editable') ? 'Neue Fassung gespeichert – die bisherige liegt im Archiv.' : 'Gespeichert.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, QmEntry $entry): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$title = $entry->title;
|
||||
$entry->delete();
|
||||
Audit::log('qm.entry_deleted', ['entry' => $entry->id, 'title' => $title]);
|
||||
|
||||
return back()->with('status', '„'.$title.'“ gelöscht.');
|
||||
}
|
||||
|
||||
public function archive(Request $request, QmEntry $entry): JsonResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
|
||||
return response()->json(['files' => $entry->files()->with('uploader:id,first_name,last_name,name')->orderByDesc('created_at')->orderByDesc('id')->get()
|
||||
->map(fn (QmFile $file) => [
|
||||
'id' => $file->id,
|
||||
'kind' => $file->kind,
|
||||
'name' => $file->name,
|
||||
'version' => $file->version,
|
||||
'valid_from' => $file->valid_from?->toDateString(),
|
||||
'size' => $file->size,
|
||||
'uploaded_at' => $file->created_at?->toIso8601String(),
|
||||
'uploader' => $file->uploader?->name,
|
||||
'archived' => $file->archived_at !== null,
|
||||
'url' => $file->url(),
|
||||
])]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function validated(Request $request, ?QmEntry $entry): array
|
||||
{
|
||||
$type = $entry?->type ?? $request->input('type');
|
||||
$fileRule = ['nullable', 'file', 'max:'.Library::MAX_KB, 'extensions:'.implode(',', Library::EXTENSIONS)];
|
||||
|
||||
return $request->validate([
|
||||
'type' => [$entry ? 'nullable' : 'required', Rule::in([QmEntry::FILE, QmEntry::LINK, QmEntry::FORM])],
|
||||
'title' => ['required', 'string', 'max:250'],
|
||||
'description' => ['nullable', 'string', 'max:1000'],
|
||||
'version' => ['nullable', 'string', 'max:30'],
|
||||
'valid_from' => ['nullable', 'date'],
|
||||
'url' => [Rule::requiredIf($type === QmEntry::LINK), 'nullable', 'string', 'max:1000', 'regex:#^(https?://|/)#i'],
|
||||
'form_id' => [Rule::requiredIf($type === QmEntry::FORM), 'nullable', 'integer', Rule::exists('forms', 'id')],
|
||||
'reading' => [...$fileRule, Rule::requiredIf($type === QmEntry::FILE && ! $entry && ! $request->hasFile('editable'))],
|
||||
'editable' => $fileRule,
|
||||
], ['url.regex' => 'Bitte eine Adresse angeben, die mit https:// oder / beginnt.', 'reading.required' => 'Bitte eine Datei auswählen.'], [
|
||||
'title' => 'Titel', 'version' => 'Version', 'valid_from' => 'Stand', 'url' => 'Adresse', 'form_id' => 'Formular',
|
||||
'reading' => 'Datei', 'editable' => 'Bearbeitbare Vorlage',
|
||||
]) + ['type' => $type];
|
||||
}
|
||||
|
||||
private function authorizeManage(Request $request): void
|
||||
{
|
||||
abort_unless($this->access->canManage($request->user()), 403);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, int> Ordner => Anzahl Einträge
|
||||
*/
|
||||
private function entryCounts(): array
|
||||
{
|
||||
return DB::table('qm_entries')->selectRaw('folder_id, count(*) as c')->groupBy('folder_id')->pluck('c', 'folder_id')->map(fn ($c) => (int) $c)->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{value: int, label: string}>
|
||||
*/
|
||||
private function formOptions(): array
|
||||
{
|
||||
if (! DB::getSchemaBuilder()->hasTable('forms')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return DB::table('forms')->orderBy('title')->get(['id', 'title'])->map(fn ($f) => ['value' => (int) $f->id, 'label' => $f->title])->all();
|
||||
}
|
||||
|
||||
private static function phpUploadLimitMb(): float
|
||||
{
|
||||
$bytes = function (string $value): float {
|
||||
$value = trim($value);
|
||||
$unit = strtolower(substr($value, -1));
|
||||
$number = (float) $value;
|
||||
|
||||
return match ($unit) {
|
||||
'g' => $number * 1024 ** 3,
|
||||
'm' => $number * 1024 ** 2,
|
||||
'k' => $number * 1024,
|
||||
default => $number,
|
||||
};
|
||||
};
|
||||
|
||||
$limits = array_filter([$bytes((string) ini_get('upload_max_filesize')), $bytes((string) ini_get('post_max_size'))]);
|
||||
|
||||
return $limits === [] ? 100 : min($limits) / 1024 / 1024;
|
||||
}
|
||||
}
|
||||
21
plugins-core/qm/src/Http/EnsureQmAccess.php
Normal file
21
plugins-core/qm/src/Http/EnsureQmAccess.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Http;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Inhaus\Plugins\Qm\QmAccess;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Ausgeschlossene Rollen (z. B. Klient*innen) sehen das QM-Modul nicht – auch nicht über Links.
|
||||
*/
|
||||
class EnsureQmAccess
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
abort_unless(app(QmAccess::class)->allows($request->user()), 404);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
55
plugins-core/qm/src/Indexer.php
Normal file
55
plugins-core/qm/src/Indexer.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Inhaus\Plugins\Qm\Models\QmFile;
|
||||
use Inhaus\Plugins\Qm\Text\Ocr;
|
||||
use Inhaus\Plugins\Qm\Text\TextExtractor;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Macht den Inhalt von QM-Dateien durchsuchbar: Textauszug beim Hochladen,
|
||||
* Texterkennung für eingescannte PDFs im Hintergrund (wenn eingerichtet).
|
||||
*/
|
||||
class Indexer
|
||||
{
|
||||
public function __construct(private readonly TextExtractor $extractor, private readonly Ocr $ocr) {}
|
||||
|
||||
public function index(QmFile $file): void
|
||||
{
|
||||
$path = Storage::disk(QmFile::DISK)->path($file->path);
|
||||
$result = $this->extractor->extract($path, pathinfo($file->name, PATHINFO_EXTENSION));
|
||||
|
||||
// PDF ohne Text: vermutlich eingescannt → Texterkennung vormerken.
|
||||
$status = $result['status'] === 'empty' && $file->mime === 'application/pdf' ? 'needs_ocr' : $result['status'];
|
||||
|
||||
$file->forceFill(['text' => $result['text'], 'text_status' => $status])->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hintergrundaufgabe: vorgemerkte Scans erkennen. Gibt die Anzahl bearbeiteter Dateien zurück.
|
||||
*/
|
||||
public function processOcr(int $limit = 5): int
|
||||
{
|
||||
if (! $this->ocr->enabled() || ! $this->ocr->available()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$done = 0;
|
||||
|
||||
foreach (QmFile::query()->where('text_status', 'needs_ocr')->whereNull('archived_at')->limit($limit)->get() as $file) {
|
||||
try {
|
||||
$text = $this->ocr->recognize(Storage::disk(QmFile::DISK)->path($file->path));
|
||||
$file->forceFill(['text' => $text !== '' ? $text : null, 'text_status' => $text !== '' ? 'ocr' : 'empty'])->save();
|
||||
} catch (Throwable $e) {
|
||||
logger()->warning("QM-Texterkennung für {$file->name} fehlgeschlagen: ".$e->getMessage());
|
||||
$file->forceFill(['text_status' => 'failed'])->save();
|
||||
}
|
||||
|
||||
$done++;
|
||||
}
|
||||
|
||||
return $done;
|
||||
}
|
||||
}
|
||||
122
plugins-core/qm/src/Library.php
Normal file
122
plugins-core/qm/src/Library.php
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Inhaus\Plugins\Qm\Models\QmEntry;
|
||||
use Inhaus\Plugins\Qm\Models\QmFile;
|
||||
use Inhaus\Plugins\Qm\Models\QmFolder;
|
||||
|
||||
/**
|
||||
* Einträge anlegen, ändern und neue Fassungen hochladen. Eine neue Fassung
|
||||
* schiebt die bisherigen Dateien ins Archiv – nichts geht verloren.
|
||||
*/
|
||||
class Library
|
||||
{
|
||||
/** Erlaubte Dateitypen (Lesefassung vor allem PDF, Vorlagen Office). */
|
||||
public const EXTENSIONS = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'rtf', 'txt', 'csv', 'png', 'jpg', 'jpeg', 'gif', 'webp', 'zip'];
|
||||
|
||||
public const MAX_KB = 102400;
|
||||
|
||||
public function __construct(private readonly Indexer $indexer) {}
|
||||
|
||||
/**
|
||||
* @param array{type: string, title: string, description?: ?string, version?: ?string, valid_from?: ?string, url?: ?string, form_id?: ?int} $data
|
||||
*/
|
||||
public function create(QmFolder $folder, array $data, ?UploadedFile $reading, ?UploadedFile $editable, User $user): QmEntry
|
||||
{
|
||||
return DB::transaction(function () use ($folder, $data, $reading, $editable, $user) {
|
||||
$entry = $folder->entries()->create([
|
||||
...$this->attributes($data),
|
||||
'created_by' => $user->id,
|
||||
'updated_by' => $user->id,
|
||||
]);
|
||||
|
||||
if ($entry->type === QmEntry::FILE) {
|
||||
$this->storeFiles($entry, $reading, $editable, $user);
|
||||
}
|
||||
|
||||
return $entry;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Angaben ändern; mit Datei(en) = neue Fassung (bisherige ins Archiv).
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public function update(QmEntry $entry, array $data, ?UploadedFile $reading, ?UploadedFile $editable, bool $removeEditable, User $user): QmEntry
|
||||
{
|
||||
return DB::transaction(function () use ($entry, $data, $reading, $editable, $removeEditable, $user) {
|
||||
$entry->update([...$this->attributes([...$data, 'type' => $entry->type]), 'updated_by' => $user->id]);
|
||||
|
||||
if ($entry->type !== QmEntry::FILE) {
|
||||
return $entry;
|
||||
}
|
||||
|
||||
if ($reading || $editable) {
|
||||
$this->storeFiles($entry, $reading, $editable, $user);
|
||||
} else {
|
||||
// Nur Angaben korrigiert (z. B. Tippfehler in der Version): aktuelle Dateien anpassen.
|
||||
$entry->files()->whereNull('archived_at')->update(['version' => $entry->version, 'valid_from' => $entry->valid_from]);
|
||||
}
|
||||
|
||||
if ($removeEditable && ! $editable) {
|
||||
$entry->files()->where('kind', QmFile::EDITABLE)->whereNull('archived_at')->update(['archived_at' => now()]);
|
||||
}
|
||||
|
||||
return $entry->refresh();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function attributes(array $data): array
|
||||
{
|
||||
$type = $data['type'];
|
||||
|
||||
return [
|
||||
'type' => $type,
|
||||
'title' => trim((string) $data['title']),
|
||||
'description' => filled($data['description'] ?? null) ? trim((string) $data['description']) : null,
|
||||
'version' => filled($data['version'] ?? null) ? trim((string) $data['version']) : null,
|
||||
'valid_from' => filled($data['valid_from'] ?? null) ? Carbon::parse($data['valid_from'])->toDateString() : now()->toDateString(),
|
||||
'url' => $type === QmEntry::LINK ? trim((string) $data['url']) : null,
|
||||
'form_id' => $type === QmEntry::FORM ? (int) $data['form_id'] : null,
|
||||
];
|
||||
}
|
||||
|
||||
private function storeFiles(QmEntry $entry, ?UploadedFile $reading, ?UploadedFile $editable, User $user): void
|
||||
{
|
||||
foreach ([QmFile::READING => $reading, QmFile::EDITABLE => $editable] as $kind => $upload) {
|
||||
if (! $upload) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry->files()->where('kind', $kind)->whereNull('archived_at')->update(['archived_at' => now()]);
|
||||
|
||||
$name = Str::limit(preg_replace('/[^\pL\pN ._()\-]+/u', '_', $upload->getClientOriginalName()) ?: 'datei', 200, '');
|
||||
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
|
||||
|
||||
$file = $entry->files()->create([
|
||||
'kind' => $kind,
|
||||
'version' => $entry->version,
|
||||
'valid_from' => $entry->valid_from,
|
||||
'name' => $name,
|
||||
'path' => $upload->storeAs('qm/'.$entry->id, Str::random(40).($extension ? '.'.$extension : ''), QmFile::DISK),
|
||||
'mime' => $upload->getMimeType(),
|
||||
'size' => $upload->getSize(),
|
||||
'uploaded_by' => $user->id,
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
$this->indexer->index($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
29
plugins-core/qm/src/Models/QmCategory.php
Normal file
29
plugins-core/qm/src/Models/QmCategory.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
|
||||
/**
|
||||
* Kategorie auf der QM-Startseite (Überschrift mit Trennlinie über den Ordnerkacheln).
|
||||
*/
|
||||
#[Fillable(['name', 'sort'])]
|
||||
class QmCategory extends Model
|
||||
{
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saved(fn () => QmTree::flush());
|
||||
static::deleted(fn () => QmTree::flush());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<QmFolder, $this>
|
||||
*/
|
||||
public function folders(): HasMany
|
||||
{
|
||||
return $this->hasMany(QmFolder::class, 'category_id');
|
||||
}
|
||||
}
|
||||
66
plugins-core/qm/src/Models/QmEntry.php
Normal file
66
plugins-core/qm/src/Models/QmEntry.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
* Ein Eintrag in einem QM-Ordner: Datei (mit Lesefassung und optional bearbeitbarer
|
||||
* Vorlage), Link oder Online-Formular. „Stand“ = valid_from.
|
||||
*/
|
||||
#[Fillable(['folder_id', 'type', 'title', 'description', 'version', 'valid_from', 'url', 'form_id', 'sort', 'created_by', 'updated_by'])]
|
||||
class QmEntry extends Model
|
||||
{
|
||||
public const FILE = 'file';
|
||||
|
||||
public const LINK = 'link';
|
||||
|
||||
public const FORM = 'form';
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
// Dateien mitlöschen (die Datenbank löscht die Zeilen, hier auch die Dateien).
|
||||
static::deleting(fn (QmEntry $entry) => $entry->files()->get()->each->delete());
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['valid_from' => 'date', 'review_due_at' => 'date', 'requires_acknowledgement' => 'boolean'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<QmFolder, $this>
|
||||
*/
|
||||
public function folder(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QmFolder::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<QmFile, $this>
|
||||
*/
|
||||
public function files(): HasMany
|
||||
{
|
||||
return $this->hasMany(QmFile::class, 'entry_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasOne<QmFile, $this>
|
||||
*/
|
||||
public function readingFile(): HasOne
|
||||
{
|
||||
return $this->hasOne(QmFile::class, 'entry_id')->where('kind', QmFile::READING)->whereNull('archived_at');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasOne<QmFile, $this>
|
||||
*/
|
||||
public function editableFile(): HasOne
|
||||
{
|
||||
return $this->hasOne(QmFile::class, 'entry_id')->where('kind', QmFile::EDITABLE)->whereNull('archived_at');
|
||||
}
|
||||
}
|
||||
71
plugins-core/qm/src/Models/QmFile.php
Normal file
71
plugins-core/qm/src/Models/QmFile.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Eine Datei eines QM-Eintrags. Aktuelle Fassung: archived_at = null.
|
||||
* Frühere Fassungen bleiben im Archiv (Nachvollziehbarkeit).
|
||||
*/
|
||||
#[Fillable(['entry_id', 'kind', 'version', 'valid_from', 'name', 'path', 'mime', 'size', 'text', 'text_status', 'archived_at', 'uploaded_by', 'created_at'])]
|
||||
class QmFile extends Model
|
||||
{
|
||||
public const DISK = 'local';
|
||||
|
||||
public const READING = 'reading';
|
||||
|
||||
public const EDITABLE = 'editable';
|
||||
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
/** Im Browser lesbar (eigener Betrachter). */
|
||||
public const VIEWABLE = ['application/pdf', 'image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||
|
||||
protected $hidden = ['text'];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::deleted(fn (QmFile $file) => Storage::disk(self::DISK)->delete($file->path));
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['valid_from' => 'date', 'archived_at' => 'datetime', 'created_at' => 'datetime'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<QmEntry, $this>
|
||||
*/
|
||||
public function entry(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QmEntry::class, 'entry_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function uploader(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'uploaded_by');
|
||||
}
|
||||
|
||||
public function extension(): string
|
||||
{
|
||||
return strtoupper(pathinfo($this->name, PATHINFO_EXTENSION));
|
||||
}
|
||||
|
||||
public function isViewable(): bool
|
||||
{
|
||||
return in_array($this->mime, self::VIEWABLE, true);
|
||||
}
|
||||
|
||||
public function url(bool $inline = false): string
|
||||
{
|
||||
return route('qm.file', ['file' => $this->id, 'name' => $this->name]).($inline ? '?lesen=1' : '');
|
||||
}
|
||||
}
|
||||
73
plugins-core/qm/src/Models/QmFolder.php
Normal file
73
plugins-core/qm/src/Models/QmFolder.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Inhaus\Plugins\Qm\QmTree;
|
||||
|
||||
#[Fillable(['category_id', 'parent_id', 'name', 'color', 'icon', 'icon_path', 'icon_mono', 'intro', 'sort', 'created_by'])]
|
||||
class QmFolder extends Model
|
||||
{
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saved(fn () => QmTree::flush());
|
||||
static::deleted(function (QmFolder $folder) {
|
||||
if ($folder->icon_path) {
|
||||
Storage::disk('uploads')->delete($folder->icon_path);
|
||||
}
|
||||
|
||||
QmTree::flush();
|
||||
});
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['icon_mono' => 'boolean'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<QmCategory, $this>
|
||||
*/
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QmCategory::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<QmFolder, $this>
|
||||
*/
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<QmFolder, $this>
|
||||
*/
|
||||
public function children(): HasMany
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<QmEntry, $this>
|
||||
*/
|
||||
public function entries(): HasMany
|
||||
{
|
||||
return $this->hasMany(QmEntry::class, 'folder_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsToMany<User, $this>
|
||||
*/
|
||||
public function contacts(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'qm_folder_contacts', 'folder_id', 'user_id')->withPivot('sort')->orderByPivot('sort');
|
||||
}
|
||||
}
|
||||
209
plugins-core/qm/src/Presenter.php
Normal file
209
plugins-core/qm/src/Presenter.php
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\ProfileFields;
|
||||
use App\Support\Settings;
|
||||
use Inhaus\Plugins\Qm\Models\QmEntry;
|
||||
|
||||
/**
|
||||
* Daten für das Portal: Ordnerkacheln, Einträge und Ansprechpartner.
|
||||
*/
|
||||
class Presenter
|
||||
{
|
||||
public const CONTACT_FIELDS = 'qm.contact_fields';
|
||||
|
||||
/** Kernfelder des Profils, die bei Ansprechpartnern erscheinen können. */
|
||||
public const CORE_FIELDS = [
|
||||
'job_title' => 'Funktion',
|
||||
'department' => 'Abteilung',
|
||||
'location' => 'Standort',
|
||||
'phone' => 'Telefon',
|
||||
'mobile' => 'Mobil',
|
||||
'email' => 'E-Mail-Adresse',
|
||||
];
|
||||
|
||||
public const DEFAULT_CONTACT_FIELDS = ['job_title', 'phone', 'email'];
|
||||
|
||||
/** QM-Startseite: Einführungstext, Hauptansprechpartner, Liste der QM-Beauftragten */
|
||||
public const HOME_INTRO = 'qm.home.intro';
|
||||
|
||||
public const HOME_CONTACTS = 'qm.home.contacts';
|
||||
|
||||
public const OFFICERS = 'qm.home.officers';
|
||||
|
||||
public function __construct(private readonly QmTree $tree, private readonly Settings $settings, private readonly ProfileFields $profileFields) {}
|
||||
|
||||
/**
|
||||
* @param array<int, int> $counts Ordner => Anzahl Einträge
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function tile(int $id, array $counts = []): array
|
||||
{
|
||||
$folder = $this->tree->folder($id);
|
||||
$children = count($this->tree->childIds($id));
|
||||
|
||||
return [
|
||||
'id' => $id,
|
||||
'name' => $folder['name'],
|
||||
'color' => $folder['color'],
|
||||
'icon' => $folder['icon'],
|
||||
'folders' => $children,
|
||||
'entries' => (int) ($counts[$id] ?? 0),
|
||||
'url' => route('qm.folder', $id),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function entry(QmEntry $entry, bool $withFolder = false): array
|
||||
{
|
||||
$reading = $entry->relationLoaded('readingFile') ? $entry->readingFile : null;
|
||||
$editable = $entry->relationLoaded('editableFile') ? $entry->editableFile : null;
|
||||
$main = $reading ?? $editable;
|
||||
|
||||
$open = match ($entry->type) {
|
||||
QmEntry::LINK => ['url' => $entry->url, 'kind' => 'link'],
|
||||
QmEntry::FORM => ['url' => $entry->form_id ? $this->formUrl($entry->form_id) : null, 'kind' => 'form'],
|
||||
default => $main
|
||||
? ($main->isViewable() ? ['url' => route('qm.view', $entry), 'kind' => 'view'] : ['url' => $main->url(), 'kind' => 'download'])
|
||||
: ['url' => null, 'kind' => 'none'],
|
||||
};
|
||||
|
||||
return [
|
||||
'id' => $entry->id,
|
||||
'type' => $entry->type,
|
||||
'title' => $entry->title,
|
||||
'description' => $entry->description,
|
||||
'version' => $entry->version,
|
||||
'valid_from' => $entry->valid_from?->toDateString(),
|
||||
'size' => $main?->size,
|
||||
'extension' => $main?->extension(),
|
||||
'open_url' => $open['url'],
|
||||
'open_kind' => $open['kind'],
|
||||
'download_url' => $main?->url(),
|
||||
'editable' => $editable ? ['name' => $editable->name, 'extension' => $editable->extension(), 'url' => $editable->url(), 'size' => $editable->size] : null,
|
||||
'searchable' => $main ? in_array($main->text_status, ['ok', 'ocr'], true) : null,
|
||||
'text_status' => $main?->text_status,
|
||||
'url' => $entry->url,
|
||||
'form_id' => $entry->form_id,
|
||||
'folder' => $withFolder ? $this->folderLabel($entry->folder_id) : null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{id: int, path: string, color: string}
|
||||
*/
|
||||
public function folderLabel(int $id): array
|
||||
{
|
||||
return [
|
||||
'id' => $id,
|
||||
'path' => implode(' › ', array_column($this->tree->path($id), 'name')),
|
||||
'color' => $this->tree->folder($id)['color'] ?? Colors::DEFAULT,
|
||||
'url' => route('qm.folder', $id),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ansprechpartner mit den im Admin gewählten Profilfeldern.
|
||||
*
|
||||
* @param iterable<User> $people
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function contacts(iterable $people, ?User $viewer): array
|
||||
{
|
||||
$fields = (array) $this->settings->get(self::CONTACT_FIELDS, self::DEFAULT_CONTACT_FIELDS);
|
||||
$result = [];
|
||||
|
||||
foreach ($people as $person) {
|
||||
if (! $person->is_active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$custom = collect($this->profileFields->visibleValues($person, $viewer))->keyBy('key');
|
||||
|
||||
foreach ($fields as $field) {
|
||||
if (isset(self::CORE_FIELDS[$field])) {
|
||||
$value = $person->{$field};
|
||||
|
||||
if (filled($value)) {
|
||||
$values[] = ['key' => $field, 'label' => self::CORE_FIELDS[$field], 'value' => $value, 'type' => in_array($field, ['phone', 'mobile'], true) ? 'phone' : ($field === 'email' ? 'email' : 'text')];
|
||||
}
|
||||
} elseif (str_starts_with($field, 'custom.') && ($item = $custom->get(substr($field, 7)))) {
|
||||
$values[] = ['key' => $field, 'label' => $item['label'], 'value' => $item['value'], 'type' => $item['type'] ?? 'text'];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = [
|
||||
'id' => $person->id,
|
||||
'name' => $person->name,
|
||||
'initials' => $person->initials,
|
||||
'avatar_url' => $person->avatarUrl(160),
|
||||
'fields' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hauptansprechpartner der QM-Startseite (in der gespeicherten Reihenfolge).
|
||||
*
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function homeContacts(?User $viewer): array
|
||||
{
|
||||
$ids = array_map('intval', (array) $this->settings->get(self::HOME_CONTACTS, []));
|
||||
$users = User::query()->whereIn('id', $ids ?: [0])->get()->keyBy('id');
|
||||
|
||||
return $this->contacts(array_filter(array_map(fn (int $id) => $users[$id] ?? null, $ids)), $viewer);
|
||||
}
|
||||
|
||||
/**
|
||||
* QM-Beauftragte mit Zuständigkeit und optional Ordner.
|
||||
*
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function officers(?User $viewer): array
|
||||
{
|
||||
$rows = array_values(array_filter((array) $this->settings->get(self::OFFICERS, []), fn ($row) => is_array($row) && ! empty($row['user_id'])));
|
||||
$users = User::query()->whereIn('id', array_map(fn ($row) => (int) $row['user_id'], $rows) ?: [0])->get()->keyBy('id');
|
||||
$result = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$user = $users[(int) $row['user_id']] ?? null;
|
||||
$contact = $user ? ($this->contacts([$user], $viewer)[0] ?? null) : null;
|
||||
|
||||
if (! $contact) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$folderId = (int) ($row['folder_id'] ?? 0);
|
||||
$result[] = [
|
||||
...$contact,
|
||||
'area' => filled($row['area'] ?? null) ? (string) $row['area'] : null,
|
||||
'folder' => $folderId && $this->tree->isVisible($folderId, $viewer) ? $this->folderLabel($folderId) : null,
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string> auswählbare Felder für die Einstellungen
|
||||
*/
|
||||
public function contactFieldOptions(): array
|
||||
{
|
||||
return self::CORE_FIELDS + collect($this->profileFields->options())->mapWithKeys(fn ($label, $key) => ['custom.'.$key => $label.' (Profilfeld)'])->all();
|
||||
}
|
||||
|
||||
private function formUrl(int $id): ?string
|
||||
{
|
||||
$class = 'Inhaus\\Plugins\\Forms\\Models\\Form';
|
||||
|
||||
return class_exists($class) ? $class::query()->find($id)?->url() : null;
|
||||
}
|
||||
}
|
||||
40
plugins-core/qm/src/QmAccess.php
Normal file
40
plugins-core/qm/src/QmAccess.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Settings;
|
||||
|
||||
/**
|
||||
* Wer das QM-Modul sehen und pflegen darf.
|
||||
*
|
||||
* - Sehen: alle angemeldeten Personen – außer Mitgliedern ausgeschlossener Rollen
|
||||
* (z. B. Klient*innen). Ausschluss geht vor; wer QM pflegen darf, sieht es immer.
|
||||
* - Pflegen: Recht „qm.manage“ (ohne Vergabe nur die Administration).
|
||||
*/
|
||||
class QmAccess
|
||||
{
|
||||
public const EXCLUDED_ROLES = 'qm.excluded_roles';
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
public function allows(?User $user): bool
|
||||
{
|
||||
if (! $user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->canManage($user)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$excluded = array_map('intval', (array) $this->settings->get(self::EXCLUDED_ROLES, []));
|
||||
|
||||
return $excluded === [] || ! $user->roles()->whereIn('roles.id', $excluded)->exists();
|
||||
}
|
||||
|
||||
public function canManage(?User $user): bool
|
||||
{
|
||||
return (bool) $user?->can('qm.manage');
|
||||
}
|
||||
}
|
||||
36
plugins-core/qm/src/QmPlugin.php
Normal file
36
plugins-core/qm/src/QmPlugin.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Plugins\Plugin;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
use Inhaus\Plugins\Qm\Models\QmCategory;
|
||||
use Inhaus\Plugins\Qm\Text\Ocr;
|
||||
use Inhaus\Plugins\Qm\Text\TextExtractor;
|
||||
|
||||
class QmPlugin extends Plugin
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
foreach ([QmTree::class, QmAccess::class, Presenter::class, Search::class, Library::class, Indexer::class, TextExtractor::class, Ocr::class] as $class) {
|
||||
$this->app->singleton($class);
|
||||
}
|
||||
|
||||
$this->app->make(Navigation::class)->add('qm', 'Qualitätsmanagement', '/qm', active: 'qm.*', sort: 55,
|
||||
visible: fn (User $user) => $this->app->make(QmAccess::class)->allows($user));
|
||||
|
||||
$abilities = $this->app->make(Abilities::class);
|
||||
$abilities->define('qm.manage', 'Qualitätsmanagement pflegen (Ordner, Dokumente, Einstellungen)', 'Qualitätsmanagement');
|
||||
$abilities->resourceType('qm_category', 'QM-Kategorie', fn () => QmCategory::query()->orderBy('sort')->pluck('name', 'id')->all());
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
// Eingescannte PDFs per Texterkennung durchsuchbar machen (nur wenn eingerichtet).
|
||||
Schedule::call(fn () => $this->app->make(Indexer::class)->processOcr())
|
||||
->everyTenMinutes()->name('qm-ocr')->withoutOverlapping(30);
|
||||
}
|
||||
}
|
||||
206
plugins-core/qm/src/QmTree.php
Normal file
206
plugins-core/qm/src/QmTree.php
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Icons;
|
||||
use App\Support\Permissions\Audiences;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Ordnerstruktur des QM-Moduls, zwischengespeichert: Kategorien, Ordner, geerbte
|
||||
* Farben und Sichtbarkeit (je Kategorie, vorbereitet über Zielgruppen).
|
||||
*/
|
||||
class QmTree
|
||||
{
|
||||
private const CACHE_KEY = 'qm.tree';
|
||||
|
||||
/** @var array<string, mixed>|null */
|
||||
private ?array $data = null;
|
||||
|
||||
public static function flush(): void
|
||||
{
|
||||
Cache::forget(self::CACHE_KEY);
|
||||
app(self::class)->data = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{id: int, parent_id: ?int, category_id: ?int, name: string, color: string, own_color: ?string, icon: array{name?: string, url?: string, mono?: bool}, sort: int}|null
|
||||
*/
|
||||
public function folder(int $id): ?array
|
||||
{
|
||||
return $this->data()['folders'][$id] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<int>
|
||||
*/
|
||||
public function childIds(?int $id): array
|
||||
{
|
||||
return $this->data()['children'][$id ?? 0] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>> Weg von oben bis einschließlich des Ordners
|
||||
*/
|
||||
public function path(int $id): array
|
||||
{
|
||||
$path = [];
|
||||
|
||||
for ($folder = $this->folder($id); $folder && count($path) < 50; $folder = $folder['parent_id'] ? $this->folder($folder['parent_id']) : null) {
|
||||
array_unshift($path, $folder);
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<int> $ids
|
||||
* @return list<int>
|
||||
*/
|
||||
public function descendantIds(array $ids): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($ids as $id) {
|
||||
foreach ($this->childIds($id) as $child) {
|
||||
$result[] = $child;
|
||||
array_push($result, ...$this->descendantIds([$child]));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kategorie eines Ordners (die des obersten Ordners im Pfad).
|
||||
*/
|
||||
public function categoryId(int $id): ?int
|
||||
{
|
||||
return $this->path($id)[0]['category_id'] ?? null;
|
||||
}
|
||||
|
||||
public function isVisible(int $id, ?User $user): bool
|
||||
{
|
||||
if (! $this->folder($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$category = $this->categoryId($id);
|
||||
|
||||
return $category === null || $this->categoryVisible($category, $user);
|
||||
}
|
||||
|
||||
public function categoryVisible(int $category, ?User $user): bool
|
||||
{
|
||||
return Audiences::matches($this->data()['category_audiences'][$category] ?? null, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<int>
|
||||
*/
|
||||
public function visibleIds(?User $user): array
|
||||
{
|
||||
return array_values(array_filter(array_keys($this->data()['folders']), fn (int $id) => $this->isVisible($id, $user)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Kategorien mit ihren obersten Ordnern – für die Startseite.
|
||||
*
|
||||
* @return list<array{id: int|null, name: string, folders: list<int>}>
|
||||
*/
|
||||
public function categories(?User $user): array
|
||||
{
|
||||
$groups = [];
|
||||
|
||||
foreach ($this->data()['categories'] as $category) {
|
||||
if (! $this->categoryVisible($category['id'], $user)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$folders = array_values(array_filter($this->childIds(null), fn (int $id) => $this->folder($id)['category_id'] === $category['id']));
|
||||
|
||||
if ($folders !== []) {
|
||||
$groups[] = ['id' => $category['id'], 'name' => $category['name'], 'folders' => $folders];
|
||||
}
|
||||
}
|
||||
|
||||
// Oberste Ordner ohne (gültige) Kategorie
|
||||
$known = array_column($this->data()['categories'], 'id');
|
||||
$rest = array_values(array_filter($this->childIds(null), fn (int $id) => ! in_array($this->folder($id)['category_id'], $known, true)));
|
||||
|
||||
if ($rest !== []) {
|
||||
$groups[] = ['id' => null, 'name' => $groups === [] ? 'Ordner' : 'Weitere', 'folders' => $rest];
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Ordner mit Einrückung – für Auswahllisten.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function options(?int $rootId = null, int $depth = 0): array
|
||||
{
|
||||
$options = [];
|
||||
|
||||
foreach ($this->childIds($rootId) as $id) {
|
||||
$options[$id] = str_repeat('— ', $depth).$this->folder($id)['name'];
|
||||
$options += $this->options($id, $depth + 1);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function data(): array
|
||||
{
|
||||
return $this->data ??= Cache::rememberForever(self::CACHE_KEY, function () {
|
||||
$categories = DB::table('qm_categories')->orderBy('sort')->orderBy('name')->get(['id', 'name'])
|
||||
->map(fn ($c) => ['id' => (int) $c->id, 'name' => $c->name])->all();
|
||||
$rows = DB::table('qm_folders')->orderBy('sort')->orderBy('name')->get(['id', 'parent_id', 'category_id', 'name', 'color', 'icon', 'icon_path', 'icon_mono', 'sort']);
|
||||
|
||||
$folders = [];
|
||||
$children = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$folders[(int) $row->id] = [
|
||||
'id' => (int) $row->id,
|
||||
'parent_id' => $row->parent_id ? (int) $row->parent_id : null,
|
||||
'category_id' => $row->category_id ? (int) $row->category_id : null,
|
||||
'name' => $row->name,
|
||||
'own_color' => Colors::has($row->color) ? $row->color : null,
|
||||
'color' => Colors::DEFAULT,
|
||||
'own_icon' => $row->icon_path
|
||||
? ['url' => Storage::disk('uploads')->url($row->icon_path), 'mono' => (bool) $row->icon_mono]
|
||||
: (Icons::has($row->icon) ? ['name' => $row->icon] : null),
|
||||
'icon' => ['name' => 'folder'],
|
||||
'sort' => (int) $row->sort,
|
||||
];
|
||||
$children[(int) ($row->parent_id ?? 0)][] = (int) $row->id;
|
||||
}
|
||||
|
||||
// Farbe und Symbol vererben: von oben nach unten auflösen.
|
||||
$resolve = function (int $parent, string $color, array $icon) use (&$resolve, &$folders, $children) {
|
||||
foreach ($children[$parent] ?? [] as $id) {
|
||||
$folders[$id]['color'] = $folders[$id]['own_color'] ?? $color;
|
||||
$folders[$id]['icon'] = $folders[$id]['own_icon'] ?? $icon;
|
||||
$resolve($id, $folders[$id]['color'], $folders[$id]['icon']);
|
||||
}
|
||||
};
|
||||
$resolve(0, Colors::DEFAULT, ['name' => 'folder']);
|
||||
|
||||
return [
|
||||
'categories' => $categories,
|
||||
'folders' => $folders,
|
||||
'children' => $children,
|
||||
'category_audiences' => Audiences::allOfType('qm_category'),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
144
plugins-core/qm/src/Search.php
Normal file
144
plugins-core/qm/src/Search.php
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Inhaus\Plugins\Qm\Models\QmEntry;
|
||||
|
||||
/**
|
||||
* Suche nur im QM-Modul: Titel, Beschreibung, Dateiname und Inhalt der aktuellen
|
||||
* Fassungen (Volltextindex, sonst Textsuche). Treffer mit Textausschnitt.
|
||||
*/
|
||||
class Search
|
||||
{
|
||||
public const LIMIT = 50;
|
||||
|
||||
public function __construct(private readonly QmTree $tree) {}
|
||||
|
||||
/**
|
||||
* @return Collection<int, array{entry: QmEntry, snippet: ?string, in_content: bool}>
|
||||
*/
|
||||
public function run(string $query, ?User $user): Collection
|
||||
{
|
||||
$terms = $this->terms($query);
|
||||
|
||||
if ($terms === []) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$folders = $this->tree->visibleIds($user) ?: [0];
|
||||
$like = fn (string $term) => '%'.str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], $term).'%';
|
||||
|
||||
// 1) Metadaten: alle Begriffe in Titel, Beschreibung, Version oder Dateiname
|
||||
$byMeta = QmEntry::query()->whereIn('folder_id', $folders)
|
||||
->where(function (Builder $q) use ($terms, $like) {
|
||||
foreach ($terms as $term) {
|
||||
$q->where(fn (Builder $w) => $w->where('title', 'like', $like($term))
|
||||
->orWhere('description', 'like', $like($term))
|
||||
->orWhere('version', 'like', $like($term))
|
||||
->orWhereHas('files', fn (Builder $f) => $f->whereNull('archived_at')->where('name', 'like', $like($term))));
|
||||
}
|
||||
})
|
||||
->limit(self::LIMIT)->pluck('id')->all();
|
||||
|
||||
// 2) Inhalt: Volltextindex (schnell, mit Gewichtung) – Rückfall auf Textsuche
|
||||
$contentHits = $this->contentMatches($terms, $folders, $like);
|
||||
|
||||
$ids = array_values(array_unique([...$byMeta, ...array_keys($contentHits)]));
|
||||
$entries = QmEntry::query()->whereIn('id', $ids ?: [0])->with(['readingFile', 'editableFile'])->get()->keyBy('id');
|
||||
|
||||
return collect($ids)
|
||||
->filter(fn (int $id) => $entries->has($id))
|
||||
->map(fn (int $id) => [
|
||||
'entry' => $entries[$id],
|
||||
'snippet' => isset($contentHits[$id]) ? $this->snippet($contentHits[$id], $terms) : null,
|
||||
'in_content' => isset($contentHits[$id]) && ! in_array($id, $byMeta, true),
|
||||
])
|
||||
->take(self::LIMIT)
|
||||
->values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $terms
|
||||
* @param list<int> $folders
|
||||
* @return array<int, string> Eintrag => Text
|
||||
*/
|
||||
private function contentMatches(array $terms, array $folders, \Closure $like): array
|
||||
{
|
||||
$base = fn () => DB::table('qm_files')->join('qm_entries', 'qm_entries.id', '=', 'qm_files.entry_id')
|
||||
->whereIn('qm_entries.folder_id', $folders)->whereNull('qm_files.archived_at')->whereNotNull('qm_files.text');
|
||||
|
||||
$rows = collect();
|
||||
|
||||
if (in_array(DB::getDriverName(), ['mysql', 'mariadb'], true) && collect($terms)->every(fn ($t) => mb_strlen($t) >= 3)) {
|
||||
$boolean = implode(' ', array_map(fn ($t) => '+'.preg_replace('/[^\p{L}\p{N}]+/u', '', $t).'*', $terms));
|
||||
$rows = $base()->whereRaw('MATCH(qm_files.text) AGAINST (? IN BOOLEAN MODE)', [$boolean])
|
||||
->orderByRaw('MATCH(qm_files.text) AGAINST (? IN BOOLEAN MODE) DESC', [$boolean])
|
||||
->limit(self::LIMIT)->get(['qm_files.entry_id', 'qm_files.kind', 'qm_files.text']);
|
||||
}
|
||||
|
||||
// Kurze Begriffe, frisch gespeicherte Zeilen oder andere Datenbanken
|
||||
if ($rows->isEmpty()) {
|
||||
$query = $base();
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$query->where('qm_files.text', 'like', $like($term));
|
||||
}
|
||||
|
||||
$rows = $query->limit(self::LIMIT)->get(['qm_files.entry_id', 'qm_files.kind', 'qm_files.text']);
|
||||
}
|
||||
|
||||
// Je Eintrag ein Text – die Lesefassung vor der Vorlage.
|
||||
$texts = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if (! isset($texts[(int) $row->entry_id]) || $row->kind === 'reading') {
|
||||
$texts[(int) $row->entry_id] = (string) $row->text;
|
||||
}
|
||||
}
|
||||
|
||||
return $texts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function terms(string $query): array
|
||||
{
|
||||
$words = preg_split('/\s+/u', mb_strtolower(trim($query)), -1, PREG_SPLIT_NO_EMPTY) ?: [];
|
||||
|
||||
return array_values(array_unique(array_filter(array_slice($words, 0, 8), fn ($w) => mb_strlen($w) >= 2)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ausschnitt rund um den ersten Treffer, Begriffe hervorgehoben (HTML, escaped).
|
||||
*
|
||||
* @param list<string> $terms
|
||||
*/
|
||||
private function snippet(string $text, array $terms): string
|
||||
{
|
||||
$lower = mb_strtolower($text);
|
||||
$position = null;
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$found = mb_strpos($lower, $term);
|
||||
|
||||
if ($found !== false && ($position === null || $found < $position)) {
|
||||
$position = $found;
|
||||
}
|
||||
}
|
||||
|
||||
$start = max(0, ($position ?? 0) - 80);
|
||||
$excerpt = str_replace("\n", ' ', mb_substr($text, $start, 240));
|
||||
$html = ($start > 0 ? '… ' : '').e($excerpt).(mb_strlen($text) > $start + 240 ? ' …' : '');
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$html = preg_replace('/('.preg_quote(e($term), '/').')/iu', '<mark>$1</mark>', $html) ?? $html;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
164
plugins-core/qm/src/Text/Ocr.php
Normal file
164
plugins-core/qm/src/Text/Ocr.php
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Text;
|
||||
|
||||
use App\Support\Settings;
|
||||
use Imagick;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Texterkennung (OCR) für eingescannte PDFs – optional, wenn der Server sie kann:
|
||||
* Tesseract (Programm „tesseract“ mit deutschen Sprachdaten) und ein Umwandler für
|
||||
* PDF-Seiten in Bilder (Programm „pdftoppm“ aus poppler-utils oder PHP-Imagick mit
|
||||
* Ghostscript). Auf Shared Hosting meist nicht vorhanden – dann bleiben solche
|
||||
* Dateien in der Suche nur über ihren Titel auffindbar.
|
||||
*
|
||||
* Einrichtung (Debian/Ubuntu): apt install tesseract-ocr tesseract-ocr-deu poppler-utils
|
||||
*/
|
||||
class Ocr
|
||||
{
|
||||
public const SETTING_ENABLED = 'qm.ocr.enabled';
|
||||
|
||||
public const SETTING_BINARY = 'qm.ocr.tesseract';
|
||||
|
||||
public const MAX_PAGES = 40;
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
public function enabled(): bool
|
||||
{
|
||||
return (bool) $this->settings->get(self::SETTING_ENABLED, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Was auf diesem Server vorhanden ist.
|
||||
*
|
||||
* @return array{exec: bool, // Programme dürfen aufgerufen werden (proc_open)
|
||||
* tesseract: ?string, languages: list<string>, rasterizer: ?string}
|
||||
*/
|
||||
public function status(): array
|
||||
{
|
||||
$exec = function_exists('proc_open') && ! in_array('proc_open', array_map('trim', explode(',', (string) ini_get('disable_functions'))), true);
|
||||
$tesseract = null;
|
||||
$languages = [];
|
||||
|
||||
if ($exec) {
|
||||
$binary = $this->binary();
|
||||
$version = $this->run([$binary, '--version']);
|
||||
|
||||
if ($version !== null && str_contains(strtolower($version), 'tesseract')) {
|
||||
$tesseract = trim(strtok($version, "\n"));
|
||||
$languages = array_values(array_filter(array_map('trim', array_slice(explode("\n", (string) $this->run([$binary, '--list-langs'])), 1))));
|
||||
}
|
||||
}
|
||||
|
||||
return ['exec' => $exec, 'tesseract' => $tesseract, 'languages' => $languages, 'rasterizer' => $this->rasterizer($exec)];
|
||||
}
|
||||
|
||||
public function available(): bool
|
||||
{
|
||||
$status = $this->status();
|
||||
|
||||
return $status['tesseract'] !== null && $status['rasterizer'] !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Text einer PDF-Datei per Texterkennung.
|
||||
*/
|
||||
public function recognize(string $pdf): string
|
||||
{
|
||||
$dir = sys_get_temp_dir().'/inhaus-ocr-'.bin2hex(random_bytes(6));
|
||||
@mkdir($dir, 0700, true);
|
||||
|
||||
try {
|
||||
$images = $this->rasterize($pdf, $dir);
|
||||
$languages = in_array('deu', $this->status()['languages'], true) ? 'deu+eng' : 'eng';
|
||||
$text = '';
|
||||
|
||||
foreach ($images as $image) {
|
||||
$text .= $this->run([$this->binary(), $image, 'stdout', '-l', $languages, '--psm', '1'])."\n";
|
||||
}
|
||||
|
||||
return TextExtractor::normalize($text);
|
||||
} finally {
|
||||
array_map('unlink', glob($dir.'/*') ?: []);
|
||||
@rmdir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
private function binary(): string
|
||||
{
|
||||
$binary = trim((string) $this->settings->get(self::SETTING_BINARY, '')) ?: 'tesseract';
|
||||
|
||||
// Nur ein Programmname oder ein absoluter Pfad – keine Parameter.
|
||||
return preg_match('#^(/[\w./-]+|[\w.-]+)$#', $binary) ? $binary : 'tesseract';
|
||||
}
|
||||
|
||||
private function rasterizer(bool $exec): ?string
|
||||
{
|
||||
if ($exec && $this->run(['pdftoppm', '-v']) !== null) {
|
||||
return 'pdftoppm';
|
||||
}
|
||||
|
||||
try {
|
||||
// Imagick meldet PDF auch ohne Ghostscript – ohne „gs“ scheitert das Umwandeln aber.
|
||||
if ($exec && class_exists(Imagick::class) && in_array('PDF', Imagick::queryFormats('PDF'), true) && $this->run(['gs', '--version']) !== null) {
|
||||
return 'imagick';
|
||||
}
|
||||
} catch (Throwable) {
|
||||
// Imagick ohne PDF-Unterstützung
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string> Bilddateien der Seiten
|
||||
*/
|
||||
private function rasterize(string $pdf, string $dir): array
|
||||
{
|
||||
if ($this->rasterizer(true) === 'pdftoppm') {
|
||||
$this->run(['pdftoppm', '-r', '300', '-gray', '-png', '-l', (string) self::MAX_PAGES, $pdf, $dir.'/seite']);
|
||||
} else {
|
||||
$imagick = new Imagick;
|
||||
$imagick->setResolution(300, 300);
|
||||
$imagick->readImage($pdf.'[0-'.(self::MAX_PAGES - 1).']');
|
||||
|
||||
foreach ($imagick as $index => $page) {
|
||||
$page->setImageFormat('png');
|
||||
$page->writeImage(sprintf('%s/seite-%03d.png', $dir, $index + 1));
|
||||
}
|
||||
|
||||
$imagick->clear();
|
||||
}
|
||||
|
||||
$images = glob($dir.'/seite*.png') ?: [];
|
||||
natsort($images);
|
||||
|
||||
return array_values($images);
|
||||
}
|
||||
|
||||
/**
|
||||
* Programm ohne Shell aufrufen; null, wenn es nicht läuft.
|
||||
*
|
||||
* @param list<string> $command
|
||||
*/
|
||||
protected function run(array $command): ?string
|
||||
{
|
||||
if (! function_exists('proc_open')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$process = @proc_open($command, [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
|
||||
|
||||
if (! is_resource($process)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$output = stream_get_contents($pipes[1]).stream_get_contents($pipes[2]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
return proc_close($process) === 0 ? (string) $output : null;
|
||||
}
|
||||
}
|
||||
120
plugins-core/qm/src/Text/TextExtractor.php
Normal file
120
plugins-core/qm/src/Text/TextExtractor.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Text;
|
||||
|
||||
use Smalot\PdfParser\Parser;
|
||||
use Throwable;
|
||||
use ZipArchive;
|
||||
|
||||
/**
|
||||
* Text aus Dokumenten für die Volltextsuche – in reinem PHP, läuft also auch auf
|
||||
* Shared Hosting. Eingescannte PDFs ohne Textebene liefern nichts; die übernimmt
|
||||
* (falls eingerichtet) die Texterkennung (Ocr).
|
||||
*/
|
||||
class TextExtractor
|
||||
{
|
||||
/** Mehr Text braucht die Suche nicht. */
|
||||
public const MAX_CHARS = 2_000_000;
|
||||
|
||||
/**
|
||||
* @return array{text: ?string, status: string} status: ok | empty | unsupported | failed
|
||||
*/
|
||||
public function extract(string $path, string $extension): array
|
||||
{
|
||||
try {
|
||||
$text = match (strtolower($extension)) {
|
||||
'pdf' => $this->pdf($path),
|
||||
'docx' => $this->xmlInZip($path, ['word/document.xml', 'word/header1.xml', 'word/footer1.xml']),
|
||||
'xlsx' => $this->xmlInZip($path, ['xl/sharedStrings.xml']),
|
||||
'pptx' => $this->xmlInZip($path, $this->zipEntries($path, '#^ppt/slides/slide\d+\.xml$#')),
|
||||
'odt', 'ods', 'odp' => $this->xmlInZip($path, ['content.xml']),
|
||||
'txt', 'csv' => (string) file_get_contents($path, length: self::MAX_CHARS),
|
||||
default => null,
|
||||
};
|
||||
} catch (Throwable $e) {
|
||||
logger()->warning("QM: Text aus {$path} nicht lesbar: ".$e->getMessage());
|
||||
|
||||
return ['text' => null, 'status' => 'failed'];
|
||||
}
|
||||
|
||||
if ($text === null) {
|
||||
return ['text' => null, 'status' => 'unsupported'];
|
||||
}
|
||||
|
||||
$text = self::normalize($text);
|
||||
|
||||
return ['text' => $text === '' ? null : $text, 'status' => $text === '' ? 'empty' : 'ok'];
|
||||
}
|
||||
|
||||
public static function normalize(string $text): string
|
||||
{
|
||||
$text = mb_convert_encoding($text, 'UTF-8', 'UTF-8');
|
||||
$text = preg_replace('/[^\P{C}\n\t]+/u', ' ', $text) ?? '';
|
||||
$text = preg_replace('/[ \t\x{00A0}]+/u', ' ', $text) ?? '';
|
||||
$text = preg_replace('/\s*\n\s*/', "\n", $text) ?? '';
|
||||
|
||||
return mb_substr(trim($text), 0, self::MAX_CHARS);
|
||||
}
|
||||
|
||||
private function pdf(string $path): string
|
||||
{
|
||||
$parser = new Parser;
|
||||
|
||||
return $parser->parseFile($path)->getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $entries
|
||||
*/
|
||||
private function xmlInZip(string $path, array $entries): string
|
||||
{
|
||||
$zip = new ZipArchive;
|
||||
|
||||
if ($zip->open($path) !== true) {
|
||||
throw new \RuntimeException('Keine gültige Office-Datei.');
|
||||
}
|
||||
|
||||
$text = '';
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
$xml = $zip->getFromName($entry);
|
||||
|
||||
if ($xml !== false) {
|
||||
// Absätze und Zellen als Zeilen, dann Tags entfernen.
|
||||
$xml = preg_replace('#</(w:p|a:p|text:p|text:h|si|table:table-cell)>#', "\n", $xml);
|
||||
$text .= html_entity_decode(strip_tags((string) $xml), ENT_QUOTES | ENT_XML1, 'UTF-8')."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function zipEntries(string $path, string $pattern): array
|
||||
{
|
||||
$zip = new ZipArchive;
|
||||
|
||||
if ($zip->open($path) !== true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$names = [];
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$name = (string) $zip->getNameIndex($i);
|
||||
|
||||
if (preg_match($pattern, $name)) {
|
||||
$names[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
natsort($names);
|
||||
|
||||
return array_values($names);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('speiseplan_weeks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->date('week_start')->unique(); // Montag der Woche
|
||||
$table->string('path');
|
||||
$table->string('original_name')->nullable();
|
||||
$table->unsignedInteger('width')->nullable();
|
||||
$table->unsignedInteger('height')->nullable();
|
||||
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('speiseplan_weeks');
|
||||
}
|
||||
};
|
||||
14
plugins-core/speiseplan/plugin.json
Normal file
14
plugins-core/speiseplan/plugin.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"slug": "speiseplan",
|
||||
"name": "Speiseplan",
|
||||
"version": "1.0.0",
|
||||
"description": "Speisepläne der Kantine als Bild je Woche – mehrere Wochen im Voraus, PDF wird automatisch zum Bild. Anzeige der aktuellen und der nächsten Woche, Allergie-Informationen als PDF und randloser A4-Druck.",
|
||||
"author": "Inhaus",
|
||||
"namespace": "Inhaus\\Plugins\\Speiseplan\\",
|
||||
"class": "Inhaus\\Plugins\\Speiseplan\\SpeiseplanPlugin",
|
||||
"enabled_by_default": false,
|
||||
"requires": {
|
||||
"core": ">=0.12.0",
|
||||
"php": ">=8.3"
|
||||
}
|
||||
}
|
||||
113
plugins-core/speiseplan/resources/js/components/ManagePanel.vue
Normal file
113
plugins-core/speiseplan/resources/js/components/ManagePanel.vue
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { router, useForm } from '@inertiajs/vue3';
|
||||
import { FileText, LoaderCircle, Trash2, Upload } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import NativeSelect from '@/components/NativeSelect.vue';
|
||||
import { pdfToImage } from '../pdfToImage';
|
||||
|
||||
const props = defineProps({
|
||||
manage: { type: Object, required: true },
|
||||
allergens: { type: Object, default: null },
|
||||
});
|
||||
|
||||
const form = useForm({ week: props.manage.suggested, image: null });
|
||||
const converting = ref(false);
|
||||
const dragging = ref(false);
|
||||
const fileInput = ref(null);
|
||||
const allergenInput = ref(null);
|
||||
|
||||
async function upload(file) {
|
||||
if (!file) return;
|
||||
|
||||
let image = file;
|
||||
|
||||
if (file.type === 'application/pdf' || /\.pdf$/i.test(file.name)) {
|
||||
converting.value = true;
|
||||
try {
|
||||
image = await pdfToImage(file);
|
||||
} catch {
|
||||
toast.error('Das PDF ließ sich nicht umwandeln. Bitte als Bild hochladen.');
|
||||
|
||||
return;
|
||||
} finally {
|
||||
converting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
form.image = image;
|
||||
form.post('/speiseplan/wochen', {
|
||||
forceFormData: true,
|
||||
preserveScroll: true,
|
||||
onError: (errors) => toast.error(Object.values(errors)[0]),
|
||||
onSuccess: () => {
|
||||
form.image = null;
|
||||
form.week = props.manage.suggested;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function uploadAllergens(file) {
|
||||
if (!file) return;
|
||||
router.post('/speiseplan/allergene', { file }, { forceFormData: true, preserveScroll: true, onError: (e) => toast.error(Object.values(e)[0]) });
|
||||
}
|
||||
|
||||
function remove(plan) {
|
||||
if (window.confirm(`Speiseplan ${plan.label} entfernen?`)) router.delete(`/speiseplan/wochen/${plan.id}`, { preserveScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="mt-10 rounded-lg border bg-card print:hidden">
|
||||
<h2 class="border-b px-5 py-3 text-base font-semibold">Speiseplan hochladen</h2>
|
||||
<div class="grid gap-6 p-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
||||
<div class="grid content-start gap-4">
|
||||
<FormField id="sp-week" label="Woche" :error="form.errors.week">
|
||||
<NativeSelect id="sp-week" v-model="form.week" :options="manage.options" />
|
||||
</FormField>
|
||||
<button
|
||||
type="button"
|
||||
class="grid place-items-center rounded-lg border-2 border-dashed px-6 py-10 text-center transition-colors"
|
||||
:class="dragging ? 'border-brand-400 bg-brand-soft/60' : 'hover:border-brand-300'"
|
||||
:disabled="form.processing || converting"
|
||||
@click="fileInput?.click()"
|
||||
@dragover.prevent="dragging = true"
|
||||
@dragleave.prevent="dragging = false"
|
||||
@drop.prevent="dragging = false; upload($event.dataTransfer.files[0])"
|
||||
>
|
||||
<LoaderCircle v-if="form.processing || converting" class="size-7 animate-spin text-muted-foreground" />
|
||||
<Upload v-else class="size-7 text-muted-foreground" />
|
||||
<span class="mt-2 text-sm font-medium">{{ converting ? 'PDF wird umgewandelt …' : form.processing ? 'Wird hochgeladen …' : 'PDF oder Bild hierher ziehen oder klicken' }}</span>
|
||||
<span class="mt-1 text-xs text-muted-foreground">Ein PDF wird automatisch zum Bild (erste Seite, A4). Ist für die Woche schon ein Plan da, wird er ersetzt.</span>
|
||||
</button>
|
||||
<input ref="fileInput" type="file" accept="application/pdf,image/jpeg,image/png,image/webp" class="hidden" @change="upload($event.target.files[0]); $event.target.value = ''" />
|
||||
|
||||
<div class="flex flex-wrap items-center gap-3 rounded-md bg-muted/50 px-3 py-2.5 text-sm">
|
||||
<FileText class="size-4 text-muted-foreground" />
|
||||
<span class="min-w-0 flex-1 truncate">{{ allergens ? allergens.name : 'Noch keine Allergie-Informationen hinterlegt' }}</span>
|
||||
<Button size="sm" variant="outline" @click="allergenInput?.click()">{{ allergens ? 'Ersetzen' : 'PDF hochladen' }}</Button>
|
||||
<Button v-if="allergens" size="icon" variant="ghost" class="size-8" aria-label="Allergie-Informationen entfernen" @click="router.delete('/speiseplan/allergene', { preserveScroll: true })"><Trash2 /></Button>
|
||||
<input ref="allergenInput" type="file" accept="application/pdf" class="hidden" @change="uploadAllergens($event.target.files[0]); $event.target.value = ''" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p class="mb-2 text-sm font-medium">Hochgeladene Wochen</p>
|
||||
<ul v-if="manage.uploaded.length" class="grid grid-cols-[repeat(auto-fill,minmax(7rem,1fr))] gap-3">
|
||||
<li v-for="plan in manage.uploaded" :key="plan.id" class="group relative">
|
||||
<a :href="plan.image_url" target="_blank" class="block overflow-hidden rounded-md border bg-white" :class="{ 'opacity-60': plan.past }">
|
||||
<img :src="plan.image_url" :alt="plan.label" class="aspect-[210/297] w-full object-cover object-top" loading="lazy" />
|
||||
</a>
|
||||
<p class="mt-1 text-xs font-medium">KW {{ plan.week }}</p>
|
||||
<p class="text-[11px] text-muted-foreground">{{ plan.past ? 'vergangen' : plan.label.split('· ')[1] }}</p>
|
||||
<button type="button" class="absolute top-1 right-1 grid size-7 place-items-center rounded-md bg-card/90 text-destructive opacity-0 shadow-xs ring-1 ring-border group-hover:opacity-100 focus-visible:opacity-100" :aria-label="`KW ${plan.week} entfernen`" @click="remove(plan)"><Trash2 class="size-3.5" /></button>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="text-sm text-muted-foreground">Noch keine Pläne hochgeladen.</p>
|
||||
<p class="mt-3 text-xs text-muted-foreground">Vergangene Wochen werden nach {{ manage.keepWeeks }} Wochen automatisch gelöscht.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
61
plugins-core/speiseplan/resources/js/pages/Index.vue
Normal file
61
plugins-core/speiseplan/resources/js/pages/Index.vue
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<script setup>
|
||||
import { watch } from 'vue';
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
import { FileText, Printer, UtensilsCrossed } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import ManagePanel from '../components/ManagePanel.vue';
|
||||
|
||||
const props = defineProps({
|
||||
weeks: { type: Array, required: true },
|
||||
allergens: { type: Object, default: null },
|
||||
canManage: { type: Boolean, default: false },
|
||||
manage: { type: Object, default: null },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
const printUrl = (ids) => `/speiseplan/druck${ids.length ? `?wochen=${ids.join(',')}` : ''}`;
|
||||
const available = () => props.weeks.filter((w) => w.plan).map((w) => w.plan.id);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Speiseplan">
|
||||
<PageHeader title="Speiseplan" description="Unsere Kantine – diese und nächste Woche.">
|
||||
<template #actions>
|
||||
<Button v-if="allergens" variant="outline" as-child><a :href="allergens.url" target="_blank" rel="noopener"><FileText /> Allergie-Informationen</a></Button>
|
||||
<Button v-if="available().length" as-child><a :href="printUrl(available())" target="_blank" rel="noopener"><Printer /> Drucken</a></Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div class="grid gap-6 lg:grid-cols-2">
|
||||
<section v-for="week in weeks" :key="week.week_start" class="overflow-hidden rounded-lg border bg-card">
|
||||
<header class="flex items-center justify-between gap-3 border-b px-4 py-2.5">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold">{{ week.title }}</h2>
|
||||
<p class="text-xs text-muted-foreground">{{ week.label }}</p>
|
||||
</div>
|
||||
<Button v-if="week.plan" size="sm" variant="ghost" as-child><a :href="printUrl([week.plan.id])" target="_blank" rel="noopener"><Printer /> Nur diese Woche</a></Button>
|
||||
</header>
|
||||
<a v-if="week.plan" :href="week.plan.image_url" target="_blank" rel="noopener" class="block bg-muted/40 p-3" title="In voller Größe öffnen">
|
||||
<img :src="week.plan.image_url" :alt="`Speiseplan ${week.label}`" class="mx-auto w-full max-w-2xl rounded shadow-sm" />
|
||||
</a>
|
||||
<div v-else class="grid aspect-[210/297] max-h-[36rem] w-full place-items-center bg-muted/30 text-center">
|
||||
<div>
|
||||
<UtensilsCrossed class="mx-auto size-8 text-muted-foreground" :stroke-width="1.5" />
|
||||
<p class="mt-2 text-sm text-muted-foreground">Für diese Woche liegt noch kein Speiseplan vor.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<p v-if="allergens" class="mt-6 text-sm">
|
||||
<a :href="allergens.url" target="_blank" rel="noopener" class="inline-flex items-center gap-1.5 font-medium text-brand-text hover:underline"><FileText class="size-4" /> Allergie-Informationen (PDF)</a>
|
||||
</p>
|
||||
|
||||
<ManagePanel v-if="canManage && manage" :manage="manage" :allergens="allergens" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
118
plugins-core/speiseplan/resources/js/pages/Print.vue
Normal file
118
plugins-core/speiseplan/resources/js/pages/Print.vue
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<script setup>
|
||||
import { onMounted } from 'vue';
|
||||
import { Head } from '@inertiajs/vue3';
|
||||
|
||||
/**
|
||||
* Druckansicht ohne Portal-Rahmen: jeder Plan füllt eine A4-Seite randlos.
|
||||
*/
|
||||
const props = defineProps({
|
||||
plans: { type: Array, required: true },
|
||||
});
|
||||
|
||||
function print() {
|
||||
window.print();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// Erst drucken, wenn alle Bilder geladen sind.
|
||||
await Promise.all([...document.querySelectorAll('.sp-page img')].map((img) => (img.complete ? null : new Promise((r) => (img.onload = img.onerror = r)))));
|
||||
if (props.plans.length) setTimeout(print, 150);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Speiseplan drucken" />
|
||||
<div class="sp-toolbar">
|
||||
<strong>Speiseplan drucken</strong>
|
||||
<span>{{ plans.length }} {{ plans.length === 1 ? 'Seite' : 'Seiten' }} · A4, randlos. Falls Adresse oder Datum mitgedruckt werden: im Druckdialog „Kopf- und Fußzeilen“ abschalten.</span>
|
||||
<button type="button" @click="print">Drucken</button>
|
||||
</div>
|
||||
<p v-if="!plans.length" class="sp-empty">Kein Speiseplan zum Drucken vorhanden.</p>
|
||||
<div v-for="plan in plans" :key="plan.id" class="sp-page">
|
||||
<img :src="plan.image_url" :alt="`Speiseplan ${plan.label}`" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@page {
|
||||
size: A4 portrait;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sp-toolbar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
font: 14px/1.4 system-ui, sans-serif;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.sp-toolbar span {
|
||||
flex: 1;
|
||||
color: #6b7280;
|
||||
min-width: 240px;
|
||||
}
|
||||
|
||||
.sp-toolbar button {
|
||||
padding: 6px 14px;
|
||||
border-radius: 6px;
|
||||
background: #111827;
|
||||
color: #fff;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sp-empty {
|
||||
padding: 24px;
|
||||
font: 14px system-ui, sans-serif;
|
||||
}
|
||||
|
||||
.sp-page {
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
margin: 16px auto;
|
||||
box-shadow: 0 1px 6px rgb(0 0 0 / 0.15);
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sp-page img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: fill;
|
||||
}
|
||||
|
||||
@media print {
|
||||
html,
|
||||
body {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
.sp-toolbar,
|
||||
.sp-empty {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.sp-page {
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
break-after: page;
|
||||
page-break-after: always;
|
||||
}
|
||||
|
||||
.sp-page:last-child {
|
||||
break-after: auto;
|
||||
page-break-after: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
28
plugins-core/speiseplan/resources/js/pdfToImage.js
Normal file
28
plugins-core/speiseplan/resources/js/pdfToImage.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Erste Seite eines PDFs als JPEG in A4-Druckqualität (ca. 200 dpi) – im Browser,
|
||||
* damit der Server nichts umwandeln muss.
|
||||
*/
|
||||
export async function pdfToImage(file, targetWidth = 1654) {
|
||||
const [pdfjs, worker] = await Promise.all([import('pdfjs-dist'), import('pdfjs-dist/build/pdf.worker.min.mjs?url')]);
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = worker.default;
|
||||
|
||||
const pdf = await pdfjs.getDocument({ data: await file.arrayBuffer(), isEvalSupported: false, enableXfa: false }).promise;
|
||||
|
||||
try {
|
||||
const page = await pdf.getPage(1);
|
||||
const viewport = page.getViewport({ scale: targetWidth / page.getViewport({ scale: 1 }).width });
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = Math.round(viewport.width);
|
||||
canvas.height = Math.round(viewport.height);
|
||||
const context = canvas.getContext('2d');
|
||||
context.fillStyle = '#ffffff';
|
||||
context.fillRect(0, 0, canvas.width, canvas.height);
|
||||
await page.render({ canvasContext: context, viewport }).promise;
|
||||
|
||||
const blob = await new Promise((resolve) => canvas.toBlob(resolve, 'image/jpeg', 0.9));
|
||||
|
||||
return new File([blob], file.name.replace(/\.pdf$/i, '') + '.jpg', { type: 'image/jpeg' });
|
||||
} finally {
|
||||
pdf.destroy();
|
||||
}
|
||||
}
|
||||
19
plugins-core/speiseplan/routes/web.php
Normal file
19
plugins-core/speiseplan/routes/web.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inhaus\Plugins\Speiseplan\Http\Controllers\SpeiseplanController;
|
||||
|
||||
Route::middleware('auth')->prefix('speiseplan')->name('speiseplan.')->controller(SpeiseplanController::class)
|
||||
->where(['week' => '[0-9]+'])
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::get('/druck', 'print')->name('print');
|
||||
Route::get('/bild/{week}', 'image')->name('image');
|
||||
Route::get('/allergene', 'allergensFile')->name('allergens.show');
|
||||
|
||||
// Pflege (Recht „speiseplan.manage“)
|
||||
Route::post('/wochen', 'store')->name('store');
|
||||
Route::delete('/wochen/{week}', 'destroy')->name('destroy');
|
||||
Route::post('/allergene', 'storeAllergens')->name('allergens.store');
|
||||
Route::delete('/allergene', 'destroyAllergens')->name('allergens.destroy');
|
||||
});
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Speiseplan\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Inhaus\Plugins\Speiseplan\Models\Week;
|
||||
use Inhaus\Plugins\Speiseplan\SpeiseplanPlugin;
|
||||
use Symfony\Component\HttpFoundation\Response as HttpResponse;
|
||||
|
||||
class SpeiseplanController extends Controller
|
||||
{
|
||||
private const ALLERGENS = 'speiseplan.allergens';
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$monday = Week::mondayOf(now());
|
||||
$weeks = Week::query()->whereIn('week_start', [$monday->toDateString(), $monday->copy()->addWeek()->toDateString()])->get()->keyBy(fn (Week $w) => $w->week_start->toDateString());
|
||||
$canManage = (bool) $request->user()->can('speiseplan.manage');
|
||||
|
||||
$slot = fn ($start, string $title) => [
|
||||
'title' => $title,
|
||||
'label' => 'KW '.$start->isoWeek().' · '.$start->format('d.m.').' – '.$start->copy()->addDays(4)->format('d.m.Y'),
|
||||
'week_start' => $start->toDateString(),
|
||||
'plan' => ($w = $weeks->get($start->toDateString())) ? $w->present() : null,
|
||||
];
|
||||
|
||||
return Inertia::render('speiseplan::Index', [
|
||||
'weeks' => [$slot($monday, 'Diese Woche'), $slot($monday->copy()->addWeek(), 'Nächste Woche')],
|
||||
'allergens' => $this->allergens(),
|
||||
'canManage' => $canManage,
|
||||
'manage' => $canManage ? $this->manageData($monday) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Druckansicht: jeder Plan eine A4-Seite, randlos.
|
||||
*/
|
||||
public function print(Request $request): Response
|
||||
{
|
||||
$ids = array_filter(array_map('intval', explode(',', (string) $request->query('wochen', ''))));
|
||||
$monday = Week::mondayOf(now());
|
||||
$query = Week::query()->orderBy('week_start');
|
||||
$ids ? $query->whereIn('id', $ids) : $query->whereIn('week_start', [$monday->toDateString(), $monday->copy()->addWeek()->toDateString()]);
|
||||
|
||||
return Inertia::render('speiseplan::Print', ['plans' => $query->get()->map(fn (Week $w) => $w->present())->values()]);
|
||||
}
|
||||
|
||||
public function image(Week $week): HttpResponse
|
||||
{
|
||||
return Storage::disk(Week::DISK)->response($week->path, 'speiseplan-kw'.$week->week_start->isoWeek().'.'.pathinfo($week->path, PATHINFO_EXTENSION), [
|
||||
'Cache-Control' => 'private, max-age=86400',
|
||||
'X-Content-Type-Options' => 'nosniff',
|
||||
]);
|
||||
}
|
||||
|
||||
private function allergens(): ?array
|
||||
{
|
||||
$file = $this->settings->get(self::ALLERGENS);
|
||||
|
||||
return is_array($file) && ! empty($file['path']) ? ['name' => $file['name'], 'url' => route('speiseplan.allergens.show')] : null;
|
||||
}
|
||||
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$data = $request->validate([
|
||||
'week' => ['required', 'date'],
|
||||
'image' => ['required', 'file', 'max:20480', 'mimes:jpg,jpeg,png,webp'],
|
||||
], ['image.mimes' => 'Bitte ein Bild (JPG, PNG, WebP) oder ein PDF hochladen.'], ['week' => 'Woche', 'image' => 'Speiseplan']);
|
||||
|
||||
$monday = Week::mondayOf($data['week']);
|
||||
$file = $request->file('image');
|
||||
[$width, $height] = @getimagesize($file->getRealPath()) ?: [null, null];
|
||||
$path = $file->storeAs('speiseplan', $monday->toDateString().'-'.Str::random(12).'.'.strtolower($file->extension() ?: 'jpg'), Week::DISK);
|
||||
|
||||
$existing = Week::query()->where('week_start', $monday->toDateString())->first();
|
||||
$old = $existing?->path;
|
||||
Week::query()->updateOrCreate(['week_start' => $monday->toDateString()], [
|
||||
'path' => $path, 'original_name' => $file->getClientOriginalName(), 'width' => $width, 'height' => $height, 'uploaded_by' => $request->user()->id,
|
||||
]);
|
||||
|
||||
if ($old) {
|
||||
Storage::disk(Week::DISK)->delete($old);
|
||||
}
|
||||
|
||||
Audit::log('speiseplan.uploaded', ['week' => $monday->toDateString()]);
|
||||
|
||||
return back()->with('status', 'Speiseplan für KW '.$monday->isoWeek().($existing ? ' ersetzt.' : ' gespeichert.'));
|
||||
}
|
||||
|
||||
public function destroy(Request $request, Week $week): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$week->delete();
|
||||
|
||||
return back()->with('status', 'Speiseplan für KW '.$week->week_start->isoWeek().' entfernt.');
|
||||
}
|
||||
|
||||
public function storeAllergens(Request $request): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$request->validate(['file' => ['required', 'file', 'max:20480', 'mimes:pdf']], [], ['file' => 'Allergie-Informationen']);
|
||||
|
||||
$old = $this->settings->get(self::ALLERGENS);
|
||||
$path = $request->file('file')->storeAs('speiseplan', 'allergene-'.Str::random(12).'.pdf', Week::DISK);
|
||||
$this->settings->set(self::ALLERGENS, ['path' => $path, 'name' => $request->file('file')->getClientOriginalName()]);
|
||||
|
||||
if (is_array($old) && ! empty($old['path'])) {
|
||||
Storage::disk(Week::DISK)->delete($old['path']);
|
||||
}
|
||||
|
||||
return back()->with('status', 'Allergie-Informationen gespeichert.');
|
||||
}
|
||||
|
||||
public function destroyAllergens(Request $request): RedirectResponse
|
||||
{
|
||||
$this->authorizeManage($request);
|
||||
$old = $this->settings->get(self::ALLERGENS);
|
||||
|
||||
if (is_array($old) && ! empty($old['path'])) {
|
||||
Storage::disk(Week::DISK)->delete($old['path']);
|
||||
}
|
||||
|
||||
$this->settings->set(self::ALLERGENS, null);
|
||||
|
||||
return back()->with('status', 'Allergie-Informationen entfernt.');
|
||||
}
|
||||
|
||||
public function allergensFile(): HttpResponse
|
||||
{
|
||||
$file = $this->settings->get(self::ALLERGENS);
|
||||
abort_unless(is_array($file) && ! empty($file['path']) && Storage::disk(Week::DISK)->exists($file['path']), 404);
|
||||
|
||||
return Storage::disk(Week::DISK)->response($file['path'], $file['name'] ?? 'allergene.pdf', ['Content-Type' => 'application/pdf', 'X-Content-Type-Options' => 'nosniff']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function manageData($monday): array
|
||||
{
|
||||
$uploaded = Week::query()->where('week_start', '>=', $monday->copy()->subWeeks(SpeiseplanPlugin::KEEP_WEEKS)->toDateString())->orderBy('week_start')->get()->keyBy(fn (Week $w) => $w->week_start->toDateString());
|
||||
$options = [];
|
||||
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$start = $monday->copy()->addWeeks($i);
|
||||
$options[] = [
|
||||
'value' => $start->toDateString(),
|
||||
'label' => 'KW '.$start->isoWeek().' · '.$start->format('d.m.').' – '.$start->copy()->addDays(4)->format('d.m.Y').($uploaded->has($start->toDateString()) ? ' (vorhanden)' : ''),
|
||||
'uploaded' => $uploaded->has($start->toDateString()),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'options' => $options,
|
||||
'suggested' => collect($options)->firstWhere('uploaded', false)['value'] ?? $options[0]['value'],
|
||||
'uploaded' => $uploaded->values()->map(fn (Week $w) => $w->present() + ['past' => $w->week_start->lt($monday)])->all(),
|
||||
'keepWeeks' => SpeiseplanPlugin::KEEP_WEEKS,
|
||||
];
|
||||
}
|
||||
|
||||
private function authorizeManage(Request $request): void
|
||||
{
|
||||
abort_unless($request->user()->can('speiseplan.manage'), 403);
|
||||
}
|
||||
}
|
||||
52
plugins-core/speiseplan/src/Models/Week.php
Normal file
52
plugins-core/speiseplan/src/Models/Week.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Speiseplan\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Speiseplan einer Kalenderwoche (ein Bild, A4 hoch).
|
||||
*/
|
||||
#[Fillable(['week_start', 'path', 'original_name', 'width', 'height', 'uploaded_by'])]
|
||||
class Week extends Model
|
||||
{
|
||||
public const DISK = 'local';
|
||||
|
||||
protected $table = 'speiseplan_weeks';
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::deleted(fn (Week $week) => Storage::disk(self::DISK)->delete($week->path));
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['week_start' => 'date'];
|
||||
}
|
||||
|
||||
public static function mondayOf(Carbon|string $date): Carbon
|
||||
{
|
||||
return Carbon::parse($date)->startOfWeek(Carbon::MONDAY)->startOfDay();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function present(): array
|
||||
{
|
||||
$end = $this->week_start->copy()->addDays(4);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'week_start' => $this->week_start->toDateString(),
|
||||
'week' => (int) $this->week_start->isoWeek(),
|
||||
'label' => 'KW '.$this->week_start->isoWeek().' · '.$this->week_start->format('d.m.').' – '.$end->format('d.m.Y'),
|
||||
'image_url' => route('speiseplan.image', ['week' => $this->id, 'v' => $this->updated_at?->timestamp]),
|
||||
'width' => $this->width,
|
||||
'height' => $this->height,
|
||||
];
|
||||
}
|
||||
}
|
||||
35
plugins-core/speiseplan/src/SpeiseplanPlugin.php
Normal file
35
plugins-core/speiseplan/src/SpeiseplanPlugin.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Speiseplan;
|
||||
|
||||
use App\Plugins\Plugin;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
use Inhaus\Plugins\Speiseplan\Models\Week;
|
||||
|
||||
class SpeiseplanPlugin extends Plugin
|
||||
{
|
||||
/** Vergangene Wochen bleiben so lange erhalten, dann werden sie gelöscht. */
|
||||
public const KEEP_WEEKS = 2;
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->make(Navigation::class)->add('speiseplan', 'Speiseplan', '/speiseplan', active: 'speiseplan.*', sort: 70);
|
||||
$this->app->make(Abilities::class)->define('speiseplan.manage', 'Speiseplan hochladen', 'Speiseplan');
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
Schedule::call(fn () => self::purge())->dailyAt('03:30')->name('speiseplan-purge')->withoutOverlapping(10);
|
||||
}
|
||||
|
||||
public static function purge(): int
|
||||
{
|
||||
$cutoff = Week::mondayOf(now())->subWeeks(self::KEEP_WEEKS);
|
||||
$old = Week::query()->where('week_start', '<', $cutoff->toDateString())->get();
|
||||
$old->each->delete();
|
||||
|
||||
return $old->count();
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
1
public/build/assets/Accordion-EREUSvuR.js
Normal file
1
public/build/assets/Accordion-EREUSvuR.js
Normal file
File diff suppressed because one or more lines are too long
1
public/build/assets/AppIcon-D29VdJwt.js
Normal file
1
public/build/assets/AppIcon-D29VdJwt.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/build/assets/AppLayout-D2Ut1Cv2.js
Normal file
1
public/build/assets/AppLayout-D2Ut1Cv2.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{_ as e,b as t,bt as n,mt as r,o as i,qt as a,v as o}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as s}from"./Panel-xPHuwfuu.js";import{t as c}from"./NewsCard-CWMFENyt.js";var l={class:`-mx-5 flex snap-x scroll-px-5 gap-4 overflow-x-auto px-5 pb-1 [scrollbar-width:none] sm:mx-0 sm:grid sm:grid-cols-2 sm:overflow-visible sm:px-0 sm:pb-0 xl:grid-cols-4 [&::-webkit-scrollbar]:hidden`},u={__name:`Areas`,props:{posts:{type:Array,required:!0}},setup(u){return(d,f)=>(r(),o(s,{title:`Aktuelles aus den Bereichen`,"action-label":`Alle`,"action-href":`/neuigkeiten`},{default:a(()=>[e(`div`,l,[(r(!0),t(i,null,n(u.posts,e=>(r(),o(c,{key:e.id,post:e,class:`w-[78%] shrink-0 snap-start sm:w-auto`},null,8,[`post`]))),128))])]),_:1}))}};export{u as default};
|
||||
import{_ as e,b as t,bt as n,mt as r,o as i,qt as a,v as o}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as s}from"./Panel-B_811BcC.js";import{t as c}from"./NewsCard-CFmNVfbg.js";var l={class:`-mx-5 flex snap-x scroll-px-5 gap-4 overflow-x-auto px-5 pb-1 [scrollbar-width:none] sm:mx-0 sm:grid sm:grid-cols-2 sm:overflow-visible sm:px-0 sm:pb-0 xl:grid-cols-4 [&::-webkit-scrollbar]:hidden`},u={__name:`Areas`,props:{posts:{type:Array,required:!0}},setup(u){return(d,f)=>(r(),o(s,{title:`Aktuelles aus den Bereichen`,"action-label":`Alle`,"action-href":`/neuigkeiten`},{default:a(()=>[e(`div`,l,[(r(!0),t(i,null,n(u.posts,e=>(r(),o(c,{key:e.id,post:e,class:`w-[78%] shrink-0 snap-start sm:w-auto`},null,8,[`post`]))),128))])]),_:1}))}};export{u as default};
|
||||
1
public/build/assets/Areas-DTSQjZrw.js
Normal file
1
public/build/assets/Areas-DTSQjZrw.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{_ as e,b as t,bt as n,mt as r,o as i,qt as a,v as o}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as s}from"./Panel-DxXU3_Yp.js";import{t as c}from"./NewsCard-BYiLYGDc.js";var l={class:`-mx-5 flex snap-x scroll-px-5 gap-4 overflow-x-auto px-5 pb-1 [scrollbar-width:none] sm:mx-0 sm:grid sm:grid-cols-2 sm:overflow-visible sm:px-0 sm:pb-0 xl:grid-cols-4 [&::-webkit-scrollbar]:hidden`},u={__name:`Areas`,props:{posts:{type:Array,required:!0}},setup(u){return(d,f)=>(r(),o(s,{title:`Aktuelles aus den Bereichen`,"action-label":`Alle`,"action-href":`/neuigkeiten`},{default:a(()=>[e(`div`,l,[(r(!0),t(i,null,n(u.posts,e=>(r(),o(c,{key:e.id,post:e,class:`w-[78%] shrink-0 snap-start sm:w-auto`},null,8,[`post`]))),128))])]),_:1}))}};export{u as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{D as e,On as t,Zn as n,_ as r,b as i,mt as a,qt as o,tr as s,v as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{n as u}from"./app-CIvn5Z1l.js";import{b as d,it as f}from"./AppIcon-BVHFLm12.js";var p={class:`relative shrink-0`},m={key:0,class:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full bg-brand text-brand-foreground ring-2 ring-card`},h={class:`min-w-0 flex-1`},g={class:`block truncate text-sm font-medium group-hover:underline`},_={class:`block truncate text-xs text-muted-foreground`},v={__name:`BirthdayItem`,props:{item:{type:Object,required:!0}},setup(v){let y=e=>new Intl.DateTimeFormat(`de-DE`,{day:`numeric`,month:`long`}).format(new Date(`${e}T12:00:00`)),b=e=>new Intl.DateTimeFormat(`de-DE`,{weekday:`short`}).format(new Date(`${e}T12:00:00`));return(x,S)=>(a(),c(t(u),{href:`/personen/${v.item.person.id}`,class:`group flex items-center gap-3 py-2.5`},{default:o(()=>[r(`span`,p,[e(d,{person:v.item.person,class:`size-10`},null,8,[`person`]),v.item.today?(a(),i(`span`,m,[e(t(f),{class:`size-3`})])):l(``,!0)]),r(`span`,h,[r(`span`,g,s(v.item.person.name),1),r(`span`,_,s(v.item.person.job_title||v.item.person.department),1)]),r(`span`,{class:n([`shrink-0 text-right text-xs`,v.item.today?`font-semibold text-brand-text`:`text-muted-foreground`])},s(v.item.today?`Heute`:`${b(v.item.date)}, ${y(v.item.date)}`),3)]),_:1},8,[`href`]))}};export{v as t};
|
||||
import{D as e,On as t,Zn as n,_ as r,b as i,mt as a,qt as o,tr as s,v as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{n as u}from"./app-CTT3S1d_.js";import{b as d,it as f}from"./AppIcon-D2nBpiR9.js";var p={class:`relative shrink-0`},m={key:0,class:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full bg-brand text-brand-foreground ring-2 ring-card`},h={class:`min-w-0 flex-1`},g={class:`block truncate text-sm font-medium group-hover:underline`},_={class:`block truncate text-xs text-muted-foreground`},v={__name:`BirthdayItem`,props:{item:{type:Object,required:!0}},setup(v){let y=e=>new Intl.DateTimeFormat(`de-DE`,{day:`numeric`,month:`long`}).format(new Date(`${e}T12:00:00`)),b=e=>new Intl.DateTimeFormat(`de-DE`,{weekday:`short`}).format(new Date(`${e}T12:00:00`));return(x,S)=>(a(),c(t(u),{href:`/personen/${v.item.person.id}`,class:`group flex items-center gap-3 py-2.5`},{default:o(()=>[r(`span`,p,[e(d,{person:v.item.person,class:`size-10`},null,8,[`person`]),v.item.today?(a(),i(`span`,m,[e(t(f),{class:`size-3`})])):l(``,!0)]),r(`span`,h,[r(`span`,g,s(v.item.person.name),1),r(`span`,_,s(v.item.person.job_title||v.item.person.department),1)]),r(`span`,{class:n([`shrink-0 text-right text-xs`,v.item.today?`font-semibold text-brand-text`:`text-muted-foreground`])},s(v.item.today?`Heute`:`${b(v.item.date)}, ${y(v.item.date)}`),3)]),_:1},8,[`href`]))}};export{v as t};
|
||||
1
public/build/assets/BirthdayItem-e4ZzvlFn.js
Normal file
1
public/build/assets/BirthdayItem-e4ZzvlFn.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{D as e,On as t,Zn as n,_ as r,b as i,mt as a,qt as o,tr as s,v as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{n as u}from"./app-BBhJdBuh.js";import{b as d,ot as f}from"./AppIcon-D29VdJwt.js";var p={class:`relative shrink-0`},m={key:0,class:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full bg-brand text-brand-foreground ring-2 ring-card`},h={class:`min-w-0 flex-1`},g={class:`block truncate text-sm font-medium group-hover:underline`},_={class:`block truncate text-xs text-muted-foreground`},v={__name:`BirthdayItem`,props:{item:{type:Object,required:!0}},setup(v){let y=e=>new Intl.DateTimeFormat(`de-DE`,{day:`numeric`,month:`long`}).format(new Date(`${e}T12:00:00`)),b=e=>new Intl.DateTimeFormat(`de-DE`,{weekday:`short`}).format(new Date(`${e}T12:00:00`));return(x,S)=>(a(),c(t(u),{href:`/personen/${v.item.person.id}`,class:`group flex items-center gap-3 py-2.5`},{default:o(()=>[r(`span`,p,[e(d,{person:v.item.person,class:`size-10`},null,8,[`person`]),v.item.today?(a(),i(`span`,m,[e(t(f),{class:`size-3`})])):l(``,!0)]),r(`span`,h,[r(`span`,g,s(v.item.person.name),1),r(`span`,_,s(v.item.person.job_title||v.item.person.department),1)]),r(`span`,{class:n([`shrink-0 text-right text-xs`,v.item.today?`font-semibold text-brand-text`:`text-muted-foreground`])},s(v.item.today?`Heute`:`${b(v.item.date)}, ${y(v.item.date)}`),3)]),_:1},8,[`href`]))}};export{v as t};
|
||||
|
|
@ -1 +1 @@
|
|||
import{_ as e,b as t,bt as n,mt as r,o as i,tr as a,v as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as c}from"./BirthdayItem-DK6xURSZ.js";var l={key:0,class:`mb-3 text-lg font-semibold`},u={class:`divide-y rounded-lg border bg-card px-4`},d={key:0,class:`py-3 text-sm text-muted-foreground`},f={__name:`BirthdaysBlock`,props:{block:{type:Object,required:!0}},setup(f){return(p,m)=>(r(),t(`section`,null,[f.block.data.title?(r(),t(`h3`,l,a(f.block.data.title),1)):s(``,!0),e(`div`,u,[(r(!0),t(i,null,n(f.block.props?.birthdays??[],e=>(r(),o(c,{key:`${e.person.id}-${e.date}`,item:e},null,8,[`item`]))),128)),(f.block.props?.birthdays??[]).length?s(``,!0):(r(),t(`p`,d,`Keine anstehenden Geburtstage.`))])]))}};export{f as default};
|
||||
import{_ as e,b as t,bt as n,mt as r,o as i,tr as a,v as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as c}from"./BirthdayItem-e4ZzvlFn.js";var l={key:0,class:`mb-3 text-lg font-semibold`},u={class:`divide-y rounded-lg border bg-card px-4`},d={key:0,class:`py-3 text-sm text-muted-foreground`},f={__name:`BirthdaysBlock`,props:{block:{type:Object,required:!0}},setup(f){return(p,m)=>(r(),t(`section`,null,[f.block.data.title?(r(),t(`h3`,l,a(f.block.data.title),1)):s(``,!0),e(`div`,u,[(r(!0),t(i,null,n(f.block.props?.birthdays??[],e=>(r(),o(c,{key:`${e.person.id}-${e.date}`,item:e},null,8,[`item`]))),128)),(f.block.props?.birthdays??[]).length?s(``,!0):(r(),t(`p`,d,`Keine anstehenden Geburtstage.`))])]))}};export{f as default};
|
||||
1
public/build/assets/BirthdaysBlock-DKXzsm4R.js
Normal file
1
public/build/assets/BirthdaysBlock-DKXzsm4R.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{_ as e,b as t,bt as n,mt as r,o as i,tr as a,v as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as c}from"./BirthdayItem-0nFFkJam.js";var l={key:0,class:`mb-3 text-lg font-semibold`},u={class:`divide-y rounded-lg border bg-card px-4`},d={key:0,class:`py-3 text-sm text-muted-foreground`},f={__name:`BirthdaysBlock`,props:{block:{type:Object,required:!0}},setup(f){return(p,m)=>(r(),t(`section`,null,[f.block.data.title?(r(),t(`h3`,l,a(f.block.data.title),1)):s(``,!0),e(`div`,u,[(r(!0),t(i,null,n(f.block.props?.birthdays??[],e=>(r(),o(c,{key:`${e.person.id}-${e.date}`,item:e},null,8,[`item`]))),128)),(f.block.props?.birthdays??[]).length?s(``,!0):(r(),t(`p`,d,`Keine anstehenden Geburtstage.`))])]))}};export{f as default};
|
||||
1
public/build/assets/Box-BBx7OjxN.js
Normal file
1
public/build/assets/Box-BBx7OjxN.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{J as e,On as t,Zn as n,_ as r,b as i,mt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{L as u,X as d}from"./AppIcon-D29VdJwt.js";import{S as f,v as p,x as m}from"./http-9R3L4KBg.js";import{t as h}from"./circle-alert-qymEjja5.js";var g=[`role`],_={class:`min-w-0 flex-1`},v={key:0,class:`mb-2 font-semibold`},y={__name:`Box`,props:{block:{type:Object,required:!0}},setup(y){let b=e(`pagebuilder:list`),x={info:{icon:m,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`,iconClass:`text-sky-600 dark:text-sky-400`},note:{icon:d,class:`border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100`,iconClass:`text-amber-600 dark:text-amber-400`},warning:{icon:p,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`,iconClass:`text-red-600 dark:text-red-400`},success:{icon:f,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`,iconClass:`text-emerald-600 dark:text-emerald-400`},neutral:{icon:h,class:`border-border bg-muted text-foreground`,iconClass:`text-muted-foreground`},highlight:{icon:u,class:`border-brand-200 bg-brand-soft text-foreground`,iconClass:`text-brand-text`}};return(e,u)=>(a(),i(`aside`,{class:n([`pb-box flex gap-3 rounded-lg border p-4 @xl:p-5`,x[y.block.data.variant]?.class]),role:y.block.data.variant===`warning`?`alert`:`note`},[y.block.data.show_icon?(a(),s(c(x[y.block.data.variant]?.icon),{key:0,class:n([`mt-0.5 size-5 shrink-0`,x[y.block.data.variant]?.iconClass])},null,8,[`class`])):l(``,!0),r(`div`,_,[y.block.data.title?(a(),i(`p`,v,o(y.block.data.title),1)):l(``,!0),(a(),s(c(t(b)),{item:y.block.items[0]},null,8,[`item`]))])],10,g))}};export{y as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{J as e,On as t,Zn as n,_ as r,b as i,mt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{J as u,L as d}from"./AppIcon-BVHFLm12.js";import{S as f,v as p,x as m}from"./http-9R3L4KBg.js";import{t as h}from"./circle-alert-qymEjja5.js";var g=[`role`],_={class:`min-w-0 flex-1`},v={key:0,class:`mb-2 font-semibold`},y={__name:`Box`,props:{block:{type:Object,required:!0}},setup(y){let b=e(`pagebuilder:list`),x={info:{icon:m,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`,iconClass:`text-sky-600 dark:text-sky-400`},note:{icon:u,class:`border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100`,iconClass:`text-amber-600 dark:text-amber-400`},warning:{icon:p,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`,iconClass:`text-red-600 dark:text-red-400`},success:{icon:f,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`,iconClass:`text-emerald-600 dark:text-emerald-400`},neutral:{icon:h,class:`border-border bg-muted text-foreground`,iconClass:`text-muted-foreground`},highlight:{icon:d,class:`border-brand-200 bg-brand-soft text-foreground`,iconClass:`text-brand-text`}};return(e,u)=>(a(),i(`aside`,{class:n([`pb-box flex gap-3 rounded-lg border p-4 @xl:p-5`,x[y.block.data.variant]?.class]),role:y.block.data.variant===`warning`?`alert`:`note`},[y.block.data.show_icon?(a(),s(c(x[y.block.data.variant]?.icon),{key:0,class:n([`mt-0.5 size-5 shrink-0`,x[y.block.data.variant]?.iconClass])},null,8,[`class`])):l(``,!0),r(`div`,_,[y.block.data.title?(a(),i(`p`,v,o(y.block.data.title),1)):l(``,!0),(a(),s(c(t(b)),{item:y.block.items[0]},null,8,[`item`]))])],10,g))}};export{y as default};
|
||||
import{J as e,On as t,Zn as n,_ as r,b as i,mt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{J as u,L as d}from"./AppIcon-D2nBpiR9.js";import{S as f,v as p,x as m}from"./http-9R3L4KBg.js";import{t as h}from"./circle-alert-qymEjja5.js";var g=[`role`],_={class:`min-w-0 flex-1`},v={key:0,class:`mb-2 font-semibold`},y={__name:`Box`,props:{block:{type:Object,required:!0}},setup(y){let b=e(`pagebuilder:list`),x={info:{icon:m,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`,iconClass:`text-sky-600 dark:text-sky-400`},note:{icon:u,class:`border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100`,iconClass:`text-amber-600 dark:text-amber-400`},warning:{icon:p,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`,iconClass:`text-red-600 dark:text-red-400`},success:{icon:f,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`,iconClass:`text-emerald-600 dark:text-emerald-400`},neutral:{icon:h,class:`border-border bg-muted text-foreground`,iconClass:`text-muted-foreground`},highlight:{icon:d,class:`border-brand-200 bg-brand-soft text-foreground`,iconClass:`text-brand-text`}};return(e,u)=>(a(),i(`aside`,{class:n([`pb-box flex gap-3 rounded-lg border p-4 @xl:p-5`,x[y.block.data.variant]?.class]),role:y.block.data.variant===`warning`?`alert`:`note`},[y.block.data.show_icon?(a(),s(c(x[y.block.data.variant]?.icon),{key:0,class:n([`mt-0.5 size-5 shrink-0`,x[y.block.data.variant]?.iconClass])},null,8,[`class`])):l(``,!0),r(`div`,_,[y.block.data.title?(a(),i(`p`,v,o(y.block.data.title),1)):l(``,!0),(a(),s(c(t(b)),{item:y.block.items[0]},null,8,[`item`]))])],10,g))}};export{y as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{Zn as e,_ as t,b as n,g as r,mt as i,o as a,tr as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as c}from"./app-CIvn5Z1l.js";var l={class:`flex items-center gap-3`},u=[`src`,`alt`],d=[`src`,`alt`],f=[`src`,`alt`],p=[`src`,`alt`],m=[`src`],h={class:`text-[17px] font-semibold tracking-tight`},g={__name:`BrandLogo`,props:{inverted:{type:Boolean,default:!1},compact:{type:Boolean,default:!1}},setup(g){let _=g,v=r(()=>c().props.branding),y=r(()=>v.value.portal_name.trim().charAt(0).toUpperCase()),b=r(()=>v.value.logo_dark_url??v.value.logo_url);return(r,c)=>(i(),n(`span`,l,[v.value.logo_url?(i(),n(a,{key:0},[g.compact&&v.value.logo_mark_url?(i(),n(`img`,{key:0,src:v.value.logo_mark_url,alt:v.value.portal_name,class:`size-8 sm:hidden`},null,8,u)):s(``,!0),t(`span`,{class:e(g.compact&&v.value.logo_mark_url?`hidden sm:contents`:`contents`)},[_.inverted?(i(),n(`img`,{key:0,src:b.value,alt:v.value.portal_name,class:`h-8 w-auto`},null,8,d)):(i(),n(a,{key:1},[t(`img`,{src:v.value.logo_url,alt:v.value.portal_name,class:`h-8 w-auto dark:hidden`},null,8,f),t(`img`,{src:b.value,alt:v.value.portal_name,class:`hidden h-8 w-auto dark:block`},null,8,p)],64))],2)],64)):(i(),n(a,{key:1},[v.value.logo_mark_url?(i(),n(`img`,{key:0,src:v.value.logo_mark_url,alt:``,class:`size-8`},null,8,m)):(i(),n(`span`,{key:1,class:e([`grid size-8 place-items-center rounded-md text-base font-bold`,_.inverted?`bg-white/15 text-current`:`bg-brand text-brand-foreground`])},o(y.value),3)),t(`span`,h,o(v.value.portal_name),1)],64))]))}};export{g as t};
|
||||
import{Zn as e,_ as t,b as n,g as r,mt as i,o as a,tr as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as c}from"./app-CTT3S1d_.js";var l={class:`flex items-center gap-3`},u=[`src`,`alt`],d=[`src`,`alt`],f=[`src`,`alt`],p=[`src`,`alt`],m=[`src`],h={class:`text-[17px] font-semibold tracking-tight`},g={__name:`BrandLogo`,props:{inverted:{type:Boolean,default:!1},compact:{type:Boolean,default:!1}},setup(g){let _=g,v=r(()=>c().props.branding),y=r(()=>v.value.portal_name.trim().charAt(0).toUpperCase()),b=r(()=>v.value.logo_dark_url??v.value.logo_url);return(r,c)=>(i(),n(`span`,l,[v.value.logo_url?(i(),n(a,{key:0},[g.compact&&v.value.logo_mark_url?(i(),n(`img`,{key:0,src:v.value.logo_mark_url,alt:v.value.portal_name,class:`size-8 sm:hidden`},null,8,u)):s(``,!0),t(`span`,{class:e(g.compact&&v.value.logo_mark_url?`hidden sm:contents`:`contents`)},[_.inverted?(i(),n(`img`,{key:0,src:b.value,alt:v.value.portal_name,class:`h-8 w-auto`},null,8,d)):(i(),n(a,{key:1},[t(`img`,{src:v.value.logo_url,alt:v.value.portal_name,class:`h-8 w-auto dark:hidden`},null,8,f),t(`img`,{src:b.value,alt:v.value.portal_name,class:`hidden h-8 w-auto dark:block`},null,8,p)],64))],2)],64)):(i(),n(a,{key:1},[v.value.logo_mark_url?(i(),n(`img`,{key:0,src:v.value.logo_mark_url,alt:``,class:`size-8`},null,8,m)):(i(),n(`span`,{key:1,class:e([`grid size-8 place-items-center rounded-md text-base font-bold`,_.inverted?`bg-white/15 text-current`:`bg-brand text-brand-foreground`])},o(y.value),3)),t(`span`,h,o(v.value.portal_name),1)],64))]))}};export{g as t};
|
||||
1
public/build/assets/BrandLogo-CIyNH3Dy.js
Normal file
1
public/build/assets/BrandLogo-CIyNH3Dy.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{Zn as e,_ as t,b as n,g as r,mt as i,o as a,tr as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as c}from"./app-BBhJdBuh.js";var l={class:`flex items-center gap-3`},u=[`src`,`alt`],d=[`src`,`alt`],f=[`src`,`alt`],p=[`src`,`alt`],m=[`src`],h={class:`text-[17px] font-semibold tracking-tight`},g={__name:`BrandLogo`,props:{inverted:{type:Boolean,default:!1},compact:{type:Boolean,default:!1}},setup(g){let _=g,v=r(()=>c().props.branding),y=r(()=>v.value.portal_name.trim().charAt(0).toUpperCase()),b=r(()=>v.value.logo_dark_url??v.value.logo_url);return(r,c)=>(i(),n(`span`,l,[v.value.logo_url?(i(),n(a,{key:0},[g.compact&&v.value.logo_mark_url?(i(),n(`img`,{key:0,src:v.value.logo_mark_url,alt:v.value.portal_name,class:`size-8 sm:hidden`},null,8,u)):s(``,!0),t(`span`,{class:e(g.compact&&v.value.logo_mark_url?`hidden sm:contents`:`contents`)},[_.inverted?(i(),n(`img`,{key:0,src:b.value,alt:v.value.portal_name,class:`h-8 w-auto`},null,8,d)):(i(),n(a,{key:1},[t(`img`,{src:v.value.logo_url,alt:v.value.portal_name,class:`h-8 w-auto dark:hidden`},null,8,f),t(`img`,{src:b.value,alt:v.value.portal_name,class:`hidden h-8 w-auto dark:block`},null,8,p)],64))],2)],64)):(i(),n(a,{key:1},[v.value.logo_mark_url?(i(),n(`img`,{key:0,src:v.value.logo_mark_url,alt:``,class:`size-8`},null,8,m)):(i(),n(`span`,{key:1,class:e([`grid size-8 place-items-center rounded-md text-base font-bold`,_.inverted?`bg-white/15 text-current`:`bg-brand text-brand-foreground`])},o(y.value),3)),t(`span`,h,o(v.value.portal_name),1)],64))]))}};export{g as t};
|
||||
1
public/build/assets/Builder-Bv3pdgeR.js
Normal file
1
public/build/assets/Builder-Bv3pdgeR.js
Normal file
File diff suppressed because one or more lines are too long
1
public/build/assets/Builder-Bv9MhvLT.js
Normal file
1
public/build/assets/Builder-Bv9MhvLT.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{D as e,E as t,On as n,Zn as r,_ as i,b as a,bt as o,mt as s,o as c,qt as l,tr as u,y as d}from"./runtime-core.esm-bundler-B8D2lM98.js";import{n as f}from"./app-CIvn5Z1l.js";import{K as p,b as m}from"./AppIcon-BVHFLm12.js";import{y as h}from"./http-9R3L4KBg.js";var g={key:0,class:`mb-3 text-lg font-semibold`},_={class:`min-w-0`},v={key:0,class:`truncate text-[13px] text-muted-foreground`},y={class:`mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[13px]`},b=[`href`],x=[`href`],S={class:`truncate`},C={key:0,class:`text-sm text-muted-foreground`},w={__name:`Contacts`,props:{block:{type:Object,required:!0}},setup(w){return(T,E)=>(s(),a(`section`,null,[w.block.data.title?(s(),a(`h3`,g,u(w.block.data.title),1)):d(``,!0),i(`div`,{class:r(w.block.data.layout===`list`?`divide-y rounded-lg border bg-card`:`grid gap-4 @xl:grid-cols-2 @4xl:grid-cols-3`)},[(s(!0),a(c,null,o(w.block.props?.people??[],o=>(s(),a(`div`,{key:o.id,class:r([`flex gap-3`,w.block.data.layout===`list`?`items-center px-4 py-3`:`rounded-lg border bg-card p-4`])},[e(m,{person:o,class:`size-12 shrink-0`},null,8,[`person`]),i(`div`,_,[e(n(f),{href:`/personen/${o.id}`,class:`block truncate font-semibold hover:underline`},{default:l(()=>[t(u(o.name),1)]),_:2},1032,[`href`]),o.job_title?(s(),a(`p`,v,u(o.job_title),1)):d(``,!0),i(`div`,y,[o.phone?(s(),a(`a`,{key:0,href:`tel:${o.phone}`,class:`inline-flex items-center gap-1 text-brand-text hover:underline`},[e(n(h),{class:`size-3.5`}),t(` `+u(o.phone),1)],8,b)):d(``,!0),i(`a`,{href:`mailto:${o.email}`,class:`inline-flex min-w-0 items-center gap-1 text-brand-text hover:underline`},[e(n(p),{class:`size-3.5 shrink-0`}),E[0]||=t(),i(`span`,S,u(o.email),1)],8,x)])])],2))),128)),(w.block.props?.people??[]).length?d(``,!0):(s(),a(`p`,C,`Noch keine Personen ausgewählt.`))],2)]))}};export{w as default};
|
||||
import{D as e,E as t,On as n,Zn as r,_ as i,b as a,bt as o,mt as s,o as c,qt as l,tr as u,y as d}from"./runtime-core.esm-bundler-B8D2lM98.js";import{n as f}from"./app-BBhJdBuh.js";import{J as p,b as m}from"./AppIcon-D29VdJwt.js";import{y as h}from"./http-9R3L4KBg.js";var g={key:0,class:`mb-3 text-lg font-semibold`},_={class:`min-w-0`},v={key:0,class:`truncate text-[13px] text-muted-foreground`},y={class:`mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[13px]`},b=[`href`],x=[`href`],S={class:`truncate`},C={key:0,class:`text-sm text-muted-foreground`},w={__name:`Contacts`,props:{block:{type:Object,required:!0}},setup(w){return(T,E)=>(s(),a(`section`,null,[w.block.data.title?(s(),a(`h3`,g,u(w.block.data.title),1)):d(``,!0),i(`div`,{class:r(w.block.data.layout===`list`?`divide-y rounded-lg border bg-card`:`grid gap-4 @xl:grid-cols-2 @4xl:grid-cols-3`)},[(s(!0),a(c,null,o(w.block.props?.people??[],o=>(s(),a(`div`,{key:o.id,class:r([`flex gap-3`,w.block.data.layout===`list`?`items-center px-4 py-3`:`rounded-lg border bg-card p-4`])},[e(m,{person:o,class:`size-12 shrink-0`},null,8,[`person`]),i(`div`,_,[e(n(f),{href:`/personen/${o.id}`,class:`block truncate font-semibold hover:underline`},{default:l(()=>[t(u(o.name),1)]),_:2},1032,[`href`]),o.job_title?(s(),a(`p`,v,u(o.job_title),1)):d(``,!0),i(`div`,y,[o.phone?(s(),a(`a`,{key:0,href:`tel:${o.phone}`,class:`inline-flex items-center gap-1 text-brand-text hover:underline`},[e(n(h),{class:`size-3.5`}),t(` `+u(o.phone),1)],8,b)):d(``,!0),i(`a`,{href:`mailto:${o.email}`,class:`inline-flex min-w-0 items-center gap-1 text-brand-text hover:underline`},[e(n(p),{class:`size-3.5 shrink-0`}),E[0]||=t(),i(`span`,S,u(o.email),1)],8,x)])])],2))),128)),(w.block.props?.people??[]).length?d(``,!0):(s(),a(`p`,C,`Noch keine Personen ausgewählt.`))],2)]))}};export{w as default};
|
||||
1
public/build/assets/Contacts-D60X8jV2.js
Normal file
1
public/build/assets/Contacts-D60X8jV2.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{D as e,E as t,On as n,Zn as r,_ as i,b as a,bt as o,mt as s,o as c,qt as l,tr as u,y as d}from"./runtime-core.esm-bundler-B8D2lM98.js";import{n as f}from"./app-CTT3S1d_.js";import{K as p,b as m}from"./AppIcon-D2nBpiR9.js";import{y as h}from"./http-9R3L4KBg.js";var g={key:0,class:`mb-3 text-lg font-semibold`},_={class:`min-w-0`},v={key:0,class:`truncate text-[13px] text-muted-foreground`},y={class:`mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[13px]`},b=[`href`],x=[`href`],S={class:`truncate`},C={key:0,class:`text-sm text-muted-foreground`},w={__name:`Contacts`,props:{block:{type:Object,required:!0}},setup(w){return(T,E)=>(s(),a(`section`,null,[w.block.data.title?(s(),a(`h3`,g,u(w.block.data.title),1)):d(``,!0),i(`div`,{class:r(w.block.data.layout===`list`?`divide-y rounded-lg border bg-card`:`grid gap-4 @xl:grid-cols-2 @4xl:grid-cols-3`)},[(s(!0),a(c,null,o(w.block.props?.people??[],o=>(s(),a(`div`,{key:o.id,class:r([`flex gap-3`,w.block.data.layout===`list`?`items-center px-4 py-3`:`rounded-lg border bg-card p-4`])},[e(m,{person:o,class:`size-12 shrink-0`},null,8,[`person`]),i(`div`,_,[e(n(f),{href:`/personen/${o.id}`,class:`block truncate font-semibold hover:underline`},{default:l(()=>[t(u(o.name),1)]),_:2},1032,[`href`]),o.job_title?(s(),a(`p`,v,u(o.job_title),1)):d(``,!0),i(`div`,y,[o.phone?(s(),a(`a`,{key:0,href:`tel:${o.phone}`,class:`inline-flex items-center gap-1 text-brand-text hover:underline`},[e(n(h),{class:`size-3.5`}),t(` `+u(o.phone),1)],8,b)):d(``,!0),i(`a`,{href:`mailto:${o.email}`,class:`inline-flex min-w-0 items-center gap-1 text-brand-text hover:underline`},[e(n(p),{class:`size-3.5 shrink-0`}),E[0]||=t(),i(`span`,S,u(o.email),1)],8,x)])])],2))),128)),(w.block.props?.people??[]).length?d(``,!0):(s(),a(`p`,C,`Noch keine Personen ausgewählt.`))],2)]))}};export{w as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{On as e,Zn as t,_ as n,b as r,mt as i,qt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{W as u}from"./AppIcon-BVHFLm12.js";import{S as d,v as f,x as p}from"./http-9R3L4KBg.js";import{t as m}from"./circle-alert-qymEjja5.js";import{t as h}from"./Panel-xPHuwfuu.js";var g=[`src`,`alt`],_={key:0,class:`block px-4 py-3 text-sm font-semibold group-hover:underline`},v={class:`min-w-0 flex-1`},y={key:0,class:`font-semibold`},b=[`innerHTML`],x=[`href`,`target`],S=[`innerHTML`],C=[`href`,`target`],w={__name:`CustomTile`,props:{tile:{type:Object,required:!0}},setup(w){let T={brand:{icon:u,class:`border-brand bg-brand text-brand-foreground`},info:{icon:p,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`},success:{icon:d,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`},warning:{icon:f,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`},neutral:{icon:m,class:`border-border bg-card text-foreground`}};return(d,f)=>w.tile.type===`image`&&w.tile.image_url?(i(),s(c(w.tile.url?`a`:`figure`),{key:0,href:w.tile.url||void 0,target:w.tile.url&&w.tile.new_tab?`_blank`:void 0,rel:w.tile.url&&w.tile.new_tab?`noopener`:void 0,class:`group block overflow-hidden rounded-lg border bg-card`},{default:a(()=>[n(`img`,{src:w.tile.image_url,alt:w.tile.alt||w.tile.title||``,loading:`lazy`,class:`w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]`},null,8,g),w.tile.title?(i(),r(`span`,_,o(w.tile.title),1)):l(``,!0)]),_:1},8,[`href`,`target`,`rel`])):w.tile.type===`notice`?(i(),r(`section`,{key:1,class:t([`pb-box flex gap-3 rounded-lg border p-4 sm:p-5`,T[w.tile.variant]?.class??T.brand.class])},[(i(),s(c(T[w.tile.variant]?.icon??e(u)),{class:`mt-0.5 size-5 shrink-0`})),n(`div`,v,[w.tile.title?(i(),r(`p`,y,o(w.tile.title),1)):l(``,!0),w.tile.html?(i(),r(`div`,{key:1,class:t([`prose prose-sm max-w-none [&_a]:underline`,w.tile.title?`mt-1`:``]),innerHTML:w.tile.html},null,10,b)):l(``,!0),w.tile.url?(i(),r(`a`,{key:2,href:w.tile.url,target:w.tile.new_tab?`_blank`:void 0,class:`mt-2 inline-block text-sm font-medium underline`},`Mehr erfahren`,8,x)):l(``,!0)])],2)):(i(),s(h,{key:2,title:w.tile.title||``},{default:a(()=>[n(`div`,{class:`prose prose-sm prose-neutral max-w-none prose-img:rounded-md`,innerHTML:w.tile.html},null,8,S),w.tile.url?(i(),r(`a`,{key:0,href:w.tile.url,target:w.tile.new_tab?`_blank`:void 0,class:`mt-3 inline-block text-[13px] font-medium text-brand-text hover:underline`},`Mehr erfahren`,8,C)):l(``,!0)]),_:1},8,[`title`]))}};export{w as default};
|
||||
import{On as e,Zn as t,_ as n,b as r,mt as i,qt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{K as u}from"./AppIcon-D29VdJwt.js";import{S as d,v as f,x as p}from"./http-9R3L4KBg.js";import{t as m}from"./circle-alert-qymEjja5.js";import{t as h}from"./Panel-B_811BcC.js";var g=[`src`,`alt`],_={key:0,class:`block px-4 py-3 text-sm font-semibold group-hover:underline`},v={class:`min-w-0 flex-1`},y={key:0,class:`font-semibold`},b=[`innerHTML`],x=[`href`,`target`],S=[`innerHTML`],C=[`href`,`target`],w={__name:`CustomTile`,props:{tile:{type:Object,required:!0}},setup(w){let T={brand:{icon:u,class:`border-brand bg-brand text-brand-foreground`},info:{icon:p,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`},success:{icon:d,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`},warning:{icon:f,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`},neutral:{icon:m,class:`border-border bg-card text-foreground`}};return(d,f)=>w.tile.type===`image`&&w.tile.image_url?(i(),s(c(w.tile.url?`a`:`figure`),{key:0,href:w.tile.url||void 0,target:w.tile.url&&w.tile.new_tab?`_blank`:void 0,rel:w.tile.url&&w.tile.new_tab?`noopener`:void 0,class:`group block overflow-hidden rounded-lg border bg-card`},{default:a(()=>[n(`img`,{src:w.tile.image_url,alt:w.tile.alt||w.tile.title||``,loading:`lazy`,class:`w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]`},null,8,g),w.tile.title?(i(),r(`span`,_,o(w.tile.title),1)):l(``,!0)]),_:1},8,[`href`,`target`,`rel`])):w.tile.type===`notice`?(i(),r(`section`,{key:1,class:t([`pb-box flex gap-3 rounded-lg border p-4 sm:p-5`,T[w.tile.variant]?.class??T.brand.class])},[(i(),s(c(T[w.tile.variant]?.icon??e(u)),{class:`mt-0.5 size-5 shrink-0`})),n(`div`,v,[w.tile.title?(i(),r(`p`,y,o(w.tile.title),1)):l(``,!0),w.tile.html?(i(),r(`div`,{key:1,class:t([`prose prose-sm max-w-none [&_a]:underline`,w.tile.title?`mt-1`:``]),innerHTML:w.tile.html},null,10,b)):l(``,!0),w.tile.url?(i(),r(`a`,{key:2,href:w.tile.url,target:w.tile.new_tab?`_blank`:void 0,class:`mt-2 inline-block text-sm font-medium underline`},`Mehr erfahren`,8,x)):l(``,!0)])],2)):(i(),s(h,{key:2,title:w.tile.title||``},{default:a(()=>[n(`div`,{class:`prose prose-sm prose-neutral max-w-none prose-img:rounded-md`,innerHTML:w.tile.html},null,8,S),w.tile.url?(i(),r(`a`,{key:0,href:w.tile.url,target:w.tile.new_tab?`_blank`:void 0,class:`mt-3 inline-block text-[13px] font-medium text-brand-text hover:underline`},`Mehr erfahren`,8,C)):l(``,!0)]),_:1},8,[`title`]))}};export{w as default};
|
||||
1
public/build/assets/CustomTile-DQDPEiZi.js
Normal file
1
public/build/assets/CustomTile-DQDPEiZi.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{On as e,Zn as t,_ as n,b as r,mt as i,qt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{W as u}from"./AppIcon-D2nBpiR9.js";import{S as d,v as f,x as p}from"./http-9R3L4KBg.js";import{t as m}from"./circle-alert-qymEjja5.js";import{t as h}from"./Panel-DxXU3_Yp.js";var g=[`src`,`alt`],_={key:0,class:`block px-4 py-3 text-sm font-semibold group-hover:underline`},v={class:`min-w-0 flex-1`},y={key:0,class:`font-semibold`},b=[`innerHTML`],x=[`href`,`target`],S=[`innerHTML`],C=[`href`,`target`],w={__name:`CustomTile`,props:{tile:{type:Object,required:!0}},setup(w){let T={brand:{icon:u,class:`border-brand bg-brand text-brand-foreground`},info:{icon:p,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`},success:{icon:d,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`},warning:{icon:f,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`},neutral:{icon:m,class:`border-border bg-card text-foreground`}};return(d,f)=>w.tile.type===`image`&&w.tile.image_url?(i(),s(c(w.tile.url?`a`:`figure`),{key:0,href:w.tile.url||void 0,target:w.tile.url&&w.tile.new_tab?`_blank`:void 0,rel:w.tile.url&&w.tile.new_tab?`noopener`:void 0,class:`group block overflow-hidden rounded-lg border bg-card`},{default:a(()=>[n(`img`,{src:w.tile.image_url,alt:w.tile.alt||w.tile.title||``,loading:`lazy`,class:`w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]`},null,8,g),w.tile.title?(i(),r(`span`,_,o(w.tile.title),1)):l(``,!0)]),_:1},8,[`href`,`target`,`rel`])):w.tile.type===`notice`?(i(),r(`section`,{key:1,class:t([`pb-box flex gap-3 rounded-lg border p-4 sm:p-5`,T[w.tile.variant]?.class??T.brand.class])},[(i(),s(c(T[w.tile.variant]?.icon??e(u)),{class:`mt-0.5 size-5 shrink-0`})),n(`div`,v,[w.tile.title?(i(),r(`p`,y,o(w.tile.title),1)):l(``,!0),w.tile.html?(i(),r(`div`,{key:1,class:t([`prose prose-sm max-w-none [&_a]:underline`,w.tile.title?`mt-1`:``]),innerHTML:w.tile.html},null,10,b)):l(``,!0),w.tile.url?(i(),r(`a`,{key:2,href:w.tile.url,target:w.tile.new_tab?`_blank`:void 0,class:`mt-2 inline-block text-sm font-medium underline`},`Mehr erfahren`,8,x)):l(``,!0)])],2)):(i(),s(h,{key:2,title:w.tile.title||``},{default:a(()=>[n(`div`,{class:`prose prose-sm prose-neutral max-w-none prose-img:rounded-md`,innerHTML:w.tile.html},null,8,S),w.tile.url?(i(),r(`a`,{key:0,href:w.tile.url,target:w.tile.new_tab?`_blank`:void 0,class:`mt-3 inline-block text-[13px] font-medium text-brand-text hover:underline`},`Mehr erfahren`,8,C)):l(``,!0)]),_:1},8,[`title`]))}};export{w as default};
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CustomTile-rpvbUDGX.js","assets/runtime-core.esm-bundler-B8D2lM98.js","assets/AppIcon-BVHFLm12.js","assets/usePrimitiveElement-BOk1PFhF.js","assets/runtime-dom.esm-bundler-BEWGoe8n.js","assets/dist-CleIz2GP.js","assets/app-CIvn5Z1l.js","assets/app-BZMCjaRn.css","assets/RovingFocusGroup-NIVUjBd5.js","assets/http-9R3L4KBg.js","assets/circle-alert-qymEjja5.js","assets/Panel-xPHuwfuu.js","assets/chevron-right-DR4LjgDm.js","assets/Greeting-B05GQpKd.js","assets/AppLayout-Cy38OwfZ.js","assets/BrandLogo-TGGJyC1K.js","assets/NewColleagues-DMxyPHNm.js","assets/PeopleSearch-lOnxyLDv.js","assets/arrow-right-CdMsByuI.js","assets/ProfileIncomplete-D_-55Kim.js","assets/QuickLinks-DD-ribbK.js","assets/chevron-left-CfNljcKt.js","assets/dist-BRRmd-wM.js","assets/Greeting-BNtvUzyI.js","assets/Upcoming-2G8rjb71.js","assets/BirthdayItem-DK6xURSZ.js","assets/MyDownloads-C3KvafhB.js","assets/FileIcon-BHQ0ftg2.js","assets/Upcoming-DpyMBhkM.js","assets/EmptyState-Ceq4v8mE.js","assets/EventListItem-C_pDZ4ur.js","assets/EventDateBlock-Cxz_hY6g.js","assets/Areas-Bzac5pwG.js","assets/NewsCard-CWMFENyt.js","assets/NewsImage-31QS1JbU.js","assets/Hero-OPvK6LV0.js","assets/play-_hM1KTvn.js","assets/Latest-CZZxoFB3.js","assets/NewsListItem-DmR535f5.js"])))=>i.map(i=>d[i]);
|
||||
import{O as e,On as t,_ as n,b as r,bt as i,et as a,g as o,mt as s,o as c,qt as l,v as u,wt as d,y as f}from"./runtime-core.esm-bundler-B8D2lM98.js";import{o as p}from"./app-CIvn5Z1l.js";import{t as m}from"./AppLayout-Cy38OwfZ.js";import{n as h}from"./dist-BRRmd-wM.js";var g=Object.assign({"../widgets/CustomTile.vue":()=>p(()=>import(`./CustomTile-rpvbUDGX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),"../widgets/Greeting.vue":()=>p(()=>import(`./Greeting-B05GQpKd.js`),__vite__mapDeps([13,1,6,4,7,2,3,5,8,9,14,15])),"../widgets/NewColleagues.vue":()=>p(()=>import(`./NewColleagues-DMxyPHNm.js`),__vite__mapDeps([16,1,6,4,7,2,3,5,8,9,11,12])),"../widgets/PeopleSearch.vue":()=>p(()=>import(`./PeopleSearch-lOnxyLDv.js`),__vite__mapDeps([17,1,6,4,7,2,3,5,8,9,18,11,12])),"../widgets/ProfileIncomplete.vue":()=>p(()=>import(`./ProfileIncomplete-D_-55Kim.js`),__vite__mapDeps([19,1,6,4,7,14,3,5,2,8,9,15])),"../widgets/QuickLinks.vue":()=>p(()=>import(`./QuickLinks-DD-ribbK.js`),__vite__mapDeps([20,1,6,4,7,2,3,5,8,9,21,12,22]))}),_=Object.assign({"../../../plugins-core/birthdays/resources/js/widgets/Greeting.vue":()=>p(()=>import(`./Greeting-BNtvUzyI.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9])),"../../../plugins-core/birthdays/resources/js/widgets/Upcoming.vue":()=>p(()=>import(`./Upcoming-2G8rjb71.js`),__vite__mapDeps([24,1,25,6,4,7,2,3,5,8,9,11,12])),"../../../plugins-core/downloads/resources/js/widgets/MyDownloads.vue":()=>p(()=>import(`./MyDownloads-C3KvafhB.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,27,11,12])),"../../../plugins-core/events/resources/js/widgets/Upcoming.vue":()=>p(()=>import(`./Upcoming-DpyMBhkM.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,29,11,12,30,31])),"../../../plugins-core/news/resources/js/widgets/Areas.vue":()=>p(()=>import(`./Areas-Bzac5pwG.js`),__vite__mapDeps([32,1,11,6,4,7,12,5,33,2,3,8,9,34])),"../../../plugins-core/news/resources/js/widgets/Hero.vue":()=>p(()=>import(`./Hero-OPvK6LV0.js`),__vite__mapDeps([35,1,4,6,7,5,18,21,12,36])),"../../../plugins-core/news/resources/js/widgets/Latest.vue":()=>p(()=>import(`./Latest-CZZxoFB3.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,29,11,12,38,34]))}),v={};for(let[t,n]of Object.entries(g))v[`core::${t.split(`/`).pop().replace(`.vue`,``)}`]=e(n);for(let[t,n]of Object.entries(_)){let[,r]=t.match(/plugins-core\/([^/]+)\//);v[`${r}::${t.split(`/`).pop().replace(`.vue`,``)}`]=e(n)}function y(e){return v[e]??null}var b={key:0,class:`mb-6 grid gap-6`},x={key:1,class:`grid grid-cols-12 gap-6`},S={class:`col-span-8 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-9 xl:grid-cols-3`},C={class:`col-span-4 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-3`},w={key:2,class:`grid min-w-0 grid-cols-1 gap-6`},T={__name:`Dashboard`,props:{widgets:{type:Array,required:!0}},setup(e){let p=e,g=h(`(min-width: 1024px)`),_=o(()=>p.widgets.filter(e=>y(e.component))),v=e=>_.value.filter(t=>t.area===e),T=o(()=>v(`hero`)[0]??null),E=o(()=>[..._.value].sort((e,t)=>e.mobileSort-t.mobileSort));return(e,o)=>(s(),u(m,{title:`Startseite`},{default:l(()=>[t(g)&&v(`top`).length?(s(),r(`div`,b,[(s(!0),r(c,null,i(v(`top`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))])):f(``,!0),t(g)?(s(),r(`div`,x,[n(`div`,S,[T.value?(s(),u(d(t(y)(T.value.component)),a({key:0},T.value.props,{class:`xl:col-span-2`}),null,16)):f(``,!0),(s(!0),r(c,null,i(v(`feed`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props,{wide:!T.value,class:T.value?`xl:col-span-1`:`xl:col-span-3`}),null,16,[`wide`,`class`]))),128)),(s(!0),r(c,null,i(v(`main`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props,{class:`xl:col-span-3`}),null,16))),128))]),n(`aside`,C,[(s(!0),r(c,null,i(v(`aside`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))])])):(s(),r(`div`,w,[(s(!0),r(c,null,i(E.value,e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))]))]),_:1}))}};export{T as default};
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CustomTile-D76N6YpL.js","assets/runtime-core.esm-bundler-B8D2lM98.js","assets/AppIcon-D29VdJwt.js","assets/usePrimitiveElement-BOk1PFhF.js","assets/runtime-dom.esm-bundler-BEWGoe8n.js","assets/dist-CleIz2GP.js","assets/app-BBhJdBuh.js","assets/app-BWNDxRMe.css","assets/RovingFocusGroup-NIVUjBd5.js","assets/http-9R3L4KBg.js","assets/circle-alert-qymEjja5.js","assets/Panel-B_811BcC.js","assets/chevron-right-DR4LjgDm.js","assets/Greeting-CeF-Ndz_.js","assets/AppLayout-D2Ut1Cv2.js","assets/BrandLogo-CIyNH3Dy.js","assets/NewColleagues-BKSQqzY_.js","assets/PeopleSearch-a3P5Vslh.js","assets/arrow-right-CdMsByuI.js","assets/ProfileIncomplete-BjnrfaTY.js","assets/QuickLinks-BnZTtJQY.js","assets/chevron-left-CfNljcKt.js","assets/dist-BRRmd-wM.js","assets/Greeting-bWOynA9x.js","assets/Upcoming-BljuZh7g.js","assets/BirthdayItem-e4ZzvlFn.js","assets/MyDownloads-C3rir9ty.js","assets/FileIcon-CF8CC4sg.js","assets/Upcoming-BP6JPF5M.js","assets/EmptyState-Ceq4v8mE.js","assets/EventListItem-BjiS2M_i.js","assets/EventDateBlock-DoGQ3llD.js","assets/Areas-Bmy6KUrw.js","assets/NewsCard-CFmNVfbg.js","assets/NewsImage-C7JcYPi4.js","assets/Hero-CVQvnvIt.js","assets/play-_hM1KTvn.js","assets/Latest-y1WzRcbj.js","assets/NewsListItem-BEa33lfL.js"])))=>i.map(i=>d[i]);
|
||||
import{O as e,On as t,_ as n,b as r,bt as i,et as a,g as o,mt as s,o as c,qt as l,v as u,wt as d,y as f}from"./runtime-core.esm-bundler-B8D2lM98.js";import{o as p}from"./app-BBhJdBuh.js";import{t as m}from"./AppLayout-D2Ut1Cv2.js";import{n as h}from"./dist-BRRmd-wM.js";var g=Object.assign({"../widgets/CustomTile.vue":()=>p(()=>import(`./CustomTile-D76N6YpL.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),"../widgets/Greeting.vue":()=>p(()=>import(`./Greeting-CeF-Ndz_.js`),__vite__mapDeps([13,1,6,4,7,2,3,5,8,9,14,15])),"../widgets/NewColleagues.vue":()=>p(()=>import(`./NewColleagues-BKSQqzY_.js`),__vite__mapDeps([16,1,6,4,7,2,3,5,8,9,11,12])),"../widgets/PeopleSearch.vue":()=>p(()=>import(`./PeopleSearch-a3P5Vslh.js`),__vite__mapDeps([17,1,6,4,7,2,3,5,8,9,18,11,12])),"../widgets/ProfileIncomplete.vue":()=>p(()=>import(`./ProfileIncomplete-BjnrfaTY.js`),__vite__mapDeps([19,1,6,4,7,14,3,5,2,8,9,15])),"../widgets/QuickLinks.vue":()=>p(()=>import(`./QuickLinks-BnZTtJQY.js`),__vite__mapDeps([20,1,6,4,7,2,3,5,8,9,21,12,22]))}),_=Object.assign({"../../../plugins-core/birthdays/resources/js/widgets/Greeting.vue":()=>p(()=>import(`./Greeting-bWOynA9x.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9])),"../../../plugins-core/birthdays/resources/js/widgets/Upcoming.vue":()=>p(()=>import(`./Upcoming-BljuZh7g.js`),__vite__mapDeps([24,1,25,6,4,7,2,3,5,8,9,11,12])),"../../../plugins-core/downloads/resources/js/widgets/MyDownloads.vue":()=>p(()=>import(`./MyDownloads-C3rir9ty.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,27,11,12])),"../../../plugins-core/events/resources/js/widgets/Upcoming.vue":()=>p(()=>import(`./Upcoming-BP6JPF5M.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,29,11,12,30,31])),"../../../plugins-core/news/resources/js/widgets/Areas.vue":()=>p(()=>import(`./Areas-Bmy6KUrw.js`),__vite__mapDeps([32,1,11,6,4,7,12,5,33,2,3,8,9,34])),"../../../plugins-core/news/resources/js/widgets/Hero.vue":()=>p(()=>import(`./Hero-CVQvnvIt.js`),__vite__mapDeps([35,1,4,6,7,5,18,21,12,36])),"../../../plugins-core/news/resources/js/widgets/Latest.vue":()=>p(()=>import(`./Latest-y1WzRcbj.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,29,11,12,38,34]))}),v={};for(let[t,n]of Object.entries(g))v[`core::${t.split(`/`).pop().replace(`.vue`,``)}`]=e(n);for(let[t,n]of Object.entries(_)){let[,r]=t.match(/plugins-core\/([^/]+)\//);v[`${r}::${t.split(`/`).pop().replace(`.vue`,``)}`]=e(n)}function y(e){return v[e]??null}var b={key:0,class:`mb-6 grid gap-6`},x={key:1,class:`grid grid-cols-12 gap-6`},S={class:`col-span-8 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-9 xl:grid-cols-3`},C={class:`col-span-4 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-3`},w={key:2,class:`grid min-w-0 grid-cols-1 gap-6`},T={__name:`Dashboard`,props:{widgets:{type:Array,required:!0}},setup(e){let p=e,g=h(`(min-width: 1024px)`),_=o(()=>p.widgets.filter(e=>y(e.component))),v=e=>_.value.filter(t=>t.area===e),T=o(()=>v(`hero`)[0]??null),E=o(()=>[..._.value].sort((e,t)=>e.mobileSort-t.mobileSort));return(e,o)=>(s(),u(m,{title:`Startseite`},{default:l(()=>[t(g)&&v(`top`).length?(s(),r(`div`,b,[(s(!0),r(c,null,i(v(`top`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))])):f(``,!0),t(g)?(s(),r(`div`,x,[n(`div`,S,[T.value?(s(),u(d(t(y)(T.value.component)),a({key:0},T.value.props,{class:`xl:col-span-2`}),null,16)):f(``,!0),(s(!0),r(c,null,i(v(`feed`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props,{wide:!T.value,class:T.value?`xl:col-span-1`:`xl:col-span-3`}),null,16,[`wide`,`class`]))),128)),(s(!0),r(c,null,i(v(`main`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props,{class:`xl:col-span-3`}),null,16))),128))]),n(`aside`,C,[(s(!0),r(c,null,i(v(`aside`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))])])):(s(),r(`div`,w,[(s(!0),r(c,null,i(E.value,e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))]))]),_:1}))}};export{T as default};
|
||||
2
public/build/assets/Dashboard-C2O1UJqL.js
Normal file
2
public/build/assets/Dashboard-C2O1UJqL.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CustomTile-DQDPEiZi.js","assets/runtime-core.esm-bundler-B8D2lM98.js","assets/AppIcon-D2nBpiR9.js","assets/usePrimitiveElement-BOk1PFhF.js","assets/runtime-dom.esm-bundler-BEWGoe8n.js","assets/dist-CleIz2GP.js","assets/app-CTT3S1d_.js","assets/app-v7ljULfP.css","assets/RovingFocusGroup-NIVUjBd5.js","assets/http-9R3L4KBg.js","assets/circle-alert-qymEjja5.js","assets/Panel-DxXU3_Yp.js","assets/chevron-right-DR4LjgDm.js","assets/Greeting-0cd4UTZ9.js","assets/AppLayout-Bz-PTr6X.js","assets/BrandLogo-BPDdZJia.js","assets/NewColleagues-C6fgI1mM.js","assets/PeopleSearch-DhF2wv00.js","assets/arrow-right-CdMsByuI.js","assets/ProfileIncomplete-C3CmrlEX.js","assets/QuickLinks-BImlvDxm.js","assets/chevron-left-CfNljcKt.js","assets/dist-BRRmd-wM.js","assets/Greeting-CDETs55Y.js","assets/Upcoming-BKGHbn74.js","assets/BirthdayItem-0nFFkJam.js","assets/MyDownloads-CXa8ibcg.js","assets/FileIcon-DfRyT9R5.js","assets/Upcoming-BaRtqAqm.js","assets/EmptyState-Ceq4v8mE.js","assets/EventListItem-0sPaaFgE.js","assets/EventDateBlock-YWJrSuHR.js","assets/Areas-DTSQjZrw.js","assets/NewsCard-BYiLYGDc.js","assets/NewsImage-oym3kghg.js","assets/Hero-DO0UdPGU.js","assets/play-_hM1KTvn.js","assets/Latest-Cr6BZ3V4.js","assets/NewsListItem-r32rBBNZ.js"])))=>i.map(i=>d[i]);
|
||||
import{O as e,On as t,_ as n,b as r,bt as i,et as a,g as o,mt as s,o as c,qt as l,v as u,wt as d,y as f}from"./runtime-core.esm-bundler-B8D2lM98.js";import{o as p}from"./app-CTT3S1d_.js";import{t as m}from"./AppLayout-Bz-PTr6X.js";import{n as h}from"./dist-BRRmd-wM.js";var g=Object.assign({"../widgets/CustomTile.vue":()=>p(()=>import(`./CustomTile-DQDPEiZi.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),"../widgets/Greeting.vue":()=>p(()=>import(`./Greeting-0cd4UTZ9.js`),__vite__mapDeps([13,1,6,4,7,2,3,5,8,9,14,15])),"../widgets/NewColleagues.vue":()=>p(()=>import(`./NewColleagues-C6fgI1mM.js`),__vite__mapDeps([16,1,6,4,7,2,3,5,8,9,11,12])),"../widgets/PeopleSearch.vue":()=>p(()=>import(`./PeopleSearch-DhF2wv00.js`),__vite__mapDeps([17,1,6,4,7,2,3,5,8,9,18,11,12])),"../widgets/ProfileIncomplete.vue":()=>p(()=>import(`./ProfileIncomplete-C3CmrlEX.js`),__vite__mapDeps([19,1,6,4,7,14,3,5,2,8,9,15])),"../widgets/QuickLinks.vue":()=>p(()=>import(`./QuickLinks-BImlvDxm.js`),__vite__mapDeps([20,1,6,4,7,2,3,5,8,9,21,12,22]))}),_=Object.assign({"../../../plugins-core/birthdays/resources/js/widgets/Greeting.vue":()=>p(()=>import(`./Greeting-CDETs55Y.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9])),"../../../plugins-core/birthdays/resources/js/widgets/Upcoming.vue":()=>p(()=>import(`./Upcoming-BKGHbn74.js`),__vite__mapDeps([24,1,25,6,4,7,2,3,5,8,9,11,12])),"../../../plugins-core/downloads/resources/js/widgets/MyDownloads.vue":()=>p(()=>import(`./MyDownloads-CXa8ibcg.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,27,11,12])),"../../../plugins-core/events/resources/js/widgets/Upcoming.vue":()=>p(()=>import(`./Upcoming-BaRtqAqm.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,29,11,12,30,31])),"../../../plugins-core/news/resources/js/widgets/Areas.vue":()=>p(()=>import(`./Areas-DTSQjZrw.js`),__vite__mapDeps([32,1,11,6,4,7,12,5,33,2,3,8,9,34])),"../../../plugins-core/news/resources/js/widgets/Hero.vue":()=>p(()=>import(`./Hero-DO0UdPGU.js`),__vite__mapDeps([35,1,4,6,7,5,18,21,12,36])),"../../../plugins-core/news/resources/js/widgets/Latest.vue":()=>p(()=>import(`./Latest-Cr6BZ3V4.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,29,11,12,38,34]))}),v={};for(let[t,n]of Object.entries(g))v[`core::${t.split(`/`).pop().replace(`.vue`,``)}`]=e(n);for(let[t,n]of Object.entries(_)){let[,r]=t.match(/plugins-core\/([^/]+)\//);v[`${r}::${t.split(`/`).pop().replace(`.vue`,``)}`]=e(n)}function y(e){return v[e]??null}var b={key:0,class:`mb-6 grid gap-6`},x={key:1,class:`grid grid-cols-12 gap-6`},S={class:`col-span-8 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-9 xl:grid-cols-3`},C={class:`col-span-4 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-3`},w={key:2,class:`grid min-w-0 grid-cols-1 gap-6`},T={__name:`Dashboard`,props:{widgets:{type:Array,required:!0}},setup(e){let p=e,g=h(`(min-width: 1024px)`),_=o(()=>p.widgets.filter(e=>y(e.component))),v=e=>_.value.filter(t=>t.area===e),T=o(()=>v(`hero`)[0]??null),E=o(()=>[..._.value].sort((e,t)=>e.mobileSort-t.mobileSort));return(e,o)=>(s(),u(m,{title:`Startseite`},{default:l(()=>[t(g)&&v(`top`).length?(s(),r(`div`,b,[(s(!0),r(c,null,i(v(`top`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))])):f(``,!0),t(g)?(s(),r(`div`,x,[n(`div`,S,[T.value?(s(),u(d(t(y)(T.value.component)),a({key:0},T.value.props,{class:`xl:col-span-2`}),null,16)):f(``,!0),(s(!0),r(c,null,i(v(`feed`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props,{wide:!T.value,class:T.value?`xl:col-span-1`:`xl:col-span-3`}),null,16,[`wide`,`class`]))),128)),(s(!0),r(c,null,i(v(`main`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props,{class:`xl:col-span-3`}),null,16))),128))]),n(`aside`,C,[(s(!0),r(c,null,i(v(`aside`),e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))])])):(s(),r(`div`,w,[(s(!0),r(c,null,i(E.value,e=>(s(),u(d(t(y)(e.component)),a({key:e.key},{ref_for:!0},e.props),null,16))),128))]))]),_:1}))}};export{T as default};
|
||||
1
public/build/assets/DialogDescription-D3_GKkMp.js
Normal file
1
public/build/assets/DialogDescription-D3_GKkMp.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{a as e}from"./usePrimitiveElement-BOk1PFhF.js";import{On as t,et as n,k as r,mt as i,qt as a,v as o,xt as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{d as c,h as l,o as u,p as d}from"./dist-CleIz2GP.js";import{j as f}from"./AppIcon-D29VdJwt.js";var p=r({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let r=e;l();let c=f();return(e,l)=>(i(),o(t(d),n(r,{id:t(c).descriptionId}),{default:a(()=>[s(e.$slots,`default`)]),_:3},16,[`id`]))}}),m=r({__name:`DialogDescription`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(r){let l=r,d=u(l,`class`),f=e(d);return(e,r)=>(i(),o(t(p),n({"data-slot":`dialog-description`},t(f),{class:t(c)(`text-muted-foreground text-sm`,l.class)}),{default:a(()=>[s(e.$slots,`default`)]),_:3},16,[`class`]))}});export{m as t};
|
||||
|
|
@ -1 +1 @@
|
|||
import{a as e}from"./usePrimitiveElement-BOk1PFhF.js";import{On as t,Zn as n,b as r,et as i,k as a,mt as o,qt as s,v as c,xt as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{d as u,h as d,o as f,p}from"./dist-CleIz2GP.js";import{j as m}from"./AppIcon-BVHFLm12.js";var h=a({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let n=e;d();let r=m();return(e,a)=>(o(),c(t(p),i(n,{id:t(r).descriptionId}),{default:s(()=>[l(e.$slots,`default`)]),_:3},16,[`id`]))}}),g=a({__name:`DialogDescription`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(n){let r=n,a=f(r,`class`),d=e(a);return(e,n)=>(o(),c(t(h),i({"data-slot":`dialog-description`},t(d),{class:t(u)(`text-muted-foreground text-sm`,r.class)}),{default:s(()=>[l(e.$slots,`default`)]),_:3},16,[`class`]))}}),_=a({__name:`DialogHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let i=e;return(e,a)=>(o(),r(`div`,{"data-slot":`dialog-header`,class:n(t(u)(`flex flex-col gap-2 text-center sm:text-left`,i.class))},[l(e.$slots,`default`)],2))}});export{g as n,_ as t};
|
||||
import{a as e}from"./usePrimitiveElement-BOk1PFhF.js";import{On as t,Zn as n,b as r,et as i,k as a,mt as o,qt as s,v as c,xt as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{d as u,h as d,o as f,p}from"./dist-CleIz2GP.js";import{j as m}from"./AppIcon-D2nBpiR9.js";var h=a({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let n=e;d();let r=m();return(e,a)=>(o(),c(t(p),i(n,{id:t(r).descriptionId}),{default:s(()=>[l(e.$slots,`default`)]),_:3},16,[`id`]))}}),g=a({__name:`DialogDescription`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(n){let r=n,a=f(r,`class`),d=e(a);return(e,n)=>(o(),c(t(h),i({"data-slot":`dialog-description`},t(d),{class:t(u)(`text-muted-foreground text-sm`,r.class)}),{default:s(()=>[l(e.$slots,`default`)]),_:3},16,[`class`]))}}),_=a({__name:`DialogHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let i=e;return(e,a)=>(o(),r(`div`,{"data-slot":`dialog-header`,class:n(t(u)(`flex flex-col gap-2 text-center sm:text-left`,i.class))},[l(e.$slots,`default`)],2))}});export{g as n,_ as t};
|
||||
1
public/build/assets/DialogHeader-YbgEMzbh.js
Normal file
1
public/build/assets/DialogHeader-YbgEMzbh.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import{On as e,Zn as t,b as n,k as r,mt as i,xt as a}from"./runtime-core.esm-bundler-B8D2lM98.js";import{d as o}from"./dist-CleIz2GP.js";var s=r({__name:`DialogHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(r){let s=r;return(r,c)=>(i(),n(`div`,{"data-slot":`dialog-header`,class:t(e(o)(`flex flex-col gap-2 text-center sm:text-left`,s.class))},[a(r.$slots,`default`)],2))}});export{s as t};
|
||||
|
|
@ -1 +1 @@
|
|||
import{D as e,E as t,On as n,_ as r,mt as i,qt as a,v as o,vn as s,y as c}from"./runtime-core.esm-bundler-B8D2lM98.js";import{w as l}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{n as u,r as d}from"./app-CIvn5Z1l.js";import{A as f}from"./dist-CleIz2GP.js";import{t as p}from"./arrow-left-nZZEveo4.js";import{t as m}from"./eye-off-DWbaLHNt.js";import{t as h}from"./eye-DcTo_il4.js";import{t as g}from"./FormField-BcJMyuzX.js";import{t as _}from"./button-SRYY3-ko.js";import{t as v}from"./Input-CgjHXzkf.js";import{t as y}from"./GuestLayout-DAusAB2K.js";var b={class:`relative`},x=[`aria-label`],S={__name:`DirectoryLogin`,props:{provider:{type:Object,required:!0}},setup(S){let C=S,w=s(!1),T=d({username:``,password:``});function E(){T.post(C.provider.action,{onFinish:()=>T.reset(`password`)})}return(s,d)=>(i(),o(y,{title:S.provider.label,description:`Mit dem Benutzernamen und Passwort, mit dem Sie sich auch am Arbeitsplatz anmelden.`},{default:a(()=>[r(`form`,{class:`grid gap-5`,onSubmit:l(E,[`prevent`])},[e(g,{id:`username`,label:S.provider.username_label,error:n(T).errors.username},{default:a(()=>[e(n(v),{id:`username`,modelValue:n(T).username,"onUpdate:modelValue":d[0]||=e=>n(T).username=e,autocomplete:`username`,autocapitalize:`none`,spellcheck:`false`,autofocus:``,class:`h-10`,"aria-invalid":!!n(T).errors.username},null,8,[`modelValue`,`aria-invalid`])]),_:1},8,[`label`,`error`]),e(g,{id:`password`,label:`Passwort`,error:n(T).errors.password},{default:a(()=>[r(`div`,b,[e(n(v),{id:`password`,modelValue:n(T).password,"onUpdate:modelValue":d[1]||=e=>n(T).password=e,type:w.value?`text`:`password`,autocomplete:`current-password`,class:`h-10 pr-10`,"aria-invalid":!!n(T).errors.password},null,8,[`modelValue`,`type`,`aria-invalid`]),r(`button`,{type:`button`,class:`absolute inset-y-0 right-0 grid w-10 place-items-center text-muted-foreground hover:text-foreground`,"aria-label":w.value?`Passwort verbergen`:`Passwort anzeigen`,onClick:d[2]||=e=>w.value=!w.value},[w.value?(i(),o(n(m),{key:0,class:`size-4`})):(i(),o(n(h),{key:1,class:`size-4`}))],8,x)])]),_:1},8,[`error`]),e(n(_),{type:`submit`,size:`lg`,class:`mt-2 h-10 w-full`,disabled:n(T).processing},{default:a(()=>[n(T).processing?(i(),o(n(f),{key:0,class:`animate-spin`})):c(``,!0),d[3]||=t(` Anmelden `,-1)]),_:1},8,[`disabled`]),e(n(u),{href:`/login`,class:`inline-flex items-center justify-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`},{default:a(()=>[e(n(p),{class:`size-4`}),d[4]||=t(` Andere Anmeldung wählen `,-1)]),_:1})],32)]),_:1},8,[`title`]))}};export{S as default};
|
||||
import{D as e,E as t,On as n,_ as r,mt as i,qt as a,v as o,vn as s,y as c}from"./runtime-core.esm-bundler-B8D2lM98.js";import{w as l}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{n as u,r as d}from"./app-CTT3S1d_.js";import{A as f}from"./dist-CleIz2GP.js";import{t as p}from"./arrow-left-nZZEveo4.js";import{t as m}from"./eye-off-DWbaLHNt.js";import{t as h}from"./eye-DcTo_il4.js";import{t as g}from"./FormField-BcJMyuzX.js";import{t as _}from"./button-SRYY3-ko.js";import{t as v}from"./Input-CgjHXzkf.js";import{t as y}from"./GuestLayout-4wMAoUic.js";var b={class:`relative`},x=[`aria-label`],S={__name:`DirectoryLogin`,props:{provider:{type:Object,required:!0}},setup(S){let C=S,w=s(!1),T=d({username:``,password:``});function E(){T.post(C.provider.action,{onFinish:()=>T.reset(`password`)})}return(s,d)=>(i(),o(y,{title:S.provider.label,description:`Mit dem Benutzernamen und Passwort, mit dem Sie sich auch am Arbeitsplatz anmelden.`},{default:a(()=>[r(`form`,{class:`grid gap-5`,onSubmit:l(E,[`prevent`])},[e(g,{id:`username`,label:S.provider.username_label,error:n(T).errors.username},{default:a(()=>[e(n(v),{id:`username`,modelValue:n(T).username,"onUpdate:modelValue":d[0]||=e=>n(T).username=e,autocomplete:`username`,autocapitalize:`none`,spellcheck:`false`,autofocus:``,class:`h-10`,"aria-invalid":!!n(T).errors.username},null,8,[`modelValue`,`aria-invalid`])]),_:1},8,[`label`,`error`]),e(g,{id:`password`,label:`Passwort`,error:n(T).errors.password},{default:a(()=>[r(`div`,b,[e(n(v),{id:`password`,modelValue:n(T).password,"onUpdate:modelValue":d[1]||=e=>n(T).password=e,type:w.value?`text`:`password`,autocomplete:`current-password`,class:`h-10 pr-10`,"aria-invalid":!!n(T).errors.password},null,8,[`modelValue`,`type`,`aria-invalid`]),r(`button`,{type:`button`,class:`absolute inset-y-0 right-0 grid w-10 place-items-center text-muted-foreground hover:text-foreground`,"aria-label":w.value?`Passwort verbergen`:`Passwort anzeigen`,onClick:d[2]||=e=>w.value=!w.value},[w.value?(i(),o(n(m),{key:0,class:`size-4`})):(i(),o(n(h),{key:1,class:`size-4`}))],8,x)])]),_:1},8,[`error`]),e(n(_),{type:`submit`,size:`lg`,class:`mt-2 h-10 w-full`,disabled:n(T).processing},{default:a(()=>[n(T).processing?(i(),o(n(f),{key:0,class:`animate-spin`})):c(``,!0),d[3]||=t(` Anmelden `,-1)]),_:1},8,[`disabled`]),e(n(u),{href:`/login`,class:`inline-flex items-center justify-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`},{default:a(()=>[e(n(p),{class:`size-4`}),d[4]||=t(` Andere Anmeldung wählen `,-1)]),_:1})],32)]),_:1},8,[`title`]))}};export{S as default};
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue