${ util.include('header', [title:'Setup: ' + page.title]) }
<div class="panel panel-default">
    <div class="panel-heading panel-xs">
        <h4>You have selected ${setup.config.dbType} database. This database needs additional configuration parameters. Please enter all required information.</h4>
    </div>
    <div class="panel-body">
<form method='POST' action="?step=${ page.nextPage() }">
<%
  def inRootBlock = false;
  page.getQuestions().each { q -> %>
    <%
    def rootBlock = q.getName().split("_")[1].startsWith("root");
    if ((!inRootBlock) && rootBlock) {
    inRootBlock = true; %>
    <details class="form-group">
        <summary style="font-weight: bold">Database root user credentials<span style="margin-left: 1em;"><button type="button" class="btn btn-sm btn-primary" style="pointer-events: none;">Show</button></span><span style="margin-left: 3em;"><i>(optional)</i></summary>
        <div style="border-color: darkgray; border-style: solid; border-width: 1px; padding: 1em;">
    <% } else if (inRootBlock && !rootBlock) {
    inRootBlock = false; %>
        </div>
    </details>
    <% } %>
    <div class="form-group">
        <% if (q.getName().endsWith("useSSL") || q.getName().endsWith("useLegacyDatetimeCode")) { %>
        <label class="col-sm-6 control-label" style="margin-left: -15px; padding-top: 7px;" for='${q.getName()}'><%= q.getLabel() %><% if (!q.isRequired()) { %><span style="margin-left: 3em;"><i>(optional)</i></span><% } %></label>
        <div class="col-sm-6">
            <input class="form-control" type='checkbox' size='30' name='${q.getName()}' <% if (q.isSelected("true")) { %>checked<% } %> />
        </div>
        <% } else { %>
        <label class="control-label" for='${q.getName()}'><%= q.getLabel() %><% if (!q.isRequired()) { %><span style="margin-left: 3em;"><i>(optional)</i></span><% } %></label>
        <input class="form-control" type='${q.isSecret() ? "password" : "text"}' size='90' name='${q.getName()}' value='${q.getValue() ?: ""}' />
        <% } %>
    </div>
<% } %>
    </div>
</div>

    <button class="btn btn-default" type="submit" name="next">Next</button>

</form>
${ util.include('footer') } 