<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
        metal:use-macro="here/main_template/macros/master"
        i18n:domain="senaite.core">

<head>
    <metal:block fill-slot="head_slot">
        <script tal:attributes="src string:${portal_url}/bika_widgets/referencewidget.js"
                type="text/javascript"></script>
        <style media="screen" type="text/css">
            h2 {
                font-size: 1.1em;
                margin: 15px 0px;
            }

            #content-core div fieldset {
                border-style: none;
            }

            ul#toc-reports {
                list-style-type: square;
                color: #CDCDCD;
            }

            #toc-reports li {
                color: #333;
                padding-bottom: 10px;
            }

            #toc-reports li span {
                font-size: 0.9em;
                color: #666;
            }

            #toc-reports li div {
                margin-top: 5px;
                border-radius: 5px 5px 5px 5px;
                margin-bottom: 5px;
                overflow: hidden;
                padding: 10px 10px 15px 15px;
                background-color: #efefef;
            }

            #toc-reports li div fieldset {
                border-style: none;
                margin-bottom: 10px;
                padding: 0px;
            }

            #toc-reports li div fieldset div.field {
                clear: none;
                float: left;
                width: 32%;
                padding: 0px 5px 0px 0px;
                font-size: 0.9em;
            }

            #toc-reports li div fieldset div.field label {
                width: 100%;
                border-bottom: 1px solid #dcdcdc;
                margin-bottom: -8px;
                padding-bottom: 2px;
                display: block;
            }

            #toc-reports li div fieldset div.field select {
                width: inherit;
            }

            #toc-reports li div fieldset div.field select#ServiceUID {
                width: 165px;
            }

            #toc-reports li div fieldset div.field table tr td {
                padding-right: 10px;
            }
        </style>

    </metal:block>
</head>

<body>
<metal:content-title fill-slot="content-title">
    <h1 i18n:translate="">Productivity Reports</h1>
</metal:content-title>
<metal:content-description
        fill-slot="content-description"></metal:content-description>

<metal:content-core fill-slot="content-core">
<input tal:replace="structure context/@@authenticator/authenticator"/>

<div>
<fieldset>
<h2 i18n:translate="">Sample related reports</h2>
<ul id="toc-reports">

    <li>
        <a href="#" id="dailysamplesreceived_selector"
                i18n:translate="">Daily samples received</a>
        <br/>
            <span i18n:translate="">
                Lists all samples received for a date range
            </span>

        <div id="dailysamplesreceived" style="display:none" class="criteria">
            <form action="createreport" method="post"
                  name="productivity_dailysamplesreceived">
                <input type="hidden" name="report_id"
                       value="productivity_dailysamplesreceived"/>
                <fieldset>
                    <tal:x content="structure python:view.selection_macros.select_daterange_received(
                                                              field_id='getDateReceived',
                                                              field_title='Date Received')"/>
                    <tal:x content="structure context/@@selection_macros/select_output_format"/>
                </fieldset>
                <input tabindex=""
                       class="searchButton allowMultiSubmit"
                       type="submit"
                       name="submit"
                       value="Generate report"
                        i18n:attributes="value"/>
            </form>
        </div>
    </li>


    <li>
        <a href="#" id="samplereceivedvsreported_selector"
                i18n:translate="">Samples received vs. samples reported</a>
        <br/>
            <span i18n:translate="">
                Report tables between a period of time the number of
                samples received and results reported for them with
                differences between the two
            </span>

        <div id="samplereceivedvsreported" style="display:none" class="criteria">
            <form action="createreport" method="post"
                  name="productivity_samplereceivedvsreported">
                <input type="hidden" name="report_id"
                       value="productivity_samplereceivedvsreported"/>
                <fieldset>
                    <tal:x content="structure python:view.selection_macros.select_daterange_received(
                                                              field_id='getDateReceived',
                                                              field_title='Date Received')"/>
                    <tal:x content="structure context/@@selection_macros/select_output_format"/>
                </fieldset>
                <input tabindex=""
                       class="searchButton allowMultiSubmit"
                       type="submit"
                       name="submit"
                       value="Generate report"
                        i18n:attributes="value"/>
            </form>
        </div>
    </li>
