<?php $__env->startSection('title', 'Event Settings'); ?>

<?php $__env->startSection('content'); ?>
<?php
    $meetup = app(\App\Services\MeetupService::class);
    $typeLabel = $event->is_virtual ? 'Virtual' : 'Face-to-face';
    $durationLabel = $meetup->eventDurationLabel($event);
?>

<div class="pg-head">
    <div>
        <h1>Settings</h1>
        <p>Configure settings for <strong><?php echo e($event->name); ?></strong> only.</p>
    </div>
</div>

<div class="card p-3 mb-3" style="background:#EEF2FF;border-color:#C7D2FE">
    <div class="cell-sub" style="color:#4338CA">
        <strong>Event info</strong> (managed by <?php echo e(config('mexco.apps.super.name')); ?>):
        <?php echo e($typeLabel); ?> · <?php echo e($event->venue ?: 'No venue'); ?> · <?php echo e($durationLabel); ?>

    </div>
</div>

<?php
    $sections = [
        'general' => 'General',
        'integrations' => 'Integrations',
        'security' => 'Security',
    ];
    $titles = [
        'general' => 'General Settings',
        'integrations' => 'Integrations',
        'security' => 'Security',
    ];
?>

<div class="settings-grid">
    <div class="card settings-nav">
        <?php $__currentLoopData = $sections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <a href="<?php echo e(route('mexco.admin.settings', ['section' => $key])); ?>" class="<?php echo e($section === $key ? 'active' : ''); ?>"><?php echo e($label); ?></a>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>

    <div class="card form-panel">
        <h2><?php echo e($titles[$section] ?? 'Settings'); ?></h2>

        <form method="POST" action="<?php echo e(route('mexco.admin.settings.update')); ?>" enctype="multipart/form-data">
            <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
            <input type="hidden" name="section" value="<?php echo e($section); ?>">

            <?php if($section === 'general'): ?>
                <div class="form-row">
                    <label class="form-label">Full event name</label>
                    <input type="text" name="event_name" class="form-input"
                           value="<?php echo e(old('event_name', $event->event_name ?? $event->name)); ?>" required maxlength="255">
                    <span class="cell-sub d-block mt-1">Used on certificates (formal / long name).</span>
                </div>
                <div class="form-row">
                    <label class="form-label">Short event name</label>
                    <input type="text" name="short_name" class="form-input"
                           value="<?php echo e(old('short_name', $event->short_name ?? $event->name)); ?>" required maxlength="100">
                    <span class="cell-sub d-block mt-1">Used for greetings and welcome messages in the app.</span>
                </div>
                <div class="form-row">
                    <label class="form-label">Event dashboard banner</label>
                    <?php if($event->banner_path): ?>
                        <div class="mb-2" style="border-radius:12px;overflow:hidden;border:1px solid #E5E7EB;background:#F8FAFC">
                            <img src="<?php echo e($event->bannerUrl()); ?>" alt="Current banner" style="display:block;width:100%;max-height:160px;object-fit:cover">
                        </div>
                        <label class="d-flex align-items-center gap-2 mb-2" style="font-size:.85rem;font-weight:600;color:#4B5563">
                            <input type="checkbox" name="remove_banner" value="1" <?php if(old('remove_banner')): echo 'checked'; endif; ?>>
                            Remove current banner
                        </label>
                    <?php endif; ?>
                    <input type="file" name="banner" class="form-input" accept="image/jpeg,image/png,image/webp">
                    <span class="cell-sub d-block mt-1">Shown at the top of the MeXCo Pass event dashboard. Recommended 1200×420px (JPG/PNG/WebP, max 4MB).</span>
                </div>
                <?php if($event->allow_floor_plan): ?>
                    <div class="form-row">
                        <label class="form-label">Venue floor plan</label>
                        <?php if($event->floor_plan_path): ?>
                            <div class="mb-2" style="border-radius:12px;overflow:hidden;border:1px solid #E5E7EB;background:#F8FAFC">
                                <img src="<?php echo e(asset('storage/'.$event->floor_plan_path)); ?>" alt="Current floor plan" style="display:block;width:100%;max-height:220px;object-fit:contain">
                            </div>
                            <label class="d-flex align-items-center gap-2 mb-2" style="font-size:.85rem;font-weight:600;color:#4B5563">
                                <input type="checkbox" name="remove_floor_plan" value="1" <?php if(old('remove_floor_plan')): echo 'checked'; endif; ?>>
                                Remove current floor plan
                            </label>
                        <?php endif; ?>
                        <input type="file" name="floor_plan" class="form-input" accept="image/jpeg,image/png,image/webp">
                        <span class="cell-sub d-block mt-1">Participants can open this from the Booths page in MeXCo Pass. JPG/PNG/WebP, max 6MB.</span>
                    </div>
                <?php else: ?>
                    <div class="form-row">
                        <div class="cell-sub" style="padding:.85rem 1rem;border-radius:12px;background:#F8FAFC;border:1px dashed #E5E7EB">
                            Floor plan upload is not enabled for this event. Ask <?php echo e(config('mexco.apps.super.name')); ?> to turn on <strong>Allow floor plan for organisers</strong>.
                        </div>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

            <?php if($section === 'integrations'): ?>
                <div class="form-row">
                    <label class="form-label">Email / WhatsApp service URL</label>
                    <input type="url" name="mail_endpoint" class="form-input" placeholder="https://script.google.com/macros/s/.../exec"
                           value="<?php echo e(old('mail_endpoint', $event->mail_endpoint)); ?>">
                    <span class="cell-sub d-block mt-1">Optional Google Apps Script for certificate delivery.</span>
                </div>
            <?php endif; ?>

            <?php if($section === 'security'): ?>
                <div class="form-row">
                    <label class="form-label">Organiser email</label>
                    <input type="email" class="form-input" value="<?php echo e($event->organiser_username); ?>" disabled>
                    <span class="cell-sub d-block mt-1">Contact <?php echo e(config('mexco.apps.super.name')); ?> to change the login email.</span>
                </div>
                <div class="form-row">
                    <label class="form-label">New password</label>
                    <input type="password" name="password" class="form-input" minlength="6" autocomplete="new-password">
                </div>
                <div class="form-row">
                    <label class="form-label">Confirm new password</label>
                    <input type="password" name="password_confirmation" class="form-input" minlength="6" autocomplete="new-password">
                    <span class="cell-sub d-block mt-1">Leave both blank to keep your current password.</span>
                </div>
            <?php endif; ?>

            <div class="d-flex justify-content-end mt-4">
                <button type="submit" class="btn-purple">Save Changes</button>
            </div>
        </form>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\myapp\resources\views/admin/settings/index.blade.php ENDPATH**/ ?>