<?xml version="1.0"?>
<odoo>
    <report id="report_kellysrooms" string="Reporte kellysrooms" model="kellysrooms" report_type="qweb-pdf" name="kellys_daily_report.template_kellysrooms" file="kellys_daily_report.template_kellysrooms" paperformat="report_kellys_paperformat"/>

    <template id="template_kellysrooms_css">
        <style>
            .titulo {
                font-size: 4.2em;
                text-align: center;
            }
            .marco {
                border-radius: 47px 10px 10px 10px;
                -moz-border-radius: 47px 10px 10px 10px;
                -webkit-border-radius: 47px 10px 10px 10px;
                border: 3px solid #000000;
                padding: 10px 3px;
                margin: 3px 0;
                text-align: center;
            }
            .client {
                border-radius: 10px;
                -moz-border-radius: 10px;
                -webkit-border-radius: 10px;
                border: 1px solid #000000;
                color: #000000;
                background-color: #FFFFFF;
            }
            .exit {
                border-radius: 20px 47px 47px 10px;
                -moz-border-radius: 20px 47px 47px 10px;
                -webkit-border-radius: 20px 47px 47px 10px;
                border: 2px solid #000000;
                padding: 20px 0;
                color: #000000;
                background-color: #FFFFFF;
            }
            .revise {
                padding: 20px 0;
                color: #000000;
                background-color: #FFFFFF;
            }
            .pie {
                font-size: 1.95em;
                margin: 2em 0 4em 0;
            }
            .tipo {
                font-size: 3.2em;
                font-weight: bold;
            }
            .notas {
                width: 90% !important;
                margin: 3px 4px;
                color: #000000;
                text-align: left;
                font-size: 2em;
            }
            .habitacion {
                font-size: 3.2em;
                padding: 0 0 0 3px;
            }
            .datos {
                font-size: 2.4em;
            }
            .section {
                clear: both;
                padding: 0;
                margin: 3px 0;
            }
            /*  COLUMN SETUP  */
            .col {
                display: block;
                float: left;
                margin: 1% 0 1% 1.6%;
            }
            .col:first-child {
                margin-left: 0;
            }
            /*  GROUPING  */
            .group:after,
            .group:before {
                content: "";
                display: table;
            }
            .group:after {
                clear: both;
            }
            .group {
                zoom: 1;
                /* For IE 6/7 */
            }
            /*  GRID OF TWO  */
            .span_2_of_2 {
                width: 100%;
            }
            .span_1_of_2 {
                width: 49.2%;
            }
        </style>
    </template>

    <template id="template_kellysrooms">
        <t t-call="web.basic_layout">
            <div class="page">
                <t t-call="kellys_daily_report.template_kellysrooms_css"/>
                <t t-set="actualkelly" t-value="False"/>
                <t t-set="espie" t-value="False"/>
                <t t-set="totalkelly" t-value="0"/>
                <t t-foreach="docs" t-as="o">
                    <t t-if="actualkelly != o.kelly">
                        <t t-if="o_index != 0">
                            <t t-set="espie" t-value="True"/>
                        </t>
                        <t t-set="actualkelly" t-value="o.kelly"/>
                        <t t-if="espie == True">
                            <t t-set="espie" t-value="False"/>
                            <div class="pie">Impreso el
                                <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d-%m-%Y a las %H:%M')"/>
                                Habitaciones:
                                <t t-esc="totalkelly"/></div>
                            <t t-set="totalkelly" t-value="0"/>
                            <p style="page-break-before:always;"></p>
                        </t>
                        <div class="marco" align="center">
                            <div class="titulo" align="center"><span t-field="o.kelly"/><br/>
                                Habitaciones<br/>
                                <span t-field="o.clean_date" t-options='{"format": "d MMMM Y"}'/>
                            </div>
                        </div>
                    </t>
                    <div t-if="o.tipo == 1" class="exit section group">
                        <t t-set="totalkelly" t-value="totalkelly + 1"/>
                        <div class="habitacion col span_1_of_2">
                            <span t-field="o.habitacion"/>
                        </div>
                        <div class="tipo col span_1_of_2">SALIDA</div>
                        <t t-if="o.checkin != ''">
                            <div class="datos col span_2_of_2">Entrada
                                <t t-if="o.checkin == 'no prevista'">
                                    <span t-field="o.checkin"/>
                                </t>
                                <t t-else="">
                                    <span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %B')"/>
                                </t>
                            </div>
                        </t>
                        <div class="notas col span_2_of_2" align="left">
                            <span t-field="o.notas"/>
                        </div>
                    </div>
                    <div t-if="o.tipo == 2" class="client section group">
                        <t t-set="totalkelly" t-value="totalkelly + 1"/>
                        <div class="habitacion col span_1_of_2">
                            <span t-field="o.habitacion"/>
                        </div>
                        <div class="tipo col span_1_of_2">CLIENTE</div>
                        <div class="datos col span_2_of_2">Del
                            <span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %b')"/>
                            al
                            <span t-esc="datetime.datetime.strptime(o.checkout, '%Y-%m-%d').strftime('%d de %b')"/>
                        </div>
                        <div class="notas col span_2_of_2" align="left">
                            <span t-field="o.notas"/>
                        </div>
                    </div>
                    <div t-if="o.tipo == 3" class="revise section group">
                        <t t-set="totalkelly" t-value="totalkelly + 1"/>
                        <div class="habitacion col span_1_of_2">
                            <span t-field="o.habitacion"/>
                        </div>
                        <div class="tipo col span_1_of_2">REVISAR</div>
                        <div class="datos col span_2_of_2">Entrada
                            <span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %b')"/>
                            al
                            <span t-esc="datetime.datetime.strptime(o.checkout, '%Y-%m-%d').strftime('%d de %b')"/>
                        </div>
                        <div class="notas col span_2_of_2" align="left">
                            <span t-field="o.notas"/>
                        </div>
                    </div>
                    <div t-if="o.tipo == 4" class="client section group">
                        <t t-set="totalkelly" t-value="totalkelly + 1"/>
                        <div class="habitacion col span_1_of_2">
                            <span t-field="o.habitacion"/>
                        </div>
                        <div class="tipo col span_1_of_2">STAFF</div>
                        <div class="datos col span_2_of_2">Del
                            <span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %b')"/>
                            al
                            <span t-esc="datetime.datetime.strptime(o.checkout, '%Y-%m-%d').strftime('%d de %b')"/>
                        </div>
                        <div class="notas col span_2_of_2" align="left">
                            <span t-field="o.notas"/>
                        </div>
                    </div>
                </t>
                <div class="pie">
                    <p>Impreso el
                    <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d %B %Y a las %H:%M')"/>
                    </p>
                    <p>Habitaciones:
                    <t t-esc="totalkelly"/></p></div>
            </div>
        </t>
    </template>
</odoo>
