<odoo>
<data noupdate="0">
<template id="website_mediatheque" name="Mediatheque">
    <t t-call="website.layout">
        <div id="wrap" class="o_wevent_index">
            <!-- Options -->
            <t t-set="opt_events_list_cards" t-value="is_view_active('website_event.opt_events_list_cards')"/>
            <t t-set="opt_events_list_columns" t-value="is_view_active('website_event.opt_events_list_columns')"/>
            <!-- Topbar -->
            <t t-call="kalachakra.mediatheque_index_topbar"/>
            <!-- Drag/Drop Area -->
            <div id="oe_structure_we_index_1" class="oe_structure oe_empty"/>
            <!-- Content -->
            <div t-attf-class="o_wevent_events_list #{opt_events_list_cards and 'opt_event_list_cards_bg'}">
                <div class="container">
                    <div class="row">
                        <t t-call="website_event.searched_tags"/>
                    </div>
                    <div class="row">
                        <div id="o_wevent_index_main_col" t-attf-class="col-md my-5 #{opt_events_list_columns and 'opt_events_list_columns' or 'opt_events_list_rows'}">
                            <div class="row">
                                <!-- Events List -->
                                <t t-call="kalachakra.mediatheque_events_list"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- Drag/Drop Area -->
            <div id="oe_structure_we_index_2" class="oe_structure oe_empty"/>
        </div>
    </t>
</template>

<template id="mediatheque_events_list" name="Events list">
    <!-- Options -->
    <t t-set="opt_index_sidebar" t-value="is_view_active('website_event.opt_index_sidebar')"/>
    <t t-if="opt_events_list_columns" t-set="opt_event_size" t-value="opt_index_sidebar and 'col-md-6' or 'col-md-6 col-lg-4'"/>
    <t t-else="" t-set="opt_event_size" t-value="opt_index_sidebar and 'col-12' or 'col-xl-10 offset-xl-1'"/>
    <!-- No events -->
    <t t-if="not event_ids">
        <div class="col-12">
            <div class="h2 mb-3">No events found.</div>
            <div class="alert alert-info text-center" groups="event.group_event_manager">
                <p class="m-0">Use the top button '<b>+ New</b>' to create an event.</p>
            </div>
        </div>
    </t>
    <!-- List -->
    <div t-foreach="event_ids" t-as="event" t-attf-class=" #{opt_event_size} mb-4">
        <a t-attf-href="/kalachakra/mediatheque/event?id=#{event.id }" class="text-decoration-none">
            <article t-attf-class="h-100 #{opt_events_list_cards and 'card border-0 shadow-sm'}" itemscope="itemscope" itemtype="http://schema.org/Event">
                <div class="h-100 row no-gutters">
                    <!-- Header -->
                    <header t-attf-class="overflow-hidden bg-secondary #{opt_events_list_columns and 'col-12 rounded-top' or 'col-sm-4 col-lg-3 rounded-left'} #{(not opt_events_list_cards) and 'rounded shadow'} #{(not opt_events_list_cards and not opt_events_list_columns) and 'rounded-top'}">
                        <!-- Image + Link -->
                        <div class="d-block h-100 w-100">
                            <t t-call="website.record_cover">
                                <t t-set="_record" t-value="event"/>

                                <!-- Short Date -->
                                <div class="o_wevent_event_date position-absolute bg-white shadow-sm text-dark">
                                    <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'YYYY'}" class="o_wevent_event_day"/>
                                    <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'LLL'}" class="o_wevent_event_month"/>
                                    <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'dd'}" class="o_wevent_event_day"/>
                                </div>
                                
                            </t>
                        </div>
                    </header>
                    <div t-att-class="'%s %s' % (
                        opt_events_list_columns and 'col-12' or 'col',
                        opt_events_list_columns and event.event_registrations_open and not event.event_registrations_sold_out and 'h-100' or '')">
                        <!-- Body -->
                        <main t-attf-class="#{opt_events_list_cards and 'card-body' or (opt_events_list_columns and 'py-3' or 'px-4')}">
                            <!-- Title -->
                            <h5 t-attf-class="card-title mt-2 mb-0  #{(not event.website_published) and 'text-danger'}">
                                <span t-field="event.name" itemprop="name"/>
                            </h5>
                            <!-- Start Date & Time -->
                            <time itemprop="startDate" t-att-datetime="event.date_begin">
                                <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'date_only': 'true', 'format': 'long'}"/> -
                                <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'time_only': 'true', 'format': 'short'}"/>
                            </time>
                            <!-- Location -->
                            <div itemprop="location" t-field="event.address_id" t-options="{'widget': 'contact', 'fields': ['city'], 'no_marker': 'true'}"/>
                            <div class="mt8  align-items-center">
                                <t t-foreach="event.tag_ids" t-as="tag">
                                    <span t-if="tag.color"
                                        t-attf-class="badge mr8 #{'badge-primary' if tag in search_tags else 'badge-light'} #{'o_tag_color_%s' % tag.color if tag.color else ''}">
                                        <span t-esc="tag.name"/>
                                    </span>
                                </t>
                            </div>
                        </main>
                    </div>
                    <!-- Footer -->
                    <!-- <footer t-if="not event.event_registrations_open or event.event_registrations_sold_out"
                        t-att-class="'small align-self-end w-100 %s %s' % (
                            opt_events_list_cards and 'card-footer' or (not opt_events_list_columns and 'mx-4 mt-auto pt-2') or 'py-2',
                            opt_events_list_cards and 'border-top' or '',
                        )">
                        
                    </footer> -->
                </div>
            </article>
        </a>
    </div>
    <!-- Pager -->
    <div class="form-inline justify-content-center my-3">
        <t t-call="website.pager"/>
    </div>
