Elég sok minden ...
This commit is contained in:
+90
@@ -1,4 +1,94 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderPageModel
|
||||
@{
|
||||
ViewData["Title"] = "Felhasználók";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<div class="card shadow p-4">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button id="newCheckListTemplateHeaderBtn" class="btn btn-primary float-right new-btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Új elem hozzáadása">
|
||||
<i class="bi bi-plus-square"></i>
|
||||
</button>
|
||||
</div>
|
||||
<table id="tbCheckListTemplateHeadersPage" class="table table-bordered table-hover table-sm" style="width:100%">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Name</th>
|
||||
<th>Description</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Name</th>
|
||||
<th>Description</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
const table = new DataTable('#tbCheckListTemplateHeadersPage', {
|
||||
ajax: {
|
||||
url: "@Url.Page("./CheckListTemplateHeaderPage", "LoadCheckListTemplateHeaders")",
|
||||
type: "GET",
|
||||
dataSrc : "data"
|
||||
},
|
||||
columns: [
|
||||
{ data: "id" },
|
||||
{ data: "shortName" },
|
||||
{ data: "description" },
|
||||
{ data: null, render: function (data, type, row) {
|
||||
return renderActionButtons(row.id);
|
||||
}}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
"targets": 0,
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"targets": 3,
|
||||
"className": "text-center",
|
||||
"width": "10%"
|
||||
}
|
||||
],
|
||||
|
||||
processing:true,
|
||||
language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
|
||||
});
|
||||
|
||||
$('#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', '.delete-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
console.log(row);
|
||||
showConfirmModal({
|
||||
title: 'Törlés megerősítése',
|
||||
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
||||
okText: 'Törlés',
|
||||
cancelText: 'Mégsem'
|
||||
}).then(function(result) {
|
||||
if(result === 'ok') {
|
||||
console.log('Törlés végrehajtva');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
+14
-1
@@ -1,12 +1,25 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using WorkFlowCheck.Web.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
|
||||
{
|
||||
public class CheckListTemplateHeaderPageModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
private readonly ICheckListService _checkListService;
|
||||
public CheckListTemplateHeaderPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
|
||||
{
|
||||
_logger = logger;
|
||||
_checkListService = checkListService;
|
||||
}
|
||||
public async Task OnGet()
|
||||
{
|
||||
}
|
||||
public async Task<JsonResult> OnGetLoadCheckListTemplateHeaders()
|
||||
{
|
||||
var results = await _checkListService.GetAllCheckListHeaderAsync();
|
||||
return new JsonResult(new { data = results });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
builder.Services.AddScoped<IUserService, UserService>();
|
||||
builder.Services.AddScoped<IBaseStockService, BaseStockService>();
|
||||
builder.Services.AddScoped<IBaseStockService, BaseStockService>();
|
||||
builder.Services.AddScoped<ICheckListService, CheckListService>();
|
||||
|
||||
builder.Host.UseSerilog();
|
||||
// Add services to the container.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
using Serilog;
|
||||
using System.Net.Http;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
|
||||
namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
{
|
||||
public class CheckListService : BaseService, ICheckListService
|
||||
{
|
||||
public CheckListService(HttpClient httpClient, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) : base(httpClient, configuration, httpContextAccessor)
|
||||
{
|
||||
}
|
||||
public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
|
||||
{
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetAllCheckListHeaders";
|
||||
var retVal = new List<CheckListHeaderDTO>();
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<CheckListHeaderDTO>>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<CheckListHeaderDTO> GetCheckListHeader(int id)
|
||||
{
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetCheckListHeader/{id}";
|
||||
var retVal = new CheckListHeaderDTO() { CheckListRowDTO = new List<CheckListRowDTO>() };
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<CheckListHeaderDTO>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
|
||||
namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
{
|
||||
public interface ICheckListService
|
||||
{
|
||||
Task<CheckListHeaderDTO> GetCheckListHeader(int id);
|
||||
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
|
||||
Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user