<!--
 ~ Copyright 2022 youngmonkeys.org
 ~ 
 ~ Licensed under the ezyplatform, Version 1.0.0 (the "License");
 ~ you may not use this file except in compliance with the License.
 ~ You may obtain a copy of the License at
 ~ 
 ~     https://youngmonkeys.org/licenses/ezyplatform-1.0.0.txt
 ~ 
 ~ 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.
-->

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:ezy="http://www.ezyplatform.com/thymeleaf/layout">
<body>
<th:block th:fragment="content">
    <th:block th:if="${commonFragments != null && commonFragments.get('prompt') != null && commonFragments.get('prompt').content != 'prompt'}">
        <ezy:block ezy:utext="${commonFragments.get('prompt').content}" />
    </th:block>
    <th:block th:if="${commonFragments == null || commonFragments.get('prompt') == null || commonFragments.get('prompt').content == 'prompt'}">
        <div class="modal fade pt-4rem" role="dialog" th:id="${id}">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">
                            <th:block th:if="${titleKey == null}">
                                [[${title}]]
                            </th:block>
                            <th:block th:if="${titleKey != null}">
                                [[#{${titleKey}}]]
                            </th:block>
                        </h5>
                        <button type="button" class="btn-close" data-dismiss="modal" data-bs-dismiss="modal" aria-label="Close">
                        </button>
                    </div>
                    <div class="modal-body">
                        <div th:id="${id + '-body-content'}">[[${body}]]</div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn"
                                th:classappend="${(id.startsWith('delete') || type == 'delete') ? 'btn-danger' : 'btn-primary'}"
                                th:attr="onclick=|onPromptConfirmed('${id}')|">
                            <th:block th:if="${confirmButtonKey == null}">
                                [[${confirmButton}]]
                            </th:block>
                            <th:block th:if="${confirmButtonKey != null}">
                                [[#{${confirmButtonKey}}]]
                            </th:block>
                        </button>
                        <button type="button" class="btn btn-secondary" data-dismiss="modal" data-bs-dismiss="modal">
                            <th:block th:if="${closeButtonKey == null}">
                                [[${closeButton}]]
                            </th:block>
                            <th:block th:if="${closeButtonKey != null}">
                                [[#{${closeButtonKey}}]]
                            </th:block>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </th:block>
</th:block>
</body>
</html>
