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

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.DevExpress().RenderScripts(Page,
        new Script { ExtensionSuite = ExtensionSuite.Editors }); %>
    <% Html.DevExpress().RenderStyleSheets(Page,
            new StyleSheet { ExtensionSuite = ExtensionSuite.Editors }
     ); %>
    <script src="<%= Request.ApplicationPath.TrimEnd(new char[] { '/' }) %>/Scripts/vis-timeline/moment-with-locales.js" type="text/javascript"></script>
    <script src="<%= Request.ApplicationPath.TrimEnd(new char[] { '/' }) %>/Scripts/vis-timeline/vis-timeline-graph2d.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="<%= Request.ApplicationPath.TrimEnd(new char[] { '/' }) %>/Scripts/vis-timeline/vis-timeline-graph2d.min.css" />
    <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 != null) { %><%= DateTimeHelper.ToString(Model.CurrentProject.LastDatabaseExport.Value) %><% } else { %>No Exports<% } %></div>
	        </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">Tasks</h1>
            <div class="right-floating-panel">Server Timezone<br /><b><%= DateTimeHelper.GetTimezoneName() %></b></div>
            <div class="clear"></div>
            <div id="tab-container">
                <ul class="tabs">
			        <li><a href="<%= Url.Action("TaskDashboard/" + Model.CurrentProject.ExternalId, "ProjectTasks") %>">Dashboard</a></li>
			        <li><a href="<%= Url.Action("CurrentTasks/" + Model.CurrentProject.ExternalId, "ProjectTasks") %>">Current Tasks</a></li>
			        <li><a href="<%= Url.Action("CompletedTasks/" + Model.CurrentProject.ExternalId, "ProjectTasks") %>">Completed Tasks</a></li>
                    <% if ((Model.CurrentProject.HasAdministratorAccess(Model.CurrentUser)) || (Model.CurrentProject.HasTaskCoordinatorAccess(Model.CurrentUser))) { %>
                        <li><a href="<%= Url.Action("TaskSchedules/" + Model.CurrentProject.ExternalId, "ProjectTasks") %>">Setup Tasks</a></li>
                    <% } %>
                    <% if (Model.CurrentProject.HasAdministratorAccess(Model.CurrentUser)) { %>
                        <li><a href="<%= Url.Action("Authorization/" + Model.CurrentProject.ExternalId,"ProjectTasks") %>">Authorization</a></li>
			            <li><a href="<%= Url.Action("TaskServers/" + Model.CurrentProject.ExternalId,"ProjectTasks") %>">Task Servers</a></li>
                    <% } %>
			        <li><a href="<%= Url.Action("TaskTimelineOverview/" + Model.CurrentProject.ExternalId, "ProjectTasks") %>" class="active">Timeline</a></li>
			        <li><a href="<%= Url.Action("TaskTimeline/" + Model.CurrentProject.ExternalId, "ProjectTasks") %>" class="line-height-24">Timeline <br /> Detailed</a></li>
                    <% if (Model.CurrentProject.UserHasTaskAccess(Model.CurrentUser))
                    { %>
                        <li><a href="<%= Url.Action("CommonTaskTargets/"+ Model.CurrentProject.ExternalId, "ProjectTasks" ) %>" class="line-height-24">Task <br /> Targets</a></li>
                        <li><a href="<%= Url.Action("MetadataMapping/"+ Model.CurrentProject.ExternalId, "Project" )%>" class="line-height-24" >Metadata <br /> Mapping</a></li>
                    <% } %>
                </ul>
	        </div>
            <br />
            <div class="left-floating-panel">
                <table>
                    <tr>
                        <td>
                            <% using (Html.BeginForm("TaskTimelineOverview", "ProjectTasks", FormMethod.Post, new { id = "time-select-form" })) { %>
                                <input type="hidden" id="SelectedDate" name="SelectedDate" />
                                <input type="hidden" id="SelectedProjectTags" name="SelectedProjectTags" />
                            <% } %>
                            <% Html.RenderPartial("Task/TaskTimelineOverviewSelect", Model.GetTaskTimelineOverviewSelectViewModel()); %>
                        </td>
                        <td style="padding-left:30px"><input type="checkbox" id="show-on-change" value="true" checked="checked"/> Show "Only On Change" tasks</td>
                    </tr>
                </table>
            </div>
            <div class="clear"></div>
            <br />
            <% Html.RenderPartial("Task/TaskTimelineOverview", Model.GetTaskTimelineOverviewViewModel()); %>
        </div>
    </div>
    <% if ((Model.CurrentProject.HasAdministratorAccess(Model.CurrentUser)) || (Model.CurrentProject.HasTaskCoordinatorAccess(Model.CurrentUser))) { %>
        <script type="text/javascript">
            function setSchedule(taskScheduleId) {
                $.ajax({
                    type: 'GET',
                    url: '<%= Url.Action("GetSetTaskSchedule", "Task") %>',
                    cache: false,
                    data: {
                        taskScheduleId: taskScheduleId
                    },
                    success: function (response) {
                        $("#modal-overlay").html(response);
                    },
                    complete: function () {
                        showModelDialog();
                    }
                });
            }
        </script>
    <%} %>
</asp:Content>
