Commit 0b3bfced authored by Jason's avatar Jason

增加mask tooltip

parent 42459e72
......@@ -52,13 +52,6 @@ namespace backstage.Controllers
{
var TokenVaultResponse = new TokenVaultResponse();
// 確認使用者是否已經登入
if (!User.Identity.IsAuthenticated)
{
return RedirectToAction("Login", "User");
}
ViewBag.Merchant_id = merchantId;
#region 取得部門列表
......@@ -183,6 +176,7 @@ namespace backstage.Controllers
ViewBag.field_id = field_id;
var DepartmentsResponse = new DepartmentsResponse();
var url = _config["IP"] + "/v2/vault/get";
var httpMethod = HttpMethod.Post;
// 取得使用者的 "token" Claim 值
......@@ -246,6 +240,48 @@ namespace backstage.Controllers
}
#endregion
#region 處理遮罩tooltip
url = _config["IP"] + "/v2/vault/get";
httpMethod = HttpMethod.Post;
parameters = new Dictionary<string, string>
{
{ "Merchant_id", Merchant_id.ToString() },
{ "id", vault_id.ToString() },
{ "info", "MASKS" }
};
apiResult = await _callApi.CallAPI(url, parameters, httpMethod);
if (apiResult.IsSuccess)
{
FieldsResponse = JsonConvert.DeserializeObject<FieldsResponse>(apiResult.Data.ToString());
foreach (var u in field.users)
{
if (u.masks.Count > 0)
{
var maskTextList = new List<string>();
var existField= FieldsResponse.fields.FirstOrDefault(f => f.id == field_id);
foreach (var maskId in u.masks)
{
var matchingMask = existField.masks.FirstOrDefault(m => m.id == maskId);
if (matchingMask != null)
{
string maskText = $"[{matchingMask.id}] - {matchingMask.name} - {matchingMask.setting}";
maskTextList.Add(maskText);
}
}
u.masksSettingText = string.Join(", ", maskTextList);
}
}
}
#endregion
......
......@@ -741,12 +741,7 @@ namespace backstage.Controllers
{
var DepartmentsResponse = new DepartmentsResponse();
var url = _config["IP"] + "/merchant/list";
// 確認使用者是否已經登入
if (!User.Identity.IsAuthenticated)
{
return RedirectToAction("Login", "User");
}
var httpMethod = HttpMethod.Post;
......
......@@ -38,6 +38,7 @@ namespace backstage.Models.Users
//=========Fields=========
public List<int> masks{get;set;}
public string masksText { get; set; }
public string masksSettingText { get; set; }
public int allow_decrypt { get; set; }
public int allow_new { get; set; }
public int allow_update { get; set; }
......
......@@ -7,6 +7,13 @@
string disabledClass = isAdmin ? "" : "disabled";
}
@section header{
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
}
<div class="page-header">
<h3 class="page-title">欄位Users列表管理</h3>
<input id="msg" hidden value="@TempData["msg"]" />
......@@ -61,7 +68,9 @@
<td>@i.id</td>
<td>@i.name</td>
<td>@i.username</td>
<td>@i.masksText</td>
<td class="custom-tooltip" data-tooltip="@i.masksSettingText">@i.masksText</td>
<td>
@if (i.allow_decrypt == 1)
{<span>&#x2714;</span>}
......@@ -127,7 +136,7 @@
</div>
@section Scripts{
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script nonce="KUY8VewuvyUYVEIvEFue4vwyiuf">
$('document').ready(function () {
var msg = '@TempData["msg"]';
......@@ -136,7 +145,13 @@
if (msg != '') {
showAlert(IsSuccess, msg);
}
$(".custom-tooltip").tooltip({
items: "[data-tooltip]",
content: function () {
return $(this).attr("data-tooltip");
},
tooltipClass: "custom-tooltip-width"
});
$("#confirmBtn").on("click", function () {
// 確認按鈕被點擊時的處理程式碼
......
......@@ -19315,3 +19315,13 @@ tbody {
font-size: 0.825rem;
padding: 20px 16px 10px 16px
}
.custom-tooltip-width {
width: auto !important;
max-width: none !important;
white-space: nowrap;
}
.custom-tooltip {
cursor: pointer !important;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment