<template name="mapReduceOptions">
    {{#if isOptionSelected "OUT"}}
        {{> out}}
    {{/if}}
    {{#if isOptionSelected "QUERY"}}
        {{> selector}}
    {{/if}}
    {{#if isOptionSelected "SORT"}}
        {{> sort}}
    {{/if}}
    {{#if isOptionSelected "LIMIT"}}
        {{> limit}}
    {{/if}}
    {{#if isOptionSelected "FINALIZE"}}
        {{> finalize}}
    {{/if}}
    {{#if isOptionSelected "SCOPE"}}
        {{> scope}}
    {{/if}}
    {{#if isOptionSelected "VERBOSE"}}
        {{> verbose}}
    {{/if}}
    {{#if isOptionSelected "BYPASS_DOCUMENT_VALIDATION"}}
        {{> bypassDocumentValidation}}
    {{/if}}
</template>

<template name="out">
    <div class="form-group">
        <label class="col-lg-1 control-label">Out</label>
        <div class="col-lg-11">
            <pre class="form-control" id='aceOut'></pre>
            <span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
                HH:mm:ss</strong><br/>Example: <i>{inline:1} | {replace:'collectionName'} | {merge:'collectionName'} |
                {reduce:'collectionName'}</i></span>
        </div>
    </div>
</template>

<template name="finalize">
    <div class="form-group">
        <label class="col-lg-1 control-label">Finalize</label>
        <div class="col-lg-11">
            <pre class="form-control" style="height: 150px" id='aceFinalize'></pre>
            <span class="help-block m-b-none">Please provide a valid function which starts with <strong>function</strong> keyword</span>
        </div>
    </div>
</template>

<template name="scope">
    <div class="form-group">
        <label class="col-lg-1 control-label">Scope</label>
        <div class="col-lg-11">
            <pre class="form-control" id='aceScope'></pre>
            <span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
                HH:mm:ss</strong></span>
        </div>
    </div>
</template>

<template name="verbose">
    <div class="form-group">
        <label class="col-lg-1 control-label">Verbose</label>
        <div class="col-lg-11">
            <div id="divVerbose" class="i-checks">
                <input id="inputVerbose" type="checkbox" value=""
                       class="form-control"
                       checked=""
                       style="position: absolute; opacity: 0;"/>
            </div>
        </div>
    </div>
</template>

<template name="bypassDocumentValidation">
    <div class="form-group">
        <label class="col-lg-1 control-label">Bypass</label>
        <div class="col-lg-11">
            <div id="divBypassDocumentValidation" class="i-checks">
                <input id="inputBypassDocumentValidation" type="checkbox" value=""
                       class="form-control"
                       checked=""
                       style="position: absolute; opacity: 0;"/>
            </div>
        </div>
    </div>
</template>