</ul>

<h2 i18n:translate="">Analyses related reports</h2>
<ul id="toc-reports">

<!--  Analyses per service -->
<li>
    <a href="#" id="analysestotals_selector"
            i18n:translate="">Analyses per service</a>
    <br/>
            <span i18n:translate="">
                The number of analyses requested per analysis service
            </span>

    <div id="analysestotals" style="display:none;" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysesperservice">
            <input type="hidden" name="report_id"
                   value="productivity_analysesperservice"/>
            <fieldset>
                <tal:x content="structure context/@@selection_macros/select_client"/>
                <tal:x content="structure python:view.selection_macros.select_daterange_requested(
                                                               field_id='Requested',
                                                               field_title='Date Requested')"/>
                <tal:x content="structure python:view.selection_macros.select_daterange_published(
                                                               field_id='Published',
                                                               field_title='Date Published')"/>
                <tal:x content="structure python:view.selection_macros.select_state_analysis(
                                                               workflow_id='bika_analysis_workflow',
                                                               field_id='bika_analysis_workflow',
                                                               field_title='Analysis state')"/>
                <tal:x content="structure python:view.selection_macros.select_state_cancellation(
                                                               workflow_id='bika_cancellation_workflow',
                                                               field_id='bika_cancellation_workflow',
                                                               field_title='Cancellation state')"/>
                <tal:x content="structure python:view.selection_macros.select_state_worksheetanalysis(
                                                               workflow_id='bika_worksheetanalysis_workflow',
                                                               field_id='bika_worksheetanalysis_workflow',
                                                               field_title='Worksheet state')"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>

<!-- Analyses per sample type -->
<li>
    <a href="#" id="analysespersampletype_selector"
            i18n:translate="">Analyses per sample type</a>
    <br/>
            <span i18n:translate="">
                The number of analyses requested per sample type
            </span>

    <div id="analysespersampletype" style="display:none" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysespersampletype">
            <input type="hidden" name="report_id"
                   value="productivity_analysespersampletype"/>
            <fieldset>
                <tal:x content="structure context/@@selection_macros/select_client"/>
                <tal:x content="structure python:view.selection_macros.select_daterange_requested(
                                                               field_id='Requested',
                                                               field_title='Date Requested')"/>
                <tal:x content="structure python:view.selection_macros.select_state_analysis(
                                                               workflow_id='bika_analysis_workflow',
                                                               field_id='bika_analysis_workflow',
                                                               field_title='Analysis state')"/>
                <tal:x content="structure python:view.selection_macros.select_state_cancellation(
                                                               workflow_id='bika_cancellation_workflow',
                                                               field_id='bika_cancellation_workflow',
                                                               field_title='Cancellation state')"/>
                <tal:x content="structure python:view.selection_macros.select_state_worksheetanalysis(
                                                               workflow_id='bika_worksheetanalysis_workflow',
                                                               field_id='bika_worksheetanalysis_workflow',
                                                               field_title='Worksheet state')"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>

<!-- Analyses requests and analyses -->
<li tal:condition="here/member_is_client">
    <a href="#" id="analysesperclient_selector"
            i18n:translate="">Analysis requests and analyses</a>
    <br/>
            <span i18n:translate="">
                The number of requests and analyses
            </span>
</li>

