<%@ page contentType="text/html; charset=UTF-8"%><%@ include file="/WEB-INF/jspf/include/taglibs.jsp"%>

<div id="paramResult"></div>

<div style="margin: 10px auto;"><button class="btn btn-secondary" onclick="showBlock( 'parametersRoot', 'list', parametersQuery ); return false;">К списку...</button></div>			

<form>
<div class="tile">
	<div class="titleFont3 titleBottomLine">Редактор параметра</div>
	<div class="paramEditorTitle" style="margin-top: 20px;">${pref.title}</div>
	
	<div class="textField paramEditorValue mTop05"><select size="8" name="paramListValue" style="width: 100%" onchange="document.getElementById( 'paramListCustomValue' ).style.display = ( this.options[this.selectedIndex].value == 0 ? 'block' : 'none' ); return false;">
			<c:forEach var="item" items="${paramListValues}">
				<c:set var="selected"><c:if test="${item.id == paramValue}">selected="true"</c:if></c:set><option value="${item.id}" ${selected}>${item.title}</option>
			</c:forEach>
		</select></div>
	<c:set var="showHideCustomValue"><c:if test="${paramValue > 0}">display: none;</c:if></c:set>
	<div class="textField paramEditorCustomValue" id="paramListCustomValue" style="margin-top: 1rem; ${showHideCustomValue}"><input type="text" name="paramListCustomValue" style="width: 100%" placeholder="свое значение" value="${paramCustomValue}" ></div>
	<div style="margin: 20px 10px; text-align: right;">
		<button class="btn btn-primary" onclick="showBlock( 'paramResult', 'update', { ...parametersQuery, paramId: ${pref.id}, paramValue: this.form.paramListValue.value, paramCustomValue: this.form.paramListCustomValue.value } ); return false;">Применить</button>
		<button class="btn btn-outline-primary" style="margin-left: 20px;" onclick="showBlock( 'parametersRoot', 'list', parametersQuery ); return false;">Отмена</button>
	</div>
</div>
</form>