@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Controllers
@using LeafWeb.WebCms.Utility
@model SearchLeafInputDataViewModel
@{
var grid = new WebGrid(Model.Results, rowsPerPage: 45);
}
@Model.Results.Count() results
@Html.Partial("_LeafDataQuery", Model.Q,
new ViewDataDictionary{
{"actionName", "Search"},
{"controllerName", "Results"},
{"htmlFormAction", "/services/search/"}})
@if (Model.Results.Any())
{
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier", data => data.LeafInput.Identifier), // TODO: link to LeafInput details
grid.Column("SiteId", "Site Id", data => data.LeafInput.SiteId),
grid.Column("Major Species", "Species", data => data.MajorSpecies),
grid.Column("", "Location: Lat., Long., Elev.", data => FormatLocation(data.Site)),
grid.Column("", "Curve Variation Ranges", data => FormatRanges(data.Value)),
grid.Column("", format: data => Actions(data.LeafInput), canSort: false)
),
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
)
@grid.PagerList()
@*
Download Results
@DownloadResults()
*@
}
else
{
No results. Click here to submit Leaf Data.
}
@helper FormatLocation(LeafInputDataSite site)
{
@(site.Latitude?.ToString("#.00"))if (site.Latitude != null)
{°if (site.Longitude != null)
{, }
}
@(site.Longitude?.ToString("#.00"))if (site.Longitude != null)
{°if (site.Elevation != null)
{, }
}
@(site.Elevation?.ToString("#.#m"))
}
@helper FormatRanges(LeafInputData data)
{
var line = new List();
if (data.CO2S_Range != null)
{
line.Add(data.CO2S_Range?.ToString("CO2S: " + "#.##" + "[umol/mol]"));
}
if (data.PARi_Range != null)
{
line.Add(data.PARi_Range?.ToString("PARi: " + "#.##" + "[umol/m2/s]"));
}
if (data.Tleaf_Range != null)
{
line.Add(data.Tleaf_Range?.ToString("Tleaf: " + "#.##" + "[oC]"));
}
if (data.PhiPS2_Range != null)
{
line.Add(data.PhiPS2_Range?.ToString("PhiPS2: " + "#.##"));
}
foreach (var l in line)
{
@l
}
}
@helper ChartLink(LeafInput item)
{
@Html.Partial("DisplayTemplates/_ChartLink", item.Id)
}
@helper Actions(LeafInput leafInput)
{
@Html.Partial("_LeafInputActions", leafInput)
}
@helper Status(LeafInput leafInput)
{
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
}
@helper DownloadResults()
{
}