<?php
/**
 * Template Name: Manage Event
 * Description: Template for managing events (uses The Events Calendar)
 */

// Define constant to indicate we are in a page template
define('HVAC_IN_PAGE_TEMPLATE', true);

get_header();

// The Events Calendar handles the event creation/editing interface
// This template ensures proper WordPress theme integration
?>

<style>
/* Hide duplicate headers and fix layout for event manage page */
.hvac-event-manage-wrapper .tribe-community-events #tribe-bar-form,
.hvac-event-manage-wrapper #tribe-bar-views,
.hvac-event-manage-wrapper .tribe-events-page-title {
    display: none !important;
}

.hvac-event-manage-wrapper {
    max-width: 1200px; 
    margin: 0 auto;
    padding: 20px;
}

/* Fix The Events Calendar layout issues */
.hvac-event-manage-wrapper #tribe-community-events,
.hvac-event-manage-wrapper .tribe-community-events {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin-top: 0 !important;
}

/* Hide any duplicate site headers within the community events content */
.hvac-event-manage-wrapper .site-header,
.hvac-event-manage-wrapper .ast-header,
.hvac-event-manage-wrapper header {
    display: none !important;
}

/* Event creation guide styling */
.hvac-event-guide {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.hvac-event-guide h3 {
    color: #2c3e50;
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 15px;
}

.hvac-event-guide ul {
    margin: 0;
    padding-left: 20px;
}

.hvac-event-guide li {
    margin-bottom: 8px;
    color: #495057;
}

.hvac-event-guide li strong {
    color: #2c3e50;
}
</style>

<div class="hvac-event-manage-wrapper">
    <?php
    // Display trainer navigation menu
    if (class_exists('HVAC_Menu_System')) {
        HVAC_Menu_System::instance()->render_trainer_menu();
    }
    ?>
    
    <?php
    // Display breadcrumbs
    if (class_exists('HVAC_Breadcrumbs')) {
        echo HVAC_Breadcrumbs::instance()->render_breadcrumbs();
    }
    ?>
    
    <div class="hvac-page-content">
        <h2>Event Management</h2>
        
        <div class="hvac-event-guide">
            <h3>Quick Guide to Creating Events</h3>
            <ul>
                <li><strong>Event Type:</strong> Choose between In-Person, Virtual/Webinar, or Hybrid formats</li>
                <li><strong>Essential Details:</strong> Use descriptive, searchable titles (e.g., "HVAC System Diagnostics Workshop - Dallas")</li>
                <li><strong>Venue & Organizer:</strong> Select from existing options or create new ones</li>
                <li><strong>Description Must Include:</strong> Learning objectives, prerequisites, what to bring, agenda, and instructor credentials</li>
                <li><strong>Event Image:</strong> Upload an eye-catching image (recommended: 1920x1080px)</li>
                <li><strong>Registration Options:</strong> Set ticket prices or make it free, define capacity limits, enable RSVPs</li>
                <li><strong>Virtual Events:</strong> Add video conference links, access instructions, and technical requirements</li>
                <li><strong>Approval Process:</strong> New events require Master Trainer approval (typically within 24 hours)</li>
            </ul>
        </div>
        
        <?php
        // Try the shortcode in case it works
        if (shortcode_exists('tribe_community_events')) {
            echo do_shortcode('[tribe_community_events]');
        }
        ?>
    </div>
</div>

<?php
get_footer();
