114 lines
3.8 KiB
Plaintext
114 lines
3.8 KiB
Plaintext
@using LeafWeb.Core.Entities
|
|
@using LeafWeb.WebCms.Controllers
|
|
@using LeafWeb.WebCms.Utility
|
|
@model SearchLeafInputDataViewModel
|
|
@{
|
|
var grid = new WebGrid(Model.Results, rowsPerPage: 45);
|
|
}
|
|
|
|
<div class="row align-items-end mb-3">
|
|
<div class="col-3 order-last order-sm-first font-italic font-weight-light ">
|
|
<strong>@Model.Results.Count()</strong> results
|
|
</div>
|
|
<div class="col-12 col-sm-9">
|
|
@Html.Partial("_LeafDataQuery", Model.Q,
|
|
new ViewDataDictionary{
|
|
{"actionName", "Search"},
|
|
{"controllerName", "Results"},
|
|
{"htmlFormAction", "/services/search/"}})
|
|
</div>
|
|
</div>
|
|
|
|
@if (Model.Results.Any())
|
|
{
|
|
<div class="table-responsive">
|
|
@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" }
|
|
)
|
|
</div>
|
|
<div class="row justify-content-end">
|
|
<div class="col-sm">@grid.PagerList()</div>
|
|
@*<div class="col-sm col-lg-5 pl-4 pt-3 pt-sm-0">
|
|
<span class="pr-2">Download Results</span>
|
|
@DownloadResults()
|
|
</div>*@
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<p>No results. <a href="@UmbracoContext.Current.UrlProvider.GetUrl(LeafWebPageIds.LeafInputCreate)">Click here to submit Leaf Data.</a></p>
|
|
}
|
|
|
|
@helper FormatLocation(LeafInputDataSite site)
|
|
{
|
|
<text>@(site.Latitude?.ToString("#.00"))</text>if (site.Latitude != null)
|
|
{<text>°</text>if (site.Longitude != null)
|
|
{<text>, </text>}
|
|
}
|
|
<text>@(site.Longitude?.ToString("#.00"))</text>if (site.Longitude != null)
|
|
{<text>°</text>if (site.Elevation != null)
|
|
{<text>, </text>}
|
|
}
|
|
<text>@(site.Elevation?.ToString("#.#m"))</text>
|
|
}
|
|
|
|
@helper FormatRanges(LeafInputData data)
|
|
{
|
|
var line = new List<string>();
|
|
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)
|
|
{
|
|
<text>@l</text><br/>
|
|
}
|
|
}
|
|
|
|
@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()
|
|
{
|
|
<div class="btn-group" role="group" aria-label="Download">
|
|
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsInputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
|
|
<span class="fa fa-download"></span> Input
|
|
</a>
|
|
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsOutputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
|
|
<span class="fa fa-download"></span> Output
|
|
</a>
|
|
</div>
|
|
} |