<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"
    i18n:domain="senaite.health">

<head>
    <title>CaseMenstrualStatus Widget</title>
</head>
<body>    
    <metal:edit_macro define-macro="edit">
    <metal:use use-macro="here/widgets/field/macros/edit">
    <tal:block metal:fill-slot="widget_body">
        <span tal:replace="structure context/@@authenticator/authenticator"/>                
        
        <fieldset tal:attributes="id string:${fieldName};
                                  name string:${fieldName};"                
             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;
                         i18n_domain field/widget/i18n_domain|context/i18n_domain|string:plone;
                         data python:widget.getMenstrualStatus()[0]">
        
            <!-- Hysterectomy -->
            <div class="fieldline">
                <div class="fieldline-label">
                    <input type="checkbox" 
                           tal:attributes="name string:${fieldName}.Hysterectomy:records;
                                           id string:${fieldName}-Hysterectomy-0;
                                           checked python:data['Hysterectomy']"/>
                    <label tal:attributes="for string:${fieldName}.Hysterectomy:records;"
                           i18n:translate="">Hysterectomy</label>
                </div>
                <div class="fieldline-content"
                    tal:attributes="style python:data['Hysterectomy']==False and 'display:none' or '';">
                    <!-- Year of Hysterectomy -->
                    <label tal:attributes="for string:${fieldName}.HysterectomyYear:records;"
                           i18n:translate="">Year</label>
                    <input type="text"
                           tal:attributes="name string:${fieldName}.HysterectomyYear:records;
                                           id string:${fieldName}-HysterectomyYear-0;
                                           value python:data['HysterectomyYear'];
                                           size string:4;
                                           class string:numeric;
                                           max-length string:4;"/>
                </div>
                <div class="clear-both"></div>  
            </div>
            
            <!-- Ovaries removed -->
            <div class="fieldline">
                <div class="fieldline-label">
                    <input type="checkbox" 
                           tal:attributes="name string:${fieldName}.OvariesRemoved:records;
                                           id string:${fieldName}-OvariesRemoved-0;
                                           checked python:data['OvariesRemoved']"/>
                    <label tal:attributes="for string:${fieldName}.OvariesRemoved:records;"
                           i18n:translate="">Ovaries removed</label>
                </div>
                <div class="fieldline-content"
                    tal:attributes="style python:data['OvariesRemoved']==False and 'display:none' or '';">
                    <!-- Number of ovaries removed -->
                    <input type="radio" 
                        tal:attributes="name string:${fieldName}.OvariesRemovedNum:records:ignore_empty;
                                        id string:${fieldName}-OvariesRemovedNum-0;
                                        checked python:data['OvariesRemovedNum']==1"
                                        value="1"/><span i18n:translate="">One</span>&nbsp;
                    <input type="radio" 
                        tal:attributes="name string:${fieldName}.OvariesRemovedNum:records:ignore_empty;
                                        id string:${fieldName}-OvariesRemovedNum-0;
                                        checked python:data['OvariesRemovedNum']==2"
                                        value="2"/><span i18n:translate="">Both</span>&nbsp;
                    
                    <!-- Year of ovaries removal -->
                    <label tal:attributes="for string:${fieldName}.OvariesRemovedYear:records;"
                           i18n:translate="">Year</label>
                    <input type="text"
                           tal:attributes="name string:${fieldName}.OvariesRemovedYear:records;
                                           id string:${fieldName}-OvariesRemovedYear-0;
                                           value python:data['OvariesRemovedYear'];
                                           size string:4;
                                           class string:numeric;
                                           max-length string:4;"/>
                </div>
                <div class="clear-both"></div>  
            </div>
            <input type='hidden' 
                    tal:attributes="name string:${fieldName}.PatientGender;
                                    id string:${fieldName}-PatientGender;
                                    value python:widget.getPatientsGender();"/>
        </fieldset>
    </tal:block> 
    </metal:use>
    </metal:edit_macro>
</body>
</html>