Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20235b9139 | ||
|
|
565eee4325 | ||
|
|
fd744edf8c | ||
|
|
7a6ee316cd |
No files matched your search
@@ -43,6 +43,8 @@ MAIL_FROM_NAME="${APP_NAME}"
|
||||
FEWO_OWNER_NAME="Brigitte Stommer"
|
||||
FEWO_OWNER_EMAIL=fewo@stommer.de
|
||||
FEWO_NOTIFICATION_EMAIL=fewo@stommer.de
|
||||
# Nur Testbetrieb: alle E-Mails ausschließlich an diese Adresse (leer = normaler Versand)
|
||||
FEWO_MAIL_REDIRECT_TO=
|
||||
FEWO_BANK_ACCOUNT_HOLDER=
|
||||
FEWO_BANK_IBAN=
|
||||
FEWO_BANK_BIC=
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Filament\Pages\PricesAndOffers;
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use App\Filament\Resources\Photos\PhotoResource;
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use Filament\Support\Contracts\HasDescription;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
@@ -26,9 +28,11 @@ enum AdminMode: string implements HasDescription, HasLabel
|
||||
public const SIMPLE_NAVIGATION = [
|
||||
BookingResource::class,
|
||||
BlockedPeriodResource::class,
|
||||
PricesAndOffers::class,
|
||||
GuestResource::class,
|
||||
ChannelTaskResource::class,
|
||||
ReviewResource::class,
|
||||
PhotoResource::class,
|
||||
];
|
||||
|
||||
public function getLabel(): string
|
||||
@@ -42,7 +46,7 @@ public function getLabel(): string
|
||||
public function getDescription(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Simple => 'Nur das Tägliche: Anfragen, Buchungen und Verträge, Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen',
|
||||
self::Simple => 'Das Tägliche: Anfragen, Buchungen und Verträge, Sperrzeiten, Preise & Angebote, Gäste, Portal-Aufgaben, Bewertungen, Fotos',
|
||||
self::Expert => 'Alle Einstellungen: Preise, Angebote, Portale, Webseite, System',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Properties\Pages\EditProperty;
|
||||
use App\Filament\Resources\Properties\RelationManagers\ExtrasRelationManager;
|
||||
use App\Filament\Resources\Properties\RelationManagers\SeasonsRelationManager;
|
||||
use App\Filament\Resources\Properties\RelationManagers\SpecialOffersRelationManager;
|
||||
use App\Models\Property;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Livewire;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Livewire\Attributes\Url;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* The yearly price work in one place, without the other apartment settings: seasons & prices,
|
||||
* special offers & promo codes, extras. Reuses the relation managers of the apartment.
|
||||
*/
|
||||
class PricesAndOffers extends Page
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCurrencyEuro;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $navigationLabel = 'Preise & Angebote';
|
||||
|
||||
protected static ?string $title = 'Preise & Angebote';
|
||||
|
||||
protected static ?string $slug = 'preise-und-angebote';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
#[Url(as: 'wohnung')]
|
||||
public ?int $propertyId = null;
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return (bool) auth()->user()?->hasRole(UserRole::Admin, UserRole::Rentals);
|
||||
}
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->propertyId ??= Property::query()->where('is_active', true)->value('id') ?? Property::query()->value('id');
|
||||
}
|
||||
|
||||
public function content(Schema $schema): Schema
|
||||
{
|
||||
$property = Property::find($this->propertyId);
|
||||
if ($property === null) {
|
||||
return $schema->components([Text::make('Es ist noch keine Wohnung angelegt (Expertenansicht › Wohnungen).')]);
|
||||
}
|
||||
|
||||
$context = ['ownerRecord' => $property, 'pageClass' => EditProperty::class];
|
||||
|
||||
return $schema->components([
|
||||
Select::make('propertyId')
|
||||
->label('Wohnung')
|
||||
->options(fn (): array => Property::query()->orderBy('name')->pluck('name', 'id')->all())
|
||||
->live()
|
||||
->afterStateUpdated(fn () => $this->redirect(static::getUrl(['wohnung' => $this->propertyId])))
|
||||
->visible(fn (): bool => Property::query()->count() > 1),
|
||||
Tabs::make('prices')
|
||||
->persistTabInQueryString()
|
||||
->tabs([
|
||||
Tab::make('Saisons & Preise')->icon(Heroicon::OutlinedCalendar)->schema([
|
||||
Livewire::make(SeasonsRelationManager::class, $context)->key("seasons-{$property->id}"),
|
||||
]),
|
||||
Tab::make('Sonderangebote & Rabattcodes')->icon(Heroicon::OutlinedSparkles)->schema([
|
||||
Livewire::make(SpecialOffersRelationManager::class, $context)->key("offers-{$property->id}"),
|
||||
]),
|
||||
Tab::make('Extras')->icon(Heroicon::OutlinedGift)->schema([
|
||||
Livewire::make(ExtrasRelationManager::class, $context)->key("extras-{$property->id}"),
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,18 @@ protected function getHeaderActions(): array
|
||||
fn () => $send->handle($this->record, $this->offerChanges($data)),
|
||||
'Angebot gesendet',
|
||||
)),
|
||||
Action::make('offerLink')
|
||||
->label('Angebotslink')
|
||||
->icon(Heroicon::OutlinedLink)
|
||||
->color('gray')
|
||||
->visible(fn (): bool => $this->record->status === BookingStatus::OfferSent && $this->record->hold_expires_at?->isFuture())
|
||||
->modalHeading('Link zum Angebot')
|
||||
->modalDescription('Derselbe Link wie in der Angebots-E-Mail – z. B. zum Weitergeben per Messenger. Gültig bis zum Ende der Angebotsfrist.')
|
||||
->schema([
|
||||
TextInput::make('url')->label('Link')->default(fn (SendOffer $send): string => $send->offerUrl($this->record))->readOnly()->copyable(),
|
||||
])
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelActionLabel('Schließen'),
|
||||
Action::make('offerPdf')
|
||||
->label('Angebot (PDF)')
|
||||
->icon(Heroicon::OutlinedDocumentText)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Support\StripImageMetadata;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
|
||||
@@ -23,6 +24,11 @@ public function register(): void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Test environments: deliver every e-mail to one address only, so no guest gets test mails.
|
||||
if (filled(config('fewo.mail_redirect_to'))) {
|
||||
Mail::alwaysTo(config('fewo.mail_redirect_to'));
|
||||
}
|
||||
|
||||
// Photos: remove metadata (GPS position, camera data) from uploaded originals, which stay downloadable.
|
||||
Event::listen(MediaHasBeenAddedEvent::class, fn (MediaHasBeenAddedEvent $event) => StripImageMetadata::strip($event->media));
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
| Further retention periods (docs/LOESCHKONZEPT.md). The defaults are PROPOSALS – please have them
|
||||
| confirmed according to the general legal opinion (tax advisor / legal advice) and adjust here.
|
||||
*/
|
||||
// Test environments: every e-mail goes to this address only (instead of guests/landlord). Empty = normal delivery.
|
||||
'mail_redirect_to' => env('FEWO_MAIL_REDIRECT_TO'),
|
||||
|
||||
// Daily database backup (php artisan backup:database): number of dumps kept in storage/app/private/backups.
|
||||
'backup' => [
|
||||
'keep' => (int) env('FEWO_BACKUP_KEEP', 14),
|
||||
|
||||
+2
-2
@@ -103,9 +103,9 @@ ## 7. Zugang zur Verwaltung (`/admin`)
|
||||
"cd test.fewo-stommer.de/current && /opt/RZphp84/bin/php-cli artisan users:create lars@stommer.com --name='Lars Stommer' --role=admin"
|
||||
```
|
||||
|
||||
Weitere Benutzer legt ein Administrator in der Verwaltung an (System › Benutzer): Name, E-Mail, **Rolle** (was die Person darf) und **Ansicht** (was das Menü zeigt), Passwort. Rollen: `admin` (alles inkl. Benutzer), `rentals` (Vermietung), `content` (Inhalte); ohne Rolle kein Zugang. Empfehlung: Lars `admin`, Brigitte `rentals` mit einfacher Ansicht.
|
||||
Weitere Benutzer legt ein Administrator in der Verwaltung an (System › Benutzer): Name, E-Mail, **Rolle** (was die Person darf) und **Ansicht** (was das Menü zeigt), Passwort. Rollen: `admin` (alles inkl. Benutzer), `rentals` (Vermietung), `content` (Inhalte); ohne Rolle kein Zugang. Festlegung 22.10.2026: Lars und Brigitte beide `admin` (dürfen alles); Brigitte mit **einfacher Ansicht** (beim Anlegen „Ansicht: Einfach“ wählen, sonst erhalten Administratoren die Expertenansicht).
|
||||
|
||||
**Ansichten:** *Einfache Ansicht* – nur Anfragen & Buchungen (inkl. Bestätigen, Mietvertrag, Zahlungen), Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen. *Expertenansicht* – alle Einstellungen, die die Rolle erlaubt (Preise, Angebote, Portale, Webseite, System). Ohne Auswahl: Administratoren Experten-, alle anderen einfache Ansicht. Umschalten jederzeit über das Benutzermenü oben rechts („Zur … Ansicht wechseln“). Die Ansicht blendet nur Menüpunkte aus; Rechte regelt allein die Rolle.
|
||||
**Ansichten:** *Einfache Ansicht* – Anfragen & Buchungen (Angebot senden, Mietvertrag, Zahlungen), Sperrzeiten, **Preise & Angebote** (Saisons, Sonderangebote/Rabattcodes, Extras), Gäste, Portal-Aufgaben, Bewertungen, Bilder. *Expertenansicht* – alle Einstellungen, die die Rolle erlaubt (Preise, Angebote, Portale, Webseite, System). Ohne Auswahl: Administratoren Experten-, alle anderen einfache Ansicht. Umschalten jederzeit über das Benutzermenü oben rechts („Zur … Ansicht wechseln“). Die Ansicht blendet nur Menüpunkte aus; Rechte regelt allein die Rolle.
|
||||
|
||||
**Passwort vergessen:** Ein Administrator vergibt unter System › Benutzer › Bearbeiten ein neues Passwort (eine Selbst-Zurücksetzung per E-Mail gibt es bewusst nicht). **Handy verloren:** dort Aktion „2FA zurücksetzen“ – die Person richtet die 2FA bei der nächsten Anmeldung neu ein.
|
||||
|
||||
|
||||
@@ -13,6 +13,16 @@
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// Strato: the domain points at the deployment folder and .htaccess forwards to releases/<version>/public,
|
||||
// and the web server then reports the rewritten path in REQUEST_URI/SCRIPT_NAME. Laravel would see
|
||||
// "/releases/…/public/angebot/2" instead of "/angebot/2" (signed links would fail). The site is always
|
||||
// served from the domain root, so the internal prefix is removed here.
|
||||
if (preg_match('~^/(?:releases/[^/?]+|current)/public(?=[/?]|$)~', $_SERVER['REQUEST_URI'] ?? '', $internalPrefix)) {
|
||||
$path = substr($_SERVER['REQUEST_URI'], strlen($internalPrefix[0]));
|
||||
$_SERVER['REQUEST_URI'] = str_starts_with($path, '/') ? $path : '/'.$path;
|
||||
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = '/index.php';
|
||||
}
|
||||
|
||||
// Bootstrap Laravel and handle the request...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Pages\PricesAndOffers;
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\BlockedPeriods\Pages\ManageBlockedPeriods;
|
||||
use App\Filament\Resources\Properties\PropertyResource;
|
||||
@@ -12,6 +13,7 @@
|
||||
use App\Filament\Resources\Users\UserResource;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Property;
|
||||
use App\Models\Season;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\Testing\TestAction;
|
||||
@@ -63,6 +65,23 @@ public function test_every_admin_resource_and_page_follows_the_admin_mode(): voi
|
||||
}
|
||||
}
|
||||
|
||||
public function test_prices_and_offers_page_bundles_seasons_offers_and_extras_in_the_simple_mode(): void
|
||||
{
|
||||
$property = Property::factory()->create();
|
||||
Season::factory()->for($property)->create(['name' => 'Hochsaison Test', 'starts_on' => now()->addMonth()->toDateString(), 'ends_on' => now()->addMonths(2)->toDateString()]);
|
||||
$this->actingAs(User::factory()->create(['admin_mode' => AdminMode::Simple]));
|
||||
|
||||
$this->get(PricesAndOffers::getUrl())
|
||||
->assertOk()
|
||||
->assertSee('Saisons & Preise', false)
|
||||
->assertSee('Sonderangebote & Rabattcodes', false)
|
||||
->assertSee('Hochsaison Test');
|
||||
$this->get(Dashboard::getUrl())->assertSee('Preise & Angebote', false)->assertSee('Bilder')->assertDontSee('Erscheinungsbilder');
|
||||
|
||||
$this->actingAs(User::factory()->role(UserRole::Content)->create());
|
||||
$this->get(PricesAndOffers::getUrl())->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_administrators_default_to_the_expert_mode(): void
|
||||
{
|
||||
$this->assertSame(AdminMode::Expert, User::factory()->create()->adminMode());
|
||||
|
||||
Reference in new issue
Block a user