<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<odoo>

  <report id="golem_activity_report_pdf" model="golem.activity"
    string="Activity Report [PDF]" report_type="qweb-pdf"
    name="golem_activity.golem_activity_report_template"
    file="golem_activity.golem_activity_report_template"
    attachment="(object.name + '.pdf')" />

  <report id="golem_activity_report_html" model="golem.activity"
    string="Activity Report [HTML]" report_type="qweb-html"
    name="golem_activity.golem_activity_report_template"
    file="golem_activity.golem_activity_report_template"
    attachment="(object.name + '.html')" />

    <template id="golem_activity_report_template">
      <t t-call="report.html_container">
        <t t-set="season" t-value="docs.default_season()" />
        <t t-foreach="docs" t-as="activity" id="foreach_activity">
          <t t-call="report.external_layout">
            <div id='page_report_activity' class="page">
              <div class="row">
                <div class="col-xs-12" id="activity_title">
                  <h2 class="golem_report_title">
                    Activity : <span t-field="activity.name" />
                  </h2>
                </div>
              </div>
              <div class="col-xs-12" style="margin-top: 40px;" >
                <div class="col-xs-4" id="activity_info_left">
                  <h4 style="font-weight: bold;">General Information</h4>
                </div>
                <div class="col-xs-4" id="activity_info_middle">
                  <h4 style="font-weight: bold;">Type</h4>
                </div>
                <div class="col-xs-4" id="activity_info_right">
                  <h4 style="font-weight: bold;">Session</h4>
                </div>
              </div>
              <div id="activity_info" class="col-xs-12" >
                <div class="col-xs-4" id="activity_info_left">
                  <div t-if="activity.season_id">
                    <strong>Season : </strong>>
                    <span t-field="activity.season_id"/>
                  </div>
                  <div t-if="activity.animator_id">
                    <strong>Animator : </strong>>
                    <span t-field="activity.animator_id"/>
                  </div>
                  <div t-if="activity.list_price">
                    <strong>Price : </strong>>
                    <span t-field="activity.list_price"/>
                  </div>
                  <div t-if="activity.default_code">
                    <strong>Reference : </strong>>
                    <span t-field="activity.default_code"/>
                  </div>
                </div>
                <div class="col-xs-4" id="activity_info_middle">
                  <div t-if="activity.type_id">
                    <strong>Type : </strong><span t-field="activity.type_id"/>
                  </div>
                  <div t-if="activity.categ_id">
                    <strong>Category : </strong><span t-field="activity.categ_id"/>
                  </div>
                </div>
                <div class="col-xs-4" id="activity_info_right">
                  <div t-if="activity.places">
                    <strong>Places : </strong><span t-field="activity.places"/>
                  </div>
                  <t t-if="activity.is_recurrent">
                    <div>
                      <strong>Is Recurrent : </strong>
                      <span t-field="activity.is_recurrent"/>
                    </div>
                    <t t-if="activity.is_fullseason">
                      <div><strong>Is Full Season : </strong>
                        <span t-field="activity.is_fullseason"/></div>
                      <div t-if="activity.weekday">
                        <strong>Weekday : </strong>
                        <span t-field="activity.weekday"/>
                      </div>
                    </t>
                    <t t-else="">
                      <div t-if="activity.date_start">
                        <strong>Date Start : </strong><span t-field="activity.date_start"/>
                      </div>
                      <div t-if="activity.date_stop">
                        <strong>Date Stop : </strong><span t-field="activity.date_stop"/>
                      </div>
                    </t>
                    <div t-if="activity.hour_start">
                      <strong>Start Hour : </strong>>
                      <span t-esc="'%02d:%02d' % (int(activity.hour_start), round(activity.hour_start % 1 * 60))" />
                    </div>
                    <div t-if="activity.hour_stop">
                      <strong>Stop Hour : </strong>>
                      <span t-esc="'%02d:%02d' % (int(activity.hour_stop), round(activity.hour_stop % 1 * 60))" />
                    </div>
                  </t>
                  <t t-else="">
                    <div t-if="activity.date_start">
                      <strong>Date Start : </strong>
                      <span t-field="activity.date_start"/>
                    </div>
                    <div t-if="activity.date_stop">
                      <strong>Date Stop : </strong>
                      <span t-field="activity.date_stop"/>
                    </div>
                  </t>
                </div>
              </div>
            </div>
          </t>
        </t>
      </t>
    </template>

</odoo>