change accountTable

This commit is contained in:
SamSys
2025-12-13 14:11:41 +03:30
parent 9469a5f76e
commit e89aae1cc9
8 changed files with 227 additions and 208 deletions

View File

@@ -142,7 +142,7 @@
</div>
<div class="col-md-6">
<div class="form-group">
@* <div class="form-group">
<label asp-for="UserRoles" > نقش در پروگرام منیجر </label>
<select disabled="disabled" class="form-control select-city" multiple="multiple" asp-for="UserRoles" asp-items="Model.RoleList">
<option value="0"></option>
@@ -150,7 +150,7 @@
<span asp-validation-for="UserRoles" class="error"></span>
</div>
</div> *@
</div>
</div>
</div>

View File

@@ -1309,30 +1309,35 @@
function saveRole() {
const checks = document.querySelectorAll("input.check-btn");
let pmIndex = 0;
//let pmIndex = 0;
let normalIndex = 0;
$("#hiddenInput").empty(); // مهم!! قبل از اضافه‌کردن، خالی کن
checks.forEach(chk => {
const isPm = chk.hasAttribute("data-pm");
if (isPm) {
$("#hiddenInput").append(`
<input class="item1" type="hidden"
name="PmPermissions[${pmIndex}]"
value="${chk.checked ? chk.value : 0}">
`);
pmIndex++;
} else {
$("#hiddenInput").append(`
<input class="item1" type="hidden"
name="Permissions[${normalIndex}]"
value="${chk.checked ? chk.value : 0}">
`);
normalIndex++;
}
// const isPm = chk.hasAttribute("data-pm");
// if (isPm) {
// $("#hiddenInput").append(`
// <input class="item1" type="hidden"
// name="PmPermissions[${pmIndex}]"
// value="${chk.checked ? chk.value : 0}">
// `);
// pmIndex++;
// } else {
// $("#hiddenInput").append(`
// <input class="item1" type="hidden"
// name="Permissions[${normalIndex}]"
// value="${chk.checked ? chk.value : 0}">
// `);
// normalIndex++;
// }
});

View File

@@ -146,7 +146,7 @@
</div>
<div class="col-md-6">
<div class="form-group">
@* <div class="form-group">
<label asp-for="UserRoles"> نقش در پروگرام منیجر </label>
@if (Model.IsProgramManagerUser)
@@ -165,7 +165,7 @@
<span asp-validation-for="UserRoles" class="error"></span>
</div>
</div> *@
</div>
</div>
</div>

View File

@@ -1363,30 +1363,35 @@
function saveRole() {
const checks = document.querySelectorAll("input.check-btn");
let pmIndex = 0;
//let pmIndex = 0;
let normalIndex = 0;
$("#hiddenInput").empty(); // مهم!! قبل از اضافه‌کردن، خالی کن
checks.forEach(chk => {
const isPm = chk.hasAttribute("data-pm");
if (isPm) {
$("#hiddenInput").append(`
<input class="item1" type="hidden"
name="PmPermissions[${pmIndex}]"
value="${chk.checked ? chk.value : 0}">
`);
pmIndex++;
} else {
$("#hiddenInput").append(`
$("#hiddenInput").append(`
<input class="item1" type="hidden"
name="Permissions[${normalIndex}]"
value="${chk.checked ? chk.value : 0}">
`);
normalIndex++;
}
// const isPm = chk.hasAttribute("data-pm");
// if (isPm) {
// $("#hiddenInput").append(`
// <input class="item1" type="hidden"
// name="PmPermissions[${pmIndex}]"
// value="${chk.checked ? chk.value : 0}">
// `);
// pmIndex++;
// } else {
// $("#hiddenInput").append(`
// <input class="item1" type="hidden"
// name="Permissions[${normalIndex}]"
// value="${chk.checked ? chk.value : 0}">
// `);
// normalIndex++;
// }
});

View File

@@ -121,22 +121,22 @@ public class IndexModel : PageModel
//);
var result = _accountApplication.GetPmUserByAccountId(account.Id).GetAwaiter().GetResult();
//var result = _accountApplication.GetPmUserByAccountId(account.Id).GetAwaiter().GetResult();
// مثل قبل:
if (result != null)
{
account.IsProgramManagerUser = (result.AccountId== account.Id && result.IsActive);
account.UserRoles = result.Roles;
}
else
{
account.IsProgramManagerUser = false;
}
//// مثل قبل:
//if (result != null)
//{
// account.IsProgramManagerUser = (result.AccountId== account.Id && result.IsActive);
// account.UserRoles = result.Roles;
//}
//else
//{
// account.IsProgramManagerUser = false;
//}
var pmRolseSelectList = _roleApplication.GetPmRoleList(null).GetAwaiter().GetResult();
account.RoleList = pmRolseSelectList;
//var pmRolseSelectList = _roleApplication.GetPmRoleList(null).GetAwaiter().GetResult();
//account.RoleList = pmRolseSelectList;
//var response = InternalApiCaller.GetAsync<RoleResponse>(
// "api/role",