<script {literal}data-pace-options='{ "ajax": false }'{/literal} src="{$urls.JS_PATH}/pace.js"></script>
<link href="{$urls.CSS_PATH}/pace.css" rel="stylesheet" type="text/css" media="all" />

<script src="{$urls.JS_PATH}/jquery/jquery-1.8.3.min.js"></script>
<script src="{$urls.JS_PATH}/legacy/startwith.js"></script>
<script type="text/javascript">
    jQuery.noConflict();
</script>

<script src="{$urls.JS_PATH}/jstree/jstree.min.js"></script>
<script src="{$urls.JS_PATH}/jstree/jstreegrid.min.js"></script>

<script src="{$urls.JS_PATH}/jquery-ui/jquery-ui.min.js"></script>
<link href="{$urls.CSS_PATH}/jquery-ui/redmond/jquery-ui.css" rel="stylesheet" type="text/css" media="all" />

<script src="{$urls.JS_PATH}/ractive/Ractive.min.js"></script>

<link href="{$urls.CSS_PATH}/jquery.select2.css" rel="stylesheet" type="text/css" media="all" />
<link href="{$urls.CSS_PATH}/jstree/style.min.css" rel="stylesheet" type="text/css" media="all"  />
<link href="{$urls.CSS_PATH}/{$moduleName}.css" rel="stylesheet" type="text/css" media="all" />

<script>
    {literal}
    var ReportData = {
        options: {},
        reportAccessUsers: {/literal}{$REPORTACCESSUSERS}{literal},
        reportScheduleUsers:{/literal}{$REPORTSCHEDULEUSERS}{literal},
        users:{/literal}{$REPORTUSERS}{literal},
    }

var translated_labels = {/literal}{$DICTIONARY}{literal}; // #5286 - Refactored to JSON object
var csrf = {/literal}{$csrf}{literal};
var $categories = {/literal}{$CATEGORIES}{literal};
var userPermissions = {/literal}{$userPermissions}{literal};
var moduleName = "AnalyticReporting";
var $urls = {/literal}{$urlsJSON}{literal};
var $reportTreeAdminAccess = {/literal}{$reportTreeAdminAccess}{literal};
var $isAdmin = {/literal}{$ISADMIN}{literal};
var $isBasic = {/literal}{$ISBASIC}{literal};
var envConfig = { isBasic: $isBasic };
    {/literal}
</script>

{* Include underscore.js and Ractive."js templates *}
{include file="$TPL_PATH/templates.tpl"}

<script src="{$urls.JS_PATH}/underscore.js"></script>
<script src="{$urls.JS_PATH}/jquery/jquery.select2.min.js"></script>
<script src="{$urls.JS_PATH}/ractive/ractive-decorators-select2.min.js"></script>
<!-- env:dev --#>
<script src="{$urls.JS_PATH}/components/reports/shared.js"></script>
<script src="{$urls.JS_PATH}/components/shared.js"></script>
<script src="{$urls.JS_PATH}/components/reportManager.js"></script>
<script src="{$urls.JS_PATH}/components/manager/accessManager.js"></script>
<script src="{$urls.JS_PATH}/components/manager/scheduleManager.js"></script>
<!-- env:dev:end -->

{* TODO: #7505 - Make it more dynamic *}
{* Allow file loading if this is production environment *}
{if $isMainMinFile eq 'true'}
<!-- env:prod -->
<script src="{$urls.JS_PATH}/main.min.js?v=3.0.278"></script>
<!-- env:prod:end -->
{/if}

{* TODO: #7505 - Make it more dynamic *}
{* There are old installation where main.js is present we should avoid this and use only minimified file version *}
{if $isMainMinFile eq 'false'}
<!-- TODO: Should include in main.min.js-->
<script src="{$urls.JS_PATH}/main.js"></script>
{/if}

<!-- ADVANCED REPORTS CONTAINER -->
<div id="ar-container">
    <div id="ar-toolbar">
        {if $ISADMIN eq 'true' || $reportTreeAdminAccess eq 'true'}
        <a href="javascript:void(0);" data-action="addCategory" data-id="0">{$MOD.label_add_folder}</a>
        {/if}

        {include file="$TPL_PATH/elements/massSchedule.tpl"}

        {if $ISADMIN eq 'true' || $reportBuilderPublic eq 'true'}
            <a href="{$urls.reportBuilderSimple}" >{$MOD.reportBuilder}</a>
        {/if}
        <form id="searchreports" action="#" method="POST" style=" display:inline!important;">
            <input type="text" id="searchCriteria" placeholder="{$MOD.label_search_placeholder}" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" aria-autocomplete="none" />
            <input type="checkbox" id="searchMatchAll" value="true" style="vertical-align: middle" />
            <label for="searchMatchAll" style="margin-right: 5px;">{$MOD.label_matchall}</label>
            <input id="ar-search" class="ar-button" type="button" value="{$MOD.label_search}" />
            <a id="ar-searchCancel" class="ar-button" href="javascript:void(0);" style="display: none;">{$MOD.label_cancel}</a>
        </form>

        {if $ISADMIN eq 'true'} {* #5885 Hide settings link from non-admin users *}
            <a style="float:right" href="{$urls.settings}">{$MOD.label_settings}</a>
            <a style="float:right" target="_blank"
               href="https://www.sapiens.bi/sugarcrm/#guide">{$MOD.label_help}</a>
            <br />
            {include file="$TPL_PATH/elements/reportImportNExport.tpl"}
        {/if}
    </div>

    <div id="modalWindow" style="display:none;"></div>
    <div id="report-tree">Loading report tree...</div>
</div>
<!-- // ADVANCED REPORTS CONTAINER -->