</template>

<template id="mediatheque_index_topbar" name="Topbar">
    <nav class="navbar navbar-light border-top shadow-sm d-print-none">
        <div class="container">
        <div class="d-flex flex-column flex-sm-row justify-content-between w-100">
        <span class="navbar-brand h4 my-0 mr-auto">Mediathèque</span>
        <ul class="o_wevent_index_topbar_filters nav">
        <div class="d-flex align-items-center flex-wrap pl-sm-3 pr-0">
        <li  class="nav-item dropdown mr-2 my-1">
                <a href="#" role="button" class="btn dropdown-toggle" data-toggle="dropdown">
                    <i class="fa fa-folder-open"/>
                    catégories
                </a>
                <div class="dropdown-menu">
                    <t t-foreach="categories" t-as="category">
                    <t t-foreach="category.tag_ids" t-as="tag">
                    <t t-if="not tag.hidden">
                        <a t-if="tag.color"
                            t-att-href="'/kalachakra/mediatheque?tags='+tag.name+'&#124;enregistrements'"
                            t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{'active' if tag in search_tags else ''}">
                            <t t-esc="tag.name"/>
                        </a>
                    </t>
                    </t>
                    </t>
                </div>
            </li>
            </div>
            </ul>


            
                <ul class="o_wevent_index_topbar_filters nav"/>
                <div class="d-flex align-items-center flex-wrap pl-sm-3 pr-0">
                    <t t-call="kalachakra.mediatheque_search_box">
                        <t t-set="_searches" t-value="searches"/>
                        <t t-set="_placeholder">Chercher un événement...</t>
                    </t>
                </div>
            </div>
        </div>
        
            
        
    </nav>
</template>

