<div class="modal-header">
	<h3 class="modal-title">{{ 'tldTitle' | translate }}</h3>
</div>
<div class="modal-body">

	<div class="well" ng-show="!model">
		{{ 'loading' | translate }}
	</div>

	<form class="form-horizontal" role="form" ng-show="model" name="tlEdit">

		<div class="form-group">
			<label class="col-sm-4 control-label">{{ 'name' | translate }}</label>
			<div class="col-sm-8">
				<p class="form-control-static">{{name}}</p>
			</div>
		</div>

		<div class="form-group" ng-show="getShowParameter(model.typeCode)">
			<label class="col-sm-4 control-label">{{ 'tlcParameter' | translate }}</label>
			<div class="col-sm-8">
				<p class="form-control-static">{{model.parameter}}</p>
			</div>
		</div>
			
		<lacuna-editable-item on-save="saveModel()">
			<item-label>{{ 'tlcLimit' | translate }}</item-label>
			<item-value>
				<span ng-show="model.limit != null">{{ model.limit }}</span>
				<span class="badge alert-warning" ng-hide="model.limit != null">{{ 'tlUnlimited' | translate }}</span>
			</item-value>
			<item-editor bs-has-error>
				<input type="number" class="form-control" id="limitInput" min="0" max="2147483647" ng-model="model.limit" name="limit" placeholder="{{ 'tlcLimitPlaceHolder' | translate }}" />
				<span class="has-error control-label" ng-show="tlEdit.limit.$error.min || tlEdit.limit.$error.max"><i class="fa fa-exclamation-circle" aria-hidden="true" title="{{ 'tlcLimitValidation' | translate }}"></i> {{ 'tlcLimitValidation' | translate }}</span>
			</item-editor>
		</lacuna-editable-item>

		<lacuna-editable-item on-save="saveModel()">
			<item-label>{{ 'tlcWarning' | translate }}</item-label>
			<item-value>
				<span ng-show="model.warning != null">{{ model.warning }}%</span>
				<span class="badge alert-warning" ng-hide="model.warning != null">{{ 'tlNoWarnings' | translate }}</span>
			</item-value>
			<item-editor bs-has-error>
				<input type="number" class="form-control" id="warningInput" min="0" max="100" ng-model="model.warning" name="warning" placeholder="{{ 'tlcWarningPlaceHolder' | translate }}" />
				<span class="has-error control-label" ng-show="tlEdit.warning.$error.min || tlEdit.warning.$error.max"><i class="fa fa-exclamation-circle" aria-hidden="true" title="{{ 'tlcWarningMinMaxValidation' | translate }}"></i> {{ 'tlcWarningMinMaxValidation' | translate }}</span>
			</item-editor>
		</lacuna-editable-item>

		<lacuna-editable-item on-save="saveModel()">
			<item-label>{{ 'tlcTolerance' | translate }}</item-label>
			<item-value>
				<span ng-show="model.tolerance != null">{{ model.tolerance }}%</span>
				<span class="badge alert-warning" ng-hide="model.tolerance != null">{{ 'tlNoTolerance' | translate }}</span>
			</item-value>
			<item-editor bs-has-error>
				<input type="number" class="form-control" id="toleranceInput" min="0" ng-model="model.tolerance" name="tolerance" placeholder="{{ 'tlcTolerancePlaceHolder' | translate }}" />
				<span class="has-error control-label" ng-show="tlEdit.tolerance.$error.min"><i class="fa fa-exclamation-circle" aria-hidden="true" title="{{ 'tlcToleranceMinValidation' | translate }}"></i> {{ 'tlcToleranceMinValidation' | translate }}</span>
			</item-editor>
		</lacuna-editable-item>

		<hr />

		<div class="form-group">
			<div class="col-md-12">
				<div ng-show="model.warning != null" class="list-group-item alert-warning">
					<span class="badge">{{ model.warning/100 * model.limit | number:0 }}</span> <span ng-bind-html="'tlcWarningHelper' | translate"></span>
				</div>
				<div ng-show="model.warning == null" class="list-group-item alert-warning">
					<span ng-bind-html="'tlcNoWarningWillBeSent' | translate"></span>
				</div>
				<div ng-show="model.tolerance == null" class="list-group-item alert-warning">
					<span ng-bind-html="'tlcNoBlockedTransactions' | translate"></span>
				</div>
				<div ng-show="model.tolerance != null" class="list-group-item alert-warning">
					<span class="badge">{{ (model.tolerance/100 * model.limit) + model.limit | number:0 }}</span><span ng-bind-html="'tlcToleranceHelper' | translate"></span>
				</div>
			</div>
		</div>
		<div class="form-group" ng-show="limit == null && tlCreate.limit.$valid">
			<div class="col-md-12">
				<div class="list-group-item alert-warning">
					<span ng-bind-html="'tlcNoLimitIsSet' | translate"></span>
				</div>
			</div>
		</div>

	</form>

</div>
<div class="modal-footer">
	<button class="btn btn-danger pull-left" ng-click="remove()" ng-show="isEditable">{{ 'remove' | translate }}</button>
	<button class="btn btn-primary" ng-click="close()">{{ 'close' | translate }}</button>
</div>
