Zahlungsaufgaben, Freigabe-/Storno-Link, Vertragsvorlagen, Anreise-Mail
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m36s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m36s
- Zahlungen werden nicht mehr automatisch angemahnt: faellige Anzahlung/Restzahlung werden Aufgaben (Zahlungen & Wuensche, Tages-/Wochenuebersicht); Mail nur per Klick; je Portal und Buchungstyp abschaltbar - Freigabe-Link in der Eingangsbestaetigung, Storno-Link in der Buchungsbestaetigung; je Wohnung Wunsch / sofort / sofort bis Frist; Stornowuensche und Kosten bleiben Aufgabe des Gastgebers - Vertragsvorlagen mit Versionen (je Angebot, Portal oder Wohnung waehlbar), benutzte Versionen gesperrt; Angebot und finaler Vertrag als unveraenderliche PDF mit SHA-256, Vertrag wird nie neu geschrieben - Anreise-Mail je Wohnung einstellbar (Standard 3 Tage), neue Textfelder Schluessel/Parken/Ankunftstag Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eafab8a2cb
commit
a73b164ea1
51 files changed
+1807
-52
No files matched your search
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\CreateContractTemplate;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\EditContractTemplate;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\ListContractTemplates;
|
||||
use App\Filament\Resources\ContractTemplates\Schemas\ContractTemplateForm;
|
||||
use App\Filament\Resources\ContractTemplates\Tables\ContractTemplatesTable;
|
||||
use App\Models\ContractTemplate;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use UnitEnum;
|
||||
|
||||
class ContractTemplateResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = ContractTemplate::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentDuplicate;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $modelLabel = 'Vertragsvorlage';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Vertragsvorlagen';
|
||||
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ContractTemplateForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ContractTemplatesTable::configure($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* A version used in an offer is a document of record and is never edited; a new version is made instead.
|
||||
*/
|
||||
public static function canEdit(Model $record): bool
|
||||
{
|
||||
return ! $record->isUsed();
|
||||
}
|
||||
|
||||
public static function canDelete(Model $record): bool
|
||||
{
|
||||
return ! $record->isUsed();
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListContractTemplates::route('/'),
|
||||
'create' => CreateContractTemplate::route('/create'),
|
||||
'edit' => EditContractTemplate::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Pages;
|
||||
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateContractTemplate extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ContractTemplateResource::class;
|
||||
|
||||
/**
|
||||
* A new template starts with version 1; further versions are made from an existing one.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['version'] = 1;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Pages;
|
||||
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditContractTemplate extends EditRecord
|
||||
{
|
||||
protected static string $resource = ContractTemplateResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [DeleteAction::make()];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Pages;
|
||||
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListContractTemplates extends ListRecords
|
||||
{
|
||||
protected static string $resource = ContractTemplateResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [CreateAction::make()];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ContractTemplateForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
$editor = fn (string $field, string $label): RichEditor => RichEditor::make("texts.{$field}")
|
||||
->label($label)
|
||||
->toolbarButtons([['bold', 'italic', 'link'], ['bulletList', 'orderedList']])
|
||||
->columnSpanFull();
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label('Name der Vorlage')->required()->maxLength(120)
|
||||
->helperText('z. B. „Direktbuchung“ oder „Portal XY“. Versionen derselben Vorlage haben denselben Namen.'),
|
||||
TextInput::make('version')->label('Version')->integer()->default(1)->disabled()->dehydrated(false)
|
||||
->helperText('Neue Versionen entstehen über „Neue Version“ in der Liste. Eine Vorlage, die in einem Angebot verwendet wurde, kann nicht mehr geändert werden.'),
|
||||
Section::make('Texte dieser Vorlage')
|
||||
->description('Nur ausgefüllte Felder ersetzen die Texte der Webseite (Texte › Aufenthalt / Vertrag); leere Felder übernehmen den Webseitentext. Beim Versand des Angebots wird eine Kopie fest abgelegt.')
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
$editor('terms', 'Mietbedingungen'),
|
||||
$editor('cancellation', 'Rücktritt / Stornierung'),
|
||||
$editor('house_rules', 'Hausordnung'),
|
||||
Textarea::make('texts.intro')->label('Vertragseinleitung')->rows(3)->columnSpanFull(),
|
||||
Textarea::make('texts.closing')->label('Vertragsschluss')->rows(3)->columnSpanFull(),
|
||||
Textarea::make('texts.contract_note')->label('Hinweis im Angebots-PDF')->rows(3)->columnSpanFull(),
|
||||
]),
|
||||
Textarea::make('notes')->label('Interne Notiz')->rows(2)->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Tables;
|
||||
|
||||
use App\Models\ContractTemplate;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ContractTemplatesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('name')
|
||||
->columns([
|
||||
TextColumn::make('name')->label('Vorlage')->searchable()->weight('medium'),
|
||||
TextColumn::make('version')->label('Version')->badge(),
|
||||
IconColumn::make('used')->label('In Angeboten verwendet')->boolean()->state(fn (ContractTemplate $record): bool => $record->isUsed()),
|
||||
TextColumn::make('updated_at')->label('Geändert')->dateTime('d.m.Y, H:i'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
Action::make('newVersion')
|
||||
->label('Neue Version')
|
||||
->icon(Heroicon::OutlinedDocumentDuplicate)
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Es wird eine Kopie mit der nächsten Versionsnummer angelegt, die Sie dann bearbeiten können. Die bisherige Version bleibt unverändert.')
|
||||
->action(function (ContractTemplate $record): void {
|
||||
$copy = $record->newVersion();
|
||||
Notification::make()->title('Version '.$copy->version.' angelegt')->success()->send();
|
||||
}),
|
||||
DeleteAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user