
<!---- CUSTOMIZED CONTENT ---->

<td colspan="3" ng-if="theField01.contentType=='fftable4updl2'"  >
    <font color="#000" ng-if="theField01.fieldDesc.forceAlias">
        {{theField01.fieldDesc.alias}}
    </font>

    <fftable4updl2Directive style="max-width:350px;" ></fftable4updl2Directive>
</td>



<!---- FIELD LABEL ---->

<!-- Field label in case of insert/update container -->
<td ng-if="theField01.panelUse!='search' && theField01.contentType!='fftable4updl2' &&
            (!theField01.fieldDesc.fieldTypeIsRelation ||
             theField01.fieldDesc.fieldTypeIsRelationWithForm ||
             theField01.fieldDesc.fieldTypeIsRelationListOfValue)"
            style="color=#000; min-width: {{labelMinWidth}}; "
            ng-show="visible"
            >
    <font color="#000">
        {{theField01.fieldDesc.alias}}
    </font>
</td>

<!-- Field label in case of search container -->
<td ng-if="theField01.panelUse=='search' && 
          (!theField01.fieldDesc.fieldTypeIsSingleAttachment &&
           !theField01.fieldDesc.fieldTypeIsMultipleAttachment)"
            style="color=#000; min-width: {{labelMinWidth}}; "
            ng-show="visible"
            >
    <font color="#000">
        {{theField01.fieldDesc.alias}}
    </font>
</td>


<!----  ---->


<!---- SPACE ---->

<!-- Space column between label and field value -->
<td style="width:25px;" ng-if="!theField01.fieldDesc.fieldTypeIsRelation 
           || theField01.fieldDesc.fieldTypeIsRelationListOfValue
           || theField01.fieldDesc.fieldTypeIsRelationWithForm"
           ng-show="visible" ></td>

<!----  ---->


