<div class="popups">
	<div class="modal hide b-filter-content g-ui-user-select-none" data-bind="modal: modalVisibility">
		<div>
			<div class="modal-header">
				<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
				<h3>
					<span class="i18n" data-i18n="POPUPS_FILTER/TITLE_CREATE_FILTER" data-bind="visible: isNew"></span>
					<span class="i18n" data-i18n="POPUPS_FILTER/TITLE_EDIT_FILTER" data-bind="visible: !isNew()"></span>
				</h3>
			</div>
			<div class="modal-body">
				<div class="row filter" data-bind="with: filter, i18nInit: filter">
					<div class="span9" data-bind="i18nInit: true">

						<div class="control-group" data-bind="css: {'error': name.error}">
							<div class="controls">
								<input type="text" class="i18n span5"
									data-bind="value: name,  hasFocus: name.focused"
									autocorrect="off" autocapitalize="off" spellcheck="false"
									data-i18n="[placeholder]POPUPS_FILTER/FILTER_NAME"
								/>
							</div>
						</div>

						<div class="legend i18n" data-i18n="POPUPS_FILTER/LEGEND_CONDITIONS"></div>
						<div>
							<div data-bind="visible: 1 < conditions().length">
								<select class="span4" data-bind="value: conditionsType">
									<option value="Any" class="i18n"
										data-i18n="POPUPS_FILTER/SELECT_MATCH_ANY"></option>
									<option value="All" class="i18n"
										data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"></option>
								</select>
							</div>
							<div data-bind="visible: 0 < conditions().length, foreach: conditions">
								<div data-bind="template: {'name': template(), 'data': $data}"></div>
							</div>
							<div data-bind="visible: 0 === conditions().length">
								<span class="i18n" data-i18n="POPUPS_FILTER/ALL_INCOMING_MESSAGES_DESC"></span>
							</div>
							<br />
							<a class="btn" data-bind="click: addCondition, i18nInit: true">
								<i class="icon-plus"></i>
								&nbsp;&nbsp;
								<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_ADD_CONDITION"></span>
							</a>
						</div>
						<br />
						<div class="legend i18n" data-i18n="POPUPS_FILTER/LEGEND_ACTIONS"></div>
						<select class="span3" data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
						<div data-bind="template: {'name': actionTemplate()}, i18nUpdate: actionTemplate"></div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<a class="btn buttonSave" data-bind="command: saveFilterCommand">
					<i class="icon-ok"></i>
					&nbsp;&nbsp;
					<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_DONE"></span>
				</a>
			</div>
		</div>
	</div>
</div>
