wip
This commit is contained in:
1 parent
ae6bb58972
commit
054654fb9c
18 files changed
+1325
-85
No files matched your search
@@ -16,7 +16,6 @@ use App\Models\Auftraggeber;
|
||||
use App\Models\Gutachter;
|
||||
use App\Models\Projekte;
|
||||
use App\Models\ProjektInhaltsverzeichnis;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
@@ -87,7 +86,7 @@ class Pdf
|
||||
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', $type)->orderBy('sort')->get();
|
||||
|
||||
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
||||
$platzhalter = Platzhalter::load($projekte_id);
|
||||
|
||||
foreach ($inhaltesverzeichnis as $inhalt) {
|
||||
|
||||
@@ -95,33 +94,41 @@ class Pdf
|
||||
$mpdf->AddPage();
|
||||
}
|
||||
|
||||
if ($inhalt->textblock) {
|
||||
$textblock = Platzhalter::replace($platzhalter, $inhalt->textblock);
|
||||
$textblock = Format::fix_str($textblock);
|
||||
}
|
||||
|
||||
$html = '';
|
||||
$html = Ueberschrift::load($inhalt);
|
||||
|
||||
if ($inhalt->textblock) {
|
||||
$textblock = Platzhalter::replace($platzhalter, $inhalt->textblock);
|
||||
$textblock = Format::fix_str($textblock);
|
||||
if ($inhalt->inhaltselement_id != '9') {
|
||||
$html .= $textblock;
|
||||
}
|
||||
}
|
||||
|
||||
if ($inhalt->textblock2) {
|
||||
$textblock2 = Platzhalter::replace($platzhalter, $inhalt->textblock2);
|
||||
$textblock2 = Format::fix_str($textblock2);
|
||||
}
|
||||
|
||||
switch ($inhalt->inhaltselement_id) {
|
||||
case '9':
|
||||
$html .= Deckblatt::load($inhalt, $textblock);
|
||||
$html .= Deckblatt::load($inhalt, $textblock, $textblock2);
|
||||
break;
|
||||
case '1':
|
||||
$html .= Inhalt::load($projekte_id);
|
||||
break;
|
||||
// case '3':
|
||||
// $html .= Paragraph6::load($projekte_id);
|
||||
// break;
|
||||
// case '4':
|
||||
// $html .= Allgemeinflaechen::load($projekte_id);
|
||||
// break;
|
||||
// case '5':
|
||||
// $html .= ZuUndAbschlaege::load($projekte_id);
|
||||
// break;
|
||||
// case '7':
|
||||
// $html .= Zusammenstellung::load($projekte_id);
|
||||
// break;
|
||||
case '3':
|
||||
$html .= Paragraph6::load($projekte_id);
|
||||
break;
|
||||
case '4':
|
||||
$html .= Allgemeinflaechen::load($projekte_id);
|
||||
break;
|
||||
case '5':
|
||||
$html .= ZuUndAbschlaege::load($projekte_id);
|
||||
break;
|
||||
case '7':
|
||||
$html .= Zusammenstellung::load($projekte_id);
|
||||
break;
|
||||
case '8':
|
||||
// AUFTRAGGEBER
|
||||
$str = RichContentRenderer::make(self::$auftraggeber->referenz_formatting)->toHtml();
|
||||
@@ -130,11 +137,10 @@ class Pdf
|
||||
// case '11':
|
||||
// $html .= DigitaleSignatur::load($projekte_id);
|
||||
// break;
|
||||
default:
|
||||
if ($inhalt->textblock) {
|
||||
$html .= $textblock;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($inhalt->textblock2 and $inhalt->inhaltselement_id != 9) {
|
||||
$html .= $textblock2;
|
||||
}
|
||||
|
||||
if ($inhalt->seitenzahl_anzeige == 1) {
|
||||
|
||||
@@ -8,7 +8,7 @@ use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
|
||||
class Deckblatt
|
||||
{
|
||||
public static function load($inhalt, $textblock)
|
||||
public static function load($inhalt, $textblock, $textblock2)
|
||||
{
|
||||
// GUTACHTER
|
||||
$html = '<div id="deckblatt-gutachter">';
|
||||
@@ -24,13 +24,12 @@ class Deckblatt
|
||||
// PROJEKT
|
||||
$html .= '<div id="deckblatt-projekt">';
|
||||
$html .= '<h1>'.trim($inhalt->name).'</h1>';
|
||||
$html .= '<p>'.trim(Pdf::$projekt->interner_name).'</p>';
|
||||
$html .= '<p>'.trim($textblock).'</p>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div id="deckblatt-festsetzung">';
|
||||
$html .= '<h3>ZUR FESTSETZUNG DER NUTZWERTE</h3>';
|
||||
$html .= '<p>'.trim(Pdf::$projekt->offizieller_name).'</p>';
|
||||
$html .= '<p>'.trim($textblock).'</p>';
|
||||
$html .= '<p>'.trim($textblock2).'</p>';
|
||||
$html .= '</div>';
|
||||
|
||||
// AUFTRAGGEBER
|
||||
|
||||
@@ -2,10 +2,28 @@
|
||||
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class Platzhalter
|
||||
{
|
||||
public static function replace($platzhalter, $standardtext)
|
||||
{
|
||||
return str_replace(array_keys($platzhalter), array_values($platzhalter), $standardtext);
|
||||
}
|
||||
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
||||
$platzhalter['###INTERNER_NAME###'] = Pdf::$projekt->interner_name;
|
||||
$platzhalter['###OFFIZIELLER_NAME###'] = Pdf::$projekt->offizieller_name;
|
||||
$platzhalter['###ORT###'] = Pdf::$projekt->ort;
|
||||
$platzhalter['###FIRMA###'] = Pdf::$gutachter->company;
|
||||
|
||||
$dt = Carbon::create(Pdf::$projekt->erstellung);
|
||||
$platzhalter['###DATUM###'] = $dt->isoFormat('D. MMMM YYYY');
|
||||
|
||||
return $platzhalter;
|
||||
}
|
||||
}
|
||||
@@ -17,18 +17,8 @@ class Paragraph6
|
||||
->orderBy('top_nummer')
|
||||
->get();
|
||||
|
||||
$html = '<table class="table-striped bl bt">';
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<thead>';
|
||||
$html .= Html::td('Top', 'head center br bb');
|
||||
$html .= Html::td('Geschoß', 'head center br bb');
|
||||
$html .= Html::td('Orientierung', 'head center br bb');
|
||||
$html .= Html::td('Typ', 'head center br bb');
|
||||
$html .= '</thead>';
|
||||
$html .= '</tr>';
|
||||
$html = Html::table_header(['Top', 'Geschoß', 'Orientierung', 'Typ']);
|
||||
foreach ($data as $value) {
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td($value->top_nummer, 'center br bb');
|
||||
$html .= Html::td($value->projektobjekteimdetail?->geschoss, 'center br bb');
|
||||
|
||||
@@ -9,7 +9,7 @@ class Html
|
||||
$html = '<table class="table-striped">';
|
||||
$html .= '<thead><tr>';
|
||||
foreach ($header_row as $value) {
|
||||
$html .= '<th class="bl bt br bb center bg-sky py-2">'.$value.'</th>';
|
||||
$html .= '<th class="bl bt br bb center bg-sky">'.$value.'</th>';
|
||||
}
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
@@ -34,11 +34,11 @@ class Html
|
||||
|
||||
$html = '<table class="table-striped"><thead><tr>';
|
||||
foreach ($header_row as $value) {
|
||||
$html .= '<th class="bl bt br bb bg-sky py-2">'.$value.'</th>';
|
||||
$html .= '<th class="bl bt br bb bg-sky">'.$value.'</th>';
|
||||
}
|
||||
$html .= '<th style="background:white"></th>';
|
||||
foreach ($header_row as $value) {
|
||||
$html .= '<th class="bl bt br bb bg-sky py-2">'.$value.'</th>';
|
||||
$html .= '<th class="bl bt br bb bg-sky">'.$value.'</th>';
|
||||
}
|
||||
$html .= '</thead></tr>';
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Utilities;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
|
||||
class Platzhalter
|
||||
{
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
||||
$platzhalter['###INTERNER_NAME###'] = Pdf::$projekt->interner_name;
|
||||
$platzhalter['###OFFIZIELLER_NAME###'] = Pdf::$projekt->offizieller_name;
|
||||
$platzhalter['###ORT###'] = Pdf::$projekt->ort;
|
||||
$platzhalter['###DATUM###'] = Pdf::$projekt->erstellung;
|
||||
|
||||
return $platzhalter;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ class GutachterForm
|
||||
->inlineLabel()
|
||||
->schema([
|
||||
TextInput::make('company')
|
||||
->belowContent([
|
||||
'Kann mit "###FIRMA###" im Gutachten verwendet werden.',
|
||||
])
|
||||
->label('Firma')
|
||||
->required(),
|
||||
TextInput::make('title')
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Models\ProjektAllgemeinflaechen;
|
||||
use App\Models\Projekte;
|
||||
use App\Models\ProjektObjekte;
|
||||
use App\Models\ProjektObjekteImDetail;
|
||||
use App\Traits\HasBackUrl;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
@@ -22,6 +23,8 @@ use Livewire\Attributes\On;
|
||||
|
||||
class EditProjekte extends EditRecord
|
||||
{
|
||||
use HasBackUrl;
|
||||
|
||||
protected static string $resource = ProjekteResource::class;
|
||||
|
||||
#[On('refreshProjektAllgemeinflaechen'), On('refreshProjektObjekteImDetail'), On('refreshMethods'), On('refreshOrientierung')]
|
||||
|
||||
+5
-7
@@ -51,11 +51,9 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
Tab::make('Überschrift')
|
||||
->schema([
|
||||
Checkbox::make('neue_seite')
|
||||
->label('Start neuer Seite')
|
||||
->columnSpan(2),
|
||||
|
||||
// Checkbox::make('seitenzahl_anzeige')
|
||||
// ->label('Seitenzahl angezeigen'),
|
||||
->label('Start neuer Seite'),
|
||||
Checkbox::make('seitenzahl_anzeige')
|
||||
->label('Seitenzahl angezeigen'),
|
||||
// Checkbox::make('ueberschrift_verbergen')
|
||||
// ->label('Überschrift verbergen'),
|
||||
TextInput::make('name')
|
||||
@@ -186,9 +184,9 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
])->columns(1),
|
||||
]),
|
||||
]),
|
||||
Tab::make('Inhalts Elemente')
|
||||
Tab::make('Inhaltselement')
|
||||
->schema([
|
||||
Select::make('inhaltselement_id')->label('Inhalts Element')
|
||||
Select::make('inhaltselement_id')->label('Inhaltselement')
|
||||
->prefixIcon('phosphor-table')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
|
||||
@@ -42,8 +42,16 @@ class ProjekteForm
|
||||
->belowContent([
|
||||
'Kann mit "###INTERNER_NAME###" im Text verwendet werden.',
|
||||
]),
|
||||
TextInput::make('ort')->required()->suffix('am'),
|
||||
DatePicker::make('erstellung')->helperText('Datum am Gutachten')->required(),
|
||||
TextInput::make('ort')->required()->suffix('am')
|
||||
->belowContent([
|
||||
'Kann mit "###ORT###" im Text verwendet werden.',
|
||||
]),
|
||||
DatePicker::make('erstellung')
|
||||
->label('Datum der Erstellung')
|
||||
->required()
|
||||
->belowContent([
|
||||
'Kann mit "###DATUM###" im Text verwendet werden.',
|
||||
]),
|
||||
])->columns(2),
|
||||
Tab::make('Zuordnung')
|
||||
->schema([
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Facades\FilamentColor;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
@@ -24,6 +25,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Carbon::setLocale(app()->getLocale());
|
||||
|
||||
FilamentColor::register([
|
||||
'danger' => Color::Red,
|
||||
'gray' => Color::Zinc,
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\Page;
|
||||
|
||||
trait HasBackUrl
|
||||
{
|
||||
/**
|
||||
* überschreibt in EditRecords CancelAction da diese history based schritt für schit zurück ging.
|
||||
* mit diese änderung füht der Link direct zurück zur projekte liste.
|
||||
*/
|
||||
public ?string $backUrl = null;
|
||||
|
||||
public function mount($record = null): void
|
||||
{
|
||||
$this->backUrl = url()->previous();
|
||||
parent::mount($record);
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string // <- return type is string to be compatible with EditRecord & CreateRecord
|
||||
{
|
||||
return $this->backUrl;
|
||||
}
|
||||
|
||||
protected function getCancelFormAction(): Action
|
||||
{
|
||||
return parent::getCancelFormAction()
|
||||
->url(fn (Page $livewire) => $livewire->backUrl ?? static::getResource()::getUrl());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user