174 lines
8.4 KiB
Plaintext
174 lines
8.4 KiB
Plaintext
|
@using Resources
|
||
|
@using PagedList.Mvc
|
||
|
@using PagedList
|
||
|
|
||
|
@model Weee.Areas.Admin.ViewModels.ParameterIndexViewModel
|
||
|
|
||
|
@{
|
||
|
ViewBag.Title = Resource.StaticLabelNonYearlyParameterMaintain;
|
||
|
Layout = "~/Areas/admin/Views/Shared/_AdminLayout.cshtml";
|
||
|
}
|
||
|
|
||
|
|
||
|
<div class="col-md-12">
|
||
|
<div class="row">
|
||
|
<h2>@Resource.StaticLabelNonYearlyParameterMaintain - @Model.CategoryName</h2>
|
||
|
<hr />
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
@if (Model.Category == Weee.Models.Paramemter.Categories.Septic)
|
||
|
{
|
||
|
<div class="alert alert-warning" role="alert">
|
||
|
@Resource.StaticLabelGlobal_Warning: @Resource.StaticLabelParameterSepticWarning
|
||
|
</div>
|
||
|
}
|
||
|
|
||
|
@if (Model.Category == Weee.Models.Paramemter.Categories.Refrigerant)
|
||
|
{
|
||
|
<div class="alert alert-warning" role="alert">
|
||
|
@Resource.StaticLabelGlobal_Warning: @Resource.ParameterWaringContent
|
||
|
</div>
|
||
|
}
|
||
|
|
||
|
@if (Model.Category == Weee.Models.Paramemter.Categories.Transport)
|
||
|
{
|
||
|
<div class="alert alert-warning" role="alert">
|
||
|
@Resource.MaterialUnit : KgCO2e / (Ton* Km)
|
||
|
</div>
|
||
|
}
|
||
|
else if (Model.Category == Weee.Models.Paramemter.Categories.WasteWater || Model.Category == Weee.Models.Paramemter.Categories.Waste)
|
||
|
{
|
||
|
<div class="alert alert-warning" role="alert">
|
||
|
@Resource.MaterialUnit : KgCO2e / Kg
|
||
|
</div>
|
||
|
}
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<div class="row">
|
||
|
<div class="col-md-8">
|
||
|
@using (Html.BeginForm("Index", "Parameter", FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||
|
{
|
||
|
if (!string.IsNullOrWhiteSpace(Model.errMsg))
|
||
|
{
|
||
|
<div class="col-md-12 alert alert-danger" role="alert">
|
||
|
@Model.errMsg
|
||
|
</div>
|
||
|
}
|
||
|
else if (!string.IsNullOrWhiteSpace(Model.resultMsg))
|
||
|
{
|
||
|
<div class="col-md-12 alert alert-success" role="alert">
|
||
|
@Model.resultMsg
|
||
|
</div>
|
||
|
}
|
||
|
@Html.AntiForgeryToken()
|
||
|
@Html.HiddenFor(m => m.cmd, new { @id = "cmd" })
|
||
|
@Html.HiddenFor(m => m.Category)
|
||
|
@Html.HiddenFor(m => m.Page)
|
||
|
@Html.HiddenFor(m => m.SearchString)
|
||
|
<div class="col-md-3">
|
||
|
@Resource.UploadExcelFile
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
@Html.TextBoxFor(m => m.uploadExcelFile, null, new { type = "file", @class = "input-file" })
|
||
|
</div>
|
||
|
<div class="col-md-5 text-left">
|
||
|
<input type="submit" value="@Resource.UploadExcelFile" onclick="$('#cmd').val('upload'); this.form.submit();" class="btn btn-xs btn-default" />
|
||
|
<input type="button" value="@Resource.DownloadExcelFile" onclick="$('#cmd').val('download'); this.form.submit();" class="btn btn-xs btn-default" />
|
||
|
<input type="button" value="@Resource.DeleteExisted" onclick="DeletePCategory()" class="btn btn-xs btn-default" />
|
||
|
</div>
|
||
|
}
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group text-right">
|
||
|
<div class="row">
|
||
|
@using (Html.BeginForm("Index", "Parameter", FormMethod.Get, new { id = "search-filter", @class = "form-horizontal" }))
|
||
|
{
|
||
|
<input name="c" type="hidden" value="@Model.Category" />
|
||
|
<div>
|
||
|
<div class="col-md-10 text-left">
|
||
|
<div class="col-md-8">
|
||
|
<input name="searchString" class="form-control" type="text" value="@Model.SearchString" />
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="submit" value="@Resource.StaticLabelGlobal_Search" class="btn btn-default" />
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_Cancel, "index", new { c = Model.Category }, new { @class = "btn btn-default" })
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-2 text-right">
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_New, "Create", new { c = Model.Category }, new { @class = "btn btn-default" })
|
||
|
</div>
|
||
|
</div>
|
||
|
}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
<table class="table text-center">
|
||
|
<tr>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Category)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().DisplayName)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().Value)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().CO2Value)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().CH4Value)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().N2OValue)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().HFCsValue)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().PFCsValue)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().SF6Value)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.PagedParameterTypes.First().Parameters.First().NF3Value)</th>
|
||
|
<th></th>
|
||
|
</tr>
|
||
|
|
||
|
@foreach (var item in Model.PagedParameterTypes)
|
||
|
{
|
||
|
<tr>
|
||
|
<td>@Html.DisplayFor(modelItem => item.Category.DisplayName)</td>
|
||
|
<td>@Html.DisplayFor(modelItem => item.DisplayName)</td>
|
||
|
<td>@item.Parameters.First().Value.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().CO2Value.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().CH4Value.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().N2OValue.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().HFCsValue.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().PFCsValue.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().SF6Value.ToString("0.############")</td>
|
||
|
<td>@item.Parameters.First().NF3Value.ToString("0.############")</td>
|
||
|
<td class="docs-button-td-md">
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_Edit, "Edit", new { typeid = item.ID }, new { @class = "btn btn-xs btn-default" })
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_Delete, "Delete", new { typeid = item.ID, category = Model.Category }, new { @class = "btn btn-xs btn-default" })
|
||
|
</td>
|
||
|
</tr>
|
||
|
}
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="row text-center">
|
||
|
@Html.PagedListPager(Model.PagedParameterTypes, page => Url.Action("Index", new { c = Model.Category, page, searchString = Model.SearchString }))
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-2"></div>
|
||
|
|
||
|
@using (Html.BeginForm("DeletePCategory", "Parameter", FormMethod.Post, new { id = "form_DeletePCategory" }))
|
||
|
{
|
||
|
<input type="hidden" id="hdn_PCategory" name="PCategory" value="" />
|
||
|
}
|
||
|
|
||
|
<script>
|
||
|
function DeletePCategory() {
|
||
|
var ckCode = Math.floor(Math.random() * 1000000);
|
||
|
while (ckCode < 100000) {
|
||
|
ckCode = Math.floor(Math.random() * 1000000);
|
||
|
}
|
||
|
let inputCode = prompt("請輸入數字以確認刪除現有資料:【" + ckCode + "】", "");
|
||
|
if (inputCode == ckCode) {
|
||
|
debugger;
|
||
|
const queryString = window.location.search;
|
||
|
const urlParams = new URLSearchParams(queryString);
|
||
|
const category = urlParams.get('c');
|
||
|
document.getElementById("hdn_PCategory").value = category;
|
||
|
var it = document.getElementById("form_DeletePCategory");
|
||
|
it.submit();
|
||
|
}
|
||
|
}
|
||
|
</script>
|