Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd744edf8c | ||
|
|
7a6ee316cd | ||
|
|
6690beafe6 |
No files matched your search
@@ -9,7 +9,7 @@
|
||||
use Illuminate\Console\Command;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Signature('photos:strip-metadata')]
|
||||
#[Signature('photos:strip-metadata {--force : Auch bereits bereinigte Fotos erneut bearbeiten}')]
|
||||
#[Description('Remove metadata (GPS position, camera data) from all stored original photos – new uploads are cleaned automatically')]
|
||||
class StripPhotoMetadata extends Command
|
||||
{
|
||||
@@ -19,7 +19,7 @@ class StripPhotoMetadata extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$cleaned = Media::query()->where('collection_name', Photo::COLLECTION)->get()
|
||||
->filter(fn (Media $media): bool => StripImageMetadata::strip($media))
|
||||
->filter(fn (Media $media): bool => StripImageMetadata::strip($media, (bool) $this->option('force')))
|
||||
->count();
|
||||
|
||||
$this->info("{$cleaned} Original-Foto(s) bereinigt.");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Spatie\Image\Enums\ImageDriver;
|
||||
use Spatie\Image\Image;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use Throwable;
|
||||
@@ -14,9 +15,9 @@ class StripImageMetadata
|
||||
{
|
||||
private const TYPES = ['image/jpeg', 'image/png', 'image/webp'];
|
||||
|
||||
public static function strip(Media $media): bool
|
||||
public static function strip(Media $media, bool $force = false): bool
|
||||
{
|
||||
if (! in_array($media->mime_type, self::TYPES, true) || $media->getCustomProperty('metadata_stripped')) {
|
||||
if (! in_array($media->mime_type, self::TYPES, true) || ($media->getCustomProperty('metadata_stripped') && ! $force)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,7 +27,8 @@ public static function strip(Media $media): bool
|
||||
}
|
||||
|
||||
try {
|
||||
Image::load($path)->quality(90)->save($path);
|
||||
// GD on purpose: Imagick (default when installed, e.g. on Strato) keeps the EXIF data when saving.
|
||||
Image::useImageDriver(ImageDriver::Gd)->loadFile($path)->quality(90)->save($path);
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
|
||||
|
||||
+3
-3
@@ -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.
|
||||
|
||||
@@ -130,7 +130,7 @@ ## 7a. Datensicherung, Löschfristen, Automationen
|
||||
Regelmäßig z. B. per Aufgabenplanung des NAS/PC ausführen (braucht den SSH-Schlüssel aus §4).
|
||||
- **Löschfristen** (Vorschläge, rechtlich zu bestätigen – `config/fewo.php` bzw. `.env`): Gästedaten 10 Jahre nach letztem Aufenthalt (`FEWO_GUEST_RETENTION_YEARS`), nie verbindlich gewordene Anfragen/Angebote 6 Monate (`FEWO_RETENTION_INQUIRY_MONTHS`), Textauszüge von Portal-Mails 90 Tage (`FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS`), Herkunftsangaben/UTM 24 Monate (`FEWO_RETENTION_ATTRIBUTION_MONTHS`). Läuft täglich 03:00. Anonymisierung ersetzt Name, Kontaktdaten, Nachrichten, Notizen, Herkunft und Bewertungs-Anzeigenamen; Buchung, Preise und Zahlungen bleiben als Beleg.
|
||||
- **Automationen (n8n):** Token bitte als Header `Authorization: Bearer <token>` senden (landet nicht in Server-Logs); `?token=` funktioniert übergangsweise weiter.
|
||||
- **Fotos:** Beim Hochladen werden Metadaten (GPS, Kamera) aus dem Original entfernt; bestehende Fotos einmalig: `php artisan photos:strip-metadata`.
|
||||
- **Fotos:** Beim Hochladen werden Metadaten (GPS, Kamera) aus dem Original entfernt; bestehende Fotos einmalig: `php artisan photos:strip-metadata` (`--force` bearbeitet auch bereits markierte erneut). Hinweis: bewusst mit GD – Imagick (auf Strato installiert) behält EXIF beim Speichern.
|
||||
|
||||
## 8. Bekannte Eigenheiten und Lösungen
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -115,9 +115,16 @@ public function test_uploaded_photo_originals_are_stripped_of_metadata(): void
|
||||
Storage::fake('public');
|
||||
$photo = Photo::factory()->create();
|
||||
|
||||
$media = $photo->addMedia(UploadedFile::fake()->image('drohne.jpg', 1200, 800))->toMediaCollection(Photo::COLLECTION);
|
||||
$image = UploadedFile::fake()->image('drohne.jpg', 1200, 800);
|
||||
$jpeg = (string) file_get_contents($image->getPathname());
|
||||
$exif = 'Exif'."\0\0".'GPS-Position 54.15N 11.75E';
|
||||
file_put_contents($image->getPathname(), substr($jpeg, 0, 2)."\xFF\xE1".pack('n', strlen($exif) + 2).$exif.substr($jpeg, 2));
|
||||
$this->assertStringContainsString('GPS-Position', (string) file_get_contents($image->getPathname()));
|
||||
|
||||
$media = $photo->addMedia($image)->toMediaCollection(Photo::COLLECTION);
|
||||
|
||||
$this->assertTrue($media->fresh()->getCustomProperty('metadata_stripped'));
|
||||
$this->assertStringNotContainsString('GPS-Position', (string) file_get_contents($media->getPath()));
|
||||
$this->artisan('photos:strip-metadata')->expectsOutputToContain('0 Original-Foto(s) bereinigt.')->assertSuccessful();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user