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

<body>

<metal:title fill-slot="content-title">
	<h1>
	<img tal:condition="view/icon | nothing"
		src="" tal:attributes="src view/icon"/>
	<span tal:content="here/title_or_id"/>
	<img tal:condition="python:context.getSample().getSampleType().getHazardous()"
		title="Hazardous"
		i18n:attributes="value"
		tal:attributes="src string:${view/portal_url}/++resource++bika.lims.images/hazardous_big.png"/>
	<img tal:condition="python:context.getInvoiceExclude()"
		title="Exclude from invoice"
		i18n:attributes="value"
		tal:attributes="src string:${view/portal_url}/++resource++bika.lims.images/invoice_exclude_big.png"/>
	</h1>
</metal:title>

<metal:description fill-slot="content-description">
</metal:description>

<metal:content fill-slot="content-core"
	tal:define="
		portal context/@@plone_portal_state/portal;
		tabindex view/tabindex;">
	<form name="folderContentsForm"
		method="post"
		tal:define="
			b_size python:100;
			b_start python:0;
			b_start request/b_start | b_start;
			Batch python:modules['Products.CMFPlone'].Batch;
			batch python:Batch(view.get_analyses_not_requested(), b_size, int(b_start), orphan=1);
			client_uid here/aq_parent/UID;
			sample python:here.getSample();
			sampletype python:sample.getSampleType()">

		<input tal:replace="structure context/@@authenticator/authenticator"/>

		<p tal:condition="not: batch" i18n:translate="">
			There are no results.
		</p>

		<table
			summary="Analyses not requested"
			class="listing"
			cellpadding="0" cellspacing="0">

		<thead>

			<tr tal:condition="batch|nothing">
				<th class="nosort">
					<input
						type="checkbox"
						name="selectButton"
						title="Select all items"
						onClick="toggleSelect(this);"
						i18n:attributes="title"/>
				</th>
				<th i18n:translate="">Analysis</th>
				<th i18n:translate="">Unit</th>
				<th i18n:translate="">Result</th>
				<th i18n:translate="">Status</th>
			</tr>

		</thead>

		<tbody tal:condition="batch|nothing">
			<tal:item tal:repeat="item batch">
			<tr tal:define="
					item_title_or_id item/title_or_id;
					wtool python:context.portal_workflow;
					review_state python:wtool.getInfoFor(item, 'review_state', '')">

				<td>
					<input type="checkbox" class="noborder" name="ids:list" id="#" value="#"
						tal:attributes="
							value item/getId;
							id python: 'cb_'+item.getId();
							tabindex tabindex/next|nothing;
							alt string:Select $item_title_or_id;
							title string:Select $item_title_or_id"/>
				</td>
				<td tal:content="item/Title"/>
				<td tal:content="item/getUnit"/>
				<td tal:condition="python:review_state == 'sample_received'">
					<input size="10" name="" value="10"
						tal:attributes="
							value item/getResult;
							name string:results.${item/getId}:record;
							tabindex tabindex/next"/>
				</td>

				<tal:result
					tal:condition="python:review_state != 'sample_received'">
					<td class="result" tal:content="item/getResult"/>
				</tal:result>

				<td class="private"
					tal:content="structure python:review_state and review_state or ''"
					tal:attributes="
						class python:review_state and 'state-'+review_state or 'state-private'"/>
			</tr>
			</tal:item>
		</tbody>
		</table>

		<div metal:use-macro="here/batch_macros/macros/navigation" />

		<tal:buttons tal:repeat="button actions/folder_buttons|nothing">
		<input
			class="context"
			type="submit"
			name=""
			value=""
			tabindex=""
			tal:condition="python:batch and button['id'] in ('delete', 'change_state', 'submit_results')"
			i18n:attributes="value"
			tal:attributes="
				value button/name;
				name button/url;
				tabindex tabindex/next" />
		</tal:buttons>


		<img tal:condition="sampletype/getHazardous"
			title="Hazardous"
			i18n:attributes="title"
			tal:attributes="src string:${view/portal_url}/++resource++bika.lims.images/hazardous_big.png"/>

	</form>

  <tal:remarks tal:condition="python:hasattr(context.aq_inner, 'schema') and 'Remarks' in context.schema"
               tal:define="checkPermission nocall: context/portal_membership/checkPermission;
                           mode python:'edit' if checkPermission('Modify portal content', context) else 'view';
                           field python:context.Schema()['Remarks'];
                           errors python:{};">
    <metal:widget use-macro="python:context.widget('Remarks', mode=mode)"/>
  </tal:remarks>

  <tal:rejection define="
        field python:context.Schema()['RejectionReasons'];
        widget python:field.widget;
        errors python:{};">
        <table style="display: none;">
            <td>
                <span tal:replace="python:widget.label"/>
            </td>
            <td>
                <metal:widget use-macro="python:context.widget('RejectionReasons', mode='edit')" />
            </td>
        </table>
    </tal:rejection>


</metal:content>
</body>
</html>