<!-- Analyses requests and analyses per client -->
<li tal:condition="not:here/member_is_client">
    <a href="#" id="analysesperclient_selector"
            i18n:translate="">Analysis requests and analyses per client</a>
    <br/>
            <span i18n:translate="">
                The number of requests and analyses per client
            </span>

    <div id="analysesperclient" style="display:none" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysesperclient">
            <input type="hidden" name="report_id"
                   value="productivity_analysesperclient"/>
            <fieldset>
                <tal:x content="structure context/@@selection_macros/select_client"/>
                <tal:x content="structure python:view.selection_macros.select_daterange_requested(
                                                               field_id='Requested',
                                                               field_title='Date Requested')"/>
                <tal:x content="structure python:view.selection_macros.select_state_analysis(
                                                               workflow_id='bika_analysis_workflow',
                                                               field_id='bika_analysis_workflow',
                                                               field_title='Analysis state')"/>
                <tal:x content="structure python:view.selection_macros.select_state_cancellation(
                                                               workflow_id='bika_cancellation_workflow',
                                                               field_id='bika_cancellation_workflow',
                                                               field_title='Cancellation state')"/>
                <tal:x content="structure python:view.selection_macros.select_state_worksheetanalysis(
                                                               workflow_id='bika_worksheetanalysis_workflow',
                                                               field_id='bika_worksheetanalysis_workflow',
                                                               field_title='Worksheet state')"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>

<!-- Analyses turnaround time -->
<li>
    <a href="#" id="tats_selector"
            i18n:translate="">Analysis turnaround time</a>
    <br/>
            <span i18n:translate="">
                The turnaround times of analyses
            </span>

    <div id="tats" style="display:none" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysestats">
            <input type="hidden" name="report_id"
                   value="productivity_analysestats"/>
            <fieldset>
                <tal:x content="structure context/@@selection_macros/select_client"/>
                <tal:x content="structure python:view.selection_macros.select_daterange_received(
                                                               field_id='Received',
                                                               field_title='Date Received')"/>
                <tal:x content="structure python:view.selection_macros.select_state_worksheetanalysis(
                                                               workflow_id='bika_worksheetanalysis_workflow',
                                                               field_id='bika_worksheetanalysis_workflow',
                                                               field_title='Worksheet state')"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>

<!-- Analyses turnaround time over time -->
<li tal:condition="not:here/member_is_client">
    <a href="#" id="tats_overtime_selector"
            i18n:translate="">Analysis turnaround time over time</a>
    <br/>
            <span i18n:translate="">
                The turnaround times of analyses plotted over time
            </span>

    <div id="tats_overtime" style="display:none" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysestats_overtime">
            <input type="hidden" name="report_id"
                   value="productivity_analysestats_overtime"/>
            <fieldset>
                <tal:x content="structure python:view.selection_macros.select_analysisservice(
                                                               allow_blank=False,
                                                               multiselect=True)"/>
                <tal:x content="structure context/@@selection_macros/select_analyst"/>
                <tal:x content="structure context/@@selection_macros/select_instrument"/>
                <tal:x content="structure context/@@selection_macros/select_period"/>
                <tal:x content="structure python:view.selection_macros.select_daterange_received(
                                                               field_id='Received',
                                                               field_title='Date Received')"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>

<!-- Analyses by lab department -->
<li>
    <a href="#" id="analysesperdepartment_selector"
            i18n:translate="">Analyses summary per department</a>
    <br/>
            <span i18n:translate="">
                Number of analysis requested and published per department
                and expresed as a percentage of all analyses performed
            </span>

    <div id="analysesperdepartment" style="display:none" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysesperdepartment">
            <input type="hidden" name="report_id"
                   value="productivity_analysesperdepartment"/>
            <fieldset>
                <tal:x content="structure python:view.selection_macros.select_daterange_requested(
                                                               field_id='getDateRequested',
                                                               field_title='Date Requested')"/>
                <tal:x content="structure python:view.selection_macros.select_state_analysis(
                                                               workflow_id='bika_analysis_workflow',
                                                               field_id='getAnalysisState',
                                                               field_title='Analysis state')"/>
                <tal:x content="structure python:view.selection_macros.select_groupingperiod(
                                                                    allow_blank=True)"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>

