CheckListTemplateHeader klónozása
This commit is contained in:
@@ -7,7 +7,7 @@ namespace WorkFlowCheck.Web.Helpers
|
||||
public static class SystemHelper
|
||||
{
|
||||
public static string DatabaseName = "";
|
||||
public static string ProgramVersion = "v1.1.019";
|
||||
public static string ProgramVersion = "v1.1.021";
|
||||
|
||||
public async static Task GetAPIInfoAsync(IConfiguration configuration)
|
||||
{
|
||||
|
||||
+45
-2
@@ -47,7 +47,7 @@
|
||||
{ data: "shortName" },
|
||||
{ data: "description" },
|
||||
{ data: null, render: function (data, type, row) {
|
||||
return renderActionButtons(row.id);
|
||||
return renderActionButtonsforCheckListTemplateHeader(row.id);
|
||||
}}
|
||||
],
|
||||
columnDefs: [
|
||||
@@ -68,15 +68,58 @@
|
||||
|
||||
$('#newCheckListTemplateHeaderBtn').on('click', function ()
|
||||
{
|
||||
console.log('New button clicked!"');
|
||||
window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=0`;
|
||||
});
|
||||
|
||||
|
||||
$('#tbCheckListTemplateHeadersPage').on('click', '.edit-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=${row.id}`;
|
||||
});
|
||||
|
||||
$('#tbCheckListTemplateHeadersPage').on('click', '.clone-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
const url = './CheckListTemplateHeaderPage?handler=CloneCheckListTemplateHeader';
|
||||
showConfirmModal({
|
||||
title: 'Klónozás megerősítése',
|
||||
message: 'Biztosan klónozni szeretnéd ezt az elemet?',
|
||||
okText: 'Klónozás',
|
||||
cancelText: 'Mégsem'
|
||||
}).then(function (result) {
|
||||
if (result === 'ok') {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
data: { id: row.id },
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
showMessageModal({
|
||||
title: 'Információ',
|
||||
message: 'A klónozás sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
table.ajax.reload();
|
||||
} else {
|
||||
showMessageModal({
|
||||
title: 'Hiba!',
|
||||
message: 'A klónozás NEM sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
showMessageModal({
|
||||
title: 'Hiba!',
|
||||
message: 'A klónozás NEM sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#tbCheckListTemplateHeadersPage').on('click', '.delete-btn', function ()
|
||||
{
|
||||
|
||||
+5
@@ -27,5 +27,10 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
|
||||
var isSuccess = await _checkListService.DeleteCheckListTemplateHeader(id);
|
||||
return new JsonResult(new { result = isSuccess });
|
||||
}
|
||||
public async Task<JsonResult> OnGetCloneCheckListTemplateHeader(int id)
|
||||
{
|
||||
var isSuccess = await _checkListService.CloneCheckListTemplateHeader(id);
|
||||
return new JsonResult(new { result = isSuccess });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +264,27 @@ namespace WorkFlowCheck.Web.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> CloneCheckListTemplateHeader(int id)
|
||||
{
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/CloneCheckListTemplateHeader/{id}";
|
||||
var retVal = false;
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id)
|
||||
|
||||
@@ -19,9 +19,11 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
|
||||
Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
|
||||
Task<bool> DeleteCheckListTemplateHeader(int id);
|
||||
Task<bool> CloneCheckListTemplateHeader(int id);
|
||||
|
||||
Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id);
|
||||
Task<bool> DeleteCheckListTemplateRow(int id);
|
||||
|
||||
Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO);
|
||||
|
||||
|
||||
|
||||
@@ -232,6 +232,19 @@ function renderActionButtonsforCheckListHeader(data, rowId) {
|
||||
//</button>`;
|
||||
|
||||
}
|
||||
function renderActionButtonsforCheckListTemplateHeader(rowId) {
|
||||
return `
|
||||
<button class="btn btn-primary edit-btn btn-sm" data-id="${rowId}">
|
||||
<i class="bi bi-pencil-fill"></i>
|
||||
</button>
|
||||
<button class="btn btn-danger delete-btn btn-sm" data-id="${rowId}">
|
||||
<i class="bi bi-trash-fill"></i>
|
||||
</button>
|
||||
<button class="btn btn-primary clone-btn btn-sm" data-id="${rowId}">
|
||||
<i class="bi bi bi-copy"></i>
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderCheckStatus(data) {
|
||||
//Open = 0,
|
||||
|
||||
Reference in New Issue
Block a user