demo20230512/Areas/admin/Views/Company/Index.cshtml

102 lines
4.4 KiB
Plaintext
Raw Normal View History

2023-05-12 10:20:28 +08:00
@using Weee.Models.ExtensionMethods
@using Resources
@using PagedList.Mvc
@using PagedList
@model IEnumerable<Weee.ViewModels.CompanyViewModel>
@*@model IEnumerable<Weee.Models.Company>*@
@{
ViewBag.Title = Resource.StaticLabelCompanyList;
Layout = "~/Areas/admin/Views/Shared/_AdminLayout.cshtml";
}
<div class="col-md-12">
<div class="row docs-row">
<div class="col-xs-5">
<h2 class="docs-h2">@Resource.StaticLabelCompanyList</h2>
</div>
<div class="col-xs-7">
@using (Html.BeginForm("Index", "Company", FormMethod.Get, new { id = "search-filter", @class = "form-horizontal" }))
{
<div class="form-group">
<div class="col-sm-1"></div>
<div class="col-sm-8">
<input name="searchString" class="form-control" type="text" value="@ViewBag.SearchString" />
</div>
<div class="col-sm-3">
<input type="submit" value="@Resource.StaticLabelGlobal_Search" class="btn btn-default" />
@Html.ActionLink(Resource.StaticLabelGlobal_Cancel, "index", new { }, new { @class = "btn btn-default" })
</div>
</div>
}
</div>
</div>
<div>
<table class="table text-center">
<tr>
<th>@Html.DisplayNameFor(model => model.UserName)</th>
<th>@Html.DisplayNameFor(model => model.Name)</th>
<th>@Html.DisplayNameFor(model => model.Address)</th>
<th>@Html.DisplayNameFor(model => model.RegisterDate)</th>
<th>@Html.DisplayNameFor(model => model.LastStatusUpdateDate)</th>
<th>@Html.DisplayNameFor(model => model.Status)</th>
<th>@Resource.StaticLabelType</th>
<th></th>
<th></th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.UserName)</td>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@Html.DisplayFor(modelItem => item.Address)</td>
<td>@item.RegisterDate.ToShortDateString()</td>
<td>@item.LastStatusUpdateDate.ToShortDateString()</td>
<td>@item.Status.DisplayString()</td>
<td>@item.CompanyTypeDisplayName</td>
<td>
@if (item.CompanyType == typeof(Weee.Models.CertificationCompany))
{
@Html.ActionLink(Resource.StaticLabelGlobal_Detail, "EditCertification", new { id = item.ID })
}
else
{
@Html.ActionLink(Resource.StaticLabelGlobal_Detail, "EditCompany", new { id = item.ID })
}
</td>
<td>
@if (item.Status == Weee.Models.CompanyStatus.Active)
{
@Html.ActionLink(Resource.DeActive, "DeActive", new { id = item.ID }, new { @class = "btn btn-xs btn-default" })
}
else
{
@Html.ActionLink(Resource.Active, "Active", new { id = item.ID }, new { @class = "btn btn-xs btn-default" })
}
</td>
<td>
@Html.ActionLink(Resource.ResetPassword, "ResetPassword", new { id = item.ID }, new { @class = "btn btn-xs btn-default" })
</td>
<td>
@Html.ActionLink("權限設定", "CompanyAdminAccess", new { id = item.ID }, new { @class = "btn btn-xs btn-default" })
</td>
</tr>
}
</table>
</div>
<div class="text-center">
@Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { page, searchString = ViewBag.SearchString }))
</div>
</div>
<div class="col-md-1"></div>
<form>
<input type="hidden" id="msg" value="@ViewBag.msg"/>
</form>
<script>
msg = $('#msg').val();
if (typeof(msg) !== 'undefined' && msg.length > 0)
alert(msg);
console.log(msg);//奇怪,顯示訊息有誤
</script>