<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Project.Master" Inherits="System.Web.Mvc.ViewPage<AdministratorConsole.Models.ModelMetricsController.IndexViewModel>" %>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function generateExternalLink() {
            $.ajax({
                type: 'GET',
                url: '<%= Url.Action("GetExternalMetricsLink", "ModelMetrics") %>',
                data: {
                    id: '<%= Model.CurrentProject.ExternalId %>'
                },
                cache: false,
                success: function (response) {
                    $("#modal-overlay").html(response);
                },
                complete: function() {
                    showModelDialog();
                }
            });
        }
    </script>
    <div id="banner-space">
        <div id="banner-detail-container">
            <div class="left-floating-panel">
	            <div id="project-title"><span><%= Html.Encode(Model.CurrentProject.Name) %></span><span id="project-number"><%= Html.Encode(Model.CurrentProject.Number) %></span></div>
                <div id="project-database-export"><b>Last Database Export:</b> <% if (Model.CurrentProject.LastDatabaseExport.HasValue)
                                                                                  { %><%= DateTimeHelper.ToString(Model.CurrentProject.LastDatabaseExport.Value) %><% } else { %>No Exports<% } %></div>
	        </div>
            <% if (Model.FirmGuidanceMarker.GetCheckEngineRequired(Model.RevitModelMetricSummaries) || Model.FirmGuidanceMarker.GetCheckEngineRequired(Model.AutoCADModelMetricSummaries)) { %><div class="left-floating-panel"><a href="<%= Url.Action("Index/" + Model.CurrentProject.ExternalId, "ModelMetrics") %>"><img id="check-engine-icon" src="<%= Request.ApplicationPath.TrimEnd(new char[] { '/' }) %>/Images/Icons/checkEngine.png" border="0" /></a></div><% } %>
            <% if (Model.LicenseType != LicenseType.ODP)
               { %>
                <div class="right-floating-panel total-time-container-outer">
                    <div id="total-time-container">
				        <div class="header">Total Time Saved</div>
			            <div class="value"><%= (Math.Ceiling(Model.CurrentProject.CompletedTasksTime.TotalHours)).ToString("000") %> hrs</div>
                    </div>
                </div> 
            <% } %>
            <% Html.RenderPartial("Partials/LaunchableTasks", new LaunchableTasksModel(Model.CurrentProject, Model.TaskSchedules, Model.CurrentUser)); %>
            <div class="clear"></div>
        </div>
    </div>
    <div id="content-wrap">
        <% Html.RenderPartial("Navigation/_SideNavigation", Model.MenuNavigationModel); %>
	    <div id="content">
	        <h1 class="left-floating-panel">Model Metrics</h1>
            <div class="project-actions">
                <nav class="action-dropdown page-admin">
                <a href="#">ACtions</a>
                    <ul>
                        <li><a href="javascript:generateExternalLink()">Get External Link</a></li>
                    </ul>
                </nav>
            </div>
            <div class="clear"></div>
            <div id="tab-container">
                <ul class="tabs">
			        <li><a href="<%= Url.Action("Index/" + Model.CurrentProject.ExternalId, "ModelMetrics") %>" class="active">Summary</a></li>
                    <li><a href="<%= Url.Action("Graphs/" + Model.CurrentProject.ExternalId, "ModelMetrics") %>">Graphs</a></li>
                </ul>
            </div>
            <br />
            <% if(Model.RevitSupport){ %>
                <% Html.RenderPartial("Partials/ModelMetrics", Model.GetModelMetricViewModel("Revit")); %>
            <% } %>
            <% if(Model.AutocadSupport){ %>
                <% Html.RenderPartial("Partials/ModelMetrics", Model.GetModelMetricViewModel("AutoCAD")); %>
            <% } %>
        </div>
    </div>
</asp:Content>
