<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<div class="modal-header">
	<h4 class="modal-title">Add tag</h4>
</div>
<div class="modal-body">
	<div class="form-group">
		<div align="center" class="error col-sm-12 tabsearchResult pointer" title="{{error}}" ng-if="isError">
			{{error}}
		</div>
	</div>
	<form name="tagDefinitionform"  class="css-form" novalidate>
		<div class="form-group hide">
			<label for="category" class="col-sm-4 control-label">Category</label>
			<div class="col-sm-8 input-spacing">
				<select class="form-control" id="category" name="category"
					ng-model="category" ng-change="categoryChange()" required>
					<option value="{{key}}"
						ng-repeat="(key, value) in categoryList"
						ng-selected="{{key===category}}">{{key}}</option>
				</select>
			</div>
		</div>
		<div class="form-group" ng-class="{'has-error': (tagDefinitionform.tagDefinition.$invalid && tagDefinitionform.tagDefinition.$dirty)}">
			<label class="control-label col-sm-4" for="tagDefinition">Tag definition</label>
			<div class="col-sm-8 input-spacing">
				<select ng-model="selectedType"  class="form-control" id="tagDefinition" name="tagDefinition"
					ng-change="getAttributeDefinations(); isError =false" required>
				<option ng-repeat="data in typesList " title="{{data}}">{{data}}</option>
				</select>
			</div>
		</div>
		<div class="form-group" ng-repeat="(key, value) in propertiesList" ng-class="{'has-error': (tagDefinitionform.propertyId_{{$index}}.$invalid && tagDefinitionform.propertyId_{{$index}}.$dirty)}">
			<label class="control-label col-sm-4" for="propertyId_{{$index}}">{{key}}</label>
			<div class="col-sm-8 input-spacing">
				<input type="text" class="form-control" id="propertyId_{{$index}}" name="propertyId_{{$index}}" ng-model="propertiesList[key]" ng-required="isRequired[key]"/>
			</div>
		</div>
		<div class="modal-footer">
			<button class="btn btn-success" type="submit" ng-click="ok($event, tagDefinitionform)" ng-disabled="tagDefinitionform.$invalid">Save</button>
			<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
		</div>
	</form>
</div>
