<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<metal:view_macro define-macro="view">
    <tal:values tal:define="values python:field.getEditAccessor(here)();
                            session_values python:here.session_restore_value(fieldName, values);
                            cached_values python:request.get(fieldName,session_values);
                            values python:cached_values or values;
                            values python:values[0] if len(values) &gt; 0 else {};">
    <tal:fields tal:condition="python:values">
        <tal:year tal:condition="python:values.get('year','')">
            <span tal:content="python:values.get('year','')"></span>
            <span i18n:translate="">years</span>&nbsp;&nbsp;
        </tal:year>
        <tal:month tal:condition="python:values.get('month','')">
            <span tal:content="python:values.get('month','')"></span>
            <span i18n:translate="">months</span>&nbsp;&nbsp;
        </tal:month>
        <tal:days tal:condition="python:values.get('day','')">
            <span tal:content="python:values.get('day','')"></span>
            <span i18n:translate="">days</span>&nbsp;&nbsp;
        </tal:days>
    </tal:fields>
    <span tal:condition="not: values" i18n:translate="">-</span>
    </tal:values>
</metal:view_macro>

<metal:search_macro define-macro="search">
    <div metal:use-macro="here/widgets/string/macros/edit"/>
</metal:search_macro>

<metal:edit_macro define-macro="edit">
    <metal:use use-macro="field_macro | context/widgets/field/macros/edit">
        <metal:body_macro fill-slot="widget_body">
            <tal:values tal:define="values python:field.getEditAccessor(here)();
                            session_values python:here.session_restore_value(fieldName, values);
                            cached_values python:request.get(fieldName,session_values);
                            values python:cached_values or values;
                            values python:values[0] if len(values) &gt; 0 else {};">
            <!-- Year -->
            <label tal:attributes="for python:fieldName+'_year';"  i18n:translate="">Years</label>:&nbsp;
            <input type="text" size="4" maxlength="4"
                tal:attributes="name python:fieldName+'_year';
                                id python:fieldName+'_year';
                                value python:values.get('year','');"/>&nbsp;
            <!-- Month -->
            <label tal:attributes="for python:fieldName+'_month';"  i18n:translate="">Months</label>:&nbsp;
            <input type="text" size="2" maxlength="2"
                tal:attributes="name python:fieldName+'_month';
                                id python:fieldName+'_month';
                                value python:values.get('month','');"/>&nbsp;

            <!-- Day -->
            <label tal:attributes="for python:fieldName+'_day';"  i18n:translate="">Days</label>:&nbsp;
            <input type="text" size="2" maxlength="2"
                tal:attributes="name python:fieldName+'_day';
                                id python:fieldName+'_day';
                                value python:values.get('day','');"/>&nbsp;


            <!-- Hidden widget params accessed by js -->
            <input type="hidden" tal:attributes="name python:fieldName+'_changeYear';
                                id python:fieldName+'_changeYear';"/>
            <input type="hidden" tal:attributes="name python:fieldName+'_changeMonth';
                                id python:fieldName+'_changeMonth';"/>
            <input type="hidden" tal:attributes="name python:fieldName+'_changeDay';
                                id python:fieldName+'_changeDay';"/>
            <input type="hidden" tal:attributes="name python:fieldName+'_maxDate';
                                id python:fieldName+'_maxDate';"/>
            <input type="hidden" tal:attributes="name python:fieldName+'_yearRange';
                                id python:fieldName+'_yearRange';"/>
            <input type="hidden" id="fieldName" name="fieldName"
                                tal:attributes="value python:fieldName;"/>
            </tal:values>
        </metal:body_macro>
    </metal:use>
</metal:edit_macro>

</body>
</html>
