@props([ 'board', 'post', 'postBlockBoards' => [], 'authGuard' => 'tenant', 'storeAction' => '', 'updateAction' => '', 'indexAction' => '', 'showUrlTemplate' => '', 'uploadUrl' => '', 'fileUrlBase' => '', 'canSchedulePublishing' => false, 'allowBackdatePublishing' => false, 'canInsertBlocks' => false, 'aiContext' => null, ]) @php $isEdit = $post->exists; $authUser = auth($authGuard)->user(); $previewVariant = $authGuard === 'web' ? 'platform' : 'tenant'; $boardCategories = $board->activeCategories; $canSelectCategory = $board->userCanSelectCategory($authUser); $selectedCategoryId = old('board_category_id', $post->board_category_id ?? $board->effectiveDefaultCategoryId()); $currentTags = old('tags', $post->exists ? $post->tags->pluck('name')->implode(', ') : ''); $publishedAtOldValue = old('published_at'); $publishedAtNativeValue = optional($post->published_at)->format('Y-m-d\TH:i'); if (filled($publishedAtOldValue)) { try { $publishedAtNativeValue = \Illuminate\Support\Carbon::parse($publishedAtOldValue)->format('Y-m-d\TH:i'); } catch (\Throwable $e) { $publishedAtNativeValue = optional($post->published_at)->format('Y-m-d\TH:i'); } } $publishedAtDateValue = old('published_at_date', filled($publishedAtNativeValue) ? \Illuminate\Support\Carbon::parse($publishedAtNativeValue)->format('Y-m-d') : ''); $publishedAtHourValue = old('published_at_hour', filled($publishedAtNativeValue) ? \Illuminate\Support\Carbon::parse($publishedAtNativeValue)->format('H') : ''); $publishedAtMinuteValue = old('published_at_minute', filled($publishedAtNativeValue) ? \Illuminate\Support\Carbon::parse($publishedAtNativeValue)->format('i') : ''); $publishedAtRestricted = $canSchedulePublishing && ! $allowBackdatePublishing; $publishedAtDateMinValue = $publishedAtRestricted ? now()->toDateString() : null; $publishedAtNativeMinValue = $publishedAtRestricted ? now()->startOfMinute()->format('Y-m-d\TH:i') : null; $showPublishedAtField = $canSchedulePublishing && (! $isEdit || ($post->published_at?->isFuture() ?? false)); $selectedThumbnail = old('thumbnail_image', $post->thumbnail); $fileUrlBase = rtrim((string) $fileUrlBase, '/'); $aiContext = is_array($aiContext ?? null) ? $aiContext : []; $isManager = (bool) ($authUser?->isManager() ?? false); $showAiButton = (bool) ($aiContext['show_button'] ?? false); $canOpenAiPanel = (bool) ($aiContext['can_open_panel'] ?? false); $aiPlanLabel = (string) ($aiContext['plan_label'] ?? ''); $aiPlanKey = (string) ($aiContext['plan_key'] ?? ''); $aiAllowedModels = (array) ($aiContext['allowed_models'] ?? []); $aiSelectedModel = (string) ($aiContext['selected_model'] ?? ($aiAllowedModels[0] ?? '')); $aiReasoningEffortOptions = (array) ($aiContext['reasoning_effort_options'] ?? \App\Core\Platform\Ai\AiDefaults::reasoningEffortOptions()); $aiSelectedReasoningEffort = (string) old('reasoning_effort', $aiContext['reasoning_effort'] ?? config('ai.reasoning_effort', \App\Core\Platform\Ai\AiDefaults::REASONING_EFFORT)); $aiUpgradeMessage = (string) ($aiContext['upgrade_message'] ?? ''); $aiWriteAction = (string) ($aiContext['write_action'] ?? ''); $aiCredit = is_array($aiContext['credit'] ?? null) ? $aiContext['credit'] : []; $aiTotalCreditRemaining = $aiCredit['total_credit_remaining'] ?? null; $aiImageContext = is_array($aiContext['image'] ?? null) ? $aiContext['image'] : []; $showAiImageButton = $isManager && (bool) ($aiImageContext['can_generate_images'] ?? false); $aiImageAction = (string) ($aiContext['image_write_action'] ?? ($aiImageContext['write_action'] ?? '')); @endphp
@if ($showPublishedAtField) @push('scripts') @endpush @endif