Direct payments for invoices
Events can be moved to archive and moved back Fixed validation
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Providers\InertiaProvider;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Response;
|
||||
|
||||
class ArchivedEventsController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): Response {
|
||||
$events = [];
|
||||
foreach ($this->events->getEventsByCriteria(['archived' => true]) as $event) {
|
||||
$events[] = [
|
||||
'id' => $event->id,
|
||||
'name' => $event->name,
|
||||
'location' => $event->location,
|
||||
'postalCode' => $event->postal_code,
|
||||
'eventBegin' => $event->start_date->format('d.m.Y'),
|
||||
'eventEnd' => $event->end_date->format('d.m.Y'),
|
||||
];
|
||||
}
|
||||
|
||||
return (new InertiaProvider('Event/ArchivedEvents', ['events' => $events]))->render();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\ArchiveEvent\ArchiveEventCommand;
|
||||
use App\Domains\Event\Actions\ArchiveEvent\ArchiveEventRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EventArchiveController extends CommonController
|
||||
{
|
||||
public function __invoke(string $eventId, Request $request): JsonResponse {
|
||||
$event = $this->events->getByIdentifier($eventId);
|
||||
|
||||
$archiveEventRequest = new ArchiveEventRequest($event);
|
||||
$archiveEventCommand = new ArchiveEventCommand($archiveEventRequest);
|
||||
$response = $archiveEventCommand->execute();
|
||||
|
||||
return response()->json([
|
||||
'status' => $response->success ? 'success' : 'error',
|
||||
'message' => $response->success ? 'Das Event wurde erfolgreich archiviert.' : 'Beim Archivieren des Events ist ein Fehler aufgetreten.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\UnarchiveEvent\UnarchiveEventCommand;
|
||||
use App\Domains\Event\Actions\UnarchiveEvent\UnarchiveEventRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EventUnarchiveController extends CommonController
|
||||
{
|
||||
public function __invoke(int $eventId, Request $request): JsonResponse {
|
||||
$event = $this->events->getById($eventId);
|
||||
|
||||
$unarchiveRequest = new UnarchiveEventRequest($event);
|
||||
$unarchiveCommand = new UnarchiveEventCommand($unarchiveRequest);
|
||||
$response = $unarchiveCommand->execute();
|
||||
|
||||
return response()->json(['status' => $response->success ? 'success' : 'error']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user