<?php if($activeAnnouncement): ?>
    <?php
        $colors = $activeAnnouncement->type_color;
    ?>

    
    <?php if(in_array($activeAnnouncement->display_mode, ['banner', 'both'])): ?>
        <div
            x-data="{
                visible: !localStorage.getItem('dismissed_announcement_<?php echo e($activeAnnouncement->id); ?>'),
                dismiss() {
                    localStorage.setItem('dismissed_announcement_<?php echo e($activeAnnouncement->id); ?>', '1');
                    <?php if(auth()->check()): ?>
                        fetch('<?php echo e(route('announcements.dismiss', $activeAnnouncement)); ?>', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'
                            }
                        });
                    <?php endif; ?>
                    this.visible = false;
                }
            }"
            x-show="visible"
            x-cloak
            class="mb-4"
        >
            <div class="bg-gradient-to-r <?php echo e($colors['bg']); ?> border-l-4 <?php echo e($colors['border']); ?> p-4 shadow-sm">
                <div class="flex justify-between items-start">
                    <div>
                        <h3 class="font-semibold <?php echo e($colors['text']); ?>"><?php echo e($activeAnnouncement->title); ?></h3>
                        <div class="mt-1 <?php echo e($colors['text']); ?> text-sm">
                            <?php echo $activeAnnouncement->body; ?>

                        </div>
                    </div>
                    <?php if($activeAnnouncement->is_dismissible): ?>
                        <button
                            type="button"
                            @click="dismiss()"
                            class="ml-4 text-gray-500 hover:text-gray-700 focus:outline-none"
                        >
                            <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
                                <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
                            </svg>
                        </button>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    <?php endif; ?>

    
    <?php if(in_array($activeAnnouncement->display_mode, ['modal', 'both'])): ?>
        <div
            x-data="{
                init() {
                    if (!localStorage.getItem('dismissed_announcement_<?php echo e($activeAnnouncement->id); ?>')) {
                        $nextTick(() => {
                            $dispatch('open-modal', 'announcement-<?php echo e($activeAnnouncement->id); ?>');
                        });
                    }
                }
            }"
        >
            <?php if (isset($component)) { $__componentOriginal9f64f32e90b9102968f2bc548315018c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9f64f32e90b9102968f2bc548315018c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.modal','data' => ['name' => 'announcement-'.e($activeAnnouncement->id).'','maxWidth' => 'md']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'announcement-'.e($activeAnnouncement->id).'','maxWidth' => 'md']); ?>
                <div class="p-6">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-lg font-semibold text-gray-900"><?php echo e($activeAnnouncement->title); ?></h3>
                        <button
                            type="button"
                            @click="$dispatch('close-modal', 'announcement-<?php echo e($activeAnnouncement->id); ?>')"
                            class="text-gray-500 hover:text-gray-700 focus:outline-none"
                        >
                            <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
                            </svg>
                        </button>
                    </div>

                    <div class="prose prose-sm max-w-none mb-6 text-gray-700">
                        <?php echo $activeAnnouncement->body; ?>

                    </div>

                    <div class="flex justify-end gap-3">
                        <?php if($activeAnnouncement->is_dismissible): ?>
                            <button
                                type="button"
                                @click="
                                    localStorage.setItem('dismissed_announcement_<?php echo e($activeAnnouncement->id); ?>', '1');
                                    <?php if(auth()->check()): ?>
                                        fetch('<?php echo e(route('announcements.dismiss', $activeAnnouncement)); ?>', {
                                            method: 'POST',
                                            headers: {
                                                'Content-Type': 'application/json',
                                                'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'
                                            }
                                        });
                                    <?php endif; ?>
                                    $dispatch('close-modal', 'announcement-<?php echo e($activeAnnouncement->id); ?>');
                                "
                                class="px-4 py-2 bg-gray-300 text-gray-800 rounded-md hover:bg-gray-400 transition-colors"
                            >
                                Got it
                            </button>
                        <?php endif; ?>
                    </div>
                </div>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9f64f32e90b9102968f2bc548315018c)): ?>
<?php $attributes = $__attributesOriginal9f64f32e90b9102968f2bc548315018c; ?>
<?php unset($__attributesOriginal9f64f32e90b9102968f2bc548315018c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9f64f32e90b9102968f2bc548315018c)): ?>
<?php $component = $__componentOriginal9f64f32e90b9102968f2bc548315018c; ?>
<?php unset($__componentOriginal9f64f32e90b9102968f2bc548315018c); ?>
<?php endif; ?>
        </div>
    <?php endif; ?>
<?php endif; ?>
<?php /**PATH /var/www/html/resources/views/components/announcement-display.blade.php ENDPATH**/ ?>