<template id="mediatheque_search_box" inherit_id="website.website_search_box" primary="True">
    <xpath expr="//div[@role='search']" position="replace">
        <form t-attf-class="o_wevent_event_searchbar_form o_wait_lazy_js w-100 my-1 my-lg-0 #{_classes}"
              t-att-action="action if action else '/kalachakra/mediatheque'" method="get">
            <t t-set="search" t-value="search or _searches and _searches['search']"/>
            <t t-set="placeholder" t-value="placeholder or _placeholder"/>
            <t>$0</t>
            <t t-foreach="_searches" t-as="search">
                <input t-if="search != 'search' and search_value != 'all'" type="hidden"
                    t-att-name="search" t-att-value="search_value"/>
            </t>
            <t t-raw="0"/>
        </form>
    </xpath>
</template>

<template id="kalachakra.website_mediatheque_event" name="website mediatheque event">
    
    <t t-call="website.layout">
    <body>
    <div class="container">
    
<a href="/kalachakra/mediatheque?search=&amp;date=old&amp;tags=enregistrements" class="navbar-brand h4 my-0 mr-0 mr-md-4">
                            <i class="fa fa-long-arrow-left text-primary mr-2"></i>
                            <span class="kala_evt1">Retour</span>
                        </a>
    <h6><span t-esc="event.name"></span></h6>
    <t t-if="event.teaching_html_content_records_published">
        
                        <div>
                        <t t-raw="event.teaching_html_content_records"/>
                        </div>
        <br></br><br></br>
        </t>
    <t t-if="event.teaching_day_ids">
        
        <h6 style="background-color: orange;">Enregistrements disponibles :</h6>
            
            <t t-foreach="event.teaching_day_ids.sorted(key=lambda r: r.sequence)" t-as="t_day">
                
                    <t t-if="t_day.teaching_session_ids">
                        <table class="table" style="font-size: smaller;">
                        <tr>
                        <td colspan="3">
                        <b><span t-field="t_day.day_teaching" class="my-1 mr-1 kala_evt1" t-options="{'date_only': 'true', 'format': 'long'}"/></b>
                        </td>
                        <t t-if="event.display_english_records">
                        <td colspan="3">
                        <b><span t-field="t_day.day_teaching" class="my-1 mr-1 kala_evt1" t-options="{'date_only': 'true', 'format': 'long'}"/></b>
                        </td>
                        </t>
                        </tr>
                        <!-- <tr>
                        <td>Session</td>
                        <t t-if="event.display_english_records">
                        <td colspan="2">En français</td>
                        
                        <td colspan="2">In english</td>
                        <td>Session</td>
                        </t>
                        </tr> -->
                    
                            <t t-foreach="t_day.teaching_session_ids" t-as="media">
                            <tr>
                               <td><span t-esc="media.description_fr" /></td>
                                <t t-if="media.link_audio_fr">
                                <td><a target='blank' t-attf-href="#{media.link_audio_fr}"><span>Audio FR</span></a></td>
                                </t>
                                <t t-if="not media.link_audio_fr">
                                <td>
                                </td>
                            </t>
                            <t t-if="media.link_video_fr">
                            <td><a target='blank' t-attf-href="#{media.link_video_fr}"><span>Video FR</span></a></td>
                            </t>
                            <t t-if="not media.link_video_fr">
                            <td>
                            </td>
                            </t>
                           <t t-if="event.display_english_records">
                            <t t-if="media.link_audio_en">
                            <td><a target='blank' t-attf-href="#{media.link_audio_en}"><span>Audio EN</span></a></td>
                            </t>
                            <t t-if="not media.link_audio_en">
                            <td>
                            </td>
                            </t>
                            <t t-if="media.link_video_en">
                            <td><a target='blank' t-attf-href="#{media.link_video_en}"><span>Video EN</span></a></td>
                            </t>
                            <t t-if="not media.link_video_en">
                            <td>
                            </td>
                            </t>
                            
                            <td><span t-esc="media.description_en" /></td>
                            </t>
                            </tr>
                            </t>
                        </table>
                    </t>
                    <br></br>
                    
                    
                </t>
        
        </t>
       
        
    </div>
    </body>
    </t>
    </template>
</data>
</odoo>