Commit 0754f3d0 authored by DESKTOP-KIP9E0Q\jason's avatar DESKTOP-KIP9E0Q\jason

1. fix add mask bug

2. delete key modal ui problem
parent af852a90
......@@ -53,13 +53,14 @@ namespace backstage.Controllers
}
[Authorize(Policy = "AdminOnly")]
[HttpGet]
public async Task<IActionResult> List(int merchantId)
{
var TokenVaultResponse = new TokenVaultResponse();
string msg = string.Empty;
ViewBag.Merchant_id = merchantId;
logger.Info("merchantId="+ merchantId);
#region 取得部門列表
var DepartmentsResponse = new DepartmentsResponse();
......@@ -98,7 +99,7 @@ namespace backstage.Controllers
}
[Authorize(Policy = "AdminOnly")]
[HttpGet]
public async Task<IActionResult> ListFields([FromQuery] int Merchant_id, int vault_id)
{
......@@ -168,7 +169,7 @@ namespace backstage.Controllers
}
return View();
}
[Authorize(Policy = "AdminOnly")]
[HttpGet]
public async Task<IActionResult> ListUsers(int Merchant_id, int vault_id, int field_id)
{
......@@ -1043,7 +1044,7 @@ namespace backstage.Controllers
var result = new ResultModel();
string msg;
//判斷非null就是編輯 反之新增
var mask_id = (form.ContainsKey("mask_id") && Convert.ToInt32(form["mask_id"]) != 0) ? Convert.ToInt32(form["mask_id"]) : (int?)null;
var mask_id = form.ContainsKey("mask_id") && int.TryParse(form["mask_id"], out int id) ? id : (int?)null;
try
{
......@@ -1098,7 +1099,7 @@ namespace backstage.Controllers
setting = System.Text.Json.JsonSerializer.Serialize(setting),
//編輯功能 mask_id要帶上
id = (form.ContainsKey("mask_id") && Convert.ToInt32(form["mask_id"]) != 0) ? Convert.ToInt32(form["mask_id"]) : (int?)null
id = mask_id
}
};
......@@ -1121,6 +1122,8 @@ namespace backstage.Controllers
if (Response.r == 0)
{
if (Response.failInfo == null)
{
if (mask_id == null)
{
switch (_currentLanguage)
{
......@@ -1138,6 +1141,27 @@ namespace backstage.Controllers
}
result.IsSuccess = true;
result.Message = msg;
}
else
{
switch (_currentLanguage)
{
case "en":
msg = "Revise mask success.";
break;
case "zh":
msg = "編輯遮罩成功";
break;
default:
msg = "編輯遮罩成功";
break;
}
result.IsSuccess = true;
result.Message = msg;
}
return result;
}
......@@ -1157,6 +1181,11 @@ namespace backstage.Controllers
}
else {
result.IsSuccess = false;
result.Message = apiResult.Message;
return result;
}
}
catch (Exception e)
......@@ -1168,9 +1197,7 @@ namespace backstage.Controllers
}
result.IsSuccess = false;
result.Message = "Create fail.";
return result;
//return View();
}
......
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AddToken Vault" xml:space="preserve">
<value>新增代碼庫</value>
</data>
<data name="Choose department" xml:space="preserve">
<value>選擇部門</value>
</data>
<data name="Creation Date" xml:space="preserve">
<value>建立日期</value>
</data>
<data name="Data Token Vault" xml:space="preserve">
<value>資料代碼保險庫</value>
</data>
<data name="Description" xml:space="preserve">
<value>描述</value>
</data>
<data name="Manage" xml:space="preserve">
<value>管理</value>
</data>
<data name="Name" xml:space="preserve">
<value>名稱</value>
</data>
<data name="Number of codes" xml:space="preserve">
<value>代碼數量</value>
</data>
<data name="Number of users" xml:space="preserve">
<value>使用者數量</value>
</data>
<data name="Serial number" xml:space="preserve">
<value>編號</value>
</data>
<data name="Status" xml:space="preserve">
<value>狀態</value>
</data>
<data name="Token Vault List" xml:space="preserve">
<value>代碼化保險庫列管理</value>
</data>
<data name="Tpye" xml:space="preserve">
<value>種類</value>
</data>
</root>
\ No newline at end of file
......@@ -120,8 +120,8 @@
<data name="Choose department" xml:space="preserve">
<value>選擇部門</value>
</data>
<data name="Create Department" xml:space="preserve">
<value>新增部門</value>
<data name="Create Token Vault" xml:space="preserve">
<value>新增代碼庫</value>
</data>
<data name="Creation Date" xml:space="preserve">
<value>建立日期</value>
......
......@@ -13,7 +13,9 @@
<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>
<style>
</style>
}
<div class="page-header">
......@@ -100,7 +102,7 @@
</div>
</div>
<div class="modal fade " id="deleteProject" role="dialog" tabindex="-1" aria-modal="true" >
<div class="modal-dialog modal-sm modalforMemberGo">
<div class="modal-dialog modal-md modalforMemberGo">
<!-- Modal content-->
<div class="modal-content">
......@@ -118,11 +120,13 @@
@Localizer["Confirm"]?
</p>
<div class="SubmitBlock SubmitBlock_sm">
<button id="confirmBtn" class="btn btn-mainblue-solid" style="margin-right: 10px; width: 80px">@Localizer["Submit"]</button>
<button type="button" class="btn btn-mainblue-hollow" data-dismiss="modal" style="margin-right: 10px; width: 80px">@Localizer["Cancel"]</button>
<div class="SubmitBlock SubmitBlock_sm button-container">
<button id="confirmBtn" class="btn btn-mainblue-solid same-size-button">@Localizer["Submit"]</button>
<button type="button" class="btn btn-mainblue-hollow same-size-button" data-dismiss="modal">@Localizer["Cancel"]</button>
</div>
</form>
</div> <!--END of div "modal-body"-->
......
@model backstage.Models.TokenVault.TokenVaultForCreate
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer Localizer
@model backstage.Models.TokenVault.TokenVaultForCreate
@{
ViewData["Title"] = "新增TokenVault";
ViewData["Title"] = @Localizer["Add Token Vault"];
}
<!-- partial -->
<div class="page-header">
<h3 class="page-title">新增TokenVault</h3>
<h3 class="page-title">@Localizer["Add Token Vault"]</h3>
<input id="msg" hidden value="@TempData["msg"]" />
@if (TempData["isSuccess"] != null)
{
......@@ -19,7 +21,7 @@
<div class="col-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">新增TokenVault</h4>
<h4 class="card-title">@Localizer["Add Token Vault"]</h4>
<form class="forms-sample" method="post" asp-action="CreateTokenVault" autocomplete="off">
<div id="errorMsg" asp-validation-summary="All" class="text-danger"></div>
......
......@@ -43,7 +43,7 @@
</select>
</div>
<div class="col-md-auto">
<a type="button" class="btn btn-info float-right mb-2 @disabledClass" asp-action="CreateTokenVault"> @Localizer["Create Department"]</a>
<a type="button" class="btn btn-info float-right mb-2 @disabledClass" asp-action="CreateTokenVault"> @Localizer["Create Token Vault"]</a>
</div>
</div>
<div class="row">
......@@ -117,26 +117,21 @@
// 在頁面載入時檢查 localStorage 是否有選單值
var selectedOption = localStorage.getItem('selectedOption');
console.log('selectedOption=' + selectedOption);
if (selectedOption) {
// 觸發 AJAX 請求並填入資料
loadData(selectedOption);
$('#selectDepartmentList').val(selectedOption);
}
// 在選單變更時保存選擇的值至 localStorage
$('#selectDepartmentList').change(function () {
var selectedOption = $(this).val();
localStorage.setItem('selectedOption', selectedOption);
});
var selectedValue = $('#selectDepartmentList').val();
console.log('selectedValue=' + selectedValue);
if (selectedValue != 0) {
selectedOption = $('#selectDepartmentList').val();
console.log('selectedOption=' + selectedOption);
if (selectedOption != 0) {
// 使用 AJAX 傳遞選擇的值
$.ajax({
url: '/TokenVault/ListTokenVaultAjax', // 替換為適當的控制器方法路徑
type: 'POST', // 或 'GET',根據實際需求
data: { merchantId: selectedValue },
data: { merchantId: selectedOption },
success: function (response) {
$('#tbody').empty();
$('#tbody').append(response);
......@@ -151,23 +146,26 @@
}
// 當選擇下拉選單時觸發事件
$('#selectDepartmentList').change(function () {
var selectedValue = $(this).val(); // 獲取選擇的值
loadData(selectedValue);
var selectedOption = parseInt($(this).val()); // 獲取選擇的值
localStorage.setItem('selectedOption', selectedOption);
loadData(selectedOption);
console.log('localStorage.setItem=' + selectedOption)
});
// 定義 AJAX 請求函式,將選單值傳遞至後端並填入 tbody
function loadData(selectedOption) {
console.log('loadData,selectedOption=' + selectedOption);
// 使用 AJAX 傳遞選擇的值
$.ajax({
url: '/TokenVault/ListTokenVaultAjax', // 替換為適當的控制器方法路徑
type: 'POST', // 或 'GET',根據實際需求
data: JSON.stringify({ merchantId: selectedOption }),
data: { merchantId: selectedOption },
success: function (response) {
$('#tbody').empty();
$('#tbody').append(response);
// 在成功取得回應後的處理邏輯
//console.log(response);
console.log(response);
},
error: function (xhr, status, error) {
// 在發生錯誤時的處理邏輯
......
......@@ -36,6 +36,11 @@
}
}
</script>
<style>
.label-space {
margin-right: 30px; /* 根据需要调整间距大小 */
}
</style>
}}
<div class="page-header">
<h3 class="page-title">@Localizer["Field List Management"]</h3>
......@@ -167,8 +172,9 @@
<input name="format_exp" type="text" class="form-control">
</div>
<div class="form-group required">
<label class="control-label">@Localizer["Enable"]</label>
<label class="form-check-label label-space">@Localizer["Enable"]</label>
<input name="enabled" type="checkbox" class="form-check-input" checked>
</div>
</div>
<div class="modal-footer">
......
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