<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <t t-name="homework.AttendeeCalendarCommonPopover">
        <t t-if="isWorkLocationEvent()">
        <Record resModel="'hr.employee.location'" fieldNames="fieldNames" fields="fields" activeFields="fields" values="values" mode="'readonly'" t-slot-scope="slot">
            <Dialog t-if="env.isSmall" title="props.record.title" contentClass="'o_calendar_color_'+ props.record.colorIndex">
                <t t-call="{{ constructor.subTemplates.body }}"/>
                <t t-set-slot="footer">
                    <t t-call="calendar.AttendeeCalendarCommonPopover.footer"/>
                </t>
            </Dialog>
            <div t-else="" class="card-header d-flex justify-content-between py-2 pe-2">
                <span class="popover-header border-0">
                    <t t-if="slot.record.data.work_location_type === 'office'">
                        <i class="fa fa-fw fa-building me-2" role="img" t-att-class="`wl_color_${props.record.colorIndex}`"/>
                    </t>
                    <t t-elif="slot.record.data.work_location_type === 'home'">
                        <i class="fa fa-fw fa-home me-2" role="img" />
                    </t>
                    <t t-else="">
                    <i class="fa fa-fw fa-map-marker me-2" t-att-class="`wl_color_${props.record.colorIndex}`" role="img"/>
                    </t>
                    <t t-esc="props.record.title"/>
                </span>
                <span class="o_cw_popover_close ms-4 mt-2 me-2" t-on-click.stop="() => props.close()">
                    <i class="fc-close fc-icon fc-icon-x" />
                </span>
            </div>
            <div class="o_cw_body">
                <t t-call="{{ constructor.subTemplates.body }}" />
                <div t-if="hasFooter" class="card-footer border-top d-flex gap-1">
                    <t t-call="{{ constructor.subTemplates.footer }}" />
                </div>
            </div>
        </Record>
        </t>
        <t t-else="">
            <t t-call="web.CalendarCommonPopover" />
        </t>
    </t>
    <t t-name="homework.AttendeeCalendarCommonPopover.body">
        <t t-if="isWorkLocationEvent()">
                <ul class="list-group list-group-flush">
                    <div class="list-group-item">
                        <i class="fa fa-fw fa-calendar me-2" t-att-class="`wl_color_${props.record.colorIndex}`"/>
                        <t t-if="props.record.start.ts != props.record.end.ts">
                            <t t-esc="props.record.start.toFormat('d MMMM')" t-options="{'widget': 'date'}"/>
                        </t>
                        <t t-else="">
                            <t t-esc="props.record.start.toFormat('d MMMM yyyy')" t-options="{'widget': 'date'}"/>
                        </t>
                    </div>
                    <div class="list-group-item">
                        <i class="fa fa-fw fa-user me-2" t-att-class="`wl_color_${props.record.colorIndex}`"/>
                        <Field name="'employee_name'" record="slot.record" readonly="true"/>
                    </div>
                </ul>
        </t>
        <t t-else="">
            <t t-call="calendar.AttendeeCalendarCommonPopover.body" />
        </t>
    </t>

    <t t-name="homework.AttendeeCalendarCommonPopover.footer">
        <t t-if="isWorkLocationEvent()">
            <t t-if="isCurrentUserIsOwnerWorklocation()">
                <t t-call="calendar.AttendeeCalendarCommonPopover.footer" />
            </t>
        </t>
        <t t-else="">
            <t t-call="calendar.AttendeeCalendarCommonPopover.footer" />
        </t>
    </t>
</templates>
