132 lines
6.4 KiB
Plaintext
132 lines
6.4 KiB
Plaintext
|
@using Resources
|
||
|
@using PagedList.Mvc
|
||
|
@using PagedList
|
||
|
@using Weee.Models
|
||
|
@using Weee.Areas.Admin.ViewModels
|
||
|
|
||
|
@model ARnGWPvm
|
||
|
@{ ViewBag.Title = "AR version(s) and GWP";
|
||
|
Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml"; }
|
||
|
|
||
|
<div class="col-md-12">
|
||
|
<h2>@ViewBag.Title</h2>
|
||
|
<hr />
|
||
|
|
||
|
<div class="form-group">
|
||
|
<div class="row">
|
||
|
<div class="col-md-8">
|
||
|
@using (Html.BeginForm("Index", "ARnGWP", FormMethod.Post, new { enctype = "multipart/form-data", id = "form" }))
|
||
|
{
|
||
|
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.page)
|
||
|
@Html.HiddenFor(m => m.arv)
|
||
|
<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="DeleteAll()" class="btn btn-xs btn-default" />
|
||
|
</div>
|
||
|
}
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-12">
|
||
|
<div class="docs-row text-right">
|
||
|
@if(Model.arv == "AR4")
|
||
|
{
|
||
|
@Html.ActionLink("AR4", "AR4", new { id = 0 }, new { @class = "btn btn-default", disabled="disabled"})
|
||
|
@Html.ActionLink("AR5", "AR5", new { id = 0 }, new { @class = "btn btn-default"})
|
||
|
@Html.ActionLink("AR6", "AR6", new { id = 0 }, new { @class = "btn btn-default"})
|
||
|
}
|
||
|
else if(Model.arv == "AR5")
|
||
|
{
|
||
|
@Html.ActionLink("AR4", "AR4", new { id = 0 }, new { @class = "btn btn-default"})
|
||
|
@Html.ActionLink("AR5", "AR5", new { id = 0 }, new { @class = "btn btn-default", disabled = "disabled" })
|
||
|
@Html.ActionLink("AR6", "AR6", new { id = 0 }, new { @class = "btn btn-default"})
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
@Html.ActionLink("AR4", "AR4", new { id = 0 }, new { @class = "btn btn-default"})
|
||
|
@Html.ActionLink("AR5", "AR5", new { id = 0 }, new { @class = "btn btn-default"})
|
||
|
@Html.ActionLink("AR6", "AR6", new { id = 0 }, new { @class = "btn btn-default", disabled = "disabled" })
|
||
|
}
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_New, "Create", new { arv = Model.arv }, new { @class = "btn btn-default" })
|
||
|
</div>
|
||
|
|
||
|
<div>
|
||
|
<table class="table text-center">
|
||
|
<tr>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().ingredientName)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().chemicalFormula)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().GWP100)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().ChineseName)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().Alias)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().GHGType)</th>
|
||
|
<th>@Html.DisplayNameFor(model => model.ARnGWPlst.First().GWPtype)</th>
|
||
|
<th></th>
|
||
|
</tr>
|
||
|
@if (Model != null && Model.ARnGWPlst != null)
|
||
|
{
|
||
|
foreach (var item in Model.ARnGWPlst)
|
||
|
{
|
||
|
<tr>
|
||
|
<td style="text-align:left">@item.ingredientName</td>
|
||
|
<td style="text-align:left">@item.chemicalFormula</td>
|
||
|
<td style="text-align:right">@item.GWP100</td>
|
||
|
<td style="text-align:left">@item.ChineseName</td>
|
||
|
<td style="text-align:left">@item.Alias</td>
|
||
|
<td style="text-align:left">@item.GHGType</td>
|
||
|
<td style="text-align:left">@item.GWPtypeDisp</td>
|
||
|
<td class="docs-button-td-md">
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_Edit, "Edit", new { id = item.ID, arv = Model.arv }, new { @class = "btn btn-xs btn-default" })
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_Delete, "Delete", new { id = item.ID, arv = Model.arv }, new { @class = "btn btn-xs btn-default", onclick = "return confirm('請確認刪除此筆資料?');" })
|
||
|
</td>
|
||
|
</tr>
|
||
|
}
|
||
|
}
|
||
|
</table>
|
||
|
</div>
|
||
|
<div class="text-center">
|
||
|
@Html.PagedListPager((IPagedList)Model.ARnGWPlst, page => Url.Action("index", new { page, arv=Model.arv }))
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-2"></div>
|
||
|
|
||
|
@using (Html.BeginForm("DeleteAll", "ARnGWP", FormMethod.Post, new { id="deleteAll_form" }))
|
||
|
{
|
||
|
}
|
||
|
<script>
|
||
|
function DeleteAll() {
|
||
|
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);
|
||
|
var it = document.getElementById("deleteAll_form");
|
||
|
it.submit();
|
||
|
}
|
||
|
}
|
||
|
</script>
|