<!-- Analyses perfomed as % of total -->
<li>
    <a href="#" id="analysesperformedpertotal_selector"
            i18n:translate="">Analyses performed and published as % of total</a>
    <br/>
            <span i18n:translate="">
                Report tables between a period of time the number of
                analyses published and expressed as a percentage of all
                analyses performed.
            </span>

    <div id="analysesperformedpertotal" style="display:none" class="criteria">
        <form action="createreport" method="post"
              name="productivity_analysesperformedpertotal">
            <input type="hidden" name="report_id"
                   value="productivity_analysesperformedpertotal"/>
            <fieldset>
                <tal:x content="structure python:view.selection_macros.select_daterange_requested(
                                                               field_id='getDateRequested',
                                                               field_title='Date Requested')"/>
                <tal:x content="structure python:view.selection_macros.select_groupingperiod(
                                                                    allow_blank=True)"/>
                <tal:x content="structure context/@@selection_macros/select_output_format"/>
            </fieldset>
            <input tabindex=""
                   class="searchButton allowMultiSubmit"
                   type="submit"
                   name="submit"
                   value="Generate report"
                    i18n:attributes="value"/>
        </form>
    </div>
</li>
</ul>

<h2 style="font-size:1.1em;margin:15px 0px;" i18n:translate="">Other productivity
    reports</h2>
<ul id="toc-reports">
    <li>
        <a href="#" id="attachments_selector"
                i18n:translate="">Attachments</a>
        <br/>
            <span i18n:translate="">
                The attachments linked to analysis requests and analyses
            </span>

        <div id="attachments" style="display:none" class="criteria">
            <form action="createreport" method="post"
                  name="productivity_analysesattachments">
                <input type="hidden" name="report_id"
                       value="productivity_analysesattachments"/>
                <fieldset>
                    <tal:x content="structure context/@@selection_macros/select_client"/>
                    <tal:x content="structure python:view.selection_macros.select_daterange_loaded(
                                                              field_id='Loaded',
                                                              field_title='Date Loaded')"/>
                    <tal:x content="structure context/@@selection_macros/select_output_format"/>
                </fieldset>
                <input tabindex=""
                       class="searchButton allowMultiSubmit"
                       type="submit"
                       name="submit"
                       value="Generate report"
                        i18n:attributes="value"/>
            </form>
        </div>
    </li>

    <li>
        <a href="#" id="dataentrydaybook_selector"
                i18n:translate="">Data entry day book</a>
        <br/>
            <span i18n:translate="">
                Report tables of Analysis Requests and totals submitted
                between a period of time
            </span>

        <div id="dataentrydaybook" style="display:none" class="criteria">
            <form action="createreport" method="post"
                  name="productivity_dataentrydaybook">
                <input type="hidden" name="report_id"
                       value="productivity_dataentrydaybook"/>
                <fieldset>
                    <tal:x content="structure python:view.selection_macros.select_daterange_created(
                                                              field_id='getDateCreated',
                                                              field_title='Date Created')"/>
                    <tal:x content="structure context/@@selection_macros/select_output_format"/>
                </fieldset>
                <input tabindex=""
                       class="searchButton allowMultiSubmit"
                       type="submit"
                       name="submit"
                       value="Generate report"
                        i18n:attributes="value"/>
            </form>
        </div>
    </li>

    <li tal:repeat="rpt_data view/additional_reports">
        <a href="#"
                tal:attributes="id string:${rpt_data/id}_selector"
                tal:content="rpt_data/title"/>
        <br/>
        <span tal:content="rpt_data/description"/>

        <div tal:attributes="id rpt_data/id" style="display:none"
                                             class="criteria">
            <form action="createreport"
                  method="post" tal:attributes="name string:productivity_${rpt_data/id}">
                <input type="hidden"
                       name="report_id" tal:attributes="value string:productivity_${rpt_data/id}" />
                <input type="hidden"
                       name="report_module" tal:attributes="value rpt_data/module" />
                <span tal:replace="structure rpt_data/query_form"/>
                <input tabindex=""
                       class="searchButton allowMultiSubmit"
                       type="submit"
                       name="submit"
                       value="Generate report"
                        i18n:attributes="value"/>
            </form>
        </div>
    </li>

</ul>
</fieldset>
</div>
</metal:content-core>

</body>
</html>
