Chart Viewer now complete
This commit is contained in:
parent
39cc7caef7
commit
8ac4a3d693
@ -52,14 +52,20 @@ namespace EFB.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult ViewCharts(Chart chart){
|
||||
ChartModel charts = HttpContext.Session.GetObject<UserModel>("User").CurrentCharts;
|
||||
public IActionResult ViewCharts(string chart){
|
||||
UserModel user = HttpContext.Session.GetObject<UserModel>("User");
|
||||
if (user != null)
|
||||
{
|
||||
ViewChartModel charts = new ViewChartModel(user.CurrentCharts, chart);
|
||||
|
||||
if (charts != null)
|
||||
{
|
||||
return View("ViewCharts", charts);
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
|
28
Models/ViewChartModel.cs
Normal file
28
Models/ViewChartModel.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Razor;
|
||||
using Newtonsoft.Json;
|
||||
using EFB.Models.JSON;
|
||||
using Microsoft.AspNetCore;
|
||||
using EFB.Sessions;
|
||||
|
||||
namespace EFB.Models
|
||||
{
|
||||
public class ViewChartModel
|
||||
{
|
||||
public ChartModel Charts { get; set; }
|
||||
public Chart Selected { get; set; }
|
||||
|
||||
public ViewChartModel(ChartModel current, string selected){
|
||||
Charts = current;
|
||||
if (selected != null)
|
||||
{
|
||||
Selected = JsonConvert.DeserializeObject<Chart>(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
@model EFB.Models.ChartModel;
|
||||
@using Newtonsoft.Json;
|
||||
@model EFB.Models.ViewChartModel;
|
||||
@{
|
||||
ViewData["Title"] = "Welcome";
|
||||
}
|
||||
@ -27,53 +28,75 @@
|
||||
}
|
||||
</form>
|
||||
|
||||
<h4>Charts for: @Model.ICAO</h4>
|
||||
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle bg-dark" type="button" data-toggle="dropdown">Dropdown Example
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
@{
|
||||
foreach (var item in Model.Approach)
|
||||
{
|
||||
<li><button class="bg-dark" runat="server" onclick=""></button></li>
|
||||
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body col-md-8">
|
||||
<div class="container jumbotron">
|
||||
<h3>Chart Lookup</h3>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<h4>Charts for: @Model.Charts.ICAO</h4>
|
||||
|
||||
<form asp-controller="Charts" asp-action="Index">
|
||||
<form asp-action="ViewCharts" method="post">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" placeholder="ICAO Code" name="ICAO" value="@TempData["ICAO"]">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-secondary">Search</button>
|
||||
<label>Select Charts</label><br />
|
||||
<select name="chart" class="form-control">
|
||||
|
||||
@{
|
||||
if (TempData["Error"] != null)
|
||||
{//If an error has been flagged, information will be displayed to the user
|
||||
@if (Model.Charts != null) {
|
||||
<option value=""></option>
|
||||
foreach(var item in Model.Charts.GroundLayout) {
|
||||
var itemString = JsonConvert.SerializeObject(item);
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<div class="alert alert-danger">
|
||||
<strong>Warning!</strong> @TempData["Error"] <button type='button' class='close' data-dismiss='alert' aria-hidden='true' />×
|
||||
</div>
|
||||
<option value="@itemString">@item.Name</option>
|
||||
}
|
||||
|
||||
<option value=""></option>
|
||||
foreach(var item in Model.Charts.SID) {
|
||||
var itemString = JsonConvert.SerializeObject(item);
|
||||
|
||||
<option value="@itemString">@item.Name</option>
|
||||
}
|
||||
|
||||
<option value=""></option>
|
||||
foreach(var item in Model.Charts.STAR) {
|
||||
var itemString = JsonConvert.SerializeObject(item);
|
||||
|
||||
<option value="@itemString">@item.Name</option>
|
||||
}
|
||||
|
||||
<option value=""></option>
|
||||
foreach(var item in Model.Charts.Approach) {
|
||||
var itemString = JsonConvert.SerializeObject(item);
|
||||
|
||||
<option value="@itemString">@item.Name</option>
|
||||
}
|
||||
|
||||
<option value=""></option>
|
||||
foreach(var item in Model.Charts.TextualData) {
|
||||
var itemString = JsonConvert.SerializeObject(item);
|
||||
|
||||
<option value="@itemString">@item.Name</option>
|
||||
}
|
||||
|
||||
}
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">View</button>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body col-md-8 vh-80">
|
||||
<div class="container jumbotron vh-100">
|
||||
@{
|
||||
if (Model.Selected != null)
|
||||
{
|
||||
<h3>@Model.Selected.Name</h3>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<iframe src="@Model.Selected.URL" width="100%" height="90%"></iframe>
|
||||
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user