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

<div class="bgmodal" id="bgModal" aria-hidden="true">
    <div class="bgmodal_dialog" aria-hidden="true">
		<div class="bgmodal-content">
      		<div class="bgmodal-header">
        		<h3 class="bgmodal-title">${message.title}</h3>
        		<c:set var="onclick">
        		<c:choose>
        			<c:when test="${message.onClose eq 'close'}">jQuery('#bgModal').parent().html(''); return false;</c:when>
        			<c:when test="${message.onClose eq 'redirect'}">
		        		<c:if test="${not empty message.tabClick}"><c:set var="tabClick">jQuery('#${message.tabClick}').trigger('click'); </c:set></c:if>
		        		<c:choose>
		        			<c:when test="${not empty message.queryParamList}">${tabClick}; showBlock( '${message.targetId}', '${message.operation}', { ...${message.query}<c:forEach var="item" items="${message.queryParamList}">, ${item.key}: '${item.value}'</c:forEach> } );</c:when>
		        			<c:otherwise>${tabClick}showBlock( '${message.targetId}', '${message.operation}', ${message.query} );</c:otherwise>
		        		</c:choose>
		        		return false;
		        	</c:when>
        			<c:when test="${message.onClose eq 'link'}">window.open('${message.query}'); return false;</c:when>
        			<c:when test="${message.onClose eq 'reload'}">window.location.reload(true); return false;</c:when>
        			<c:otherwise></c:otherwise>
	       		</c:choose>
        		</c:set>
        		<a href="#" title="Закрыть окно" class="bgmodal-close" onclick="${onclick}">×</a>
      		</div>
      		<div class="bgmodal-body">    
        		<p>${message.text}</p>
      		</div>
       		<div class="text-center my-3"><button class="btn btn-primary" onclick="${onclick}">Закрыть</button></div>
    	</div>    
    </div>
</div>