<?xml version="1.0" encoding="UTF-8"?>

<templates>
    <t t-name="hr_timesheet_sheet.WeeklyTimesheet">
        <div class="oe_timesheet_weekly">
            <table>
                <tr>
                    <th class="oe_timesheet_first_col"> </th>
                    <t t-foreach="widget.dates" t-as="date">
                        <th t-att-class="'oe_timesheet_weekly_date_head' + (Date.compare(date, Date.today()) === 0 ? ' oe_timesheet_weekly_today' : '')">
                            <t t-esc="date.toString('ddd')"/><br />
                            <t t-esc="date.toString('MMM d')"/>
                        </th>
                    </t>
                    <th class="oe_timesheet_weekly_date_head">Total</th>
                </tr>
                <tr t-foreach="widget.accounts" t-as="account">
                    <td class="oe_timesheet_weekly_account"><a href="javascript:void(0)" t-att-data-id="JSON.stringify(account.account)"><t t-esc="widget.account_names[account.account]"/></a></td>
                    <t t-set="day_count" t-value="0"/>
                    <t t-foreach="account.days" t-as="day">
                        <td t-att-class="(Date.compare(day.day, Date.today()) === 0 ? 'oe_timesheet_weekly_today' : '')">
                            <input t-if="!widget.get('effective_readonly')" class="oe_timesheet_weekly_input" t-att-data-account="account.account"
                                t-att-data-day-count="day_count" type="text"/>
                            <span t-if="widget.get('effective_readonly')" t-att-data-account="account.account"
                                t-att-data-day-count="day_count" class="oe_timesheet_weekly_box"/>
                            <t t-set="day_count" t-value="day_count + 1"/>
                        </td>
                    </t>
                    <td t-att-data-account-total="account.account" class="oe_timesheet_total"> </td>
                </tr>
                <tr class="oe_timesheet_weekly_add_row" style="display: none">
                    <td t-att-colspan="widget.dates.length + 2">
                        <button class="oe_highlight">Add</button>
                    </td>
                </tr>
                <tr class="oe_timesheet_total">
                    <td>
                        <div class="oe_timesheet_weekly_adding_tot">
                            <div t-if="!widget.get('effective_readonly')" class="oe_timesheet_weekly_adding"><button class="oe_timesheet_button_add">Add a Line</button></div>
                            <div class="oe_timesheet_weekly_tottot"><span>Total</span></div>
                        </div>
                    </td>
                    <t t-set="day_count" t-value="0"/>
                    <t t-foreach="widget.dates" t-as="date">
                        <td class="oe_timesheet_total">
                            <span class="oe_timesheet_weekly_box" t-att-data-day-total="day_count">
                            </span>
                            <t t-set="day_count" t-value="day_count + 1"/>
                        </td>
                    </t>
                    <td class="oe_timesheet_weekly_supertotal oe_timesheet_total"> </td>
                </tr>
            </table>
            <div t-if="widget.accounts.length == 0">
                <div class="oe_view_nocontent">
                    <p class="oe_view_nocontent_create">
                        Click to add projects, contracts or analytic accounts.
                    </p><p>
                        You will be able to register your working hours and
                        activities.
                    </p>
                </div>
            </div>
        </div>
    </t>
</templates>
