<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
    <template id="report_wallchart_template">
        <t t-call="report.html_container">
        <tr t-foreach="Wallcharts" t-as="wallchart">
            <t t-call="report.external_layout">
                <div class="page" style="page-break-after:always">
                    <div class="row mt8 mb8 ">
                        <div class="col-xs-7" style="text-align:center"><h2>Template Inscriptions: <span t-esc="_(wallchart['day'])" t-lang="o.partner_id.lang"/></h2></div>
                        <div class="col-xs-5 col-xs-push-1"><h4>Regular workers sign-ups as of<br/><span t-esc="date.strftime(date.today(),'%d/%m/%Y')"/></h4></div>
                    </div>

                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th width="8%">Time</th>
                                <th width="23%">Week A <span t-esc="wallchart['next_dates']['weekA']"/></th>
                                <th width="23%">Week B <span t-esc="wallchart['next_dates']['weekB']"/></th>
                                <th width="23%">Week C <span t-esc="wallchart['next_dates']['weekC']"/></th>
                                <th width="23%">Week D <span t-esc="wallchart['next_dates']['weekD']"/></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="wallchart['times']" t-as="time">
                                <td><span t-esc="time['start_time']"/> - <span t-esc="time['end_time']"/></td>
                                <td>
                                    <t t-set="num" t-value="1"/>
                                    <t t-foreach="time['partnersA']" t-as="partner">
                                        <t t-if="partner['dates']">
                                            <span t-esc="num"/> - <span t-esc="partner['dates']"/><br/><br/>
                                            <t t-set="num" t-value="num + 1"/>
                                        </t>
                                    </t>
                                    <t t-foreach="time['free_seatsA']" t-as="free_seat">
                                        <t t-set="number" t-value="free_seat_index + num"/>
                                        <span t-esc="number"/> - <br/><br/>
                                    </t>
                                </td>
                                <td>
                                    <t t-set="num" t-value="1"/>
                                    <t t-foreach="time['partnersB']" t-as="partner">
                                        <t t-if="partner['dates']">
                                            <span t-esc="num"/> - <span t-esc="partner['dates']"/><br/><br/>
                                            <t t-set="num" t-value="num + 1"/>
                                        </t>
                                    </t>
                                    <t t-foreach="time['free_seatsB']" t-as="free_seat">
                                        <t t-set="number" t-value="free_seat_index + num"/>
                                        <span t-esc="number"/> - <br/><br/>
                                    </t>
                                </td>
                                <td>
                                    <t t-set="num" t-value="1"/>
                                    <t t-foreach="time['partnersC']" t-as="partner">
                                        <t t-if="partner['dates']">
                                            <span t-esc="num"/> - <span t-esc="partner['dates']"/><br/><br/>
                                            <t t-set="num" t-value="num + 1"/>
                                        </t>
                                    </t>
                                    <t t-foreach="time['free_seatsC']" t-as="free_seat">
                                        <t t-set="number" t-value="free_seat_index + num"/>
                                        <span t-esc="number"/> - <br/><br/>
                                    </t>
                                </td>
                                <td>
                                    <t t-set="num" t-value="1"/>
                                    <t t-foreach="time['partnersD']" t-as="partner">
                                        <t t-if="partner['dates']">
                                            <span t-esc="num"/> - <span t-esc="partner['dates']"/><br/><br/>
                                            <t t-set="num" t-value="num + 1"/>
                                        </t>
                                    </t>
                                    <t t-foreach="time['free_seatsD']" t-as="free_seat">
                                        <t t-set="number" t-value="free_seat_index + num"/>
                                        <span t-esc="number"/> - <br/><br/>
                                    </t>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </t>
        </tr>
        </t>
    </template>
    <template id="report_wallchart_ftop">
        <t t-call="report.html_container">
        <tr t-foreach="Wallcharts" t-as="wallchart">
            <t t-call="coop_shift.custom_external_layout">
                <div class="page" style="page-break-after:always">
                    <div class="row mt8 mb8 ">
                        <div class="col-xs-7" style="text-align:center"><h2>Shift Inscriptions: <span t-esc="_(wallchart['day'])"/></h2></div>
                        <div class="col-xs-5 col-xs-push-1"><h4>FTOP workers sign-ups as of<br/><span t-esc="date.strftime(date.today(),'%d/%m/%Y')"/></h4></div>
                    </div>

                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th width="8%">Time</th>
                                <t t-foreach="wallchart['header']" t-as="header">
                                <th width="23%">Week <span t-esc="header['week_letter']"/> - <span t-esc="date.strftime(header['date'],'%d/%m/%Y')"/></th>
                                </t>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="wallchart['times']" t-as="time">
                                <t t-set="num" t-value="1"/>
                                <td><span t-esc="time['start_time']"/> - <span t-esc="time['end_time']"/></td>
                                <t t-foreach="time['shift_list']" t-as="shift">
                                    <td>
                                        <t t-foreach="shift['partners']" t-as="partner">
                                            <span t-esc="partner_index + 1"/> - <t t-if="partner.barcode_base">[<span t-esc="partner.barcode_base"/>] </t><span t-esc="partner.name"/><br/>
                                            <t t-set="num" t-value="partner_size + 1"/>
                                        </t>
                                        <t t-foreach="shift['free_seats']" t-as="free_seat">
                                            <t t-set="number" t-value="free_seat_index + num"/>
                                            <span t-esc="number"/> - <br/><br/>
                                        </t>
                                    </td>
                                </t>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </t>
        </tr>
        </t>
    </template>
</data>
</odoo>