rearranged tenant admin layout, invite layouts now visible and manageable

This commit is contained in:
Codex Agent
2025-10-29 12:36:34 +01:00
parent a7bbf230fd
commit d781448914
31 changed files with 2190 additions and 1685 deletions

View File

@@ -20,11 +20,11 @@ class EventJoinTokenResource extends JsonResource
$eventContext = $eventFromRoute instanceof Event ? $eventFromRoute : ($this->resource->event ?? null);
$layouts = [];
if ($eventContext && Route::has('tenant.events.join-tokens.layouts.download')) {
if ($eventContext && Route::has('api.v1.tenant.events.join-tokens.layouts.download')) {
$layouts = JoinTokenLayoutRegistry::toResponse(function (string $layoutId, string $format) use ($eventContext) {
return route('tenant.events.join-tokens.layouts.download', [
return route('api.v1.tenant.events.join-tokens.layouts.download', [
'event' => $eventContext,
'joinToken' => $this->resource,
'joinToken' => $eventContext instanceof Event ? $this->resource->id : $this->resource,
'layout' => $layoutId,
'format' => $format,
]);
@@ -32,10 +32,10 @@ class EventJoinTokenResource extends JsonResource
}
$layoutsUrl = null;
if ($eventContext && Route::has('tenant.events.join-tokens.layouts.index')) {
$layoutsUrl = route('tenant.events.join-tokens.layouts.index', [
if ($eventContext && Route::has('api.v1.tenant.events.join-tokens.layouts.index')) {
$layoutsUrl = route('api.v1.tenant.events.join-tokens.layouts.index', [
'event' => $eventContext,
'joinToken' => $this->resource,
'joinToken' => $eventContext instanceof Event ? $this->resource->id : $this->resource,
]);
}

View File

@@ -49,8 +49,14 @@ class EventResource extends JsonResource
'event_type_id' => $this->event_type_id,
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),
'photo_count' => $this->photos_count ?? 0,
'like_count' => $this->whenLoaded('photos', fn () => $this->photos->sum('likes_count'), 0),
'photo_count' => (int) ($this->photos_count ?? 0),
'pending_photo_count' => isset($this->pending_photos_count) ? (int) $this->pending_photos_count : null,
'like_count' => isset($this->likes_sum)
? (int) $this->likes_sum
: $this->whenLoaded('photos', fn () => (int) $this->photos->sum('likes_count'), 0),
'tasks_count' => isset($this->tasks_count) ? (int) $this->tasks_count : null,
'active_invites_count' => isset($this->active_join_tokens_count) ? (int) $this->active_join_tokens_count : null,
'total_invites_count' => isset($this->total_join_tokens_count) ? (int) $this->total_join_tokens_count : null,
'is_public' => $this->status === 'published',
'public_share_url' => null,
'qr_code_url' => null,