<!---- FIELD VALUES ---->
<td ng-if="!theField01.fieldDesc.fieldTypeIsRelation || theField01.fieldDesc.fieldTypeIsRelationListOfValue 
|| theField01.fieldDesc.fieldTypeIsRelationWithForm"
    style="display:inline;" ng-show="visible">

  <!---- Geometry field ---->
  <GeometryFieldDirective ng-if="theField01.fieldDesc.fieldTypeIsGeometry" ng-show="visible">
  </GeometryFieldDirective>

  <!-- Date field for input -->
  
    <input type="text" class="form-control" 
           ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
           ng-change="valueChanged()"
           data-date-format="dd/MM/yyyy" data_autoclose="true"
           ng-model="theField01.objectField.value"
           data-ng-options="datepickerOptions" 
           ng-disabled="theField01.mode=='readonly'"
           name="date" bs-datepicker ng-if="theField01.fieldDesc.fieldTypeIsDate && theField01.panelUse!='search'"/>

  	  <select ng-model="theField01.objectField.operator"
  	          ng-if="theField01.fieldDesc.fieldTypeIsDate && theField01.panelUse=='search'"
              ng-options="desc.operator as desc.text for desc in dateOperators">
  	  </select>
      <input type="text" class="form-control" 
             ng-change="valueChanged()"
             data-date-format="dd/MM/yyyy" data_autoclose="true" 
             ng-model="theField01.objectField.value" 
             ng-readonly="theField01.mode=='readonly'"
             name="date" bs-datepicker ng-if="theField01.fieldDesc.fieldTypeIsDate && theField01.panelUse=='search'"/>
      <label ng-if="theField01.fieldDesc.fieldTypeIsDate && theField01.panelUse=='search'" ng-show="theField01.objectField.operator == 'BETWEEN'">et</label>
      <input type="text" class="form-control" 
             ng-change="valueChanged()"
             data-date-format="dd/MM/yyyy" data_autoclose="true" 
             ng-show="theField01.objectField.operator == 'BETWEEN'" 
             ng-model="theField01.objectField.value2" 
             name="date" bs-datepicker ng-if="theField01.fieldDesc.fieldTypeIsDate && theField01.panelUse=='search'"/>

  <!-- Text fields -->
  <input type="text" class="form-control" ng-change="valueChanged()"
         ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }" 
         ng-readonly="theField01.mode=='readonly'"
  		 ng-if="theField01.fieldDesc.fieldTypeIsString && !fieldTypeIsDomain && !theField01.fieldDesc.fieldTypeIsComment"
         maxlength="{{maxLength}}"
         ng-model="theField01.objectField.value" ng-attr-title="{{theField01.objectField.value}}" >
  </input>

  <!-- text for relation when accessed through a form -->
  <table ng-if="theField01.fieldDesc.fieldTypeIsRelationWithForm" >
  	<tr>
  		<td>
			 <input type="text" class="form-control" ng-change="valueChanged()" 
                     ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }" 
			 		 readonly="readonly"
			         ng-model="theField01.objectField.valueToDisplay"
			         title="{{theField01.objectField.valueToDisplay}}" />
		</td>
		<td width="5px">
		</td>
		<td>
			 <button ng-click="openForm()" ng-disabled="theField01.mode=='readonly'" title="Ouvrir la fenêtre de sélection">
				<img src="img/common/form.png"></img>
			 </button>
		</td>
		<td ng-if="theField01.fieldDesc.relatedTableIsGeographic && theField01.mode!='readonly'">
             <button ng-click="getSelectedMapObject()" title="Récupérer l'objet sélectionné sur la carte" >
                 <span class="glyphicon glyphicon-screenshot"></span>
             </button> 
		</td>
	 </tr>
  </table>
  
  <!-- Big text field : comments -->
  <table ng-if="theField01.fieldDesc.fieldTypeIsComment && !fieldTypeIsDomain">
      <tr>
          <td>
              <textarea type="text" class="form-control" ng-change="valueChanged()"
                     ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
                     ng-readonly="theField01.mode=='readonly'" 
                     rows="{{theField01.rows}}"
                     ng-model="theField01.objectField.value" >
              </textarea>
          </td>
          <td>
              <img src="img/common/8px-View-fullscreen.png" title='Grande zone de saisie'
                   ng-show="!hideSmallViewComment" ng-init="hideSmallViewComment=false"
                   ng-click="openCommentInput()" ng-mouseover="hideSmallViewComment=true" /> 
              <img src="img/common/16px-View-fullscreen.png" title='Grande zone de saisie' 
                   ng-show="hideSmallViewComment" 
                   ng-click="openCommentInput()" ng-mouseleave="hideSmallViewComment=false" /> 
          </td>
      </tr>
  </table>
 
  <!-- Numeric field -->
  <input type="text" numbers-only class="form-control" ng-change="valueChanged()"
         ng-readonly="theField01.mode=='readonly'" 
         ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
  		 ng-if="theField01.fieldDesc.fieldTypeIsNumber && !fieldTypeIsDomain"
  		 ng-show="!fieldHasUnit"
         ng-model="theField01.objectField.value" >
  </input>
  <table ng-show="fieldHasUnit">
    <tr>
        <td>
          <input type="text" numbers-only class="form-control" ng-change="valueChanged()" 
             ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
             ng-readonly="theField01.mode=='readonly'" 
             ng-show="fieldHasUnit"
             ng-if="theField01.fieldDesc.fieldTypeIsNumber && !fieldTypeIsDomain"
             ng-attr-title="{{theField01.objectField.value+' '+dbUnit}}"
             ng-model="numericValue.value" >
          </input>
        </td>
        <td>
          <select ng-if="fieldHasUnit"
                  ng-options="unit.symbol for unit in unitDesc.multiple"
                  ng-attr-title="{{currentUnitFactor.value.tooltip}}"
                  ng-model="currentUnitFactor.value"
                  ng-disabled="theField01.mode=='readonly'"
                >
          </select>
        </td>
    </tr>      
  </table>

  <!-- Dropdown value list for domains -->
  <!-- single selection -->
  <select class="select01"
          ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
  		  ng-change="valueChanged()"
          ng-if="fieldTypeIsDomain && domainSelectionMode!='multiple' && theField01.fieldDesc.groupSelect==undefined"
          ng-model="theField01.objectField.value" 
          title="{{theField01.objectField.value}}"
          style="max-width: 300px;min-width:150px;"
          ng-disabled="theField01.mode=='readonly'"
          ng-options="desc.code as desc.value for desc in theField01.fieldDesc.listOfValues">
  </select>
  <select class="select01"
          ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
  		  ng-change="valueChanged()"
          ng-if="fieldTypeIsDomain && domainSelectionMode!='multiple' && theField01.fieldDesc.groupSelect!=undefined"
          ng-model="theField01.objectField.value" 
          title="{{theField01.objectField.value}}"
          style="max-width: 300px;min-width:150px;"
          ng-disabled="theField01.mode=='readonly'"
          ng-options="desc.code as desc.value group by desc.group_value for desc in theField01.fieldDesc.listOfValues">
  </select>
  
  <!-- multiple selection -->
  <select class="select01"
          ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
          ng-change="valueChanged()"
          ng-if="fieldTypeIsDomain && domainSelectionMode=='multiple'"
          ng-model="theField01.objectField.value" 
          title="{{theField01.objectField.value}}"
          style="max-width: 300px;min-width:150px;"
          ng-disabled="theField01.mode=='readonly'"
          multiple
          data-ng-attr-size="{{domainSize}}"
          ng-options="desc.code as desc.value for desc in theField01.fieldDesc.listOfValues">
  </select>

  <!-- Dropdown value list from table -->
  <table ng-if="theField01.fieldDesc.fieldTypeIsRelationListOfValue">
      <tr>
          <td>
              <select id="select_{{thisId}}"
                      ng-class="{ 'form-control': !requiredValueIsNull , 'form-control mandatoryField': requiredValueIsNull  }"
                      ng-model="theField01.objectField.value" 
                      ng-change="valueChanged()"
                      style="max-width: 300px;min-width:150px;"
                      ng-disabled="theField01.mode=='readonly'"
                      ng-options="val.code as val.value group by val.group_value for val in theField01.fieldDesc.listOfValues | orderBy:'value'"
                      >
              </select>
          </td>
          <td ng-if="theField01.fieldDesc.relation.callForm">
              <button ng-disabled="theField01.mode=='readonly'"
                      ng-click="openForm()"  >
                <img src="img/common/form.png">
                </img>
             </button> 
          </td>
      </tr>      
  </table>

  <!--
  <select class="select01" id="select_{{thisId}}"
  		  ng-change="valueChanged()"
          ng-if="theField01.fieldDesc.fieldTypeIsRelationListOfValue"
          ng-model="theField01.objectField.value" 
          style="max-width: 300px;min-width:150px;"
          >
  </select>
