<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="TeamIntelligence.aspx.cs" Inherits="TeamIntelligence" %>

<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" runat="Server">
    <link href="<%=GetFileUrlWithVersion("../css/split.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=GetFileUrlWithVersion("css/sections.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=GetFileUrlWithVersion("../css/spectrum.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=GetFileUrlWithVersion("../css/tabcontrol.css")%>" rel="stylesheet" />
    <link href="<%=GetFileUrlWithVersion("../css/jquery.datetimepicker.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=GetFileUrlWithVersion("../js/spectrum.js")%>"></script>
    <script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
    <%--<script src="<%=GetFileUrlWithVersion("../js/split.js")%>"></script>--%>
    <style type="text/css">
        .fa {
            display: inline-block;
            font: normal normal normal 14px/1 FontAwesome;
            font-size: inherit;
            text-rendering: auto;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        .icon-menu {
            width: 20px;
            height: 20px;
        }

        .icon-sections::before {
            content: '\f03a';
        }

        .icon-templates::before {
            content: '\f0ae';
        }

        .icon-packages::before {
            content: '\f1b3';
        }

        .icon-report:before {
            content: '\f15c';
        }

        .page_title {
            font-size: 24px;
        }

        .settings-line {
            line-height: 30px;
            padding: 0 20px;
            box-sizing: border-box;
        }

            .settings-line > span {
                display: block;
                padding: 4px 0;
            }

            .settings-line > textarea {
                box-sizing: border-box;
                width: 100%;
                height: 70px;
                resize: vertical;
            }
    </style>
    <script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script>
    <script data-main="<%=GetFileUrlWithVersion("js/main.js")%>" src="<%=GetFileUrlWithVersion("../js/lib/require-2.3.6.min.js")%>"></script>
    <script type="text/javascript">
        var sectiontype = 0;//sectiontype:0 - global,1 - normal
        var templatestatus = 0;//templatestatus:0 - draft,1 - published
        var templatereadonly = <%=TemplateReadonly ?"true":"false"%>;;//published template cannot be edit
        var editable = true;
        var draggingobj = null;
        var IsForesight =<%=IsForesight ?"true":"false"%>;
        var IsAdmin =<%=IsAdmin ?"true":"false"%>;
        var teamintelligence = true;
        var begindate = "<%=BeginDate%>";
        var enddate = "<%=EndDate%>";

        var ShowTemplate =<%=ShowTemplate ?"true":"false"%>;
        var ShowReport =<%=ShowReport ?"true":"false"%>;
        var ReportReadonly =<%=ReportReadonly ?"true":"false"%>;
        var IsCustomerRecord = false;        

        function inspectionrequest(method, param, callback, error) {
            _network.request("Inspection/Inspection.aspx", -1, method, param, callback, error || function (e) {
                showAlert('An unknown error occurred.  Please refresh page.', 'Query');
            });
        }

        function showRightPopup(state) {
            if (state) {
                $("#mask_bg").show();
                $("#right_popup").css("left", $("#set_left").width()).show();
            }
            else {
                $("#mask_bg").hide();
                $("#right_popup").hide();
            }
        }

        function OnPrint(rid) {
            $("#ifdiv").attr('src', "Inspection.aspx?rt=f&t=2&id=" + rid + "&team=" + (teamintelligence ? 1 : 0));
            if (!$("#ifdiv").data('inited')) {
                $("#ifdiv").on('load', function () {
                    onifload();
                }).show();
                $("#ifdiv").data('inited', 1);
            }
            //window.open("Inspection.aspx?rt=f&t=2&id=" + reportid, '_blank');
        }

        function onifload() {
            var iframe = document.getElementById('ifdiv');
            iframe.contentWindow.focus();
            iframe.contentWindow.print();
        }

        function createSubMenus(items) {
            var maintenancesubmenu = $("#inspectsubmenu").empty();
            var ulsubmenus = $('<ul class="lefttitlemenu_ul" style="line-height:32px;"></ul>');
            maintenancesubmenu.append(ulsubmenus);
            for (var i = 0; i < items.length; i++) {
                var item = items[i];
                if (!item) continue;
                var li = $('<li></li>');
                var a = $('<a></a>').append($("<span></span>").text(item.Title));
                a.attr('href', '#' + item.ID);
                li.append(a);
                ulsubmenus.append(li);
            }
        }

        $(function () {
            $("#atemplates").click(function (ev) {
                if ($('#set_left').prop('isexpanded'))
                    return;
                if ($('.panel_holder.subitems').is(':visible')) {
                    return;
                }
                var items = [{ ID: 'templates/0', Title: GetTextByKey("P_DRAFT", "Draft") },
                { ID: 'templates/1', Title: GetTextByKey("P_PUBLISHED", "Published") },
                { ID: 'layouts/0', Title: GetTextByKey("P_LAYOUTS", "Layouts") }];
                createSubMenus(items);

                var left = $(this).offset().left;
                var top = $(ev.target).offset().top - 80;
                $('.panel_holder.subitems').css({
                    'opacity': 0,
                    'left': 60,
                    'right': 'auto',
                    'top': top
                }).show().animate({ 'opacity': 1 }, 100);
                $('.panel_holder.subitems .trigle').css({
                    'left': -10,// left - $('.panel_holder.favorites').offset().left,
                    'right': 'auto',
                    'top': 3
                });
                return false;
            });

            $("#apackages").click(function (ev) {
                if ($('#set_left').prop('isexpanded'))
                    return;
                if ($('.panel_holder.subitems').is(':visible')) {
                    return;
                }
                var items = [{ ID: 'exportpackages', Title: GetTextByKey("P_IPT_EXPORTPACKAGES", "Export Packages") },
                { ID: 'importpackages', Title: GetTextByKey("P_IPT_IMPORTPACKAGES", "Import Packages") }];
                createSubMenus(items);

                var left = $(this).offset().left;
                var top = $(ev.target).offset().top - 80;
                $('.panel_holder.subitems').css({
                    'opacity': 0,
                    'left': 60,
                    'right': 'auto',
                    'top': top
                }).show().animate({ 'opacity': 1 }, 100);
                $('.panel_holder.subitems .trigle').css({
                    'left': -10,// left - $('.panel_holder.favorites').offset().left,
                    'right': 'auto',
                    'top': 3
                });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" runat="Server">
    <div id="set_left">
        <ul class="ul_menu">
            <li id="nav_arrow">
                <div class="icn collapse"></div>
            </li>
            <%if (IsSupperAdmin)
                {%>
            <li class="nav_item" data-module="globalsections" data-title-lgid="P_GLOBALSECTIONS"><a href="#globalsections">
                <div>
                    <em class="fa icon-menu icon-sections"></em>
                </div>
                <span data-lgid="P_GLOBALSECTIONS">Global Sections</span></a>
            </li>
            <%} %>
            <%if (ShowTemplate)
                {%>
            <li class="nav_item" data-title-lgid="P_TEMPLATES"><a id="atemplates">
                <div>
                    <em class="fa icon-menu icon-templates"></em>
                </div>
                <span data-lgid="P_TEMPLATES">Templates</span></a>
            </li>
            <li class="nav_item subitem" data-module="templates/0" data-title-lgid="P_DRAFT" style="height: 32px; line-height: 32px; display: none;"><a href="#templates/0">
                <div style="width: 64px;">
                </div>
                <span style="color: #666;" data-lgid="P_DRAFT">Draft</span></a>
            </li>
            <li class="nav_item subitem" data-module="templates/1" data-title-lgid="Published" style="height: 32px; line-height: 32px; display: none;"><a href="#templates/1">
                <div style="width: 64px;">
                </div>
                <span style="color: #666;" data-lgid="P_PUBLISHED">Published</span></a>
            </li>
            <li class="nav_item subitem" data-module="layouts/1" data-title-lgid="P_LAYOUTS" style="height: 32px; line-height: 32px; display: none;"><a href="#layouts/1">
                <div style="width: 64px;">
                </div>
                <span style="color: #666;" data-lgid="P_LAYOUTS">Layouts</span></a>
            </li>

            <%if (!TemplateReadonly && ShowExportPackage)
                {%>
            <li style="height: 10px;">
                <hr style="background-color: #d8d8d8; border: none; height: 1px;" />
            </li>

            <li class="nav_item" data-title-lgid="P_IPT_PACKAGES"><a id="apackages">
                <div>
                    <em class="fa icon-menu icon-packages"></em>
                </div>
                <span data-lgid="P_IPT_PACKAGES">Packages</span></a>
            </li>
            <li class="nav_item subitem" data-module="exportpackages" data-title-lgid="P_IPT_EXPORTPACKAGES" style="height: 32px; line-height: 32px; display: none;"><a href="#exportpackages">
                <div style="width: 64px;">
                </div>
                <span style="color: #666;" data-lgid="P_IPT_EXPORTPACKAGES">Export Packages</span></a>
            </li>
            <li class="nav_item subitem" data-module="importpackages" data-title-lgid="P_IPT_IMPORTPACKAGES" style="height: 32px; line-height: 32px; display: none;"><a href="#importpackages">
                <div style="width: 64px;">
                </div>
                <span style="color: #666;" data-lgid="P_IPT_IMPORTPACKAGES">Import Packages</span></a>
            </li>
            <%} %>
            <%} %>

            <%if (ShowReport)
                {%>
            <li class="nav_item" data-module="inspections" data-title-lgid="P_INSPECTIONS"><a href="#inspections">
                <div>
                    <em class="fa icon-menu icon-report"></em>
                </div>
                <span data-lgid="P_INSPECTIONS">Inspections</span></a>
            </li>
            <%} %>
        </ul>
        <div class="hostmask maskbg" style="display: none;"></div>
    </div>
    <div id="set_right" style="height: 100%; overflow: auto;">
        <div class="loading_holder">
            <div class="loading_icon icn icn-spin"></div>
        </div>
    </div>
    <div class="panel_holder subitems">
        <div id="inspectsubmenu" class="menupanel panel">
        </div>
        <div class="trigle" style="left: -12px; right: auto;"></div>
        <div class="trigle white" style="left: -12px; right: auto;"></div>
    </div>

    <div id="mask_bg" style="display: none;"></div>
    <div id="right_popup" style="display: none; position: absolute; left: 250px; top: 0; right: 0; bottom: 0; background-color: white; overflow: auto;">
    </div>
    <div id="right_popup1" style="display: none; position: absolute; left: 250px; top: 0; right: 0; bottom: 0; background-color: white; overflow: auto;"></div>
    <iframe id="ifdiv" style="position: absolute; top: -9999px; height: 1px; width: 1px; border: 0; display: none;"></iframe>
</asp:Content>