This commit is contained in:
2025-06-06 08:47:53 +02:00
35 changed files with 420 additions and 190 deletions
+1
View File
@@ -342,3 +342,4 @@ healthchecksdb
/src/WorkFlowCheck.API/Images /src/WorkFlowCheck.API/Images
*.pdf *.pdf
/src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx /src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx
/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk
@@ -170,7 +170,7 @@ namespace WorkFlowCheck.BL.Services
IsEditable = true, IsEditable = true,
UserId = checkListHeaderNewDTO.UserId, UserId = checkListHeaderNewDTO.UserId,
ShortName = "", ShortName = "",
Description = "", Description = checkListTemplateHeader.Description ?? "",
DocumentNumber = documentNumber, DocumentNumber = documentNumber,
GuidNumber = Guid.NewGuid(), GuidNumber = Guid.NewGuid(),
IsDeleted = false, IsDeleted = false,
@@ -227,7 +227,10 @@ namespace WorkFlowCheck.BL.Services
checkListHeader.CheckStatus = CheckStatus.Signed; checkListHeader.CheckStatus = CheckStatus.Signed;
checkListHeader.IsEditable = false; checkListHeader.IsEditable = false;
checkListHeader.AcceptUserId = userid; checkListHeader.AcceptUserId = userid;
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhasyás: Ellenőrzés:{id}, Felhasználó:{userid}");
checkListHeader.DateExecution = DateTime.Now;
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhagyás: Ellenőrzés:{checkListHeader.DocumentNumber}, Felhasználó: {checkListHeader.AcceptUser.LastName} {checkListHeader.AcceptUser.FirstName}");
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
var pdf = await CreateCheckListHeaderPDFAsync(id); var pdf = await CreateCheckListHeaderPDFAsync(id);
+46 -42
View File
@@ -212,8 +212,7 @@ namespace WorkFlowCheck.BL.Services
var res = await _dbContext.Locations.Where(w => w.Id == LocationDTO.Id).FirstOrDefaultAsync(); var res = await _dbContext.Locations.Where(w => w.Id == LocationDTO.Id).FirstOrDefaultAsync();
if (res != null) if (res != null)
{ {
res = _mapper.Map<DL.Entities.Location>(LocationDTO); res.FullName = LocationDTO.FullName;
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<LocationDTO>(res); retVal = _mapper.Map<LocationDTO>(res);
@@ -349,9 +348,10 @@ namespace WorkFlowCheck.BL.Services
try try
{ {
var res = await _dbContext.CheckListHeaders var res = await _dbContext.CheckListHeaders
.Where(w => (w.IsEditable && .Where(w => w.CheckStatus == CheckStatus.Open ||
w.IsDeleted != true) || (w.CheckStatus == CheckStatus.Blocked) w.CheckStatus == CheckStatus.InProgress ||
) w.CheckStatus == CheckStatus.Blocked ||
w.CheckStatus == CheckStatus.Sent)
.Include(i => i.CheckListRows) .Include(i => i.CheckListRows)
//.ThenInclude(i => i.CheckListTemplateRow) //.ThenInclude(i => i.CheckListTemplateRow)
.AsNoTracking() .AsNoTracking()
@@ -385,43 +385,6 @@ namespace WorkFlowCheck.BL.Services
if (res != null && (res.CheckStatus == CheckStatus.Open || if (res != null && (res.CheckStatus == CheckStatus.Open ||
res.CheckStatus == CheckStatus.InProgress)) res.CheckStatus == CheckStatus.InProgress))
{ {
if (NeedBlocking(checkListHeaderDTO))
{
/// TODO: blokkolás miatt
res.CheckStatus = CheckStatus.Blocked;
await _dbContext.SaveChangesAsync();
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}");
var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1);
foreach (var item in user.RoleDTO)
{
var deviceMessageDTO = new DeviceMessageDTO()
{
IsReaded = false,
Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]",
SendDate = DateTime.UtcNow,
ExtraDataJSON = "",
RoleId = item.ParentId,
DeviceIdFrom = "",
DeviceIdTo = "",
};
await this.DeviceMessageSend(deviceMessageDTO);
var fCMMessageDTO = new FCMMessageDTO
{
Body = deviceMessageDTO.Message,
Title = "Blokkolási értesítés",
UserId = user.Id,
};
await _messageService.SendFCMMessageToLastToken(fCMMessageDTO);
}
return retVal;
}
res.CheckStatus = CheckStatus.InProgress;
var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList(); var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList();
if (ids != null && ids.Count > 0) if (ids != null && ids.Count > 0)
{ {
@@ -448,6 +411,47 @@ namespace WorkFlowCheck.BL.Services
} }
} }
} }
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(res);
if (NeedBlocking(checkListHeaderDTO))
{
/// TODO: blokkolás miatt
res.CheckStatus = CheckStatus.Blocked;
await _dbContext.SaveChangesAsync();
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}");
var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1);
foreach (var item in user.RoleDTO)
{
var deviceMessageDTO = new DeviceMessageDTO()
{
IsReaded = false,
Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]",
SendDate = DateTime.UtcNow,
ExtraDataJSON = "",
RoleId = item.ParentId,
DeviceIdFrom = "",
DeviceIdTo = "",
};
await this.DeviceMessageSend(deviceMessageDTO);
var fCMMessageDTO = new FCMMessageDTO
{
Body = deviceMessageDTO.Message,
Title = "Blokkolási értesítés",
UserId = user.Id,
};
await _messageService.SendFCMMessageToLastToken(fCMMessageDTO);
}
return retVal;
}
res.CheckStatus = CheckStatus.InProgress;
if (CheckIfLastReached(checkListHeaderDTO)) if (CheckIfLastReached(checkListHeaderDTO))
{ {
/// TODO: most kell a CheckStatust állítani és menjen üzenet ! /// TODO: most kell a CheckStatust állítani és menjen üzenet !
@@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +11,13 @@ namespace WorkFlowCheck.Common.DTO
public class EquipmentDTO public class EquipmentDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A megnevezést megadása kötelező.")]
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
[Required(ErrorMessage = "Az azonosító megadása kötelező.")]
[DisplayName("Azonosító")]
public string EquipmentNumber { get; set; } = null!; public string EquipmentNumber { get; set; } = null!;
} }
} }
@@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,6 +11,9 @@ namespace WorkFlowCheck.Common.DTO
public class LocationDTO public class LocationDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A megnevezést megadása kötelező.")]
[DisplayName("Megnevezés")]
public string FullName { get; set; } = null!; public string FullName { get; set; } = null!;
} }
} }
@@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -10,10 +12,19 @@ namespace WorkFlowCheck.Common.DTO
public class RoleCheckListTemplateHeaderDTO public class RoleCheckListTemplateHeaderDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")]
[DisplayName("Szabály")]
public int RoleId { get; set; } public int RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; } = null!; public RoleDTO? RoleDTO { get; set; } = null!;
[Required(ErrorMessage = "Az ellenőrzési sablon megadása kötelező.")]
[DisplayName("Ellenőrzési sablon")]
public int CheckListTemplateHeaderId { get; set; } public int CheckListTemplateHeaderId { get; set; }
public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!; public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!;
[DisplayName("Engedélyezve?")]
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
} }
} }
@@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -10,10 +12,18 @@ namespace WorkFlowCheck.Common.DTO
public class RoleCheckPointDTO public class RoleCheckPointDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A szabály megadása kötelező.")]
[DisplayName("Szabály")]
public int RoleId { get; set; } public int RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; } = null!; public RoleDTO? RoleDTO { get; set; } = null!;
[Required(ErrorMessage = "Az ellenőrzési pont megadása kötelező.")]
[DisplayName("Ellenőrzési pont")]
public int CheckPointId { get; set; } public int CheckPointId { get; set; }
public CheckPointDTO? CheckPointDTO { get; set; } = null!; public CheckPointDTO? CheckPointDTO { get; set; } = null!;
[DisplayName("Engedélyezve?")]
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
} }
} }
@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -16,9 +17,13 @@ namespace WorkFlowCheck.Common.DTO
[DisplayName("Régi jelszó")] [DisplayName("Régi jelszó")]
public string OldPassword { get; set; } = null!; public string OldPassword { get; set; } = null!;
[Required(ErrorMessage = "A jelszó kötelező.")]
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")]
[DisplayName("Új jelszó")] [DisplayName("Új jelszó")]
public string NewPassword1 { get; set; } = null!; public string NewPassword1 { get; set; } = null!;
[Required(ErrorMessage = "A jelszó kötelező.")]
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")]
[DisplayName("Jelszó megerősítése")] [DisplayName("Jelszó megerősítése")]
public string NewPassword2 { get; set; } = null!; public string NewPassword2 { get; set; } = null!;
+5 -2
View File
@@ -25,9 +25,12 @@ namespace WorkFlowCheck.Common.DTO
[DisplayName("Felhasználó neve")] [DisplayName("Felhasználó neve")]
public string UserName { get;set; } = null!; public string UserName { get;set; } = null!;
[Required(ErrorMessage = "A jelszó kötelező.")]
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "A jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")]
[DisplayName("Jelszó")] [DisplayName("Jelszó")]
public string Password { get; set; } public string Password { get; set; } = null!;
public string JwtToken { get; set; } = null!; public string JwtToken { get; set; } = null!;
[DisplayName("Aktív")] [DisplayName("Aktív")]
@@ -19,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper
public static string DatabaseName = ""; public static string DatabaseName = "";
public static bool Syncronised = false; public static bool Syncronised = false;
public static UserDTO SystemUserDTO; public static UserDTO SystemUserDTO;
public static string ProgramVersion = "v1.1.027"; public static string ProgramVersion = "v1.1.030";
#if DEBUG #if DEBUG
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/"; public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
@@ -38,7 +38,7 @@
</HorizontalStackLayout> </HorizontalStackLayout>
</Grid> </Grid>
</Shell.TitleView> </Shell.TitleView>
<Grid RowDefinitions="*,4*,2*" Padding="30,30"> <Grid RowDefinitions="*,4*,2*" Padding="30,30">
<VerticalStackLayout Grid.Row="0" Margin="0,0,0,0"> <VerticalStackLayout Grid.Row="0" Margin="0,0,0,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" /> <Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
@@ -63,7 +63,7 @@
CornerRadius="25" CornerRadius="25"
VerticalOptions="Center" /> VerticalOptions="Center" />
</HorizontalStackLayout> </HorizontalStackLayout>
</VerticalStackLayout> </VerticalStackLayout>
<Frame Grid.Row="1" <Frame Grid.Row="1"
BorderColor="Gray" BorderColor="Gray"
@@ -198,20 +198,23 @@
Margin="1" Margin="1"
CornerRadius="10" CornerRadius="10"
HasShadow="True"> HasShadow="True">
<ScrollView> <RefreshView x:Name="CheckListTemplateRefreshView"
<VerticalStackLayout> IsRefreshing="{Binding IsRefreshingT}"
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" /> Command="{Binding RefreshCommandT}">
<CollectionView x:Name="CheckListTemplate"> <ScrollView>
<CollectionView.ItemTemplate> <VerticalStackLayout>
<DataTemplate> <Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <CollectionView x:Name="CheckListTemplate">
<Grid ColumnDefinitions="*,Auto"> <CollectionView.ItemTemplate>
<StackLayout> <DataTemplate>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" /> <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Label Text="{Binding Description}" FontSize="14" /> <Grid ColumnDefinitions="*,Auto">
</StackLayout> <StackLayout>
<HorizontalStackLayout HorizontalOptions="End"> <Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Button Text="Új ellenőrzés" <Label Text="{Binding Description}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Új ellenőrzés"
BackgroundColor="Green" BackgroundColor="Green"
Margin="5,0,0,0" Margin="5,0,0,0"
HeightRequest="50" HeightRequest="50"
@@ -220,14 +223,15 @@
MaximumWidthRequest="120" MaximumWidthRequest="120"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}" Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</HorizontalStackLayout> </HorizontalStackLayout>
</Grid> </Grid>
</Frame> </Frame>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
</RefreshView>
</Frame> </Frame>
<Grid BackgroundColor="#80000000" <Grid BackgroundColor="#80000000"
IsVisible="{Binding IsLoading}" IsVisible="{Binding IsLoading}"
@@ -31,6 +31,7 @@ public partial class CheckListPage : ContentPage
public ICommand InfoCommand { get; set; } public ICommand InfoCommand { get; set; }
public ICommand CloseCommand { get; set; } public ICommand CloseCommand { get; set; }
public ICommand RefreshCommand { get; } public ICommand RefreshCommand { get; }
public ICommand RefreshCommandT { get; }
public bool IsLoading public bool IsLoading
{ {
@@ -52,6 +53,7 @@ public partial class CheckListPage : ContentPage
} }
private bool _isRefreshing; private bool _isRefreshing;
private bool _isRefreshingT;
public bool IsRefreshing public bool IsRefreshing
{ {
get => _isRefreshing; get => _isRefreshing;
@@ -64,6 +66,18 @@ public partial class CheckListPage : ContentPage
} }
} }
} }
public bool IsRefreshingT
{
get => _isRefreshingT;
set
{
if (_isRefreshingT != value)
{
_isRefreshingT = value;
OnPropertyChanged(nameof(IsRefreshingT));
}
}
}
public CheckListPage() public CheckListPage()
{ {
@@ -79,6 +93,7 @@ public partial class CheckListPage : ContentPage
InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem); InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem);
CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem); CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem);
RefreshCommand = new Command(async () => await OnRefresh()); RefreshCommand = new Command(async () => await OnRefresh());
RefreshCommandT = new Command(async () => await OnRefreshT());
} }
private async void OnSyncClicked(object sender, EventArgs e) private async void OnSyncClicked(object sender, EventArgs e)
@@ -128,6 +143,16 @@ public partial class CheckListPage : ContentPage
IsRefreshing = false; IsRefreshing = false;
} }
private async Task OnRefreshT()
{
IsRefreshingT = true;
//await _syncService.SyncCheckListHeader_Down((d, s) => { });
await LoadCheckListTemplate();
IsRefreshingT = false;
}
private void SetInfo() private void SetInfo()
{ {
_currentUser = _userService.GetCurrentUser(); _currentUser = _userService.GetCurrentUser();
@@ -0,0 +1,44 @@
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace WorkFlowCheck.Web.Helpers
{
[HtmlTargetElement("input", Attributes = "asp-for-datatype")]
public class AspForDataTypeTagHelper : TagHelper
{
[HtmlAttributeName("asp-for-datatype")]
public ModelExpression For { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (For == null) return;
var type = For.ModelExplorer.ModelType;
string dataType = GetDataTypeString(type);
output.Attributes.SetAttribute("data-type", dataType);
// 🔥 EZ HIÁNYZIK → Rakd be!
output.Attributes.RemoveAll("asp-for-datatype");
}
private string GetDataTypeString(Type type)
{
// Nullable<T> esetén nyerjük ki az alaptípust
if (Nullable.GetUnderlyingType(type) is Type underlyingType)
{
type = underlyingType;
}
if (type == typeof(string)) return "string";
if (type == typeof(int) || type == typeof(long) || type == typeof(float) ||
type == typeof(double) || type == typeof(decimal)) return "number";
if (type == typeof(bool)) return "bool";
if (type == typeof(DateTime)) return "date";
return "string"; // default fallback
}
}
}
@@ -7,7 +7,7 @@ namespace WorkFlowCheck.Web.Helpers
public static class SystemHelper public static class SystemHelper
{ {
public static string DatabaseName = ""; public static string DatabaseName = "";
public static string ProgramVersion = "v1.1.025"; public static string ProgramVersion = "v1.1.027";
public async static Task GetAPIInfoAsync(IConfiguration configuration) public async static Task GetAPIInfoAsync(IConfiguration configuration)
{ {
@@ -79,7 +79,7 @@
$('#tbEquipmentsPage').on('click', '.delete-btn', function () $('#tbEquipmentsPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/BaseStock/Equipments/EquipmentPage?handler=DeleteEquipment', row.id); deleteEntity(table, '/BaseStock/Equipments/EquipmentsPage?handler=DeleteEquipment', row.id);
}); });
</script> </script>
} }
@@ -17,14 +17,14 @@
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Full name</th> <th>@DisplayNameHelper.GetDisplayName(nameof(LocationDTO.FullName), typeof(LocationDTO))</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tfoot class="table-light"> <tfoot class="table-light">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Full name</th> <th>@DisplayNameHelper.GetDisplayName(nameof(LocationDTO.FullName), typeof(LocationDTO))</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</tfoot> </tfoot>
@@ -33,23 +33,23 @@
<div class="tab-pane fade show active" id="general" role="tabpanel"> <div class="tab-pane fade show active" id="general" role="tabpanel">
<form method="post" id="CheckListHeaderForm"> <form method="post" id="CheckListHeaderForm">
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" /> <meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
<input type="hidden" asp-for="CheckListHeaderDTO.Id" /> <input type="hidden" asp-for="CheckListHeaderDTO.Id" data-type="int" />
<input type="hidden" asp-for="CheckListHeaderDTO.IsEditable" /> <input type="hidden" asp-for="CheckListHeaderDTO.IsEditable" data-type="bool" />
<input type="hidden" asp-for="CheckListHeaderDTO.IsStorno" /> <input type="hidden" asp-for="CheckListHeaderDTO.IsStorno" data-type="bool" />
<input type="hidden" asp-for="CheckListHeaderDTO.GuidNumber" /> <input type="hidden" asp-for="CheckListHeaderDTO.GuidNumber" />
<input type="hidden" asp-for="CheckListHeaderDTO.CheckListTemplateHeaderId" /> <input type="hidden" asp-for="CheckListHeaderDTO.CheckListTemplateHeaderId" data-type="int" />
<input type="hidden" asp-for="CheckListHeaderDTO.UserId" /> <input type="hidden" asp-for="CheckListHeaderDTO.UserId" data-type="int" />
<input type="hidden" name="CheckListHeaderDTO.DateExecution" value="@Model.CheckListHeaderDTO.DateExecution.ToString("yyyy-MM-dd")" /> <input type="hidden" name="CheckListHeaderDTO.DateExecution" value="@Model.CheckListHeaderDTO.DateExecution.ToString("yyyy-MM-dd")" />
<input type="hidden" asp-for="CheckListHeaderDTO.AcceptUserId" /> <input type="hidden" asp-for="CheckListHeaderDTO.AcceptUserId" data-type="int" />
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<label asp-for="CheckListHeaderDTO.DocumentNumber"></label> <label asp-for="CheckListHeaderDTO.DocumentNumber"></label>
<input asp-for="CheckListHeaderDTO.DocumentNumber" class="form-control" readonly /> <input asp-for="CheckListHeaderDTO.DocumentNumber" class="form-control" readonly />
<span asp-validation-for="CheckListHeaderDTO.DocumentNumber" class="text-danger"></span> <span asp-validation-for="CheckListHeaderDTO.DocumentNumber" class="text-danger"></span>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label asp-for="CheckListHeaderDTO.CheckStatus"></label> <label asp-for="CheckListHeaderDTO.CheckStatus"></label>
<select asp-for="CheckListHeaderDTO.CheckStatus" class="form-control" asp-items="Model.CheckStatus" readonly></select> <select asp-for="CheckListHeaderDTO.CheckStatus" class="form-control" asp-items="Model.CheckStatus" readonly data-type="int"></select>
<span asp-validation-for="CheckListHeaderDTO.CheckStatus" class="text-danger"></span> <span asp-validation-for="CheckListHeaderDTO.CheckStatus" class="text-danger"></span>
</div> </div>
</div> </div>
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery @inject IAntiforgery Antiforgery
@{ @{
ViewData["Title"] = "Ellenőrzési pont"; ViewData["Title"] = "Szabály - ellenőrzési sablon";
var RoleCheckListTemplateHeaderId = Model.RoleCheckListTemplateHeaderDTO.Id; var RoleCheckListTemplateHeaderId = Model.RoleCheckListTemplateHeaderDTO.Id;
var urlPost = Url.Page("./RoleCheckListTemplateHeaderEditPage", "Save"); var urlPost = Url.Page("./RoleCheckListTemplateHeaderEditPage", "Save");
} }
@@ -15,18 +15,18 @@
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Role name</th> <th>Szabály neve</th>
<th>Template name</th> <th>Ellenőrzési sablon neve</th>
<th>Enabled</th> <th>Engedélyezve?</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tfoot class="table-light"> <tfoot class="table-light">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Role name</th> <th>Szabály neve</th>
<th>Template name</th> <th>Ellenőrzési sablon neve</th>
<th>Enabled</th> <th>Engedélyezve?</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</tfoot> </tfoot>
@@ -90,17 +90,7 @@
$('#tbRoleCheckListTemplateHeadersPage').on('click', '.delete-btn', function () $('#tbRoleCheckListTemplateHeadersPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
console.log(row); deleteEntity(table, '/UserAndRole/RoleCheckListTemplateHeadersPage?handler=DeleteRoleCheckListTemplateHeader', row.id);
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> </script>
} }
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllRoleCheckListTemplates(); var results = await _userService.GetAllRoleCheckListTemplates();
return new JsonResult(new { data = results }); return new JsonResult(new { data = results });
} }
public async Task<JsonResult> OnGetDeleteRoleCheckListTemplateHeader(int id)
{
var isSuccess = await _userService.DeleteRoleCheckListTemplateHeader(id);
return new JsonResult(new { result = isSuccess });
}
} }
} }
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery @inject IAntiforgery Antiforgery
@{ @{
ViewData["Title"] = "Ellenőrzési pont"; ViewData["Title"] = "Szabály - Ellenőrzési pont";
var RoleCheckPointId = Model.RoleCheckPointDTO.Id; var RoleCheckPointId = Model.RoleCheckPointDTO.Id;
var urlPost = Url.Page("./RoleCheckPointEditPage", "Save"); var urlPost = Url.Page("./RoleCheckPointEditPage", "Save");
} }
@@ -96,6 +96,8 @@
} }
}); });
$(document).ready(function () { $(document).ready(function () {
const $form = $("#RoleCheckPointForm"); const $form = $("#RoleCheckPointForm");
@@ -71,5 +71,6 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
this.RoleCheckPoints.Add(new SelectListItem() { Value = CheckPoint.Id.ToString(), Text = CheckPoint.ShortName }); this.RoleCheckPoints.Add(new SelectListItem() { Value = CheckPoint.Id.ToString(), Text = CheckPoint.ShortName });
} }
} }
} }
} }
@@ -3,7 +3,7 @@
@using WorkFlowCheck.Common.Helper @using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO @using WorkFlowCheck.Common.DTO
@{ @{
ViewData["Title"] = "Szabályok - Ellenőrzési sablonok"; ViewData["Title"] = "Szabályok - Ellenőrzési pontok";
} }
<h1>@ViewData["Title"]</h1> <h1>@ViewData["Title"]</h1>
@@ -17,8 +17,8 @@
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO))</th> <th>Szabály @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO))</th> <th>Ellenőrzési pont @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
@@ -26,8 +26,8 @@
<tfoot class="table-light"> <tfoot class="table-light">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO))</th> <th>Szabály @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO))</th> <th>Ellenőrzési pont @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
@@ -91,18 +91,8 @@
$('#tbRoleCheckPointsPage').on('click', '.delete-btn', function () $('#tbRoleCheckPointsPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
console.log(row); deleteEntity(table, '/UserAndRole/RoleCheckPointsPage?handler=DeleteRoleCheckPoint', row.id);
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> </script>
} }
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllRoleCheckPoints(); var results = await _userService.GetAllRoleCheckPoints();
return new JsonResult(new { data = results }); return new JsonResult(new { data = results });
} }
public async Task<JsonResult> OnGetDeleteRoleCheckPoint(int id)
{
var isSuccess = await _userService.DeleteRoleCheckPoint(id);
return new JsonResult(new { result = isSuccess });
}
} }
} }
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery @inject IAntiforgery Antiforgery
@{ @{
ViewData["Title"] = "Ellenőrzési pont"; ViewData["Title"] = "Szabály szerkesztése";
var RoleId = Model.RoleDTO.Id; var RoleId = Model.RoleDTO.Id;
var urlPost = Url.Page("./RoleEditPage", "Save"); var urlPost = Url.Page("./RoleEditPage", "Save");
} }
@@ -140,7 +140,7 @@
$('#tbRolesPage').on('click', '.delete-btn', function () $('#tbRolesPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/UserAndRole/UserRole?handler=DeleteUser', row.id); deleteEntity(table, '/UserAndRole/RolePage?handler=DeleteRole', row.id);
}); });
</script> </script>
} }
@@ -20,30 +20,46 @@
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" /> <meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
<input type="hidden" asp-for="UserDTO.Id" /> <input type="hidden" asp-for="UserDTO.Id" />
<input type="hidden" asp-for="UserDTO.Password" value="" /> <input type="hidden" asp-for="UserDTO.Password" value="" />
<input type="hidden" asp-for="UserDTO.NFCCode" value="" />
<input type="hidden" asp-for="UserDTO.JwtToken" value="" /> <input type="hidden" asp-for="UserDTO.JwtToken" value="" />
<input type="hidden" asp-for="UserDTO.RoleDTO" value="" /> <input type="hidden" asp-for="UserDTO.RoleDTO" value="" />
<div class="mb-3"> @if (Model.UserDTO.Id == 0)
<label asp-for="UserDTO.UserName"></label> {
<input asp-for="UserDTO.UserName" class="form-control" /> <div class="mb-3">
<span asp-validation-for="UserDTO.UserName" class="text-danger"></span> <label asp-for="UserDTO.UserName"></label>
</div> <input asp-for="UserDTO.UserName" class="form-control" autocomplete="off" />
<span asp-validation-for="UserDTO.UserName" class="text-danger"></span>
</div>
}
else
{
<div class="mb-3">
<label asp-for="UserDTO.UserName"></label>
<input asp-for="UserDTO.UserName" class="form-control" readonly />
<span asp-validation-for="UserDTO.UserName" class="text-danger"></span>
</div>
}
@if (Model.UserDTO.Id == 0) @if (Model.UserDTO.Id == 0)
{ {
<div class="row"> <div class="row">
<div class="mb-6"> <div class="mb-3">
<label asp-for="UserDTO.Password"></label> <label asp-for="UserDTO.Password" class="form-label"></label>
<input asp-for="UserDTO.Password" class="form-control" type="password" /> <div class="input-group">
<input asp-for="UserDTO.Password" class="form-control" type="password" id="passwordInput" autocomplete="off" />
<button class="btn btn-outline-secondary" type="button" onclick="togglePasswordVisibility()" tabindex="-1">
<i class="bi bi-eye" id="toggleIcon"></i>
</button>
</div>
<span asp-validation-for="UserDTO.Password" class="text-danger"></span> <span asp-validation-for="UserDTO.Password" class="text-danger"></span>
</div> </div>
<div class="mb-6">
<label asp-for="UserDTO.NFCCode"></label>
<input asp-for="UserDTO.NFCCode" class="form-control" type="password" />
<span asp-validation-for="UserDTO.NFCCode" class="text-danger"></span>
</div>
</div> </div>
} }
<div class="mb-3">
<label asp-for="UserDTO.NFCCode"></label>
<input asp-for="UserDTO.NFCCode" class="form-control" />
<span asp-validation-for="UserDTO.NFCCode" class="text-danger"></span>
</div>
<div class="mb-3"> <div class="mb-3">
<label asp-for="UserDTO.Email"></label> <label asp-for="UserDTO.Email"></label>
<input asp-for="UserDTO.Email" class="form-control" /> <input asp-for="UserDTO.Email" class="form-control" />
@@ -78,35 +94,38 @@
</div> </div>
</form> </form>
</div> </div>
<br></br> @if (Model.UserDTO.Id != 0)
<div class="card shadow p-4"> {
<table id="tbUserPage" class="table table-bordered table-hover table-sm" style="width:100%"> <br></br>
<thead class="table-primary"> <div class="card shadow p-4">
<tr> <table id="tbUserPage" class="table table-bordered table-hover table-sm" style="width:100%">
<th>ID</th> <thead class="table-primary">
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th> <tr>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th> <th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th>
</tr> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))</th>
</thead> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))</th>
<tfoot class="table-light"> </tr>
<tr> </thead>
<th>ID</th> <tfoot class="table-light">
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th> <tr>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th> <th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))</th> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th>
</tr> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))</th>
</tfoot> <th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))</th>
</table> </tr>
</div> </tfoot>
</table>
</div>
}
@section Scripts { @section Scripts {
<script> <script>
@@ -189,6 +208,7 @@
const $form = $('#UserForm'); const $form = $('#UserForm');
formData.UserDTO.RoleDTO=[]; formData.UserDTO.RoleDTO=[];
formData.UserDTO.JwtToken='';
formData.UserDTO.Active = $('#UserForm input[name="UserDTO.Active"]').is(':checked'); formData.UserDTO.Active = $('#UserForm input[name="UserDTO.Active"]').is(':checked');
formData.UserDTO.NFCActive = $('#UserForm input[name="UserDTO.NFCActive"]').is(':checked'); formData.UserDTO.NFCActive = $('#UserForm input[name="UserDTO.NFCActive"]').is(':checked');
@@ -23,8 +23,17 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
public async Task OnGet(int id) public async Task OnGet(int id)
{ {
UserDTO = await _userService.GetUser(id); if (id == 0)
{
UserDTO = new UserDTO();
}
else
{
UserDTO = await _userService.GetUser(id);
}
} }
public async Task<IActionResult> OnPostSave([FromBody] UserDTO userDTO) public async Task<IActionResult> OnPostSave([FromBody] UserDTO userDTO)
{ {
try try
@@ -78,17 +78,7 @@
$('#tbUserRolesPage').on('click', '.delete-btn', function () $('#tbUserRolesPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
console.log(row); deleteEntity(table, '/UserAndRole/UserRolePage?handler=DeleteUserRole', row.id);
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> </script>
} }
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllUserRoles(); var results = await _userService.GetAllUserRoles();
return new JsonResult(new { data = results }); return new JsonResult(new { data = results });
} }
public async Task<JsonResult> OnGetDeleteUserRole(int id)
{
var results = await _userService.DeleteUserRole(id);
return new JsonResult(new { data = results });
}
} }
} }
@@ -2,3 +2,4 @@
@using WorkFlowCheck.Web.Helpers @using WorkFlowCheck.Web.Helpers
@namespace WorkFlowCheck.Web.Pages @namespace WorkFlowCheck.Web.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, WorkFlowCheck.Web.Helpers
@@ -21,14 +21,16 @@ namespace WorkFlowCheck.Web.Services.Interfaces
Task<UserRoleDTO> GetUserRole(int id); Task<UserRoleDTO> GetUserRole(int id);
Task<List<UserRoleDTO>> GetAllUserRoles(); Task<List<UserRoleDTO>> GetAllUserRoles();
Task<ApiResponseDTO<UserRoleDTO>> UpdateUserRole(UserRoleDTO userRoleDTO); Task<ApiResponseDTO<UserRoleDTO>> UpdateUserRole(UserRoleDTO userRoleDTO);
Task<bool> DeleteUserRole(int id);
Task<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeader(int id); Task<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeader(int id);
Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplates(); Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplates();
Task<ApiResponseDTO<RoleCheckListTemplateHeaderDTO>> UpdateRoleCheckListTemplateHeader(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO); Task<ApiResponseDTO<RoleCheckListTemplateHeaderDTO>> UpdateRoleCheckListTemplateHeader(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO);
Task<bool> DeleteRoleCheckListTemplateHeader(int id);
Task<RoleCheckPointDTO> GetRoleCheckPoint(int id); Task<RoleCheckPointDTO> GetRoleCheckPoint(int id);
Task<List<RoleCheckPointDTO>> GetAllRoleCheckPoints(); Task<List<RoleCheckPointDTO>> GetAllRoleCheckPoints();
Task<ApiResponseDTO<RoleCheckPointDTO>> UpdateRoleCheckPoint(RoleCheckPointDTO roleCheckPointDTO); Task<ApiResponseDTO<RoleCheckPointDTO>> UpdateRoleCheckPoint(RoleCheckPointDTO roleCheckPointDTO);
Task<bool> DeleteRoleCheckPoint(int id);
} }
} }
+74 -6
View File
@@ -59,7 +59,12 @@ namespace WorkFlowCheck.Web.Services
{ {
try try
{ {
string endpoint = $"{_httpClient.BaseAddress}api/user/updateUser"; if (userDTO.Id != null)
{
userDTO.Password = "xXyY3456!!!;;"; // Ez csak amiatt kell, hogy ne szálljon el a JSON
}
string endpoint = $"{_httpClient.BaseAddress}api/user/UpdateUser";
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, userDTO)) using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, userDTO))
{ {
@@ -131,7 +136,7 @@ namespace WorkFlowCheck.Web.Services
{ {
UserName = username, UserName = username,
Password = password, Password = password,
}; };
@@ -161,7 +166,7 @@ namespace WorkFlowCheck.Web.Services
{ {
try try
{ {
string endpoint = $"{_httpClient.BaseAddress}api/User/Authenticate2F2"; string endpoint = $"{_httpClient.BaseAddress}api/User/Authenticate2F2";
var userSimpleDTO = new User2FADTO() var userSimpleDTO = new User2FADTO()
@@ -188,7 +193,7 @@ namespace WorkFlowCheck.Web.Services
} }
catch (Exception ex) catch (Exception ex)
{ {
return new ApiResponseDTO<UserDTO> return new ApiResponseDTO<UserDTO>
{ {
IsSuccess = false IsSuccess = false
@@ -206,7 +211,7 @@ namespace WorkFlowCheck.Web.Services
{ {
UserName = username, UserName = username,
OldPassword = oldpassword, OldPassword = oldpassword,
NewPassword1 = newpassword, NewPassword1 = newpassword,
NewPassword2 = newpassword, NewPassword2 = newpassword,
Code = code, Code = code,
Token2FA = token2FA Token2FA = token2FA
@@ -421,6 +426,27 @@ namespace WorkFlowCheck.Web.Services
}; };
} }
} }
public async Task<bool> DeleteUserRole(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteUserRole/{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<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeader(int id) public async Task<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeader(int id)
{ {
@@ -492,6 +518,27 @@ namespace WorkFlowCheck.Web.Services
}; };
} }
} }
public async Task<bool> DeleteRoleCheckListTemplateHeader(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteRoleCheckListTemplateHeader/{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<RoleCheckPointDTO> GetRoleCheckPoint(int id) public async Task<RoleCheckPointDTO> GetRoleCheckPoint(int id)
{ {
@@ -563,7 +610,28 @@ namespace WorkFlowCheck.Web.Services
}; };
} }
} }
public async Task<bool> DeleteRoleCheckPoint(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteRoleCheckPoint/{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;
}
} }
} }
+23 -4
View File
@@ -2,7 +2,11 @@
// for details on configuring this project to bundle and minify static web assets. // for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code. // Write your JavaScript code.
function parseValue(value) { function parseValue(value, type = "string") {
if (type === "string") {
return value;
}
if (value === "") return null; if (value === "") return null;
// Boolean // Boolean
@@ -23,17 +27,17 @@ function getFormAsNestedObject(formSelector) {
formArray.forEach(function (item) { formArray.forEach(function (item) {
var keys = item.name.split('.'); var keys = item.name.split('.');
var value = parseValue(item.value); var inputElement = document.querySelector(`[name="${item.name}"]`);
var type = inputElement?.dataset?.type || "string"; // ha nincs data-type, alap: string
var value = parseValue(item.value, type);
var current = result; var current = result;
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
var key = keys[i]; var key = keys[i];
// Ha utolsó kulcs, értéket rendelünk hozzá
if (i === keys.length - 1) { if (i === keys.length - 1) {
current[key] = value; current[key] = value;
} else { } else {
// Ha a következő szint nincs meg, hozzuk létre
if (!current[key]) { if (!current[key]) {
current[key] = {}; current[key] = {};
} }
@@ -44,6 +48,7 @@ function getFormAsNestedObject(formSelector) {
return result; return result;
} }
function showConfirmModal(options) { function showConfirmModal(options) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
// Alapértelmezett értékek // Alapértelmezett értékek
@@ -434,4 +439,18 @@ function saveEntity(csrfToken, data, url) {
}); });
} }
}); });
}
function togglePasswordVisibility() {
const passwordInput = document.getElementById("passwordInput");
const icon = document.getElementById("toggleIcon");
if (passwordInput.type === "password") {
passwordInput.type = "text";
icon.classList.remove("bi-eye");
icon.classList.add("bi-eye-slash");
} else {
passwordInput.type = "password";
icon.classList.remove("bi-eye-slash");
icon.classList.add("bi-eye");
}
} }