-->
  <!-- Send mail field -->
  <SendMailFieldDirective ng-if="theField01.fieldDesc.fieldTypeIsSendMail"></SendMailFieldDirective>

  
  <!-- Attachment field: one file -->
  <ffl2AttachmentDirective ng-if="theField01.fieldDesc.fieldTypeIsSingleAttachment && theField01.panelUse!='search'" 
  						   my-cardinality="1" my-parent-type="main"  >
  </ffl2AttachmentDirective>
  
  <!-- Attachment field: many files -->
  <ffl2AttachmentDirective ng-if="theField01.fieldDesc.fieldTypeIsMultipleAttachments && theField01.panelUse!='search'" 
                           my-cardinality="n" my-parent-type="main" the-field01="{{theField01}}" >
  </ffl2AttachmentDirective>
  
  <!-- Report field -->
   <ReportFieldDirective ng-if="theField01.fieldDesc.fieldTypeIsReport">
  </ReportFieldDirective>

  <!-- True/false value field -->
  <input type="checkbox" class="form-control" ng-change="valueChanged()" 
         ng-if="theField01.fieldDesc.fieldTypeIsBoolean && theField01.fieldDesc.buttons==undefined"
         ng-true-value="'1'" ng-false-value="'0'"
         ng-disabled="theField01.mode=='readonly'"
         ng-model="theField01.objectField.strValue"
         style="display:inline;width:20px;" >
  </input>
 
 <!-- Radio buttons -->
  <div ng-repeat="rad in theField01.fieldDesc.buttons">
    <input type="radio" name="{{theField01.fieldDesc.name}}" 
           ng-disabled="theField01.mode=='readonly'"
  	       ng-change="valueChanged()" ng-disabled="!enabled"
           ng-model="theField01.objectField.strValue" value={{""+rad.value}}>&nbsp;{{rad.text}}<br>
  </div>
</td>
<td ng-if="!theField01.fieldDesc.fieldTypeIsRelation || theField01.fieldDesc.fieldTypeIsRelationListOfValue 
|| theField01.fieldDesc.fieldTypeIsRelationWithForm" ng-show="visible">
  <button ng-if="theField01.panelUse=='search'" ng-click='emptyField()' style="display:inline;">
    <img src="img/common/24px-refresh.png"></img>
  </button>
</td>
<td ng-if="theField01.fieldDesc.fieldTypeIsRelationWithForm" ng-show="visible">
  <button ng-if="theField01.panelUse=='search'" ng-click='emptyField()' style="display:inline;">
    <img src="img/common/24px-refresh.png"></img>
  </button>
</td>
 
<!-- List box for 1:n and m:n relations -->
<td ng-if="theField01.fieldDesc.fieldTypeIsRelation 
           && !theField01.fieldDesc.fieldTypeIsRelationListOfValue
           && !theField01.fieldDesc.fieldTypeIsRelationWithForm" 
		ng-show="visible" colspan=3>
 <div RelationFormFieldDirective>
 <!-- 
  <select class="select01" size={{theField01.lineNumber}}
  		  ng-change="valueChanged()"
          ng-model="theField01.objectField.value" ng-options="desc.code as desc.value for desc in theField01.fieldDesc.domain">
  </select>
   -->
 </div>
 </td>
 
<!-- Interval -->
<td ng-if="theField01.fieldDesc.fieldTypeIsInterval" 
        ng-show="visible" colspan=3>
 <IntervalFieldDirective></IntervalFieldDirective>
</td>
