| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- @using Microsoft.AspNetCore.Mvc.Rendering
- @using VberAdmin.Web.Models.Input
- @using VberAdmin.Web.Models.Modals
- @using VberAdmin.Web.Models.Search
- @using VberAdmin.Web.Models.Table
- @using VberZero
- @{
- string activeMenu = PermissionNames.VberSystemMgTenantMg; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- ViewBag.Title = L("TenantTitle");
- string activeType = ViewBag.IsActive;
- string[] activeType2 = ViewBag.IsActive2;
- var search = new List<VmSearchItem>()
- {
- new VmSearchItem("tenancyName", L("tenancyName")),
- new VmSearchItem("name", L("tenantName")),
- new VmSearchItem("isActive", L("activeState"), FType.B, EType.Equal).WithRadio(activeType2),
- };
-
- var searchForm = new VmSearch(search);
- var table = new VmTable(VzConsts.ApiAppUrl + "Tenant/GetAll", activeMenu, searchForm).AddItems(new List<VmTableItem>()
- {
- new VmTableItem("tenancyName", L("tenancyName")),
- new VmTableItem("name", L("tenantName")),
- new VmTableItem("isActive", L("activeState"), "ActiveStateFormatter"),
- });
- var modalBody = new VmModalBody().AddGroup(new List<VmInputBase>()
- {
-
- new VmInputHidden("id"),
- new VmInput("tenancyName", L("tenancyName")),
- new VmInput("name", L("tenantName")),
- new VmInput("adminEmailAddress", L("adminEmailAddress")),
- new VmInput("isActive", L("activeState")).WithRadio(activeType2)
- },2);
- var modal = new VmModal().WithHeaderAndFooter(L("tenant"), "").WithBody(modalBody);
- }
- @await Html.PartialAsync("_Table", table)
- @await Html.PartialAsync("_Modal", modal)
- @section scripts
- {
- <script type="text/javascript">
- $(function() {
- var $table = $('#table');
- var funs = LoadTable();
- funs["btnCreate"] = function() {
- BtnCreate({
- data: { isActive: "true" }
- });
- };
-
- funs["btnUpdate"] = function() {
- var row = $table.VbTable("getSelection");
- if (row) {
- BtnUpdate({ disabled: "tenancyName,adminEmailAddress", row: row });
- }
- };
-
- });
- </script>
- <script>
-
- function ActiveStateFormatter(v) {
- var name = $('#hid-activeType option[value="' + v + '"]').text();
- if (v) {
- return '<span class="label label-success"> ' + name + '</span>';
- }
- return '<span class="label label-danger"> ' + name + '</span>';
- }
- </script>
- }
- <section style="display:none">
- <select id="hid-activeType">
- @Html.Raw(activeType)
- </select>
- </section>
|