<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <t t-name="xeno_theme_slate.MyProfile">
        <div class="xeno_app_dashboard p-4">
            <h2 class="mb-4" t-if="employee" t-esc="employee.name"/>

            <div class="xeno_home_grid mb-4">
                <div class="xeno_profile_card xeno_attendance_card">
                    <div>
                        <h5>Today's Attendance</h5>
                        <div t-if="!attendanceLinked" class="text-muted">
                            Your login isn't linked to an HRSystem employee code
                            yet, so attendance can't be shown here. Contact HR.
                        </div>
                        <t t-else="">
                            <div t-if="today and today.in">
                                Checked in <strong t-esc="today.in"/>
                                <t t-if="today.out">
                                    &#8211; checked out <strong t-esc="today.out"/>
                                </t>
                                <t t-else="">
                                    <span t-attf-class="text-{{ today.status == 'late' ? 'warning' : 'success' }}">
                                        <t t-if="today.status == 'late'"> (late, not checked out yet)</t>
                                        <t t-else=""> (not checked out yet)</t>
                                    </span>
                                </t>
                            </div>
                            <div t-elif="today and today.status == 'holiday'" class="text-muted">
                                Today is a holiday.
                            </div>
                            <div t-elif="today and today.status == 'weekend'" class="text-muted">
                                It's the weekend.
                            </div>
                            <div t-elif="today and today.status == 'leave'" class="text-muted">
                                You're on approved leave today (<t t-esc="today.leave_code"/>).
                            </div>
                            <div t-else="">
                                <div class="text-muted mb-1">Not checked in yet today</div>
                                <div t-if="todaySchedule.length">
                                    Today's schedule:
                                    <span t-foreach="todaySchedule" t-as="s" t-key="s_index">
                                        <t t-esc="formatHour(s.hour_from)"/>-<t t-esc="formatHour(s.hour_to)"/>
                                        <t t-if="!s_last">, </t>
                                    </span>
                                </div>
                            </div>
                        </t>
                        <a href="/odoo/attendances/my" class="xeno_attendance_link">View full Monthly Attendance &#8594;</a>
                    </div>
                </div>
            </div>

            <div class="xeno_home_grid">
                <div t-foreach="months" t-as="month" t-key="month_index" class="xeno_mini_calendar">
                    <div class="xeno_mini_calendar_header" t-esc="month.label"/>
                    <div class="xeno_mini_calendar_weekdays">
                        <span t-foreach="month.weekdays" t-as="wd" t-key="wd" t-esc="wd"/>
                    </div>
                    <div class="xeno_mini_calendar_grid">
                        <span t-foreach="month.cells" t-as="cell" t-key="cell_index"
                              class="xeno_mini_calendar_cell"
                              t-att-class="{
                                  'today': cell and cell.isToday,
                                  'holiday': cell and cell.isHoliday,
                                  'att-present': cell and cell.attStatus == 'present',
                                  'att-late': cell and cell.attStatus == 'late',
                                  'att-absent': cell and cell.attStatus == 'absent',
                                  'att-leave': cell and cell.attStatus == 'leave',
                                  'att-off': cell and cell.attStatus == 'off',
                                  'att-bt': cell and cell.attStatus == 'bt',
                              }"
                              t-att-title="cell and (cell.holidayName or cell.attTitle)"
                              t-esc="cell and cell.day"/>
                    </div>
                </div>
            </div>

            <div t-if="employee and employee.xeno_probation_start" class="xeno_profile_card xeno_probation_card mb-4">
                <h5>Probation</h5>
                <div class="xeno_probation_row">
                    <span class="text-muted">Start</span>
                    <span t-esc="employee.xeno_probation_start"/>
                </div>
                <div class="xeno_probation_row" t-if="employee.xeno_probation_end">
                    <span class="text-muted">End</span>
                    <span t-esc="employee.xeno_probation_end"/>
                </div>
                <div class="xeno_probation_row" t-if="employee.xeno_probation_reviewer_id">
                    <span class="text-muted">Reviewer</span>
                    <span t-esc="employee.xeno_probation_reviewer_id[1]"/>
                </div>
                <div class="xeno_probation_row" t-if="employee.xeno_probation_mid_review_date">
                    <span class="text-muted">Mid-Probation Review</span>
                    <span t-esc="employee.xeno_probation_mid_review_date"/>
                </div>
                <div class="xeno_probation_row" t-if="employee.xeno_probation_final_review_date">
                    <span class="text-muted">Final Evaluation</span>
                    <span t-esc="employee.xeno_probation_final_review_date"/>
                </div>
            </div>
        </div>
    </t>
</templates>
