Neues Modul: Qualitätsmanagement
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m46s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m55s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m15s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m46s
CI / Build-Artefakte aktuell (pull_request) Successful in 52s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m46s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m55s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m15s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m46s
CI / Build-Artefakte aktuell (pull_request) Successful in 52s
- Kategorien mit farbigen Ordnerkacheln; Farbe und Symbol je Ordner (Auswahl oder eigener Upload, SVG bereinigt), an Unterordner vererbt - Ordnerseite: Einführungstext, Ansprechpartner (Profilfelder wählbar), Unterordner, Liste mit Dokument, Version, Stand, Größe, Aktion - Einträge: Datei (Lesefassung + bearbeitbare Vorlage), Link, Online-Formular; neue Fassungen archivieren die bisherigen - PDF-Betrachter im Portal (pdf.js) - Eigene Volltextsuche (PDF, Word, Excel, PowerPoint, OpenDocument) mit Textausschnitt; optionale Texterkennung per Tesseract - Rollen-Ausschluss für das ganze Modul, Pflegerecht qm.manage, Zielgruppen je Kategorie - Vorbereitet: Wiedervorlage, Verantwortliche, Lesebestätigungen - Abhängigkeit smalot/pdfparser Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f78cc96be7
commit
b3a057e27c
218 changed files with 13478 additions and 358 deletions
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');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue