<html xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      i18n:domain="senaite.core">

<body>

<div metal:define-macro="portlet"
     tal:define="member python: context.portal_membership.getAuthenticatedMember()"
     tal:condition="python:member.has_role(('LabManager', 'Verifier'))">

<tal:review
     tal:define="portal context/portal_url/getPortalObject;
                 plone_view context/@@plone;
                 DateTime python:modules['DateTime'].DateTime;
                 ws python:context.bika_catalog(
                    portal_type='Worksheet',
                    review_state='to_be_verified');
                 ws_results python:[p.getObject() for p in ws[:5]];
                 ar python:context.bika_catalog(
                    portal_type='AnalysisRequest',
                    review_state='to_be_verified',
                    cancellation_state='active',
                    sort_on='sortable_title') or [];
                 ar_results python:[p.getObject() for p in ar[:5]];
                 rs python:ws_results + ar_results;
                 results python:rs[:5];"
     tal:condition="results">

    <dl class="portlet" id="portlet-workflow-review">

        <dt class="portletHeader"
            i18n:translate="">To be verified</dt>

        <tal:block repeat="o results">
        <dd style="padding-top:4px;padding-bottom:0px;">

            <a href="#"
                class="marker"
                tal:attributes="href string:${o/absolute_url};
                                title o/Description;
                                id python:'to_be_verified_'+o.Title()">
                <img src="" height="16" width="16"
                        tal:attributes="src string:${context/portal_url}/${o/getIcon};
                                        title o/Type;" />
                <span tal:replace="o/Title|o/getId">
                AR-00001
                </span>
            </a>

            <div class="portletDetails"
                 style="text-align:right"
                 tal:define="moddate o/ModificationDate;"
                 tal:content="python:plone_view.toLocalizedTime(moddate)">July 7, 08:11
            </div>
        </dd>
        </tal:block>
        <dd class="portletFooter" tal:condition="python:len(ar)+len(ws) > 5">
            <a  tal:condition="ws"
                class="portletMore"
                tal:attributes="href string:${context/portal_url}/worksheets?review_state=to_be_verified">
                <span tal:content="python:str(len(ws))"/>
                <span i18n:translate="">Worksheets</span>
            </a>
            <br tal:condition="ws"/>
            <a  tal:condition="ar"
                class="portletMore"
                tal:attributes="href string:${context/portal_url}/analysisrequests?list_review_state=to_be_verified">
                <span tal:content="python:str(len(ar))"/>
                <span i18n:translate="">Analysis Requests</span>
            </a>
        </dd>

    </dl>

</tal:review>
</div>
</body>

</html>
