193 lines
8.4 KiB
Plaintext
193 lines
8.4 KiB
Plaintext
|
@using Resources
|
||
|
@using System.Web
|
||
|
|
||
|
@model Weee.Areas.Admin.ViewModels.YearlyParameterIndexViewModel
|
||
|
|
||
|
@{
|
||
|
ViewBag.Title = Resource.StaticLabelYearlyParameterMaintain;
|
||
|
Layout = "~/Areas/admin/Views/Shared/_AdminLayout.cshtml";
|
||
|
}
|
||
|
|
||
|
<div class="col-md-12">
|
||
|
<div class="row">
|
||
|
<h2>@(Model.Categories.Count == 1 ? Model.Categories.First().DisplayName : Resource.StaticLabelYearlyParameterMaintain)</h2>
|
||
|
</div>
|
||
|
|
||
|
<div class="row docs-row">
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td>
|
||
|
@using (Html.BeginForm("Index", "YearlyParameter", FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||
|
{
|
||
|
if (!string.IsNullOrWhiteSpace(Model.errMsg))
|
||
|
{
|
||
|
<div class="alert alert-danger" role="alert">
|
||
|
@Model.errMsg
|
||
|
</div>
|
||
|
}
|
||
|
else if (!string.IsNullOrWhiteSpace(Model.resultMsg))
|
||
|
{
|
||
|
<div class="alert alert-success" role="alert">
|
||
|
@Model.resultMsg
|
||
|
</div>
|
||
|
}
|
||
|
@Html.AntiForgeryToken()
|
||
|
@Html.HiddenFor(m => m.cmd, new { @id = "cmd" })
|
||
|
@Html.HiddenFor(m => m.category)
|
||
|
|
||
|
<table style="width:100%">
|
||
|
<tr>
|
||
|
<td style="width:160px;font-weight:bold;">@Resource.UploadExcelFile:</td>
|
||
|
<td>@Html.TextBoxFor(m => m.uploadExcelFile, null, new { type = "file", @class = "input-file" })</td>
|
||
|
<td><input type="submit" value="@Resource.UploadExcelFile" onclick="$('#cmd').val('upload'); this.form.submit();" class="btn btn-sm btn-primary" /> </td>
|
||
|
<td><input type="button" value="@Resource.DownloadExcelFile" onclick="$('#cmd').val('download'); this.form.submit();" class="btn btn-sm btn-primary" /> </td>
|
||
|
<td><input type="button" value="@Resource.DeleteExisted" class="btn btn-sm btn-primary" onclick="DeleteYPCategory()" /></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
}
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<br />
|
||
|
|
||
|
<table class="table text-center">
|
||
|
@if (Model.Categories.Count > 1)
|
||
|
{
|
||
|
<tr>
|
||
|
<th>@Resource.Page</th>
|
||
|
@foreach (var Category in Model.Categories)
|
||
|
{
|
||
|
foreach (var Type in Category.Types)
|
||
|
{
|
||
|
foreach (var Area in Category.Areas)
|
||
|
{
|
||
|
<th>@Category.DisplayName</th>
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</tr>
|
||
|
}
|
||
|
|
||
|
<tr>
|
||
|
<td>@Resource.Category</td>
|
||
|
@if (Model.Categories.Count == 1 && Model.Categories.First().Types.Count >= 1)
|
||
|
{
|
||
|
foreach (var Category in Model.Categories)
|
||
|
{
|
||
|
foreach (var Type in Category.Types)
|
||
|
{
|
||
|
foreach (var Area in Category.Areas)
|
||
|
{
|
||
|
<td>
|
||
|
@Html.ActionLink(
|
||
|
Type.DisplayName,
|
||
|
"EditType",
|
||
|
"YearlyParameterCategory",
|
||
|
new { t = Type.ID },
|
||
|
new { })
|
||
|
</td>
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
<td>@Html.ActionLink(Resource.StaticLabelGlobal_New, "CreateType", "YearlyParameterCategory", new { c = Model.Categories.First().Category }, new { @class = "btn btn-xs btn-default" })</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td>@Resource.YearAndArea</td>
|
||
|
@foreach (var Category in Model.Categories)
|
||
|
{
|
||
|
foreach (var Type in Category.Types)
|
||
|
{
|
||
|
foreach (var Area in Category.Areas)
|
||
|
{
|
||
|
<td>
|
||
|
@Html.ActionLink(
|
||
|
Area.DisplayName,
|
||
|
"EditArea",
|
||
|
"YearlyParameterCategory",
|
||
|
new { a = Area.ID },
|
||
|
new { })
|
||
|
</td>
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@if (Model.Categories.Count == 1)
|
||
|
{
|
||
|
<td>@Html.ActionLink(Resource.StaticLabelGlobal_New, "CreateArea", "YearlyParameterCategory", new { c = Model.Categories.First().Category }, new { @class = "btn btn-xs btn-default" })</td>
|
||
|
}
|
||
|
</tr>
|
||
|
|
||
|
@foreach (var Year in Model.Years.OrderBy(x => x))
|
||
|
{
|
||
|
<tr>
|
||
|
<td>@Year</td>
|
||
|
@foreach (var Category in Model.Categories)
|
||
|
{
|
||
|
foreach (var Type in Category.Types)
|
||
|
{
|
||
|
foreach (var Area in Category.Areas)
|
||
|
{
|
||
|
<td>
|
||
|
@(Model.Parameters.FirstOrDefault(x => x.AreaID == Area.ID && x.TypeID == Type.ID && x.Year == Year) == null ?
|
||
|
Html.ActionLink(Resource.StaticLabelGlobal_New,
|
||
|
"Create",
|
||
|
new { areaid = Area.ID, typeid = Type.ID, year = Year })
|
||
|
:
|
||
|
Html.ActionLink(Model.Parameters.FirstOrDefault(x => x.AreaID == Area.ID && x.TypeID == Type.ID && x.Year == Year).Value.ToString("G29"),
|
||
|
"Create",
|
||
|
new { areaid = Area.ID, typeid = Type.ID, year = Year })
|
||
|
)
|
||
|
</td>
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
}
|
||
|
|
||
|
<tr>
|
||
|
<td>@Resource.StaticLabelGlobal_New</td>
|
||
|
@foreach (var Category in Model.Categories)
|
||
|
{
|
||
|
foreach (var Type in Category.Types)
|
||
|
{
|
||
|
foreach (var Area in Category.Areas)
|
||
|
{
|
||
|
<td>
|
||
|
@Html.ActionLink(Resource.StaticLabelGlobal_New,
|
||
|
"Create",
|
||
|
new { areaid = Area.ID, typeid = Type.ID, year = 0 })
|
||
|
</td>
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
@using (Html.BeginForm("DeleteYPCategory", "YearlyParameter", FormMethod.Post, new { id = "from_DeleteCategory" }))
|
||
|
{
|
||
|
<input type="hidden" id="hdn_YPCategory" name="YPCategory" value="" />
|
||
|
}
|
||
|
|
||
|
<script>
|
||
|
function DeleteYPCategory() {
|
||
|
var ckCode = Math.floor(Math.random() * 1000000);
|
||
|
while (ckCode < 100000) {
|
||
|
ckCode = Math.floor(Math.random() * 1000000);
|
||
|
}
|
||
|
let inputCode = prompt("請輸入數字以確認刪除現有資料:【" + ckCode + "】", "");
|
||
|
if (inputCode == ckCode) {
|
||
|
const queryString = window.location.search;
|
||
|
const urlParams = new URLSearchParams(queryString);
|
||
|
const category = urlParams.get('c');
|
||
|
document.getElementById("hdn_YPCategory").value = category;
|
||
|
var it = document.getElementById("from_DeleteCategory");
|
||
|
it.submit();
|
||
|
}
|
||
|
}
|
||
|
</script>
|