* Changed views to have them in the same layout
* Added Authorization
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Diagnostics;
|
|||||||
using FaKrosnoApi.Models;
|
using FaKrosnoApi.Models;
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using Hangfire.Storage;
|
using Hangfire.Storage;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using OrdersManagementDataModel.Dtos;
|
using OrdersManagementDataModel.Dtos;
|
||||||
using OrdersManagementDataModel.Services;
|
using OrdersManagementDataModel.Services;
|
||||||
@@ -10,7 +11,10 @@ namespace FaKrosnoApi.Controllers;
|
|||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager recurringJobManager, ITaskSchedulerService service) : Controller
|
public class HangfireJobsController(
|
||||||
|
JobStorage jobStorage,
|
||||||
|
IRecurringJobManager recurringJobManager,
|
||||||
|
ITaskSchedulerService service) : Controller
|
||||||
{
|
{
|
||||||
[HttpGet("GetJobsToRun")]
|
[HttpGet("GetJobsToRun")]
|
||||||
public async Task<ActionResult<IEnumerable<JobModel>>> GetJobsToRun()
|
public async Task<ActionResult<IEnumerable<JobModel>>> GetJobsToRun()
|
||||||
@@ -25,7 +29,7 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
|||||||
foreach (var recurringJob in recurringJobs)
|
foreach (var recurringJob in recurringJobs)
|
||||||
{
|
{
|
||||||
TaskSchedulerDto? taskScheduler = taskSchedulers?.FirstOrDefault(ts => ts.Name == recurringJob.Id);
|
TaskSchedulerDto? taskScheduler = taskSchedulers?.FirstOrDefault(ts => ts.Name == recurringJob.Id);
|
||||||
|
|
||||||
if (taskScheduler != null)
|
if (taskScheduler != null)
|
||||||
{
|
{
|
||||||
jobsToRun.Add(new JobModel(recurringJob.Id, recurringJob.Cron, taskScheduler.Path,
|
jobsToRun.Add(new JobModel(recurringJob.Id, recurringJob.Cron, taskScheduler.Path,
|
||||||
@@ -36,8 +40,8 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
|||||||
|
|
||||||
return Ok(jobsToRun);
|
return Ok(jobsToRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("RunJobs")]
|
[HttpPost("run")]
|
||||||
public async Task<IActionResult> RunJobs()
|
public async Task<IActionResult> RunJobs()
|
||||||
{
|
{
|
||||||
var jobsToRun = (await GetJobsToRun()).Value?.ToList();
|
var jobsToRun = (await GetJobsToRun()).Value?.ToList();
|
||||||
@@ -58,8 +62,8 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
|||||||
|
|
||||||
return Ok("Zadania zostały zaplanowane do uruchamiania zgodnie z ich CRON.");
|
return Ok("Zadania zostały zaplanowane do uruchamiania zgodnie z ich CRON.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("AddTask")]
|
[HttpPost("add")]
|
||||||
public async Task<IActionResult> AddTask([FromBody] TaskSchedulerDto taskSchedulerDto)
|
public async Task<IActionResult> AddTask([FromBody] TaskSchedulerDto taskSchedulerDto)
|
||||||
{
|
{
|
||||||
var taskScheduler = new OrdersManagementDataModel.Entities.TaskScheduler
|
var taskScheduler = new OrdersManagementDataModel.Entities.TaskScheduler
|
||||||
@@ -83,9 +87,11 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
|||||||
return Ok("Zadanie zostało dodane.");
|
return Ok("Zadanie zostało dodane.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("DeleteTask")]
|
[HttpPost("delete")]
|
||||||
public async Task<IActionResult> DeleteTask([FromBody] TaskSchedulerDto taskSchedulerDto)
|
public async Task<IActionResult> DeleteTask([FromBody] TaskSchedulerDto taskSchedulerDto)
|
||||||
{
|
{
|
||||||
|
var taskSchedulerByTaskName = await service.GetTaskSchedulerByTaskName(taskSchedulerDto.Name);
|
||||||
|
Console.WriteLine(taskSchedulerByTaskName.RowPointer);
|
||||||
int result = await service.DeleteTaskScheduler(taskSchedulerDto.RowPointer);
|
int result = await service.DeleteTaskScheduler(taskSchedulerDto.RowPointer);
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
@@ -98,21 +104,35 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
|||||||
return Ok("Zadanie zostało usunięte.");
|
return Ok("Zadanie zostało usunięte.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("GetTasks")]
|
[HttpGet]
|
||||||
public async Task<ActionResult<IEnumerable<TaskSchedulerDto>>> GetTasks()
|
public async Task<ActionResult<IEnumerable<TaskSchedulerDto>>> GetTasks()
|
||||||
{
|
{
|
||||||
var tasks = await service.GetTaskSchedulers();
|
var tasks = await service.GetTaskSchedulers();
|
||||||
|
|
||||||
foreach (TaskSchedulerDto taskSchedulerDto in tasks)
|
foreach (TaskSchedulerDto taskSchedulerDto in tasks)
|
||||||
{
|
{
|
||||||
var job = GetJob(taskSchedulerDto.Name);
|
var job = GetJob(taskSchedulerDto.Name);
|
||||||
taskSchedulerDto.LastExecution = job?.LastExecution;
|
taskSchedulerDto.LastExecution = job?.LastExecution;
|
||||||
taskSchedulerDto.NextExecution = job?.NextExecution;
|
taskSchedulerDto.NextExecution = job?.NextExecution;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(tasks);
|
return Ok(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("by-name")]
|
||||||
|
public async Task<ActionResult<TaskSchedulerDto>> GetTaskSchedulerByTaskName([FromQuery] string name)
|
||||||
|
{
|
||||||
|
var taskSchedulerDto = await service.GetTaskSchedulerByTaskName(name);
|
||||||
|
|
||||||
|
if (taskSchedulerDto == null) return NotFound();
|
||||||
|
|
||||||
|
var job = GetJob(taskSchedulerDto.Name);
|
||||||
|
taskSchedulerDto.LastExecution = job?.LastExecution;
|
||||||
|
taskSchedulerDto.NextExecution = job?.NextExecution;
|
||||||
|
|
||||||
|
return Ok(taskSchedulerDto);
|
||||||
|
}
|
||||||
|
|
||||||
private RecurringJobDto? GetJob(string jobId)
|
private RecurringJobDto? GetJob(string jobId)
|
||||||
{
|
{
|
||||||
using IStorageConnection? connection = jobStorage.GetConnection();
|
using IStorageConnection? connection = jobStorage.GetConnection();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using FaKrosnoApi.Services;
|
using FaKrosnoApi.Services;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace FaKrosnoApi.Controllers;
|
namespace FaKrosnoApi.Controllers;
|
||||||
|
|||||||
@@ -51,13 +51,11 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
|||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|
||||||
// Konfiguracja NSwag z obsługą Bearer Token
|
|
||||||
builder.Services.AddOpenApiDocument(config =>
|
builder.Services.AddOpenApiDocument(config =>
|
||||||
{
|
{
|
||||||
config.Title = "FaKrosnoApi";
|
config.Title = "FaKrosnoApi";
|
||||||
config.Version = "v1";
|
config.Version = "v1";
|
||||||
|
|
||||||
// Dodaj definicję zabezpieczeń Bearer Token
|
|
||||||
config.AddSecurity("Bearer", new OpenApiSecurityScheme
|
config.AddSecurity("Bearer", new OpenApiSecurityScheme
|
||||||
{
|
{
|
||||||
Name = "Authorization",
|
Name = "Authorization",
|
||||||
@@ -68,23 +66,22 @@ builder.Services.AddOpenApiDocument(config =>
|
|||||||
Description = "Wprowadź token JWT w formacie: Bearer {token}"
|
Description = "Wprowadź token JWT w formacie: Bearer {token}"
|
||||||
});
|
});
|
||||||
|
|
||||||
// Zastosuj zabezpieczenia globalnie
|
|
||||||
config.OperationProcessors.Add(new OperationSecurityScopeProcessor("Bearer"));
|
config.OperationProcessors.Add(new OperationSecurityScopeProcessor("Bearer"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// builder.Services.AddHangfire(config => config
|
builder.Services.AddHangfire(config => config
|
||||||
// .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
||||||
// .UseSimpleAssemblyNameTypeSerializer()
|
.UseSimpleAssemblyNameTypeSerializer()
|
||||||
// .UseRecommendedSerializerSettings()
|
.UseRecommendedSerializerSettings()
|
||||||
// .UseSqlServerStorage(builder.Configuration.GetConnectionString("OrdersManagementConnection"), new SqlServerStorageOptions
|
.UseSqlServerStorage(builder.Configuration.GetConnectionString("OrdersManagementConnection"), new SqlServerStorageOptions
|
||||||
// {
|
{
|
||||||
// CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
|
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
|
||||||
// SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
|
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
|
||||||
// QueuePollInterval = TimeSpan.Zero,
|
QueuePollInterval = TimeSpan.Zero,
|
||||||
// UseRecommendedIsolationLevel = true,
|
UseRecommendedIsolationLevel = true,
|
||||||
// DisableGlobalLocks = true
|
DisableGlobalLocks = true
|
||||||
// }));
|
}));
|
||||||
// builder.Services.AddHangfireServer();
|
builder.Services.AddHangfireServer();
|
||||||
|
|
||||||
builder.Services.AddAutoMapper(typeof(FaKrosnoMappingProfile), typeof(SytelineSaAppMappingProfile),
|
builder.Services.AddAutoMapper(typeof(FaKrosnoMappingProfile), typeof(SytelineSaAppMappingProfile),
|
||||||
typeof(OrdersManagementMappingProfile));
|
typeof(OrdersManagementMappingProfile));
|
||||||
@@ -116,6 +113,6 @@ app.UseAuthorization();
|
|||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|
||||||
// app.UseHangfireDashboard();
|
app.UseHangfireDashboard();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"FaKrosnoConnection": "Server=192.168.0.7;Database=fakrosno;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
"FaKrosnoConnection": "Server=192.168.0.7;Database=fakrosnotest;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
||||||
"SytelineSaAppConnection": "Server=192.168.0.7;Database=SL_PROD_SA_APP;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
"SytelineSaAppConnection": "Server=192.168.0.7;Database=SL_PRODTEST_SA_APP;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
||||||
"OrdersManagementConnection": "Server=192.168.0.7;Database=OrdersManagement;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true"
|
"OrdersManagementConnection": "Server=192.168.0.7;Database=OrdersManagement;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@using Microsoft.AspNetCore.Components.Authorization
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
@using OrdersManagement.Components.Layout
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
@@ -18,7 +19,22 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<Routes @rendermode="@InteractiveServer" />
|
<Routes @rendermode="@InteractiveServer" />
|
||||||
|
<CascadingAuthenticationState>
|
||||||
|
<Router AppAssembly="@typeof(App).Assembly">
|
||||||
|
<Found Context="routeData">
|
||||||
|
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
||||||
|
<NotAuthorized>
|
||||||
|
<h3>Brak autoryzacji</h3>
|
||||||
|
<p><a href="/login">Zaloguj się</a></p>
|
||||||
|
</NotAuthorized>
|
||||||
|
</AuthorizeRouteView>
|
||||||
|
</Found>
|
||||||
|
<NotFound>
|
||||||
|
<p>Strona nie znaleziona.</p>
|
||||||
|
</NotFound>
|
||||||
|
</Router>
|
||||||
|
</CascadingAuthenticationState>
|
||||||
<script src="_framework/blazor.web.js"></script>
|
<script src="_framework/blazor.web.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|||||||
@@ -1,50 +1,87 @@
|
|||||||
@using Syncfusion.Blazor.Navigations
|
@inherits LayoutComponentBase
|
||||||
@using Syncfusion.Blazor.SplitButtons
|
|
||||||
@using Orientation = Syncfusion.Blazor.Navigations.Orientation
|
|
||||||
@inject NavigationManager NavigationManager
|
|
||||||
@inherits LayoutComponentBase
|
|
||||||
|
|
||||||
<div class="page h-100">
|
@using System.Security.Claims
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
@using Syncfusion.Blazor.Navigations
|
||||||
|
@using static Syncfusion.Blazor.Navigations.Orientation
|
||||||
|
@using Syncfusion.Blazor.Buttons
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider AuthenticationStateProvider
|
||||||
|
|
||||||
|
<div class="page h-100 d-flex flex-column">
|
||||||
<main class="container-fluid d-flex flex-column h-100">
|
<main class="container-fluid d-flex flex-column h-100">
|
||||||
<div class="bb-top-row px-4 d-flex justify-content-between align-items-center mb-3">
|
<div class="bb-top-row px-4 d-flex justify-content-between align-items-center mb-3 shadow-sm"
|
||||||
|
style="background-color: #f8f9fa;">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<img src="logo.svg" class="me-2" width="35" height="35" alt="Icon">
|
<img src="logo.svg" class="me-2" width="35" height="35" alt="Icon">
|
||||||
<span>FA Krosno Manager</span>
|
<h3 class="text-primary m-0">FA Krosno Manager</h3>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
@if (IsAuthenticated)
|
||||||
|
{
|
||||||
|
<span class="me-2">Jesteś zalogowany jako <strong>@UserName</strong></span>
|
||||||
|
<SfButton CssClass="e-primary" IsPrimary="true" @onclick="Logout">Wyloguj</SfButton>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<a href="/login" class="text-muted">Zaloguj</a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row gx-1 flex-grow-1">
|
<div class="row gx-1 flex-grow-1">
|
||||||
<div class="col-auto custom-menu-width mb-3">
|
<div class="col-auto custom-menu-width">
|
||||||
<SfMenu HamburgerMode="true" Title="FA Krosno Manager" Items="@MenuItems"
|
<SfMenu TValue="MenuItem" HamburgerMode="true" Orientation="Vertical" Title="Menu">
|
||||||
Orientation="Orientation.Vertical" CssClass="custom-menu">
|
<MenuItems>
|
||||||
<MenuEvents TValue="MenuItem" ItemSelected="OnMenuItemSelected"></MenuEvents>
|
<MenuItem Text="Zamówienia DELFOR" Url="/ScheduleOrders" IconCss="fa-solid fa-landmark"></MenuItem>
|
||||||
<MenuFieldSettings Text="Text" Children="Children"></MenuFieldSettings>
|
<MenuItem Text="Zamówienia klienta EDI" Url="/EdiCustomerOrders" IconCss="fa-solid fa-list-check"></MenuItem>
|
||||||
|
<MenuItem Text="Zamówienia klienta" Url="/CustomerOrders" IconCss="fa-solid fa-database"></MenuItem>
|
||||||
|
@if (UserName == "pkus")
|
||||||
|
{
|
||||||
|
<MenuItem Text="Admin" IconCss="fa-solid fa-screwdriver-wrench">
|
||||||
|
<MenuItems>
|
||||||
|
<MenuItem Text = "Użytkownicy" Url = "/Admin/UsersManager" IconCss="fa-solid fa-user-tie"></MenuItem>
|
||||||
|
<MenuItem Text= "Scheduler" Url = "/Admin/Scheduler" IconCss="fa-solid fa-calendar-week"></MenuItem>
|
||||||
|
</MenuItems>
|
||||||
|
</MenuItem>
|
||||||
|
}
|
||||||
|
</MenuItems>
|
||||||
|
<MenuAnimationSettings Effect="MenuEffect.SlideDown" Duration="800"></MenuAnimationSettings>
|
||||||
</SfMenu>
|
</SfMenu>
|
||||||
</div>
|
</div>
|
||||||
<article class="content col d-flex flex-column">
|
<article class="content col d-flex flex-column">
|
||||||
<div class="py-2 flex-grow-1">@Body</div>
|
<div class="py-2 flex-grow-1">@Body</div>
|
||||||
|
<footer class="text-center text-muted py-2">
|
||||||
|
<small>FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<MenuItem> MenuItems { get; set; } = new();
|
private bool IsAuthenticated { get; set; }
|
||||||
|
private string UserName { get; set; } = string.Empty;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
MenuItems = new List<MenuItem>
|
ClaimsPrincipal currentUser = AuthenticationStateProvider.GetCurrentUser();
|
||||||
{
|
IsAuthenticated = currentUser.Identity?.IsAuthenticated == true;
|
||||||
new() { Text = "Zamówienia DELFOR", Url = "/ScheduleOrders", IconCss = "fa-solid fa-landmark" },
|
UserName = currentUser.Identity?.Name ?? "Nieznany użytkownik";
|
||||||
new() { Text = "Zamówienia klienta EDI", Url = "/EdiCustomerOrders", IconCss = "fa-solid fa-list-check" },
|
|
||||||
new() { Text = "Zamówienia klienta", Url = "/CustomerOrders", IconCss = "fa-solid fa-database" }
|
AuthenticationStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMenuItemSelected(MenuEventArgs<MenuItem> args)
|
private async void OnAuthenticationStateChanged(Task<AuthenticationState> task)
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo(args.Item.Url);
|
var authState = await task;
|
||||||
|
IsAuthenticated = authState.User.Identity?.IsAuthenticated ?? false;
|
||||||
|
UserName = IsAuthenticated ? authState.User.Identity?.Name ?? "Nieznany użytkownik" : string.Empty;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Logout()
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
<div class="top-row ps-3 navbar navbar-dark">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="">OrdersManagement</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
|
|
||||||
|
|
||||||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
|
|
||||||
<nav class="flex-column">
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
|
||||||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="counter">
|
|
||||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="weather">
|
|
||||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
.navbar-toggler {
|
|
||||||
appearance: none;
|
|
||||||
cursor: pointer;
|
|
||||||
width: 3.5rem;
|
|
||||||
height: 2.5rem;
|
|
||||||
color: white;
|
|
||||||
position: absolute;
|
|
||||||
top: 0.5rem;
|
|
||||||
right: 1rem;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-toggler:checked {
|
|
||||||
background-color: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row {
|
|
||||||
height: 3.5rem;
|
|
||||||
background-color: rgba(0,0,0,0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bi {
|
|
||||||
display: inline-block;
|
|
||||||
position: relative;
|
|
||||||
width: 1.25rem;
|
|
||||||
height: 1.25rem;
|
|
||||||
margin-right: 0.75rem;
|
|
||||||
top: -1px;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bi-house-door-fill-nav-menu {
|
|
||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
|
|
||||||
}
|
|
||||||
|
|
||||||
.bi-plus-square-fill-nav-menu {
|
|
||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
|
|
||||||
}
|
|
||||||
|
|
||||||
.bi-list-nested-nav-menu {
|
|
||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item:first-of-type {
|
|
||||||
padding-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item:last-of-type {
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item ::deep .nav-link {
|
|
||||||
color: #d7d7d7;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
height: 3rem;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
line-height: 3rem;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item ::deep a.active {
|
|
||||||
background-color: rgba(255,255,255,0.37);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item ::deep .nav-link:hover {
|
|
||||||
background-color: rgba(255,255,255,0.1);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-scrollable {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-toggler:checked ~ .nav-scrollable {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 641px) {
|
|
||||||
.navbar-toggler {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-scrollable {
|
|
||||||
/* Never collapse the sidebar for wide screens */
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
/* Allow sidebar to scroll for tall menus */
|
|
||||||
height: calc(100vh - 3.5rem);
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +1,77 @@
|
|||||||
@page "/Admin/Scheduler"
|
@page "/Admin/Scheduler"
|
||||||
|
|
||||||
|
@attribute [Authorize]
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using OrdersManagementDataModel.Dtos
|
@using OrdersManagementDataModel.Dtos
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
@using Action = Syncfusion.Blazor.Grids.Action
|
@using Action = Syncfusion.Blazor.Grids.Action
|
||||||
@inject HangfireService HangfireService
|
@using Syncfusion.Blazor.Cards
|
||||||
|
|
||||||
<h3>Zarządzanie Zadaniami</h3>
|
@inject HangfireService HangfireService
|
||||||
<br />
|
@inject NavigationManager NavigationManager
|
||||||
<SfGrid DataSource="@Tasks" AllowPaging="true" ShowColumnMenu="true" Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field=@nameof(TaskSchedulerDto.RowPointer.ToString) IsPrimaryKey="true" HeaderText="Id"></GridColumn>
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<GridColumn Field=@nameof(TaskSchedulerDto.Name) HeaderText="Nazwa"></GridColumn>
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
<GridColumn Field=@nameof(TaskSchedulerDto.Path) HeaderText="Ścieżka"></GridColumn>
|
<CardHeader>
|
||||||
<GridColumn Field=@nameof(TaskSchedulerDto.CronOptions) HeaderText="CRON"></GridColumn>
|
<h3 class="text-primary">Zarządzanie Zadaniami</h3>
|
||||||
<GridColumn Field=@nameof(TaskSchedulerDto.LastExecution) HeaderText="Ostatnie Uruchomienie"></GridColumn>
|
</CardHeader>
|
||||||
<GridColumn Field=@nameof(TaskSchedulerDto.NextExecution) HeaderText="Następne Uruchomienie"></GridColumn>
|
<CardContent>
|
||||||
</GridColumns>
|
<SfGrid DataSource="@Tasks"
|
||||||
<GridEditSettings AllowDeleting="true" ShowDeleteConfirmDialog="true" AllowAdding="true" NewRowPosition="NewRowPosition.Bottom" AllowEditing="true"></GridEditSettings>
|
AllowPaging="true"
|
||||||
<GridEvents OnActionBegin="OnActionBegin" TValue="TaskSchedulerDto" OnActionComplete="OnActionComplete"></GridEvents>
|
ShowColumnMenu="true"
|
||||||
</SfGrid>
|
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field=@nameof(TaskSchedulerDto.RowPointer) AllowEditing="false" IsPrimaryKey="true" HeaderText="Id"
|
||||||
|
Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(TaskSchedulerDto.Name) HeaderText="Nazwa" Width="150"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(TaskSchedulerDto.Path) HeaderText="Ścieżka" Width="200"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(TaskSchedulerDto.CronOptions) HeaderText="CRON" Width="120"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(TaskSchedulerDto.LastExecution) AllowEditing="false" HeaderText="Ostatnie Uruchomienie"
|
||||||
|
Width="150"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(TaskSchedulerDto.NextExecution) AllowEditing="false" HeaderText="Następne Uruchomienie"
|
||||||
|
Width="150"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridEditSettings AllowDeleting="true"
|
||||||
|
ShowDeleteConfirmDialog="true"
|
||||||
|
AllowAdding="true"
|
||||||
|
NewRowPosition="NewRowPosition.Bottom"
|
||||||
|
AllowEditing="true">
|
||||||
|
</GridEditSettings>
|
||||||
|
<GridEvents OnActionBegin="OnActionBegin"
|
||||||
|
OnActionComplete="OnActionComplete"
|
||||||
|
TValue="TaskSchedulerDto">
|
||||||
|
</GridEvents>
|
||||||
|
<GridPageSettings PageSize="10"></GridPageSettings>
|
||||||
|
</SfGrid>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
|
</SfCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<TaskSchedulerDto> Tasks { get; set; } = new();
|
private List<TaskSchedulerDto> Tasks { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
await LoadTasks();
|
if (firstRender)
|
||||||
|
{
|
||||||
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
|
if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await LoadTasks();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnActionBegin(ActionEventArgs<TaskSchedulerDto> args)
|
public async Task OnActionBegin(ActionEventArgs<TaskSchedulerDto> args)
|
||||||
@@ -65,4 +112,5 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
@page "/admin/UsersManager"
|
|
||||||
|
|
||||||
@using OrdersManagementDataModel.Dtos
|
|
||||||
@using Syncfusion.Blazor.Grids
|
|
||||||
@using Action = Syncfusion.Blazor.Grids.Action
|
|
||||||
@using UserService = OrdersManagement.Services.UserService
|
|
||||||
@inject UserService UserService
|
|
||||||
@inject RoleService RoleService
|
|
||||||
@inject FunctionService FunctionService
|
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
|
||||||
<h5>Użytkownicy</h5>
|
|
||||||
<SfGrid DataSource="@UserList" AllowPaging="true" ShowColumnMenu="true"
|
|
||||||
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field="@nameof(UserDto.Id)" IsPrimaryKey="true" HeaderText="ID" Width="70"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(UserDto.Login)" HeaderText="Login" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(UserDto.Email)" HeaderText="Email" Width="150"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(UserDto.FirstName)" HeaderText="Imię" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(UserDto.LastName)" HeaderText="Nazwisko" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(UserDto.IsActive)" HeaderText="Aktywny" Width="80"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(UserDto.CreatedDate)" HeaderText="Utworzono" Format="d" Width="120"></GridColumn>
|
|
||||||
</GridColumns>
|
|
||||||
<GridEditSettings AllowDeleting="true" ShowDeleteConfirmDialog="true" AllowAdding="true" NewRowPosition="NewRowPosition.Bottom" AllowEditing="true"></GridEditSettings>
|
|
||||||
<GridEvents OnActionBegin="UserActionBegin" OnActionComplete="UserActionComplete" TValue="UserDto"></GridEvents>
|
|
||||||
</SfGrid>§
|
|
||||||
<br/>
|
|
||||||
<h5>Role</h5>
|
|
||||||
<SfGrid DataSource="@Roles" AllowPaging="true" ShowColumnMenu="true"
|
|
||||||
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field="@nameof(RoleDto.Id)" IsPrimaryKey="true" HeaderText="ID" Width="70"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(RoleDto.Name)" HeaderText="Nazwa" Width="150"></GridColumn>
|
|
||||||
</GridColumns>
|
|
||||||
<GridEditSettings AllowDeleting="true" ShowDeleteConfirmDialog="true" AllowAdding="true" AllowEditing="true"
|
|
||||||
Mode="EditMode.Normal"></GridEditSettings>
|
|
||||||
<GridEvents OnActionBegin="RoleActionBegin" OnActionComplete="RoleActionComplete" TValue="RoleDto"></GridEvents>
|
|
||||||
</SfGrid>
|
|
||||||
<br/>
|
|
||||||
<h5>Funkcje</h5>
|
|
||||||
<SfGrid DataSource="@Functions" AllowPaging="true" ShowColumnMenu="true"
|
|
||||||
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field="@nameof(FunctionDto.Id)" IsPrimaryKey="true" HeaderText="ID" Width="70"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(FunctionDto.RoleId)" HeaderText="ID Roli" Width="70"></GridColumn>
|
|
||||||
<GridColumn Field="@nameof(FunctionDto.Name)" HeaderText="Nazwa Funkcji" Width="200"></GridColumn>
|
|
||||||
</GridColumns>
|
|
||||||
<GridEditSettings AllowDeleting="true" ShowDeleteConfirmDialog="true" AllowAdding="true" AllowEditing="true"
|
|
||||||
Mode="EditMode.Normal"></GridEditSettings>
|
|
||||||
<GridEvents OnActionBegin="FunctionActionBegin" OnActionComplete="FunctionActionComplete"
|
|
||||||
TValue="FunctionDto"></GridEvents>
|
|
||||||
</SfGrid>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private List<UserDto> UserList { get; set; } = new();
|
|
||||||
private List<RoleDto> Roles { get; set; } = new();
|
|
||||||
private List<FunctionDto> Functions { get; set; } = new();
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
await LoadUsers();
|
|
||||||
await LoadRoles();
|
|
||||||
await LoadFunctions();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadUsers()
|
|
||||||
{
|
|
||||||
UserList = (await UserService.GetUsersAsync() ?? Array.Empty<UserDto>()).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadRoles()
|
|
||||||
{
|
|
||||||
Roles = (await RoleService.GetRolesAsync() ?? Array.Empty<RoleDto>()).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadFunctions()
|
|
||||||
{
|
|
||||||
Functions = (await FunctionService.GetFunctionsAsync() ?? Array.Empty<FunctionDto>()).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UserActionBegin(ActionEventArgs<UserDto> args)
|
|
||||||
{
|
|
||||||
if (args.RequestType.Equals(Action.Delete))
|
|
||||||
{
|
|
||||||
await UserService.DeleteUserAsync(args.Data.RowPointer);
|
|
||||||
}
|
|
||||||
else if (args.RequestType.Equals(Action.Add))
|
|
||||||
{
|
|
||||||
args.Data.RowPointer = Guid.NewGuid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UserActionComplete(ActionEventArgs<UserDto> args)
|
|
||||||
{
|
|
||||||
switch (args.RequestType)
|
|
||||||
{
|
|
||||||
case Action.Delete:
|
|
||||||
await LoadUsers();
|
|
||||||
break;
|
|
||||||
case Action.Add:
|
|
||||||
await UserService.AddUserAsync(args.Data);
|
|
||||||
await LoadUsers();
|
|
||||||
break;
|
|
||||||
case Action.Save:
|
|
||||||
await UserService.UpdateUserAsync(args.Data);
|
|
||||||
await LoadUsers();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task RoleActionBegin(ActionEventArgs<RoleDto> args)
|
|
||||||
{
|
|
||||||
if (args.RequestType.Equals(Action.Delete))
|
|
||||||
{
|
|
||||||
await RoleService.DeleteRoleAsync(args.Data.RowPointer);
|
|
||||||
}
|
|
||||||
else if (args.RequestType.Equals(Action.Add))
|
|
||||||
{
|
|
||||||
args.Data.RowPointer = Guid.NewGuid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task RoleActionComplete(ActionEventArgs<RoleDto> args)
|
|
||||||
{
|
|
||||||
switch (args.RequestType)
|
|
||||||
{
|
|
||||||
case Action.Delete:
|
|
||||||
await LoadRoles();
|
|
||||||
break;
|
|
||||||
case Action.Add:
|
|
||||||
await RoleService.AddRoleAsync(args.Data);
|
|
||||||
await LoadRoles();
|
|
||||||
break;
|
|
||||||
case Action.Save:
|
|
||||||
await RoleService.UpdateRoleAsync(args.Data);
|
|
||||||
await LoadRoles();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task FunctionActionBegin(ActionEventArgs<FunctionDto> args)
|
|
||||||
{
|
|
||||||
if (args.RequestType.Equals(Action.Delete))
|
|
||||||
{
|
|
||||||
await FunctionService.DeleteFunctionAsync(args.Data.RowPointer);
|
|
||||||
}
|
|
||||||
else if (args.RequestType.Equals(Action.Add))
|
|
||||||
{
|
|
||||||
args.Data.RowPointer = Guid.NewGuid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task FunctionActionComplete(ActionEventArgs<FunctionDto> args)
|
|
||||||
{
|
|
||||||
switch (args.RequestType)
|
|
||||||
{
|
|
||||||
case Action.Delete:
|
|
||||||
await LoadFunctions();
|
|
||||||
break;
|
|
||||||
case Action.Add:
|
|
||||||
await FunctionService.AddFunctionAsync(args.Data);
|
|
||||||
await LoadFunctions();
|
|
||||||
break;
|
|
||||||
case Action.Save:
|
|
||||||
await FunctionService.UpdateFunctionAsync(args.Data);
|
|
||||||
await LoadFunctions();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
298
OrdersManagement/Components/Pages/Admin/UsersManager.razor
Normal file
298
OrdersManagement/Components/Pages/Admin/UsersManager.razor
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
@page "/admin/UsersManager"
|
||||||
|
|
||||||
|
@attribute [Authorize]
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using OrdersManagementDataModel.Dtos
|
||||||
|
@using Syncfusion.Blazor.Grids
|
||||||
|
@using Action = Syncfusion.Blazor.Grids.Action
|
||||||
|
@using UserService = OrdersManagement.Services.UserService
|
||||||
|
@using Syncfusion.Blazor.Cards
|
||||||
|
@using Syncfusion.Blazor.Popups
|
||||||
|
@using Syncfusion.Blazor.Buttons
|
||||||
|
@inject UserService UserService
|
||||||
|
@inject RoleService RoleService
|
||||||
|
@inject FunctionService FunctionService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
|
||||||
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
|
<CardHeader>
|
||||||
|
<h3 class="text-primary">Zarządzanie Użytkownikami i Rolami</h3>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<h5 class="text-primary mb-3">Użytkownicy</h5>
|
||||||
|
<SfGrid DataSource="@UserList"
|
||||||
|
AllowPaging="true"
|
||||||
|
ShowColumnMenu="true"
|
||||||
|
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field="@nameof(UserDto.RowPointer)" AllowEditing="false" IsPrimaryKey="true" HeaderText="ID" Width="70"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(UserDto.Login)" HeaderText="Login" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(UserDto.Email)" HeaderText="Email" Width="150"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(UserDto.FirstName)" HeaderText="Imię" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(UserDto.LastName)" HeaderText="Nazwisko" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(UserDto.IsActive)" HeaderText="Aktywny" Width="80"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(UserDto.CreatedDate)" AllowEditing="false" HeaderText="Utworzono" Format="d" Width="120"></GridColumn>
|
||||||
|
<GridColumn HeaderText="" Width="100">
|
||||||
|
<Template>
|
||||||
|
@{
|
||||||
|
var user = (context as UserDto);
|
||||||
|
<SfButton CssClass="e-small e-primary" @onclick="() => ResetPassword(user)">Zresetuj haslo</SfButton>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
</GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridEditSettings AllowDeleting="true"
|
||||||
|
ShowDeleteConfirmDialog="true"
|
||||||
|
AllowAdding="true"
|
||||||
|
NewRowPosition="NewRowPosition.Bottom"
|
||||||
|
AllowEditing="true">
|
||||||
|
</GridEditSettings>
|
||||||
|
<GridEvents OnActionBegin="UserActionBegin"
|
||||||
|
OnActionComplete="UserActionComplete"
|
||||||
|
TValue="UserDto">
|
||||||
|
</GridEvents>
|
||||||
|
<GridPageSettings PageSize="10"></GridPageSettings>
|
||||||
|
</SfGrid>
|
||||||
|
|
||||||
|
<h5 class="text-primary mb-3 mt-4">Role</h5>
|
||||||
|
<SfGrid DataSource="@Roles"
|
||||||
|
AllowPaging="true"
|
||||||
|
ShowColumnMenu="true"
|
||||||
|
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field="@nameof(RoleDto.Id)" IsPrimaryKey="true" HeaderText="ID" Width="70"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(RoleDto.Name)" HeaderText="Nazwa" Width="150"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridEditSettings AllowDeleting="true"
|
||||||
|
ShowDeleteConfirmDialog="true"
|
||||||
|
AllowAdding="true"
|
||||||
|
AllowEditing="true"
|
||||||
|
Mode="EditMode.Normal">
|
||||||
|
</GridEditSettings>
|
||||||
|
<GridEvents OnActionBegin="RoleActionBegin"
|
||||||
|
OnActionComplete="RoleActionComplete"
|
||||||
|
TValue="RoleDto">
|
||||||
|
</GridEvents>
|
||||||
|
<GridPageSettings PageSize="10"></GridPageSettings>
|
||||||
|
</SfGrid>
|
||||||
|
|
||||||
|
<h5 class="text-primary mb-3 mt-4">Funkcje</h5>
|
||||||
|
<SfGrid DataSource="@Functions"
|
||||||
|
AllowPaging="true"
|
||||||
|
ShowColumnMenu="true"
|
||||||
|
Toolbar="@(new List<string> { "Add", "Edit", "Delete", "Cancel", "Update" })">
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field="@nameof(FunctionDto.Id)" IsPrimaryKey="true" HeaderText="ID" Width="70"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(FunctionDto.RoleId)" HeaderText="ID Roli" Width="70"></GridColumn>
|
||||||
|
<GridColumn Field="@nameof(FunctionDto.Name)" HeaderText="Nazwa Funkcji" Width="200"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridEditSettings AllowDeleting="true"
|
||||||
|
ShowDeleteConfirmDialog="true"
|
||||||
|
AllowAdding="true"
|
||||||
|
AllowEditing="true"
|
||||||
|
Mode="EditMode.Normal">
|
||||||
|
</GridEditSettings>
|
||||||
|
<GridEvents OnActionBegin="FunctionActionBegin"
|
||||||
|
OnActionComplete="FunctionActionComplete"
|
||||||
|
TValue="FunctionDto">
|
||||||
|
</GridEvents>
|
||||||
|
<GridPageSettings PageSize="10"></GridPageSettings>
|
||||||
|
</SfGrid>
|
||||||
|
|
||||||
|
<SfDialog Width="500px" Title="Dodano użytkownika!" IsModal="true" @bind-Visible="Visibility" AllowPrerender="true">
|
||||||
|
<DialogTemplates>
|
||||||
|
<Content>
|
||||||
|
<p>Użytkownik <strong>@Login</strong> został dodany pomyślnie!</p>
|
||||||
|
<p>Hasło tymczasowe: <strong>@TempPassword</strong></p>
|
||||||
|
</Content>
|
||||||
|
</DialogTemplates>
|
||||||
|
<DialogButtons>
|
||||||
|
<DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/>
|
||||||
|
</DialogButtons>
|
||||||
|
</SfDialog>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
|
</SfCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<UserDto> UserList { get; set; } = new();
|
||||||
|
private List<RoleDto> Roles { get; set; } = new();
|
||||||
|
private List<FunctionDto> Functions { get; set; } = new();
|
||||||
|
|
||||||
|
private bool Visibility { get; set; }
|
||||||
|
|
||||||
|
private string Login { get; set; } = string.Empty;
|
||||||
|
private string TempPassword { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
Visibility = false;
|
||||||
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
|
if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await LoadUsers();
|
||||||
|
await LoadRoles();
|
||||||
|
//await LoadFunctions();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadUsers()
|
||||||
|
{
|
||||||
|
UserList = (await UserService.GetUsersAsync() ?? Array.Empty<UserDto>()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadRoles()
|
||||||
|
{
|
||||||
|
Roles = (await RoleService.GetRolesAsync() ?? Array.Empty<RoleDto>()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadFunctions()
|
||||||
|
{
|
||||||
|
Functions = (await FunctionService.GetFunctionsAsync() ?? Array.Empty<FunctionDto>()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ResetPassword(UserDto? user)
|
||||||
|
{
|
||||||
|
if(user == null) return;
|
||||||
|
|
||||||
|
TempPassword = Guid.NewGuid().ToString().Substring(0, 8);
|
||||||
|
Login = user.Login;
|
||||||
|
|
||||||
|
string passwordHash = BCrypt.Net.BCrypt.HashPassword(TempPassword);
|
||||||
|
|
||||||
|
user.PasswordHash = passwordHash;
|
||||||
|
user.IsTemporaryPassword = true;
|
||||||
|
|
||||||
|
await UserService.UpdateUserAsync(user);
|
||||||
|
await LoadUsers();
|
||||||
|
|
||||||
|
Visibility = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UserActionBegin(ActionEventArgs<UserDto> args)
|
||||||
|
{
|
||||||
|
switch (args.RequestType)
|
||||||
|
{
|
||||||
|
case Action.Delete:
|
||||||
|
await UserService.DeleteUserAsync(args.Data.RowPointer);
|
||||||
|
break;
|
||||||
|
case Action.Add:
|
||||||
|
args.Data.RowPointer = Guid.NewGuid();
|
||||||
|
args.Data.CreatedDate = DateTime.Now;
|
||||||
|
args.Data.IsActive = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UserActionComplete(ActionEventArgs<UserDto> args)
|
||||||
|
{
|
||||||
|
switch (args.RequestType)
|
||||||
|
{
|
||||||
|
case Action.Delete:
|
||||||
|
await LoadUsers();
|
||||||
|
break;
|
||||||
|
case Action.Save when args.Data.Id == 0:
|
||||||
|
UserDto? user = args.Data;
|
||||||
|
TempPassword = Guid.NewGuid().ToString().Substring(0, 8);
|
||||||
|
Login = user.Login;
|
||||||
|
|
||||||
|
string? passwordHash = BCrypt.Net.BCrypt.HashPassword(TempPassword);
|
||||||
|
|
||||||
|
user.PasswordHash = passwordHash;
|
||||||
|
user.IsTemporaryPassword = true;
|
||||||
|
user.ActiveFrom = DateTime.Now;
|
||||||
|
user.CreatedDate = DateTime.Now;
|
||||||
|
|
||||||
|
await UserService.AddUserAsync(user);
|
||||||
|
await LoadUsers();
|
||||||
|
|
||||||
|
Visibility = true;
|
||||||
|
break;
|
||||||
|
case Action.Save when args.Data.Id != 0:
|
||||||
|
await UserService.UpdateUserAsync(args.Data);
|
||||||
|
await LoadUsers();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RoleActionBegin(ActionEventArgs<RoleDto> args)
|
||||||
|
{
|
||||||
|
if (args.RequestType.Equals(Action.Delete))
|
||||||
|
{
|
||||||
|
await RoleService.DeleteRoleAsync(args.Data.RowPointer);
|
||||||
|
}
|
||||||
|
else if (args.RequestType.Equals(Action.Add))
|
||||||
|
{
|
||||||
|
args.Data.RowPointer = Guid.NewGuid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RoleActionComplete(ActionEventArgs<RoleDto> args)
|
||||||
|
{
|
||||||
|
switch (args.RequestType)
|
||||||
|
{
|
||||||
|
case Action.Delete:
|
||||||
|
await LoadRoles();
|
||||||
|
break;
|
||||||
|
case Action.Save when args.Data.Id == 0:
|
||||||
|
await RoleService.AddRoleAsync(args.Data);
|
||||||
|
await LoadUsers();
|
||||||
|
break;
|
||||||
|
case Action.Save when args.Data.Id != 0:
|
||||||
|
await RoleService.UpdateRoleAsync(args.Data);
|
||||||
|
await LoadRoles();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task FunctionActionBegin(ActionEventArgs<FunctionDto> args)
|
||||||
|
{
|
||||||
|
if (args.RequestType.Equals(Action.Delete))
|
||||||
|
{
|
||||||
|
await FunctionService.DeleteFunctionAsync(args.Data.RowPointer);
|
||||||
|
}
|
||||||
|
else if (args.RequestType.Equals(Action.Add))
|
||||||
|
{
|
||||||
|
args.Data.RowPointer = Guid.NewGuid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task FunctionActionComplete(ActionEventArgs<FunctionDto> args)
|
||||||
|
{
|
||||||
|
switch (args.RequestType)
|
||||||
|
{
|
||||||
|
case Action.Delete:
|
||||||
|
await LoadFunctions();
|
||||||
|
break;
|
||||||
|
case Action.Save when args.Data.Id == 0:
|
||||||
|
await FunctionService.AddFunctionAsync(args.Data);
|
||||||
|
await LoadFunctions();
|
||||||
|
break;
|
||||||
|
case Action.Save when args.Data.Id != 0:
|
||||||
|
await FunctionService.UpdateFunctionAsync(args.Data);
|
||||||
|
await LoadFunctions();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideModal()
|
||||||
|
{
|
||||||
|
Visibility = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,204 +1,198 @@
|
|||||||
@page "/CustomerOrder/{CustomerOrderId:guid}"
|
@page "/CustomerOrder/{CustomerOrderId:guid}"
|
||||||
|
|
||||||
@rendermode InteractiveServer
|
@attribute [Authorize]
|
||||||
|
|
||||||
@inject CustomerOrderService CustomerOrderService
|
@inject CustomerOrderService CustomerOrderService
|
||||||
@inject ScheduleOrderService ScheduleOrderService
|
@inject ScheduleOrderService ScheduleOrderService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using SytelineSaAppEfDataModel.Dtos
|
@using SytelineSaAppEfDataModel.Dtos
|
||||||
@using OrdersManagement.Components.Pages.Shared
|
@using OrdersManagement.Components.Pages.Shared
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
@using Syncfusion.Blazor.Cards
|
@using Syncfusion.Blazor.Cards
|
||||||
|
@using Syncfusion.Blazor.Buttons
|
||||||
|
@using SelectionType = Syncfusion.Blazor.Grids.SelectionType
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<h5>Zamówienie klienta nr @CustomerOrderDto?.CoNum</h5>
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
<SfCard>
|
<CardHeader>
|
||||||
|
<h3 class="text-primary">Zamówienie klienta nr @(CustomerOrderDto?.CoNum ?? "Brak numeru")</h3>
|
||||||
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div class="row">
|
<SfCard CssClass="mb-4">
|
||||||
<div class="col">
|
<CardContent>
|
||||||
<u>Numer Zamówienia:</u> <b>@CustomerOrderDto?.CoNum</b><br/>
|
<div class="row">
|
||||||
<u>Numer Zamówienia Klienta:</u> <b>@CustomerOrderDto?.CustPo</b><br/>
|
<div class="col">
|
||||||
<u>Klient:</u> <b>@CustomerOrderDto?.CustNum</b><br/>
|
<u>Numer Zamówienia:</u> <b>@CustomerOrderDto?.CoNum</b><br/>
|
||||||
<u>Numer Odbiorcy:</u> <b>@CustomerOrderDto?.CustSeq</b><br/>
|
<u>Numer Zamówienia Klienta:</u> <b>@CustomerOrderDto?.CustPo</b><br/>
|
||||||
<u>Kontakt:</u> <b>@CustomerOrderDto?.Contact</b><br/>
|
<u>Klient:</u> <b>@CustomerOrderDto?.CustNum</b><br/>
|
||||||
<u>Telefon:</u> <b>@CustomerOrderDto?.Phone</b><br/>
|
<u>Numer Odbiorcy:</u> <b>@CustomerOrderDto?.CustSeq</b><br/>
|
||||||
<u>Data Zamówienia:</u> <b>@CustomerOrderDto?.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br/>
|
<u>Kontakt:</u> <b>@CustomerOrderDto?.Contact</b><br/>
|
||||||
<u>Warunki:</u> <b>@CustomerOrderDto?.TermsCode</b><br/>
|
<u>Telefon:</u> <b>@CustomerOrderDto?.Phone</b><br/>
|
||||||
<u>Wartość Brutto:</u> <b>@(CustomerOrderDto?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
<u>Data Zamówienia:</u> <b>@CustomerOrderDto?.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br/>
|
||||||
<u>Status:</u> <b>@CustomerOrderDto?.TranslatedStatus</b><br/>
|
<u>Warunki:</u> <b>@CustomerOrderDto?.TermsCode</b><br/>
|
||||||
</div>
|
<u>Wartość Brutto:</u> <b>@(CustomerOrderDto?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
<div class="col">
|
<u>Status:</u> <b>@CustomerOrderDto?.TranslatedStatus</b><br/>
|
||||||
<u>Magazyn:</u> <b>@CustomerOrderDto?.Whse</b><br/>
|
</div>
|
||||||
<u>VAT:</u> <b>@CustomerOrderDto?.FrtTaxCode1</b><br/>
|
<div class="col">
|
||||||
<u>Typ Odbiorcy:</u> <b>@CustomerOrderDto?.EndUserType</b><br/>
|
<u>Magazyn:</u> <b>@CustomerOrderDto?.Whse</b><br/>
|
||||||
<u>Kurs Wymiany:</u> <b>@(CustomerOrderDto?.ExchRate?.ToString("F4") ?? "N/A")</b><br/>
|
<u>VAT:</u> <b>@CustomerOrderDto?.FrtTaxCode1</b><br/>
|
||||||
<u>Gate:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_Gate</b><br/>
|
<u>Typ Odbiorcy:</u> <b>@CustomerOrderDto?.EndUserType</b><br/>
|
||||||
<u>RecipientCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_RecipientCode</b><br/>
|
<u>Kurs Wymiany:</u> <b>@(CustomerOrderDto?.ExchRate?.ToString("F4") ?? "N/A")</b><br/>
|
||||||
<u>SelletCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_SellerCode</b><br/>
|
<u>Gate:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_Gate</b><br/>
|
||||||
<u>SenderCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_SenderCode</b><br/>
|
<u>RecipientCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_RecipientCode</b><br/>
|
||||||
<u>BuyerCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_BuyerCode</b><br/>
|
<u>SellerCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_SellerCode</b><br/>
|
||||||
<u>Typ Dokumentu:</u> <b>@CustomerOrderDto?.Uf_DocType</b><br/>
|
<u>SenderCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_SenderCode</b><br/>
|
||||||
|
<u>BuyerCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_BuyerCode</b><br/>
|
||||||
|
<u>Typ Dokumentu:</u> <b>@CustomerOrderDto?.Uf_DocType</b><br/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</SfCard>
|
||||||
|
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<SfButton CssClass="e-primary" IsPrimary="true" @onclick="ShowLastDelfors">@_text</SfButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (_isVisible)
|
||||||
|
{
|
||||||
|
<h5 class="text-primary mb-3">Zamówienie DELFOR do zamówienia @(CustomerOrderDto?.CoNum ?? "Brak numeru")</h5>
|
||||||
|
<ScheduleOrdersGrid PageSize="5" PassGridRef="SetGridRef" GridData="_scheduleOrders" />
|
||||||
|
}
|
||||||
|
|
||||||
|
<h5 class="text-primary mb-3 pt-5">Indeksy</h5>
|
||||||
|
<SfGrid @ref="_customerOrderLinesGrid"
|
||||||
|
AllowFiltering="true"
|
||||||
|
AllowPaging="true"
|
||||||
|
AllowSorting="true"
|
||||||
|
AllowSelection="true"
|
||||||
|
TValue="CustomerOrderLineDto"
|
||||||
|
DataSource="@_customerOrderLines"
|
||||||
|
EnableAdaptiveUI="true">
|
||||||
|
<GridTemplates>
|
||||||
|
<DetailTemplate>
|
||||||
|
@{
|
||||||
|
var order = context as CustomerOrderLineDto;
|
||||||
|
<SfCard>
|
||||||
|
<CardContent>
|
||||||
|
<div class="row">
|
||||||
|
<h6>Szczegóły</h6>
|
||||||
|
<div class="col">
|
||||||
|
<u>Numer zamówienia:</u> <b>@order?.CoNum</b><br/>
|
||||||
|
<u>Linia:</u> <b>@order?.CoLine</b><br/>
|
||||||
|
<u>Pozycja:</u> <b>@order?.Item</b><br/>
|
||||||
|
<u>Pozycja Klienta:</u> <b>@order?.CustItem</b><br/>
|
||||||
|
<u>Opis:</u> <b>@order?.Description</b><br/>
|
||||||
|
<u>Łączna Ilość:</u> <b>@order?.BlanketQty.ToString("F2")</b><br/>
|
||||||
|
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<u>Cena:</u> <b>@(order?.ContPrice?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Ważne Od:</u> <b>@(order?.EffDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>J/M:</u> <b>@order?.UM</b><br/>
|
||||||
|
<u>BoxType:</u> <b>@order?.Uf_FKR_EDI_BLN_BoxType</b><br/>
|
||||||
|
<u>Address:</u> <b>@order?.Uf_FKR_EDI_BLN_Address</b><br/>
|
||||||
|
<u>FinalDestination:</u> <b>@order?.Uf_FKR_EDI_BLN_FinalDestination</b><br/>
|
||||||
|
<u>QtyPerBox:</u> <b>@(order?.Uf_FKR_EDI_BLN_QtyPerBox?.ToString() ?? "N/A")</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</SfCard>
|
||||||
|
}
|
||||||
|
</DetailTemplate>
|
||||||
|
</GridTemplates>
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.CoLine) HeaderText="Linia" Width="70"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.Item) HeaderText="Pozycja" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.CustItem) HeaderText="Pozycja Klienta" Width="120"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.Description) HeaderText="Opis" Width="200"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.BlanketQty) HeaderText="Ilość" TextAlign="TextAlign.Right" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.UM) HeaderText="J/M" Width="50"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.ContPrice) HeaderText="Cena" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(CustomerOrderLineDto.TranslatedStatus) HeaderText="Status" Width="100"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
|
<GridEvents TValue="CustomerOrderLineDto" RowSelected="OnSelectedLineRow"></GridEvents>
|
||||||
|
</SfGrid>
|
||||||
|
|
||||||
|
@if (_isVisibleCustomerOrderLine)
|
||||||
|
{
|
||||||
|
<h5 class="text-primary mb-3 mt-4">Harmonogramy</h5>
|
||||||
|
<SfGrid @ref="_customerOrderLineItemsGrid"
|
||||||
|
TValue="CustomerOrderLineItemDto"
|
||||||
|
DataSource="@_customerOrderLineItems"
|
||||||
|
AllowFiltering="true"
|
||||||
|
AllowPaging="true"
|
||||||
|
AllowSelection="true"
|
||||||
|
AllowSorting="true"
|
||||||
|
SelectionMode="Syncfusion.Blazor.Grids.SelectionMode.Single"
|
||||||
|
SelectedItemsChanged="SelectedCustomerOrderLineItemChanged">
|
||||||
|
<GridTemplates>
|
||||||
|
<DetailTemplate>
|
||||||
|
@{
|
||||||
|
var detailLineItem = context as CustomerOrderLineItemDto;
|
||||||
|
<SfCard>
|
||||||
|
<CardContent>
|
||||||
|
<div class="row">
|
||||||
|
<h6>Szczegóły</h6>
|
||||||
|
<div class="col">
|
||||||
|
<u>Numer Zamówienia:</u> <b>@detailLineItem?.CoNum</b><br/>
|
||||||
|
<u>Linia:</u> <b>@detailLineItem?.CoLine</b><br/>
|
||||||
|
<u>Zwolnienie:</u> <b>@detailLineItem?.CoRelease</b><br/>
|
||||||
|
<u>Pozycja:</u> <b>@detailLineItem?.Item</b><br/>
|
||||||
|
<u>Pozycja Klienta:</u> <b>@detailLineItem?.CustItem</b><br/>
|
||||||
|
<u>Łączna Ilość Sztuk:</u> <b>@(detailLineItem?.QtyOrdered.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Cena:</u> <b>@(detailLineItem?.Price.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Data Wykonania:</u> <b>@(detailLineItem?.DueDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>Data Rejestracji:</u> <b>@(detailLineItem?.ReleaseDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>Magazyn:</u> <b>@detailLineItem?.Whse</b><br/>
|
||||||
|
<u>Typ Documentu:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_DocumentType</b><br/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<u>Kod VAT:</u> <b>@detailLineItem?.TaxCode1</b><br/>
|
||||||
|
<u>J/M:</u> <b>@detailLineItem?.UM</b><br/>
|
||||||
|
<u>Numer Klienta:</u> <b>@detailLineItem?.CoCustNum</b><br/>
|
||||||
|
<u>Opis:</u> <b>@detailLineItem?.Description</b><br/>
|
||||||
|
<u>Status:</u> <b>@detailLineItem?.TranslatedStatus</b><br/>
|
||||||
|
<u>RoutingCode:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_RoutingCode</b><br/>
|
||||||
|
<u>DeliveryCallNumber:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_DeliveryCallNum</b><br/>
|
||||||
|
<u>UnloadingPoint:</u> <b>@detailLineItem?.Uf_LOC_11_UnloadingPoint</b><br/>
|
||||||
|
<u>DestinationPoint:</u> <b>@detailLineItem?.Uf_LOC_159_DestinationPoint</b><br/>
|
||||||
|
<u>PalletCode:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_PalletCode</b><br/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</SfCard>
|
||||||
|
}
|
||||||
|
</DetailTemplate>
|
||||||
|
</GridTemplates>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumns>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoLine) HeaderText="Linia" Width="70"/>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoRelease) HeaderText="Zwolnienie" Width="70"/>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.Item) HeaderText="Pozycja" Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CustItem) HeaderText="Pozycja" Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.QtyOrdered) HeaderText="Łączna Ilość" TextAlign="TextAlign.Right" Width="120"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.DueDate) HeaderText="Data Wykonania" Width="100"/>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.TranslatedStatus) HeaderText="Status" Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
</Syncfusion.Blazor.Grids.GridColumns>
|
||||||
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
|
</SfGrid>
|
||||||
|
}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
</SfCard>
|
</SfCard>
|
||||||
<br/>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<Button Color="ButtonColor.Primary" @onclick="ShowLastDelfors">@_text</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
@if (_isVisible)
|
|
||||||
{
|
|
||||||
<div class="row">
|
|
||||||
<h5>Zamówienie DELFOR do zamówienia @CustomerOrderDto?.CoNum</h5>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<div class="row">
|
|
||||||
<ScheduleOrdersGrid PageSize="5" PassGridRef="SetGridRef" GridData="_scheduleOrders"></ScheduleOrdersGrid>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
}
|
|
||||||
<h5>Indeksy</h5>
|
|
||||||
<SfGrid @ref="_customerOrderLinesGrid"
|
|
||||||
AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
TValue="CustomerOrderLineDto"
|
|
||||||
DataSource="@_customerOrderLines"
|
|
||||||
EnableAdaptiveUI="true">
|
|
||||||
<GridTemplates>
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
var order = context as CustomerOrderLineDto;
|
|
||||||
<SfCard>
|
|
||||||
<CardContent>
|
|
||||||
<div class="row">
|
|
||||||
<h6>Szczegóły</h6>
|
|
||||||
<div class="col">
|
|
||||||
<u>Numer zamówienia:</u> <b>@order?.CoNum</b><br/>
|
|
||||||
<u>Linia:</u> <b>@order?.CoLine</b><br/>
|
|
||||||
<u>Pozycja:</u> <b>@order?.Item</b><br/>
|
|
||||||
<u>Pozycja Klienta:</u> <b>@order?.CustItem</b><br/>
|
|
||||||
<u>Opis:</u> <b>@order?.Description</b><br/>
|
|
||||||
<u>Łączna Ilość:</u> <b>@order?.BlanketQty.ToString("F2")</b><br/>
|
|
||||||
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<u>Cena:</u> <b>@(order?.ContPrice?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Ważne Od:</u> <b>@(order?.EffDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>J/M:</u> <b>@order?.UM</b><br/>
|
|
||||||
<u>BoxType:</u> <b>@order?.Uf_FKR_EDI_BLN_BoxType</b><br/>
|
|
||||||
<u>Address:</u> <b>@order?.Uf_FKR_EDI_BLN_Address</b><br/>
|
|
||||||
<u>FinalDestination:</u> <b>@order?.Uf_FKR_EDI_BLN_FinalDestination</b><br/>
|
|
||||||
<u>QtyPerBox:</u> <b>@(order?.Uf_FKR_EDI_BLN_QtyPerBox?.ToString() ?? "N/A")</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</SfCard>
|
|
||||||
}
|
|
||||||
</DetailTemplate>
|
|
||||||
</GridTemplates>
|
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.CoLine) HeaderText="Linia" Width="70"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.Item) HeaderText="Pozycja" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.CustItem) HeaderText="Pozycja Klienta"
|
|
||||||
Width="120"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.Description) HeaderText="Opis" Width="200"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.BlanketQty) HeaderText="Ilość" TextAlign="TextAlign.Right"
|
|
||||||
Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.UM) HeaderText="J/M" Width="50"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.ContPrice) HeaderText="Cena" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(CustomerOrderLineDto.TranslatedStatus) HeaderText="Status"
|
|
||||||
Width="100"></GridColumn>
|
|
||||||
</GridColumns>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="10"/>
|
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
|
||||||
<GridEvents TValue="CustomerOrderLineDto" RowSelected="OnSelectedLineRow"></GridEvents>
|
|
||||||
</SfGrid>
|
|
||||||
@if (_isVisibleCustomerOrderLine)
|
|
||||||
{
|
|
||||||
<br/>
|
|
||||||
<h5>Harmonogramy</h5>
|
|
||||||
<SfGrid @ref="_customerOrderLineItemsGrid"
|
|
||||||
TValue="CustomerOrderLineItemDto"
|
|
||||||
DataSource="@_customerOrderLineItems"
|
|
||||||
AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
SelectionMode="Syncfusion.Blazor.Grids.SelectionMode.Single"
|
|
||||||
SelectedItemsChanged="SelectedCustomerOrderLineItemChanged">
|
|
||||||
<GridTemplates>
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
var detailLineItem = context as CustomerOrderLineItemDto;
|
|
||||||
<SfCard>
|
|
||||||
<CardContent>
|
|
||||||
<div class="row">
|
|
||||||
<h6>Szczegóły</h6>
|
|
||||||
<div class="col">
|
|
||||||
<u>Numer Zamówienia:</u> <b>@detailLineItem?.CoNum</b><br/>
|
|
||||||
<u>Linia:</u> <b>@detailLineItem?.CoLine</b><br/>
|
|
||||||
<u>Zwolnienie:</u> <b>@detailLineItem?.CoRelease</b><br/>
|
|
||||||
<u>Pozycja:</u> <b>@detailLineItem?.Item</b><br/>
|
|
||||||
<u>Pozycja Klienta:</u> <b>@detailLineItem?.CustItem</b><br/>
|
|
||||||
<u>Łączna Ilość
|
|
||||||
Sztuk:</u> <b>@(detailLineItem?.QtyOrdered.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Cena:</u> <b>@(detailLineItem?.Price.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Data
|
|
||||||
Wykonania:</u> <b>@(detailLineItem?.DueDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>Data
|
|
||||||
Rejestracji:</u> <b>@(detailLineItem?.ReleaseDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>Magazyn:</u> <b>@detailLineItem?.Whse</b><br/>
|
|
||||||
<u>Typ
|
|
||||||
Documentu:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_DocumentType</b><br/>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<u>Kod VAT:</u> <b>@detailLineItem?.TaxCode1</b><br/>
|
|
||||||
<u>J/M:</u> <b>@detailLineItem?.UM</b><br/>
|
|
||||||
<u>Numer Klienta:</u> <b>@detailLineItem?.CoCustNum</b><br/>
|
|
||||||
<u>Opis:</u> <b>@detailLineItem?.Description</b><br/>
|
|
||||||
<u>Status:</u> <b>@detailLineItem?.TranslatedStatus</b><br/>
|
|
||||||
<u>RoutingCode:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_RoutingCode</b><br/>
|
|
||||||
<u>DeliveryCallNumber:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_DeliveryCallNum</b><br/>
|
|
||||||
<u>UnloadingPoint:</u> <b>@detailLineItem?.Uf_LOC_11_UnloadingPoint</b><br/>
|
|
||||||
<u>DestinationPoint:</u> <b>@detailLineItem?.Uf_LOC_159_DestinationPoint</b><br/>
|
|
||||||
<u>PalletCode:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_PalletCode</b><br/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</SfCard>
|
|
||||||
}
|
|
||||||
</DetailTemplate>
|
|
||||||
</GridTemplates>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumns>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoLine) HeaderText="Linia"
|
|
||||||
Width="70"/>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoRelease)
|
|
||||||
HeaderText="Zwolnienie" Width="70"/>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.Item) HeaderText="Pozycja"
|
|
||||||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CustItem)
|
|
||||||
HeaderText="Pozycja"
|
|
||||||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.QtyOrdered)
|
|
||||||
HeaderText="Łączna Ilość" TextAlign="TextAlign.Right"
|
|
||||||
Width="120"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.DueDate)
|
|
||||||
HeaderText="Data Wykonania" Width="100"/>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.TranslatedStatus)
|
|
||||||
HeaderText="Status"
|
|
||||||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
</Syncfusion.Blazor.Grids.GridColumns>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="10"/>
|
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
|
||||||
</SfGrid>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@@ -221,18 +215,7 @@
|
|||||||
|
|
||||||
private bool _isVisible = true;
|
private bool _isVisible = true;
|
||||||
private string _text = "Pokaż powiązane zamówienia DELFOR";
|
private string _text = "Pokaż powiązane zamówienia DELFOR";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
CustomerOrderDto? customerOrder = await CustomerOrderService.GetCustomerOrderAsync(CustomerOrderId);
|
|
||||||
|
|
||||||
if (customerOrder != null)
|
|
||||||
{
|
|
||||||
CustomerOrderDto = customerOrder;
|
|
||||||
_customerOrderLines = CustomerOrderDto.CustomerOrderLines.ToList() ?? [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
@@ -240,6 +223,23 @@
|
|||||||
await SetGridRef(_gridRef);
|
await SetGridRef(_gridRef);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
_isVisible = false;
|
_isVisible = false;
|
||||||
|
|
||||||
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
|
if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CustomerOrderDto? customerOrder = await CustomerOrderService.GetCustomerOrderAsync(CustomerOrderId);
|
||||||
|
|
||||||
|
if (customerOrder != null)
|
||||||
|
{
|
||||||
|
CustomerOrderDto = customerOrder;
|
||||||
|
_customerOrderLines = CustomerOrderDto.CustomerOrderLines.ToList() ?? [];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,86 +1,110 @@
|
|||||||
@page "/CustomerOrders"
|
@page "/CustomerOrders"
|
||||||
|
|
||||||
@rendermode InteractiveServer
|
@attribute [Authorize]
|
||||||
|
|
||||||
@inject CustomerOrderService CustomerOrderService
|
@inject CustomerOrderService CustomerOrderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using SytelineSaAppEfDataModel.Dtos
|
@using SytelineSaAppEfDataModel.Dtos
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
@using Syncfusion.Blazor.Cards
|
@using Syncfusion.Blazor.Cards
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<h5>Zamówienia Klienta</h5>
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
<SfGrid AllowFiltering="true"
|
<CardHeader>
|
||||||
AllowPaging="true"
|
<h3 class="text-primary">Zamówienia Klienta</h3>
|
||||||
AllowSorting="true"
|
</CardHeader>
|
||||||
AllowSelection="true"
|
<CardContent>
|
||||||
TValue="CustomerOrderDto"
|
<SfGrid AllowFiltering="true"
|
||||||
DataSource="@_customerOrders"
|
AllowPaging="true"
|
||||||
EnableAdaptiveUI="true">
|
AllowSorting="true"
|
||||||
<GridTemplates>
|
AllowSelection="true"
|
||||||
<DetailTemplate>
|
TValue="CustomerOrderDto"
|
||||||
@{
|
DataSource="@_customerOrders"
|
||||||
var order = context as CustomerOrderDto;
|
EnableAdaptiveUI="true">
|
||||||
<SfCard>
|
<GridTemplates>
|
||||||
<CardContent>
|
<DetailTemplate>
|
||||||
<div class="row">
|
@{
|
||||||
<div class="col">
|
var order = context as CustomerOrderDto;
|
||||||
<u>Numer Zamówienia:</u> <b>@order?.CoNum</b><br/>
|
<SfCard>
|
||||||
<u>Numer Zamówienia Klienta:</u> <b>@order?.CustPo</b><br/>
|
<CardContent>
|
||||||
<u>Klient:</u> <b>@order?.CustNum</b><br/>
|
<div class="row">
|
||||||
<u>Numer Odbiorcy:</u> <b>@order?.CustSeq</b><br/>
|
<div class="col">
|
||||||
<u>Kontakt:</u> <b>@order?.Contact</b><br/>
|
<u>Numer Zamówienia:</u> <b>@order?.CoNum</b><br/>
|
||||||
<u>Telefon:</u> <b>@order?.Phone</b><br/>
|
<u>Numer Zamówienia Klienta:</u> <b>@order?.CustPo</b><br/>
|
||||||
<u>Data Zamówienia:</u>
|
<u>Klient:</u> <b>@order?.CustNum</b><br/>
|
||||||
<b>@order?.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br/>
|
<u>Numer Odbiorcy:</u> <b>@order?.CustSeq</b><br/>
|
||||||
<u>Warunki:</u> <b>@order?.TermsCode</b><br/>
|
<u>Kontakt:</u> <b>@order?.Contact</b><br/>
|
||||||
<u>Wartość Brutto:</u> <b>@(order?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
<u>Telefon:</u> <b>@order?.Phone</b><br/>
|
||||||
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
<u>Data Zamówienia:</u>
|
||||||
</div>
|
<b>@order?.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br/>
|
||||||
<div class="col">
|
<u>Warunki:</u> <b>@order?.TermsCode</b><br/>
|
||||||
<u>Magazyn:</u> <b>@order?.Whse</b><br/>
|
<u>Wartość Brutto:</u> <b>@(order?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
<u>VAT:</u> <b>@order?.FrtTaxCode1</b><br/>
|
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
||||||
<u>Typ Odbiorcy:</u> <b>@order?.EndUserType</b><br/>
|
</div>
|
||||||
<u>Kurs Wymiany:</u> <b>@(order?.ExchRate?.ToString("F4") ?? "N/A")</b><br/>
|
<div class="col">
|
||||||
<u>Gate:</u> <b>@order?.Uf_FKR_EDI_Gate</b><br/>
|
<u>Magazyn:</u> <b>@order?.Whse</b><br/>
|
||||||
<u>RecipientCode:</u> <b>@order?.Uf_FKR_EDI_RecipientCode</b><br/>
|
<u>VAT:</u> <b>@order?.FrtTaxCode1</b><br/>
|
||||||
<u>SelletCode:</u> <b>@order?.Uf_FKR_EDI_SellerCode</b><br/>
|
<u>Typ Odbiorcy:</u> <b>@order?.EndUserType</b><br/>
|
||||||
<u>SenderCode:</u> <b>@order?.Uf_FKR_EDI_SenderCode</b><br/>
|
<u>Kurs Wymiany:</u> <b>@(order?.ExchRate?.ToString("F4") ?? "N/A")</b><br/>
|
||||||
<u>BuyerCode:</u> <b>@order?.Uf_FKR_EDI_BuyerCode</b><br/>
|
<u>Gate:</u> <b>@order?.Uf_FKR_EDI_Gate</b><br/>
|
||||||
<u>Typ Dokumentu:</u> <b>@order?.Uf_DocType</b><br/>
|
<u>RecipientCode:</u> <b>@order?.Uf_FKR_EDI_RecipientCode</b><br/>
|
||||||
</div>
|
<u>SellerCode:</u> <b>@order?.Uf_FKR_EDI_SellerCode</b><br/>
|
||||||
</div>
|
<u>SenderCode:</u> <b>@order?.Uf_FKR_EDI_SenderCode</b><br/>
|
||||||
</CardContent>
|
<u>BuyerCode:</u> <b>@order?.Uf_FKR_EDI_BuyerCode</b><br/>
|
||||||
</SfCard>
|
<u>Typ Dokumentu:</u> <b>@order?.Uf_DocType</b><br/>
|
||||||
}
|
</div>
|
||||||
</DetailTemplate>
|
</div>
|
||||||
</GridTemplates>
|
</CardContent>
|
||||||
<GridColumns>
|
</SfCard>
|
||||||
<GridColumn Field=@nameof(CustomerOrderDto.CoNum) HeaderText="Numer Zamówienia" Width="110"></GridColumn>
|
}
|
||||||
<GridColumn Field=@nameof(CustomerOrderDto.CustPo) HeaderText="Zamówienie Klienta" Width="100"></GridColumn>
|
</DetailTemplate>
|
||||||
<GridColumn Field=@nameof(CustomerOrderDto.CustNum) HeaderText="Numer Klienta" Width="90"></GridColumn>
|
</GridTemplates>
|
||||||
<GridColumn Field=@nameof(CustomerOrderDto.CustSeq) HeaderText="Odbiorca" Width="80"></GridColumn>
|
<GridColumns>
|
||||||
<GridColumn Field=@nameof(CustomerOrderDto.CreateDate) HeaderText="Data zamówienia"
|
<GridColumn Field=@nameof(CustomerOrderDto.CoNum) HeaderText="Numer Zamówienia" Width="110"></GridColumn>
|
||||||
TextAlign="TextAlign.Right" Width="110"></GridColumn>
|
<GridColumn Field=@nameof(CustomerOrderDto.CustPo) HeaderText="Zamówienie Klienta" Width="100"></GridColumn>
|
||||||
<GridColumn Field=@nameof(CustomerOrderDto.TranslatedStatus) HeaderText="Status" Width="100"></GridColumn>
|
<GridColumn Field=@nameof(CustomerOrderDto.CustNum) HeaderText="Numer Klienta" Width="90"></GridColumn>
|
||||||
</GridColumns>
|
<GridColumn Field=@nameof(CustomerOrderDto.CustSeq) HeaderText="Odbiorca" Width="80"></GridColumn>
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
<GridColumn Field=@nameof(CustomerOrderDto.CreateDate) HeaderText="Data zamówienia" TextAlign="TextAlign.Right" Width="110"></GridColumn>
|
||||||
<GridPageSettings PageSize="10"/>
|
<GridColumn Field=@nameof(CustomerOrderDto.TranslatedStatus) HeaderText="Status" Width="100"></GridColumn>
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
</GridColumns>
|
||||||
<GridEvents TValue="CustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick"/>
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
</SfGrid>
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
|
<GridEvents TValue="CustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick"/>
|
||||||
|
</SfGrid>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
|
</SfCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private IEnumerable<CustomerOrderDto>? _customerOrders;
|
private IEnumerable<CustomerOrderDto>? _customerOrders;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
_customerOrders = await CustomerOrderService.GetCustomerOrdersAsync() ?? new List<CustomerOrderDto>();
|
if (firstRender)
|
||||||
_customerOrders = _customerOrders.OrderByDescending(x => x.CreateDate).ToList();
|
{
|
||||||
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
StateHasChanged();
|
if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_customerOrders = await CustomerOrderService.GetCustomerOrdersAsync() ?? new List<CustomerOrderDto>();
|
||||||
|
_customerOrders = _customerOrders.OrderByDescending(x => x.CreateDate).ToList();
|
||||||
|
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRowDoubleClick(RecordDoubleClickEventArgs<CustomerOrderDto> obj)
|
private void OnRowDoubleClick(RecordDoubleClickEventArgs<CustomerOrderDto> obj)
|
||||||
|
|||||||
@@ -1,192 +1,182 @@
|
|||||||
@page "/EdiCustomerOrder/{CustomerOrderId:guid}"
|
@page "/EdiCustomerOrder/{CustomerOrderId:guid}"
|
||||||
|
|
||||||
@rendermode InteractiveServer
|
@attribute [Authorize]
|
||||||
|
|
||||||
@inject EdiCustomerOrderService EdiCustomerOrderService
|
@inject EdiCustomerOrderService EdiCustomerOrderService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using SytelineSaAppEfDataModel.Dtos
|
@using SytelineSaAppEfDataModel.Dtos
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
@using Syncfusion.Blazor.Cards
|
@using Syncfusion.Blazor.Cards
|
||||||
|
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<h5>Zamówienie klienta nr @EdiCustomerOrderDto?.CustomerOrderNumber</h5>
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
<SfCard>
|
<CardHeader>
|
||||||
|
<h3 class="text-primary">Zamówienie klienta EDI nr @(EdiCustomerOrderDto?.CustomerOrderNumber ?? "Brak numeru")</h3>
|
||||||
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div class="row">
|
<SfCard CssClass="mb-4">
|
||||||
<div class="col">
|
<CardContent>
|
||||||
<u>Numer zamówienia EDI:</u> <b>@EdiCustomerOrderDto?.CustomerOrderNumber</b><br/>
|
<div class="row">
|
||||||
<u>Numer zamówienia Klienta:</u> <b>@EdiCustomerOrderDto?.CustomerPoNumber</b><br/>
|
<div class="col">
|
||||||
<u>Numer klienta:</u> <b>@EdiCustomerOrderDto?.CustomerNumber</b><br/>
|
<u>Numer zamówienia EDI:</u> <b>@EdiCustomerOrderDto?.CustomerOrderNumber</b><br/>
|
||||||
<u>Klient:</u> <b>@EdiCustomerOrderDto?.CustomerName</b><br/>
|
<u>Numer zamówienia Klienta:</u> <b>@EdiCustomerOrderDto?.CustomerPoNumber</b><br/>
|
||||||
<u>Numer
|
<u>Numer klienta:</u> <b>@EdiCustomerOrderDto?.CustomerNumber</b><br/>
|
||||||
odbiorcy:</u> <b>@(EdiCustomerOrderDto?.CustomerSequence?.ToString() ?? "N/A")</b><br/>
|
<u>Klient:</u> <b>@EdiCustomerOrderDto?.CustomerName</b><br/>
|
||||||
<u>Data
|
<u>Numer odbiorcy:</u> <b>@(EdiCustomerOrderDto?.CustomerSequence?.ToString() ?? "N/A")</b><br/>
|
||||||
otrzymania:</u> <b>@(EdiCustomerOrderDto?.RecivedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
<u>Data otrzymania:</u> <b>@(EdiCustomerOrderDto?.RecivedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
<u>Wysłano do
|
<u>Wysłano do Syteline?:</u> <b>@((EdiCustomerOrderDto?.Posted?.ToString() ?? "0") == "0" ? "NIE" : "TAK")</b><br/>
|
||||||
Syteline?:</u> <b>@((EdiCustomerOrderDto?.Posted?.ToString() ?? "0") == "0" ? "NIE" : "TAK")</b><br/>
|
<u>Data wysyłki do Syteline:</u> <b>@(EdiCustomerOrderDto?.PostedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
<u>Data wysyłki do
|
<u>Data zamówienia:</u> <b>@(EdiCustomerOrderDto?.OrderDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
Syteline:</u> <b>@(EdiCustomerOrderDto?.PostedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
</div>
|
||||||
<u>Data
|
<div class="col">
|
||||||
zamówienia:</u> <b>@(EdiCustomerOrderDto?.OrderDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
<u>Cena:</u> <b>@(EdiCustomerOrderDto?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
</div>
|
<u>Waga:</u> <b>@(EdiCustomerOrderDto?.Weight?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
<div class="col">
|
<u>Magazyn:</u> <b>@EdiCustomerOrderDto?.Warehouse</b><br/>
|
||||||
<u>Cena:</u> <b>@(EdiCustomerOrderDto?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
<u>Gate:</u> <b>@EdiCustomerOrderDto?.Gate</b><br/>
|
||||||
<u>Waga:</u> <b>@(EdiCustomerOrderDto?.Weight?.ToString("F2") ?? "N/A")</b><br/>
|
<u>Kod odbiorcy:</u> <b>@EdiCustomerOrderDto?.RecipientCode</b><br/>
|
||||||
<u>Magazyn:</u> <b>@EdiCustomerOrderDto?.Warehouse</b><br/>
|
<u>Kod wysyłającego:</u> <b>@EdiCustomerOrderDto?.SenderCode</b><br/>
|
||||||
<u>Gate:</u> <b>@EdiCustomerOrderDto?.Gate</b><br/>
|
<u>Kod sprzedawcy:</u> <b>@EdiCustomerOrderDto?.SellerCode</b><br/>
|
||||||
<u>Kod odbiorcy:</u> <b>@EdiCustomerOrderDto?.RecipientCode</b><br/>
|
<u>Kod kupującego:</u> <b>@EdiCustomerOrderDto?.BuyerCode</b><br/>
|
||||||
<u>Kod wysyłającego:</u> <b>@EdiCustomerOrderDto?.SenderCode</b><br/>
|
<u>Typ dokumentu:</u> <b>@EdiCustomerOrderDto?.DocType</b><br/>
|
||||||
<u>Kod sprzedawcy:</u> <b>@EdiCustomerOrderDto?.SellerCode</b><br/>
|
</div>
|
||||||
<u>Kod kupującego:</u> <b>@EdiCustomerOrderDto?.BuyerCode</b><br/>
|
</div>
|
||||||
<u>Typ dokumentu:</u> <b>@EdiCustomerOrderDto?.DocType</b><br/>
|
</CardContent>
|
||||||
</div>
|
</SfCard>
|
||||||
</div>
|
|
||||||
|
<h5 class="text-primary mb-3">Indeksy</h5>
|
||||||
|
<SfGrid @ref="_ediCustomerOrderLinesGrid"
|
||||||
|
AllowFiltering="true"
|
||||||
|
AllowPaging="true"
|
||||||
|
AllowSorting="true"
|
||||||
|
AllowSelection="true"
|
||||||
|
TValue="EdiCustomerOrderLineDto"
|
||||||
|
DataSource="@_ediCustomerOrderLines"
|
||||||
|
EnableAdaptiveUI="true">
|
||||||
|
<GridTemplates>
|
||||||
|
<DetailTemplate>
|
||||||
|
@{
|
||||||
|
var order = context as EdiCustomerOrderLineDto;
|
||||||
|
<SfCard CssClass="mb-4">
|
||||||
|
<CardContent>
|
||||||
|
<div class="row">
|
||||||
|
<h6>Szczegóły</h6>
|
||||||
|
<div class="col">
|
||||||
|
<u>Numer zamówienia EDI:</u> <b>@order?.CustomerOrderNumber</b><br/>
|
||||||
|
<u>Linia:</u> <b>@order?.CustomerOrderLine</b><br/>
|
||||||
|
<u>Pozycja:</u> <b>@order?.Item</b><br/>
|
||||||
|
<u>Pozycja Klienta:</u> <b>@order?.CustomerItemNumber</b><br/>
|
||||||
|
<u>Opis:</u> <b>@order?.Description</b><br/>
|
||||||
|
<u>Łączna Ilość:</u> <b>@(order?.BlanketQty?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<u>Cena:</u> <b>@(order?.ContPrice?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Ważne Od:</u> <b>@(order?.EffectiveDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>J/M:</u> <b>@order?.Uom</b><br/>
|
||||||
|
<u>BoxType:</u> <b>@order?.BoxType</b><br/>
|
||||||
|
<u>Address:</u> <b>@order?.Address</b><br/>
|
||||||
|
<u>FinalDestination:</u> <b>@order?.FinalDestination</b><br/>
|
||||||
|
<u>QtyPerBox:</u> <b>@(order?.QtyPerBox?.ToString() ?? "N/A")</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</SfCard>
|
||||||
|
}
|
||||||
|
</DetailTemplate>
|
||||||
|
</GridTemplates>
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.CustomerOrderLine) HeaderText="Linia" Width="70"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.Item) HeaderText="Pozycja" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.CustomerItemNumber) HeaderText="Pozycja Klienta" Width="120"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.Description) HeaderText="Opis" Width="200"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.BlanketQty) HeaderText="Ilość" TextAlign="TextAlign.Right" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.Uom) HeaderText="J/M" Width="50"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.ContPrice) HeaderText="Cena" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.TranslatedStatus) HeaderText="Status" Width="100"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
|
<GridEvents TValue="EdiCustomerOrderLineDto" RowSelected="OnSelectedLineRow"></GridEvents>
|
||||||
|
</SfGrid>
|
||||||
|
|
||||||
|
@if (_isVisibleEdiCustomerOrderLine)
|
||||||
|
{
|
||||||
|
<h5 class="text-primary mb-3 mt-4">Harmonogramy</h5>
|
||||||
|
<SfGrid @ref="_ediCustomerOrderLineItemsGrid"
|
||||||
|
TValue="EdiCustomerOrderLineItemDto"
|
||||||
|
DataSource="@_ediCustomerOrderLineItems"
|
||||||
|
AllowFiltering="true"
|
||||||
|
AllowPaging="true"
|
||||||
|
AllowSelection="true"
|
||||||
|
AllowSorting="true"
|
||||||
|
SelectionMode="Syncfusion.Blazor.Grids.SelectionMode.Single"
|
||||||
|
SelectedItemsChanged="SelectedCustomerOrderLineItemChanged">
|
||||||
|
<GridTemplates>
|
||||||
|
<DetailTemplate>
|
||||||
|
@{
|
||||||
|
var detailLineItem = context as EdiCustomerOrderLineItemDto;
|
||||||
|
<SfCard CssClass="mb-4">
|
||||||
|
<CardContent>
|
||||||
|
<div class="row">
|
||||||
|
<h6>Szczegóły</h6>
|
||||||
|
<div class="col">
|
||||||
|
<u>Numer Zamówienia:</u> <b>@detailLineItem?.CustomerOrderNumber</b><br/>
|
||||||
|
<u>Linia:</u> <b>@detailLineItem?.CustomerOrderLine</b><br/>
|
||||||
|
<u>Zwolnienie:</u> <b>@detailLineItem?.CustomerOrderRelease</b><br/>
|
||||||
|
<u>Pozycja:</u> <b>@detailLineItem?.Item</b><br/>
|
||||||
|
<u>Pozycja Klienta:</u> <b>@detailLineItem?.CustomerItem</b><br/>
|
||||||
|
<u>Łączna Ilość Sztuk:</u> <b>@(detailLineItem?.QtyOrdered?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Cena:</u> <b>@(detailLineItem?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Data Wykonania:</u> <b>@(detailLineItem?.DueDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>Data Rejestracji:</u> <b>@(detailLineItem?.ReleaseDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>Magazyn:</u> <b>@detailLineItem?.Warehouse</b><br/>
|
||||||
|
<u>Typ Dokumentu:</u> <b>@detailLineItem?.DocumentType</b><br/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<u>Kod VAT:</u> <b>@detailLineItem?.TaxCodeOne</b><br/>
|
||||||
|
<u>J/M:</u> <b>@detailLineItem?.Uom</b><br/>
|
||||||
|
<u>Numer Klienta:</u> <b>@detailLineItem?.CustomerOrderCustomerNumber</b><br/>
|
||||||
|
<u>Opis:</u> <b>@detailLineItem?.Description</b><br/>
|
||||||
|
<u>Status:</u> <b>@detailLineItem?.TranslatedStatus</b><br/>
|
||||||
|
<u>RoutingCode:</u> <b>@detailLineItem?.RoutingCode</b><br/>
|
||||||
|
<u>DeliveryCallNumber:</u> <b>@detailLineItem?.DeliveryCallNumber</b><br/>
|
||||||
|
<u>UnloadingPoint:</u> <b>@detailLineItem?.UnloadingPoint</b><br/>
|
||||||
|
<u>DestinationPoint:</u> <b>@detailLineItem?.DestinationPoint</b><br/>
|
||||||
|
<u>PalletCode:</u> <b>@detailLineItem?.PalletCode</b><br/>
|
||||||
|
<u>PalletNumber:</u> <b>@detailLineItem?.PalletNumber</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</SfCard>
|
||||||
|
}
|
||||||
|
</DetailTemplate>
|
||||||
|
</GridTemplates>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumns>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.CustomerOrderLine) HeaderText="Linia" Width="70"/>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.CustomerOrderRelease) HeaderText="Zwolnienie" Width="70"/>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.Item) HeaderText="Pozycja" Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.CustomerItem) HeaderText="Pozycja Klienta" Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.QtyOrdered) HeaderText="Łączna Ilość" TextAlign="TextAlign.Right" Width="120"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.DueDate) HeaderText="Data Wykonania" Width="100"/>
|
||||||
|
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(EdiCustomerOrderLineItemDto.TranslatedStatus) HeaderText="Status" Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||||||
|
</Syncfusion.Blazor.Grids.GridColumns>
|
||||||
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
|
</SfGrid>
|
||||||
|
}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
</SfCard>
|
</SfCard>
|
||||||
<br/>
|
|
||||||
<h5>Indeksy</h5>
|
|
||||||
<SfGrid @ref="_ediCustomerOrderLinesGrid"
|
|
||||||
AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
TValue="EdiCustomerOrderLineDto"
|
|
||||||
DataSource="@_ediCustomerOrderLines"
|
|
||||||
EnableAdaptiveUI="true">
|
|
||||||
<GridTemplates>
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
var order = context as EdiCustomerOrderLineDto;
|
|
||||||
<SfCard>
|
|
||||||
<CardContent>
|
|
||||||
<div class="row">
|
|
||||||
<h6>Szczegóły</h6>
|
|
||||||
<div class="col">
|
|
||||||
<u>Numer zamówienia EDI:</u> <b>@order?.CustomerOrderNumber</b><br/>
|
|
||||||
<u>Linia:</u> <b>@order?.CustomerOrderLine</b><br/>
|
|
||||||
<u>Pozycja:</u> <b>@order?.Item</b><br/>
|
|
||||||
<u>Pozycja Klienta:</u> <b>@order?.CustomerItemNumber</b><br/>
|
|
||||||
<u>Opis:</u> <b>@order?.Description</b><br/>
|
|
||||||
<u>Łączna Ilość:</u> <b>@(order?.BlanketQty?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<u>Cena:</u> <b>@(order?.ContPrice?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Ważne
|
|
||||||
Od:</u> <b>@(order?.EffectiveDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>J/M:</u> <b>@order?.Uom</b><br/>
|
|
||||||
<u>BoxType:</u> <b>@order?.BoxType</b><br/>
|
|
||||||
<u>Address:</u> <b>@order?.Address</b><br/>
|
|
||||||
<u>FinalDestination:</u> <b>@order?.FinalDestination</b><br/>
|
|
||||||
<u>QtyPerBox:</u> <b>@(order?.QtyPerBox?.ToString() ?? "N/A")</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</SfCard>
|
|
||||||
}
|
|
||||||
</DetailTemplate>
|
|
||||||
</GridTemplates>
|
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.CustomerOrderLine) HeaderText="Linia"
|
|
||||||
Width="70"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.Item) HeaderText="Pozycja" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.CustomerItemNumber) HeaderText="Pozycja Klienta"
|
|
||||||
Width="120"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.Description) HeaderText="Opis" Width="200"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.BlanketQty) HeaderText="Ilość" TextAlign="TextAlign.Right"
|
|
||||||
Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.Uom) HeaderText="J/M" Width="50"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.ContPrice) HeaderText="Cena" Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderLineDto.TranslatedStatus) HeaderText="Status"
|
|
||||||
Width="100"></GridColumn>
|
|
||||||
</GridColumns>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="10"/>
|
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
|
||||||
<GridEvents TValue="EdiCustomerOrderLineDto" RowSelected="OnSelectedLineRow"></GridEvents>
|
|
||||||
</SfGrid>
|
|
||||||
@if (_isVisibleEdiCustomerOrderLine)
|
|
||||||
{
|
|
||||||
<br/>
|
|
||||||
<h5>Harmonogramy</h5>
|
|
||||||
<SfGrid @ref="_ediCustomerOrderLineItemsGrid"
|
|
||||||
TValue="EdiCustomerOrderLineItemDto"
|
|
||||||
DataSource="@_ediCustomerOrderLineItems"
|
|
||||||
AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
SelectionMode="Syncfusion.Blazor.Grids.SelectionMode.Single"
|
|
||||||
SelectedItemsChanged="SelectedCustomerOrderLineItemChanged">
|
|
||||||
<GridTemplates>
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
var detailLineItem = context as EdiCustomerOrderLineItemDto;
|
|
||||||
<SfCard>
|
|
||||||
<CardContent>
|
|
||||||
<div class="row">
|
|
||||||
<h6>Szczegóły</h6>
|
|
||||||
<div class="col">
|
|
||||||
<u>Numer Zamówienia:</u> <b>@detailLineItem?.CustomerOrderNumber</b><br/>
|
|
||||||
<u>Linia:</u> <b>@detailLineItem?.CustomerOrderLine</b><br/>
|
|
||||||
<u>Zwolnienie:</u> <b>@detailLineItem?.CustomerOrderRelease</b><br/>
|
|
||||||
<u>Pozycja:</u> <b>@detailLineItem?.Item</b><br/>
|
|
||||||
<u>Pozycja Klienta:</u> <b>@detailLineItem?.CustomerItem</b><br/>
|
|
||||||
<u>Łączna Ilość
|
|
||||||
Sztuk:</u> <b>@(detailLineItem?.QtyOrdered?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Cena:</u> <b>@(detailLineItem?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Data
|
|
||||||
Wykonania:</u> <b>@(detailLineItem?.DueDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>Data
|
|
||||||
Rejestracji:</u> <b>@(detailLineItem?.ReleaseDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>Magazyn:</u> <b>@detailLineItem?.Warehouse</b><br/>
|
|
||||||
<u>Typ Documentu:</u> <b>@detailLineItem?.DocumentType</b><br/>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<u>Kod VAT:</u> <b>@detailLineItem?.TaxCodeOne</b><br/>
|
|
||||||
<u>J/M:</u> <b>@detailLineItem?.Uom</b><br/>
|
|
||||||
<u>Numer
|
|
||||||
Klienta:</u> <b>@detailLineItem?.CustomerOrderCustomerNumber</b><br/>
|
|
||||||
<u>Opis:</u> <b>@detailLineItem?.Description</b><br/>
|
|
||||||
<u>Status:</u> <b>@detailLineItem?.TranslatedStatus</b><br/>
|
|
||||||
<u>RoutingCode:</u> <b>@detailLineItem?.RoutingCode</b><br/>
|
|
||||||
<u>DeliveryCallNumber:</u> <b>@detailLineItem?.DeliveryCallNumber</b><br/>
|
|
||||||
<u>UnloadingPoint:</u> <b>@detailLineItem?.UnloadingPoint</b><br/>
|
|
||||||
<u>DestinationPoint:</u> <b>@detailLineItem?.DestinationPoint</b><br/>
|
|
||||||
<u>PalletCode:</u> <b>@detailLineItem?.PalletCode</b><br/>
|
|
||||||
<u>PalletNumber:</u> <b>@detailLineItem?.PalletNumber</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</SfCard>
|
|
||||||
}
|
|
||||||
</DetailTemplate>
|
|
||||||
</GridTemplates>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumns>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoLine) HeaderText="Linia"
|
|
||||||
Width="70"/>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoRelease)
|
|
||||||
HeaderText="Zwolnienie" Width="70"/>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.Item) HeaderText="Pozycja"
|
|
||||||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CustItem)
|
|
||||||
HeaderText="Pozycja"
|
|
||||||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.QtyOrdered)
|
|
||||||
HeaderText="Łączna Ilość" TextAlign="TextAlign.Right"
|
|
||||||
Width="120"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.DueDate)
|
|
||||||
HeaderText="Data Wykonania" Width="100"/>
|
|
||||||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.TranslatedStatus)
|
|
||||||
HeaderText="Status"
|
|
||||||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
|
||||||
</Syncfusion.Blazor.Grids.GridColumns>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="10"/>
|
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
|
||||||
</SfGrid>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@@ -202,13 +192,25 @@
|
|||||||
SfGrid<EdiCustomerOrderLineItemDto>? _ediCustomerOrderLineItemsGrid;
|
SfGrid<EdiCustomerOrderLineItemDto>? _ediCustomerOrderLineItemsGrid;
|
||||||
|
|
||||||
private bool _isVisibleEdiCustomerOrderLine;
|
private bool _isVisibleEdiCustomerOrderLine;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
EdiCustomerOrderDto? ediCustomerOrder = await EdiCustomerOrderService.GetEdiCustomerOrderAsync(CustomerOrderId);
|
if (firstRender)
|
||||||
|
{
|
||||||
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
EdiCustomerOrderDto = ediCustomerOrder;
|
if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
_ediCustomerOrderLines = ediCustomerOrder?.EdiCustomerOrderLines.ToList() ?? [];
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EdiCustomerOrderDto? ediCustomerOrder = await EdiCustomerOrderService.GetEdiCustomerOrderAsync(CustomerOrderId);
|
||||||
|
|
||||||
|
EdiCustomerOrderDto = ediCustomerOrder;
|
||||||
|
_ediCustomerOrderLines = ediCustomerOrder?.EdiCustomerOrderLines.ToList() ?? [];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSelectedLineRow<TValue>(RowSelectEventArgs<TValue> obj)
|
private void OnSelectedLineRow<TValue>(RowSelectEventArgs<TValue> obj)
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
@page "/EdiCustomerOrders"
|
@page "/EdiCustomerOrders"
|
||||||
|
|
||||||
@rendermode InteractiveServer
|
@attribute [Authorize]
|
||||||
|
|
||||||
@inject EdiCustomerOrderService EdiCustomerOrderService
|
@inject EdiCustomerOrderService EdiCustomerOrderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using OrdersManagement.Models
|
@using OrdersManagement.Models
|
||||||
@using SytelineSaAppEfDataModel.Dtos
|
@using SytelineSaAppEfDataModel.Dtos
|
||||||
@@ -14,120 +16,115 @@
|
|||||||
@using SelectionType = Syncfusion.Blazor.Grids.SelectionType
|
@using SelectionType = Syncfusion.Blazor.Grids.SelectionType
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<h5>Zamówienia Klienta EDI</h5>
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
<div class="row">
|
<CardHeader>
|
||||||
<div class="col-md-12">
|
<h3 class="text-primary">Zamówienia Klienta EDI</h3>
|
||||||
<label for="checked" style="padding: 10px 10px 10px 0">Pokaż wszystkie</label>
|
</CardHeader>
|
||||||
<SfSwitch @bind-Checked="_filter" ValueChange="FilterChanged" TChecked="bool?"
|
<CardContent>
|
||||||
OnLabel="Pokaż tylko Wysłanr do SL" OffLabel="Pokaż wszystkie"/>
|
<div class="row mb-4">
|
||||||
</div>
|
<div class="col-md-12 d-flex align-items-center">
|
||||||
</div>
|
<label for="checked" style="padding: 10px 10px 10px 0">Pokaż wszystkie</label>
|
||||||
<br/>
|
<SfSwitch @bind-Checked="_filter" ValueChange="FilterChanged" TChecked="bool?"
|
||||||
@if (_isVisible)
|
OnLabel="Pokaż tylko Wysłane do SL" OffLabel="Pokaż wszystkie"/>
|
||||||
{
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<SfButton @onclick="SendOrderToSyteLine">@_text</SfButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
}
|
|
||||||
<SfGrid @ref="_grid"
|
|
||||||
AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
TValue="EdiCustomerOrderDto"
|
|
||||||
DataSource="@_ediCustomerOrders"
|
|
||||||
EnableAdaptiveUI="true">
|
|
||||||
<GridTemplates>
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
var order = context as EdiCustomerOrderDto;
|
|
||||||
<SfCard>
|
|
||||||
<CardContent>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<u>Numer zamówienia EDI:</u> <b>@order?.CustomerOrderNumber</b><br/>
|
|
||||||
<u>Numer zamówienia Klienta:</u> <b>@order?.CustomerPoNumber</b><br/>
|
|
||||||
<u>Numer klienta:</u> <b>@order?.CustomerNumber</b><br/>
|
|
||||||
<u>Klient:</u> <b>@order?.CustomerName</b><br/>
|
|
||||||
<u>Numer
|
|
||||||
odbiorcy:</u> <b>@(order?.CustomerSequence?.ToString() ?? "N/A")</b><br/>
|
|
||||||
<u>Data
|
|
||||||
otrzymania:</u> <b>@(order?.RecivedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>Wysłano do
|
|
||||||
Syteline?:</u> <b>@((order?.Posted?.ToString() ?? "0") == "0" ? "NIE" : "TAK")</b><br/>
|
|
||||||
<u>Data wysyłki do
|
|
||||||
Syteline:</u> <b>@(order?.PostedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
<u>Data
|
|
||||||
zamówienia:</u> <b>@(order?.OrderDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<u>Cena:</u> <b>@(order?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Waga:</u> <b>@(order?.Weight?.ToString("F2") ?? "N/A")</b><br/>
|
|
||||||
<u>Magazyn:</u> <b>@order?.Warehouse</b><br/>
|
|
||||||
<u>Gate:</u> <b>@order?.Gate</b><br/>
|
|
||||||
<u>Kod odbiorcy:</u> <b>@order?.RecipientCode</b><br/>
|
|
||||||
<u>Kod wysyłającego:</u> <b>@order?.SenderCode</b><br/>
|
|
||||||
<u>Kod sprzedawcy:</u> <b>@order?.SellerCode</b><br/>
|
|
||||||
<u>Kod kupującego:</u> <b>@order?.BuyerCode</b><br/>
|
|
||||||
<u>Typ dokumentu:</u> <b>@order?.DocType</b><br/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</SfCard>
|
|
||||||
}
|
|
||||||
</DetailTemplate>
|
|
||||||
</GridTemplates>
|
|
||||||
<GridColumns>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerOrderNumber) HeaderText="Numer Zamówienia"
|
|
||||||
Width="110"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerPoNumber) HeaderText="Zamówienie Klienta"
|
|
||||||
Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerNumber) HeaderText="Numer Klienta"
|
|
||||||
Width="90"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerSequence) HeaderText="Odbiorca"
|
|
||||||
Width="80"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.CreateDate) HeaderText="Data Otrzymania"
|
|
||||||
TextAlign="TextAlign.Center" Width="110"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.SlOrderNumber) HeaderText="Zamówienie SL"
|
|
||||||
Width="100"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(EdiCustomerOrderDto.SentToSl) HeaderText="Wysłane do SL"
|
|
||||||
TextAlign="TextAlign.Center" Width="80"></GridColumn>
|
|
||||||
</GridColumns>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="10"/>
|
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/>
|
|
||||||
<GridEvents TValue="EdiCustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick" RowSelected="RowSelected"/>
|
|
||||||
</SfGrid>
|
|
||||||
|
|
||||||
<SfDialog Width="500px" Title="@_text" IsModal="true" @bind-Visible="Visibility" AllowPrerender="true">
|
@if (_isVisible)
|
||||||
<DialogTemplates>
|
{
|
||||||
<Content>
|
<div class="row mb-4">
|
||||||
@if (_responses.Any(x => x.Status == 1))
|
<div class="col-md-12">
|
||||||
{
|
<SfButton CssClass="btn-primary" @onclick="SendOrderToSyteLine">@_text</SfButton>
|
||||||
foreach (ResponseModel? response in _responses.Where(x => x.Status == 1))
|
</div>
|
||||||
{
|
</div>
|
||||||
<p>Zamówienie EDI @response.Identifier zostało poprawnie zaksięgowane w Zamówieniach klienta pod
|
}
|
||||||
numerem '@response.ExternalIdentifier'</p>
|
|
||||||
}
|
<SfGrid @ref="_grid"
|
||||||
}
|
AllowFiltering="true"
|
||||||
@if (_responses.Any(x => x.Status == 0))
|
AllowPaging="true"
|
||||||
{
|
AllowSorting="true"
|
||||||
foreach (ResponseModel? response in _responses.Where(x => x.Status == 0))
|
AllowSelection="true"
|
||||||
{
|
TValue="EdiCustomerOrderDto"
|
||||||
<p>Błąd: Zamówienie EDI @response.Identifier nie zostało poprawnie zaksięgowane w Zamówieniach
|
DataSource="@_ediCustomerOrders"
|
||||||
klienta.<br/>Lista błędów:<br/>@response.Message</p>
|
EnableAdaptiveUI="true">
|
||||||
}
|
<GridTemplates>
|
||||||
}
|
<DetailTemplate>
|
||||||
</Content>
|
@{
|
||||||
</DialogTemplates>
|
var order = context as EdiCustomerOrderDto;
|
||||||
<DialogButtons>
|
<SfCard CssClass="mb-4">
|
||||||
<DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/>
|
<CardContent>
|
||||||
</DialogButtons>
|
<div class="row">
|
||||||
</SfDialog>
|
<div class="col">
|
||||||
|
<u>Numer zamówienia EDI:</u> <b>@order?.CustomerOrderNumber</b><br/>
|
||||||
|
<u>Numer zamówienia Klienta:</u> <b>@order?.CustomerPoNumber</b><br/>
|
||||||
|
<u>Numer klienta:</u> <b>@order?.CustomerNumber</b><br/>
|
||||||
|
<u>Klient:</u> <b>@order?.CustomerName</b><br/>
|
||||||
|
<u>Numer odbiorcy:</u> <b>@(order?.CustomerSequence?.ToString() ?? "N/A")</b><br/>
|
||||||
|
<u>Data otrzymania:</u> <b>@(order?.RecivedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>Wysłano do Syteline?:</u> <b>@((order?.Posted?.ToString() ?? "0") == "0" ? "NIE" : "TAK")</b><br/>
|
||||||
|
<u>Data wysyłki do Syteline:</u> <b>@(order?.PostedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
<u>Data zamówienia:</u> <b>@(order?.OrderDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<u>Cena:</u> <b>@(order?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Waga:</u> <b>@(order?.Weight?.ToString("F2") ?? "N/A")</b><br/>
|
||||||
|
<u>Magazyn:</u> <b>@order?.Warehouse</b><br/>
|
||||||
|
<u>Gate:</u> <b>@order?.Gate</b><br/>
|
||||||
|
<u>Kod odbiorcy:</u> <b>@order?.RecipientCode</b><br/>
|
||||||
|
<u>Kod wysyłającego:</u> <b>@order?.SenderCode</b><br/>
|
||||||
|
<u>Kod sprzedawcy:</u> <b>@order?.SellerCode</b><br/>
|
||||||
|
<u>Kod kupującego:</u> <b>@order?.BuyerCode</b><br/>
|
||||||
|
<u>Typ dokumentu:</u> <b>@order?.DocType</b><br/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</SfCard>
|
||||||
|
}
|
||||||
|
</DetailTemplate>
|
||||||
|
</GridTemplates>
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerOrderNumber) HeaderText="Numer Zamówienia" Width="110"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerPoNumber) HeaderText="Zamówienie Klienta" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerNumber) HeaderText="Numer Klienta" Width="90"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerSequence) HeaderText="Odbiorca" Width="80"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.CreateDate) HeaderText="Data Otrzymania" TextAlign="TextAlign.Center" Width="110"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.SlOrderNumber) HeaderText="Zamówienie SL" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(EdiCustomerOrderDto.SentToSl) HeaderText="Wysłane do SL" TextAlign="TextAlign.Center" Width="80"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/>
|
||||||
|
<GridEvents TValue="EdiCustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick" RowSelected="RowSelected"/>
|
||||||
|
</SfGrid>
|
||||||
|
|
||||||
|
<SfDialog Width="500px" Title="@_text" IsModal="true" @bind-Visible="Visibility" AllowPrerender="true">
|
||||||
|
<DialogTemplates>
|
||||||
|
<Content>
|
||||||
|
@if (_responses.Any(x => x.Status == 1))
|
||||||
|
{
|
||||||
|
foreach (ResponseModel? response in _responses.Where(x => x.Status == 1))
|
||||||
|
{
|
||||||
|
<p>Zamówienie EDI @response.Identifier zostało poprawnie zaksięgowane w Zamówieniach klienta pod numerem '@response.ExternalIdentifier'</p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if (_responses.Any(x => x.Status == 0))
|
||||||
|
{
|
||||||
|
foreach (ResponseModel? response in _responses.Where(x => x.Status == 0))
|
||||||
|
{
|
||||||
|
<p>Błąd: Zamówienie EDI @response.Identifier nie zostało poprawnie zaksięgowane w Zamówieniach klienta.<br/>Lista błędów:<br/>@response.Message</p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</Content>
|
||||||
|
</DialogTemplates>
|
||||||
|
<DialogButtons>
|
||||||
|
<DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/>
|
||||||
|
</DialogButtons>
|
||||||
|
</SfDialog>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
|
</SfCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@@ -145,9 +142,21 @@
|
|||||||
|
|
||||||
private string _text = "Księguj bieżący";
|
private string _text = "Księguj bieżący";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
await LoadData();
|
if (firstRender)
|
||||||
|
{
|
||||||
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
|
if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRowDoubleClick(RecordDoubleClickEventArgs<EdiCustomerOrderDto> obj)
|
private void OnRowDoubleClick(RecordDoubleClickEventArgs<EdiCustomerOrderDto> obj)
|
||||||
|
|||||||
@@ -1,47 +1,43 @@
|
|||||||
@page "/login"
|
@page "/login"
|
||||||
|
|
||||||
@rendermode InteractiveServer
|
|
||||||
@attribute [AllowAnonymous]
|
@attribute [AllowAnonymous]
|
||||||
|
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using Microsoft.AspNetCore.Components.Authorization
|
|
||||||
@using OrdersManagement.Models
|
@using OrdersManagement.Models
|
||||||
@using Syncfusion.Blazor.Inputs
|
@using Syncfusion.Blazor.Inputs
|
||||||
@using Syncfusion.Blazor.Buttons
|
@using Syncfusion.Blazor.Buttons
|
||||||
@using Syncfusion.Blazor.Cards
|
@using Syncfusion.Blazor.Cards
|
||||||
@inject UserService UserService
|
@inject UserService UserService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<h5>Logowanie</h5>
|
<SfCard CssClass="text-center shadow" style="max-width: 500px;">
|
||||||
|
<CardHeader>
|
||||||
@if (!string.IsNullOrEmpty(TempPassword))
|
<h3 class="text-primary">Logowanie</h3>
|
||||||
{
|
</CardHeader>
|
||||||
<div class="alert alert-info">
|
|
||||||
Twoje tymczasowe hasło to: <strong>@TempPassword</strong>. Użyj go do pierwszego logowania.
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<SfCard>
|
|
||||||
<CardHeader Title="Zaloguj się"/>
|
|
||||||
<CardContent>
|
<CardContent>
|
||||||
|
@if (!string.IsNullOrEmpty(TempPassword))
|
||||||
|
{
|
||||||
|
<div class="alert alert-info mb-3">
|
||||||
|
Twoje tymczasowe hasło to: <strong>@TempPassword</strong>. Użyj go do pierwszego logowania.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<EditForm Model="@LoginModel" FormName="LoginForm" OnValidSubmit="@HandleLogin">
|
<EditForm Model="@LoginModel" FormName="LoginForm" OnValidSubmit="@HandleLogin">
|
||||||
<DataAnnotationsValidator/>
|
<DataAnnotationsValidator/>
|
||||||
<ValidationSummary/>
|
<ValidationSummary class="text-danger mb-3"/>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group mb-3">
|
||||||
<label for="login">Login</label>
|
<label for="login" class="d-block text-start">Login</label>
|
||||||
<SfTextBox ID="login" @bind-Value="LoginModel.Login" Placeholder="Wprowadź login"
|
<SfTextBox ID="login" @bind-Value="LoginModel.Login" Placeholder="Wprowadź login" CssClass="e-outline"/>
|
||||||
CssClass="e-outline"/>
|
<ValidationMessage For="@(() => LoginModel.Login)" ClassName="text-danger"/>
|
||||||
<ValidationMessage For="@(() => LoginModel.Login)"/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group mb-3">
|
||||||
<label for="password">Hasło</label>
|
<label for="password" class="d-block text-start">Hasło</label>
|
||||||
<SfTextBox ID="password" Type="InputType.Password" @bind-Value="LoginModel.Password"
|
<SfTextBox ID="password" Type="InputType.Password" @bind-Value="LoginModel.Password"
|
||||||
Placeholder="Wprowadź hasło" CssClass="e-outline"/>
|
Placeholder="Wprowadź hasło" CssClass="e-outline"/>
|
||||||
<ValidationMessage For="@(() => LoginModel.Password)"/>
|
<ValidationMessage For="@(() => LoginModel.Password)" ClassName="text-danger"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
@@ -56,37 +52,36 @@
|
|||||||
|
|
||||||
@if (ShowChangePassword)
|
@if (ShowChangePassword)
|
||||||
{
|
{
|
||||||
<hr/>
|
<hr class="my-4"/>
|
||||||
<h5>Zmień hasło</h5>
|
<h5 class="text-success mb-3">Zmień hasło</h5>
|
||||||
<EditForm Model="@ChangePasswordModel" FormName="ChangePasswordForm"
|
<EditForm Model="@ChangePasswordModel" FormName="ChangePasswordForm" OnValidSubmit="@HandleChangePassword">
|
||||||
OnValidSubmit="@HandleChangePassword">
|
|
||||||
<DataAnnotationsValidator/>
|
<DataAnnotationsValidator/>
|
||||||
<ValidationSummary/>
|
<ValidationSummary class="text-danger mb-3"/>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group mb-3">
|
||||||
<label for="newPassword">Nowe hasło</label>
|
<label for="newPassword" class="d-block text-start">Nowe hasło</label>
|
||||||
<SfTextBox ID="newPassword" Type="InputType.Password"
|
<SfTextBox ID="newPassword" Type="InputType.Password" @bind-Value="ChangePasswordModel.NewPassword"
|
||||||
@bind-Value="ChangePasswordModel.NewPassword" Placeholder="Wprowadź nowe hasło"
|
Placeholder="Wprowadź nowe hasło" CssClass="e-outline"/>
|
||||||
CssClass="e-outline"/>
|
<ValidationMessage For="@(() => ChangePasswordModel.NewPassword)" ClassName="text-danger"/>
|
||||||
<ValidationMessage For="@(() => ChangePasswordModel.NewPassword)"/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group mb-3">
|
||||||
<label for="confirmPassword">Potwierdź hasło</label>
|
<label for="confirmPassword" class="d-block text-start">Potwierdź hasło</label>
|
||||||
<SfTextBox ID="confirmPassword" Type="InputType.Password"
|
<SfTextBox ID="confirmPassword" Type="InputType.Password" @bind-Value="ChangePasswordModel.ConfirmPassword"
|
||||||
@bind-Value="ChangePasswordModel.ConfirmPassword" Placeholder="Potwierdź nowe hasło"
|
Placeholder="Potwierdź nowe hasło" CssClass="e-outline"/>
|
||||||
CssClass="e-outline"/>
|
<ValidationMessage For="@(() => ChangePasswordModel.ConfirmPassword)" ClassName="text-danger"/>
|
||||||
<ValidationMessage For="@(() => ChangePasswordModel.ConfirmPassword)"/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<SfButton CssClass="e-success" Type="submit">Zmień hasło</SfButton>
|
<SfButton CssClass="e-success" IsPrimary="true" Type="submit">Zmień hasło</SfButton>
|
||||||
</div>
|
</div>
|
||||||
</EditForm>
|
</EditForm>
|
||||||
}
|
}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">Orders Management System © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
</SfCard>
|
</SfCard>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
20
OrdersManagement/Components/Pages/Main.razor
Normal file
20
OrdersManagement/Components/Pages/Main.razor
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@page "/"
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
|
||||||
|
@attribute [AllowAnonymous]
|
||||||
|
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
await CustomAuthenticationStateProvider.MarkUserAsLoggedOut();
|
||||||
|
NavigationManager.NavigateTo("/login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
@inject NavigationManager Navigation
|
|
||||||
|
|
||||||
@code {
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
Navigation.NavigateTo("/login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,154 +1,159 @@
|
|||||||
@page "/ScheduleOrder/{ScheduleOrderId:int}"
|
@page "/ScheduleOrder/{ScheduleOrderId:int}"
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
@using Syncfusion.Blazor.Lists
|
@using Syncfusion.Blazor.Lists
|
||||||
|
@using Syncfusion.Blazor.Cards
|
||||||
@inject ScheduleOrderService ScheduleOrderService
|
@inject ScheduleOrderService ScheduleOrderService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<h5>Zamówienie DELFOR nr @ScheduleOrderDto?.PONum</h5>
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
<SfListView Id="ScheduleOrderMiscs"
|
<CardHeader>
|
||||||
DataSource="@ScheduleOrderDto?.ScheduleOrderMiscs"
|
<h3 class="text-primary">Zamówienie DELFOR nr @(ScheduleOrderDto?.PONum ?? "Brak numeru")</h3>
|
||||||
ShowHeader="false"
|
</CardHeader>
|
||||||
CssClass="e-list-template">
|
<CardContent>
|
||||||
<ListViewFieldSettings TValue="ScheduleOrderMiscDto" Id="ScheduleOrderMiscListId"
|
<SfListView Id="ScheduleOrderMiscs"
|
||||||
Text="Text"></ListViewFieldSettings>
|
DataSource="@ScheduleOrderDto?.ScheduleOrderMiscs"
|
||||||
<ListViewTemplates Context="item" TValue="ScheduleOrderMiscDto">
|
ShowHeader="false"
|
||||||
<Template>
|
CssClass="e-list-template mb-4">
|
||||||
<span
|
<ListViewFieldSettings TValue="ScheduleOrderMiscDto" Id="ScheduleOrderMiscListId" Text="Text"></ListViewFieldSettings>
|
||||||
class="e-list-content"><b>@item.Label:</b> @item.Value
|
<ListViewTemplates Context="item" TValue="ScheduleOrderMiscDto">
|
||||||
</span>
|
<Template>
|
||||||
</Template>
|
<span class="e-list-content"><b>@item.Label:</b> @item.Value</span>
|
||||||
</ListViewTemplates>
|
</Template>
|
||||||
</SfListView>
|
</ListViewTemplates>
|
||||||
<br/>
|
</SfListView>
|
||||||
<h5>Indeksy</h5>
|
|
||||||
<SfGrid AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
TValue="ScheduleOrderDetailDto"
|
|
||||||
DataSource="@_scheduleOrderDetails"
|
|
||||||
EnableAdaptiveUI="true">
|
|
||||||
<GridTemplates>
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
IList<ScheduleOrderDetailMiscDto>? scheduleOrderDetailMiscs = (@context as ScheduleOrderDetailDto)?.ScheduleOrderDetailMiscs;
|
|
||||||
IList<ScheduleOrderDetailDetailDto>? scheduleOrderDetailDetails = (@context as ScheduleOrderDetailDto)?.ScheduleOrderDetailDetails;
|
|
||||||
|
|
||||||
<SfListView Id="ScheduleOrderDetailMiscs"
|
<h5 class="text-primary mb-3">Indeksy</h5>
|
||||||
DataSource="@scheduleOrderDetailMiscs"
|
<SfGrid AllowFiltering="true"
|
||||||
ShowHeader="false"
|
AllowPaging="true"
|
||||||
CssClass="e-list-template">
|
AllowSorting="true"
|
||||||
<ListViewFieldSettings TValue="ScheduleOrderDetailMiscDto" Id="ScheduleOrderDetailMiscListId"
|
AllowSelection="true"
|
||||||
Text="Text"></ListViewFieldSettings>
|
TValue="ScheduleOrderDetailDto"
|
||||||
<ListViewTemplates Context="item" TValue="ScheduleOrderDetailMiscDto">
|
DataSource="@_scheduleOrderDetails"
|
||||||
<Template>
|
EnableAdaptiveUI="true">
|
||||||
<span
|
<GridTemplates>
|
||||||
class="e-list-content"><b>@item.Label:</b> @item.Value
|
<DetailTemplate>
|
||||||
</span>
|
@{
|
||||||
</Template>
|
IList<ScheduleOrderDetailMiscDto>? scheduleOrderDetailMiscs = (@context as ScheduleOrderDetailDto)?.ScheduleOrderDetailMiscs;
|
||||||
</ListViewTemplates>
|
IList<ScheduleOrderDetailDetailDto>? scheduleOrderDetailDetails = (@context as ScheduleOrderDetailDto)?.ScheduleOrderDetailDetails;
|
||||||
</SfListView>
|
|
||||||
<br/>
|
|
||||||
<h5>Harmonogramy</h5>
|
|
||||||
<SfGrid AllowFiltering="true"
|
|
||||||
AllowPaging="true"
|
|
||||||
AllowSorting="true"
|
|
||||||
AllowSelection="true"
|
|
||||||
TValue="ScheduleOrderDetailDetailDto"
|
|
||||||
DataSource="@scheduleOrderDetailDetails"
|
|
||||||
EnableAdaptiveUI="true"
|
|
||||||
AdaptiveUIMode="AdaptiveMode.Both">
|
|
||||||
<GridEvents TValue="ScheduleOrderDetailDetailDto" RowDataBound="OnRowDataBound"/>
|
|
||||||
<GridTemplates Context="detailDetail">
|
|
||||||
<DetailTemplate>
|
|
||||||
@{
|
|
||||||
IList<ScheduleOrderDetailDetailMiscDto>? scheduleOrderDetailDetailMiscs = (@detailDetail as ScheduleOrderDetailDetailDto)?.ScheduleOrderDetailDetailMiscs;
|
|
||||||
|
|
||||||
<SfListView Id="ScheduleOrderDetailDetailMiscs"
|
<SfListView Id="ScheduleOrderDetailMiscs"
|
||||||
DataSource="@scheduleOrderDetailDetailMiscs"
|
DataSource="@scheduleOrderDetailMiscs"
|
||||||
ShowHeader="false"
|
ShowHeader="false"
|
||||||
CssClass="e-list-template">
|
CssClass="e-list-template mb-4">
|
||||||
<ListViewFieldSettings TValue="ScheduleOrderDetailDetailMiscDto"
|
<ListViewFieldSettings TValue="ScheduleOrderDetailMiscDto" Id="ScheduleOrderDetailMiscListId" Text="Text"></ListViewFieldSettings>
|
||||||
Id="ScheduleOrderDetailDetailMiscListId"
|
<ListViewTemplates Context="item" TValue="ScheduleOrderDetailMiscDto">
|
||||||
Text="Text"></ListViewFieldSettings>
|
<Template>
|
||||||
<ListViewTemplates Context="item" TValue="ScheduleOrderDetailDetailMiscDto">
|
<span class="e-list-content"><b>@item.Label:</b> @item.Value</span>
|
||||||
<Template>
|
</Template>
|
||||||
<span
|
</ListViewTemplates>
|
||||||
class="e-list-content"><b>@item.Label:</b> @item.Value
|
</SfListView>
|
||||||
</span>
|
|
||||||
</Template>
|
<h5 class="text-primary mb-3">Harmonogramy</h5>
|
||||||
</ListViewTemplates>
|
<SfGrid AllowFiltering="true"
|
||||||
</SfListView>
|
AllowPaging="true"
|
||||||
}
|
AllowSorting="true"
|
||||||
</DetailTemplate>
|
AllowSelection="true"
|
||||||
</GridTemplates>
|
TValue="ScheduleOrderDetailDetailDto"
|
||||||
<GridColumns>
|
DataSource="@scheduleOrderDetailDetails"
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateFrom) HeaderText="Data Od"
|
EnableAdaptiveUI="true"
|
||||||
Width="100"></GridColumn>
|
AdaptiveUIMode="AdaptiveMode.Both">
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateTo) HeaderText="Data Do"
|
<GridEvents TValue="ScheduleOrderDetailDetailDto" RowDataBound="OnRowDataBound"/>
|
||||||
Width="100"></GridColumn>
|
<GridTemplates Context="detailDetail">
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.Qty) TextAlign="TextAlign.Right"
|
<DetailTemplate>
|
||||||
HeaderText="Ilość Sztuk" Width="50"></GridColumn>
|
@{
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyType) TextAlign="TextAlign.Right"
|
IList<ScheduleOrderDetailDetailMiscDto>? scheduleOrderDetailDetailMiscs = (@detailDetail as ScheduleOrderDetailDetailDto)?.ScheduleOrderDetailDetailMiscs;
|
||||||
HeaderText="Typ Qty" Width="50"></GridColumn>
|
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyDesc) HeaderText="Opis Typu"
|
<SfListView Id="ScheduleOrderDetailDetailMiscs"
|
||||||
Width="100"></GridColumn>
|
DataSource="@scheduleOrderDetailDetailMiscs"
|
||||||
</GridColumns>
|
ShowHeader="false"
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
CssClass="e-list-template mb-4">
|
||||||
<GridPageSettings PageSize="10"/>
|
<ListViewFieldSettings TValue="ScheduleOrderDetailDetailMiscDto" Id="ScheduleOrderDetailDetailMiscListId" Text="Text"></ListViewFieldSettings>
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
<ListViewTemplates Context="item" TValue="ScheduleOrderDetailDetailMiscDto">
|
||||||
</SfGrid>
|
<Template>
|
||||||
}
|
<span class="e-list-content"><b>@item.Label:</b> @item.Value</span>
|
||||||
</DetailTemplate>
|
</Template>
|
||||||
</GridTemplates>
|
</ListViewTemplates>
|
||||||
<GridColumns>
|
</SfListView>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.OrderNumber) HeaderText="Numer Zamówienia"
|
}
|
||||||
Width="100"></GridColumn>
|
</DetailTemplate>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.PurchaserName) HeaderText="Klient"
|
</GridTemplates>
|
||||||
Width="100"></GridColumn>
|
<GridColumns>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientName) HeaderText="Odbiorca"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateFrom) HeaderText="Data Od" Width="100"></GridColumn>
|
||||||
Width="100"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateTo) HeaderText="Data Do" Width="100"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientCode) HeaderText="Kod odbiorcy" Width="100"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.Qty) TextAlign="TextAlign.Right" HeaderText="Ilość Sztuk" Width="50"></GridColumn>
|
||||||
AllowFiltering="true"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyType) TextAlign="TextAlign.Right" HeaderText="Typ Qty" Width="50"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sh_productCode) HeaderText="Pozycja"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyDesc) HeaderText="Opis Typu" Width="100"></GridColumn>
|
||||||
Width="100"></GridColumn>
|
</GridColumns>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sc_productCode) HeaderText="Pozycja Klienta"
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
Width="100"></GridColumn>
|
<GridPageSettings PageSize="10"/>
|
||||||
</GridColumns>
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
</SfGrid>
|
||||||
<GridPageSettings PageSize="10"/>
|
}
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
</DetailTemplate>
|
||||||
</SfGrid>
|
</GridTemplates>
|
||||||
|
<GridColumns>
|
||||||
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.OrderNumber) HeaderText="Numer Zamówienia" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.PurchaserName) HeaderText="Klient" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientName) HeaderText="Odbiorca" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientCode) HeaderText="Kod odbiorcy" Width="100" AllowFiltering="true"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sh_productCode) HeaderText="Pozycja" Width="100"></GridColumn>
|
||||||
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sc_productCode) HeaderText="Pozycja Klienta" Width="100"></GridColumn>
|
||||||
|
</GridColumns>
|
||||||
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
|
<GridPageSettings PageSize="10"/>
|
||||||
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
|
</SfGrid>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
|
</SfCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public int ScheduleOrderId { get; set; }
|
[Parameter] public int ScheduleOrderId { get; set; }
|
||||||
|
|
||||||
private IEnumerable<ScheduleOrderDetailDto>? _scheduleOrderDetails;
|
private IEnumerable<ScheduleOrderDetailDto>? _scheduleOrderDetails;
|
||||||
|
|
||||||
private ScheduleOrderDto? ScheduleOrderDto { get; set; }
|
private ScheduleOrderDto? ScheduleOrderDto { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
ScheduleOrderDto = await ScheduleOrderService.GetScheduleOrderAsync(ScheduleOrderId);
|
if (firstRender)
|
||||||
|
|
||||||
_scheduleOrderDetails = ScheduleOrderDto?.ScheduleOrderDetails;
|
|
||||||
|
|
||||||
if (ScheduleOrderDto is not null && _scheduleOrderDetails is not null)
|
|
||||||
{
|
{
|
||||||
foreach (ScheduleOrderDetailDto scheduleOrderDetailDto in _scheduleOrderDetails)
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
|
||||||
|
if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
{
|
||||||
scheduleOrderDetailDto.OrderNumber = ScheduleOrderDto?.PONum;
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
scheduleOrderDetailDto.RecipientCode = ScheduleOrderDto?.RecipientCode;
|
}
|
||||||
scheduleOrderDetailDto.RecipientName = ScheduleOrderDto?.RecipientName;
|
else
|
||||||
scheduleOrderDetailDto.PurchaserName = ScheduleOrderDto?.PurchaserCode;
|
{
|
||||||
|
ScheduleOrderDto = await ScheduleOrderService.GetScheduleOrderAsync(ScheduleOrderId);
|
||||||
|
|
||||||
|
_scheduleOrderDetails = ScheduleOrderDto?.ScheduleOrderDetails;
|
||||||
|
|
||||||
|
if (ScheduleOrderDto is not null && _scheduleOrderDetails is not null)
|
||||||
|
{
|
||||||
|
foreach (ScheduleOrderDetailDto scheduleOrderDetailDto in _scheduleOrderDetails)
|
||||||
|
{
|
||||||
|
scheduleOrderDetailDto.OrderNumber = ScheduleOrderDto?.PONum;
|
||||||
|
scheduleOrderDetailDto.RecipientCode = ScheduleOrderDto?.RecipientCode;
|
||||||
|
scheduleOrderDetailDto.RecipientName = ScheduleOrderDto?.RecipientName;
|
||||||
|
scheduleOrderDetailDto.PurchaserName = ScheduleOrderDto?.PurchaserCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRowDataBound(RowDataBoundEventArgs<ScheduleOrderDetailDetailDto> args)
|
private void OnRowDataBound(RowDataBoundEventArgs<ScheduleOrderDetailDetailDto> args)
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
|
||||||
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using OrdersManagement.Components.Pages.Shared
|
@using OrdersManagement.Components.Pages.Shared
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
|
|
||||||
@inject ScheduleOrderService ScheduleOrderService
|
@inject ScheduleOrderService ScheduleOrderService
|
||||||
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
|
@inject NavigationManager NavigationManager;
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<ScheduleOrdersGrid PageSize="20" PassGridRef="SetGridRef" GridData="_scheduleOrders" />
|
||||||
<h5>Zamówienia DELFOR</h5>
|
|
||||||
<ScheduleOrdersGrid PageSize="20" PassGridRef="SetGridRef" GridData="_scheduleOrders" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private IEnumerable<ScheduleOrderDto> _scheduleOrders = [];
|
private IEnumerable<ScheduleOrderDto> _scheduleOrders = [];
|
||||||
@@ -20,8 +20,17 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
_scheduleOrders = await FetchScheduleOrdersAsync();
|
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
StateHasChanged();
|
|
||||||
|
if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Unauthorized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_scheduleOrders = await FetchScheduleOrdersAsync();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,116 +1,103 @@
|
|||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@using Syncfusion.Blazor.Grids
|
@using Syncfusion.Blazor.Grids
|
||||||
|
@using Syncfusion.Blazor.Cards
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
@inject ScheduleOrderService ScheduleOrderService
|
@inject ScheduleOrderService ScheduleOrderService
|
||||||
|
|
||||||
<div class="h-100 d-flex flex-column">
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||||
<SfGrid @ref="Grid"
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||||
TValue="ScheduleOrderDto"
|
<CardHeader>
|
||||||
AllowFiltering="true"
|
<h3 class="text-primary">Zamówienia DELFOR</h3>
|
||||||
AllowPaging="true"
|
</CardHeader>
|
||||||
AllowSorting="true"
|
<CardContent>
|
||||||
AllowSelection="true"
|
<SfGrid @ref="Grid"
|
||||||
DataSource="@_dataSource"
|
TValue="ScheduleOrderDto"
|
||||||
EnableAdaptiveUI="true"
|
AllowFiltering="true"
|
||||||
EnablePersistence="true"
|
AllowPaging="true"
|
||||||
AdaptiveUIMode="AdaptiveMode.Both"
|
AllowSorting="true"
|
||||||
AllowRowClick="true"
|
AllowSelection="true"
|
||||||
SelectionMode="GridSelectionMode.Single"
|
DataSource="@_dataSource"
|
||||||
QueryCellInfo="OnQueryCellInfo"
|
EnableAdaptiveUI="true"
|
||||||
RowSelected="OnRowSelected">
|
EnablePersistence="true"
|
||||||
<GridColumns>
|
AdaptiveUIMode="AdaptiveMode.Both"
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDto.PONum) HeaderText="Zamówienie Klienta" Width="150"
|
AllowRowClick="true"
|
||||||
AllowFiltering="true"></GridColumn>
|
SelectionMode="GridSelectionMode.Single"
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDto.PurchaserCode) HeaderText="Klient" Width="100"
|
QueryCellInfo="OnQueryCellInfo"
|
||||||
AllowFiltering="true"></GridColumn>
|
RowSelected="OnRowSelected">
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDto.RecipientName) HeaderText="Odbiorca" Width="100"
|
<GridColumns>
|
||||||
AllowFiltering="true"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDto.PONum) HeaderText="Zamówienie Klienta" Width="150" AllowFiltering="true"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDto.RecipientCode) HeaderText="Kod odbiorcy" Width="100"
|
<GridColumn Field=@nameof(ScheduleOrderDto.PurchaserCode) HeaderText="Klient" Width="100" AllowFiltering="true"></GridColumn>
|
||||||
AllowFiltering="true"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDto.RecipientName) HeaderText="Odbiorca" Width="100" AllowFiltering="true"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDto.LastUpdateDate) HeaderText="Data Utworzenia" Format="d"
|
<GridColumn Field=@nameof(ScheduleOrderDto.RecipientCode) HeaderText="Kod odbiorcy" Width="100" AllowFiltering="true"></GridColumn>
|
||||||
Type="ColumnType.Date" Width="130" AllowFiltering="true"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDto.LastUpdateDate) HeaderText="Data Utworzenia" Format="d" Type="ColumnType.Date" Width="130" AllowFiltering="true"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDto.DocType) HeaderText="Typ Dokumentu" Width="100"
|
<GridColumn Field=@nameof(ScheduleOrderDto.DocType) HeaderText="Typ Dokumentu" Width="100" AllowFiltering="true"></GridColumn>
|
||||||
AllowFiltering="true"></GridColumn>
|
</GridColumns>
|
||||||
</GridColumns>
|
<GridTemplates>
|
||||||
<GridTemplates>
|
<DetailTemplate>
|
||||||
<DetailTemplate>
|
@{
|
||||||
@{
|
IList<ScheduleOrderDetailDto>? scheduleOrderDetails = (@context as ScheduleOrderDto)?.ScheduleOrderDetails;
|
||||||
IList<ScheduleOrderDetailDto>? scheduleOrderDetails = (@context as ScheduleOrderDto)?.ScheduleOrderDetails;
|
<SfGrid AllowFiltering="true"
|
||||||
<SfGrid AllowFiltering="true"
|
AllowPaging="true"
|
||||||
AllowPaging="true"
|
AllowSorting="true"
|
||||||
AllowSorting="true"
|
AllowSelection="true"
|
||||||
AllowSelection="true"
|
TValue="ScheduleOrderDetailDto"
|
||||||
TValue="ScheduleOrderDetailDto"
|
DataSource="@scheduleOrderDetails"
|
||||||
DataSource="@scheduleOrderDetails"
|
EnablePersistence="true"
|
||||||
EnablePersistence="true"
|
EnableAdaptiveUI="true"
|
||||||
EnableAdaptiveUI="true"
|
AdaptiveUIMode="AdaptiveMode.Both">
|
||||||
AdaptiveUIMode="AdaptiveMode.Both">
|
<GridColumns>
|
||||||
<GridColumns>
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.OrderNumber) HeaderText="Numer Zamówienia" Width="100"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.OrderNumber) HeaderText="Numer Zamówienia"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.PurchaserName) HeaderText="Klient" Width="100"></GridColumn>
|
||||||
Width="100"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientName) HeaderText="Odbiorca" Width="100"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.PurchaserName) HeaderText="Klient"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientCode) HeaderText="Kod odbiorcy" Width="100" AllowFiltering="true"></GridColumn>
|
||||||
Width="100"></GridColumn>
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sc_productCode) HeaderText="Pozycja" Width="100"></GridColumn>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientName) HeaderText="Odbiorca"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sh_productCode) HeaderText="Pozycja Klienta" Width="100"></GridColumn>
|
||||||
Width="100"></GridColumn>
|
</GridColumns>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.RecipientCode) HeaderText="Kod odbiorcy"
|
<GridTemplates>
|
||||||
Width="100" AllowFiltering="true"></GridColumn>
|
<DetailTemplate Context="detail">
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sc_productCode) HeaderText="Pozycja"
|
@{
|
||||||
Width="100"></GridColumn>
|
IList<ScheduleOrderDetailDetailDto>? scheduleOrderDetailsDetails = (@detail as ScheduleOrderDetailDto)?.ScheduleOrderDetailDetails;
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sh_productCode)
|
<SfGrid AllowFiltering="true"
|
||||||
HeaderText="Pozycja Klienta" Width="100"></GridColumn>
|
AllowPaging="true"
|
||||||
</GridColumns>
|
AllowSorting="true"
|
||||||
<GridTemplates>
|
AllowSelection="true"
|
||||||
<DetailTemplate Context="detail">
|
TValue="ScheduleOrderDetailDetailDto"
|
||||||
@{
|
DataSource="@scheduleOrderDetailsDetails"
|
||||||
IList<ScheduleOrderDetailDetailDto>? scheduleOrderDetailsDetails = (@detail as ScheduleOrderDetailDto)?.ScheduleOrderDetailDetails;
|
EnableAdaptiveUI="true"
|
||||||
<SfGrid AllowFiltering="true"
|
AdaptiveUIMode="AdaptiveMode.Both">
|
||||||
AllowPaging="true"
|
<GridColumns>
|
||||||
AllowSorting="true"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateFrom) HeaderText="Data Od" Width="100"></GridColumn>
|
||||||
AllowSelection="true"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateTo) HeaderText="Data Do" Width="100"></GridColumn>
|
||||||
TValue="ScheduleOrderDetailDetailDto"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.Qty) TextAlign="TextAlign.Right" HeaderText="Ilość Sztuk" Width="50"></GridColumn>
|
||||||
DataSource="@scheduleOrderDetailsDetails"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyType) TextAlign="TextAlign.Right" HeaderText="Typ Qty" Width="50"></GridColumn>
|
||||||
EnableAdaptiveUI="true"
|
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyDesc) HeaderText="Opis Typu" Width="100"></GridColumn>
|
||||||
AdaptiveUIMode="AdaptiveMode.Both">
|
</GridColumns>
|
||||||
<GridColumns>
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateFrom)
|
<GridPageSettings PageSize="10"/>
|
||||||
HeaderText="Data Od"
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
Width="100"></GridColumn>
|
<GridEvents TValue="ScheduleOrderDetailDetailDto" OnRecordDoubleClick="OnScheduleOrderDetailDetailRowDoubleClick" RowDataBound="OnRowDataBound"/>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.DateTo)
|
</SfGrid>
|
||||||
HeaderText="Data Do"
|
}
|
||||||
Width="100"></GridColumn>
|
</DetailTemplate>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.Qty)
|
</GridTemplates>
|
||||||
TextAlign="TextAlign.Right"
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
HeaderText="Ilość Sztuk" Width="50"></GridColumn>
|
<GridPageSettings PageSize="10"/>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyType)
|
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||||
TextAlign="TextAlign.Right"
|
<GridEvents TValue="ScheduleOrderDetailDto" OnRecordDoubleClick="OnScheduleOrderDetailRowDoubleClick"/>
|
||||||
HeaderText="Typ Qty" Width="50"></GridColumn>
|
</SfGrid>
|
||||||
<GridColumn Field=@nameof(ScheduleOrderDetailDetailDto.QtyDesc)
|
}
|
||||||
HeaderText="Opis Typu"
|
</DetailTemplate>
|
||||||
Width="100"></GridColumn>
|
</GridTemplates>
|
||||||
</GridColumns>
|
<GridEvents TValue="ScheduleOrderDto" OnRecordDoubleClick="OnScheduleOrderRowDoubleClick" DetailsExpanding="OnDetailsExpanding"/>
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
<GridFilterSettings Type="FilterType.Excel"/>
|
||||||
<GridPageSettings PageSize="10"/>
|
<GridPageSettings PageSize="@PageSize"/>
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
</SfGrid>
|
||||||
<GridEvents TValue="ScheduleOrderDetailDetailDto" OnRecordDoubleClick="OnScheduleOrderDetailDetailRowDoubleClick"
|
</CardContent>
|
||||||
RowDataBound="OnRowDataBound"/>
|
<CardFooter>
|
||||||
</SfGrid>
|
<small class="text-muted">Orders Management System © @(DateTime.Now.Year)</small>
|
||||||
}
|
</CardFooter>
|
||||||
</DetailTemplate>
|
</SfCard>
|
||||||
</GridTemplates>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="10"/>
|
|
||||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
|
||||||
<GridEvents TValue="ScheduleOrderDetailDto" OnRecordDoubleClick="OnScheduleOrderDetailRowDoubleClick"/>
|
|
||||||
</SfGrid>
|
|
||||||
}
|
|
||||||
</DetailTemplate>
|
|
||||||
</GridTemplates>
|
|
||||||
<GridEvents TValue="ScheduleOrderDto" OnRecordDoubleClick="OnScheduleOrderRowDoubleClick"
|
|
||||||
DetailsExpanding="OnDetailsExpanding"/>
|
|
||||||
<GridFilterSettings Type="FilterType.Excel"/>
|
|
||||||
<GridPageSettings PageSize="PageSize"/>
|
|
||||||
</SfGrid>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|||||||
35
OrdersManagement/Components/Pages/Unauthorized.razor
Normal file
35
OrdersManagement/Components/Pages/Unauthorized.razor
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
@page "/Unauthorized"
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
|
||||||
|
@attribute [AllowAnonymous]
|
||||||
|
|
||||||
|
@using Syncfusion.Blazor.Cards
|
||||||
|
@using Syncfusion.Blazor.Buttons
|
||||||
|
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<div class="h-100 d-flex justify-content-center align-items-start pt-5">
|
||||||
|
<SfCard CssClass="text-center shadow" style="max-width: 500px;">
|
||||||
|
<CardHeader>
|
||||||
|
<h3 class="text-warning">Brak autoryzacji</h3>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p class="text-muted mb-4">
|
||||||
|
Ups! Wygląda na to, że nie masz dostępu do tej strony. Aby kontynuować, zaloguj się do swojego konta.
|
||||||
|
</p>
|
||||||
|
<SfButton CssClass="e-primary" IsPrimary="true" @onclick="NavigateToLogin">
|
||||||
|
Przejdź do logowania
|
||||||
|
</SfButton>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<small class="text-muted">Orders Management System © @(DateTime.Now.Year)</small>
|
||||||
|
</CardFooter>
|
||||||
|
</SfCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private void NavigateToLogin()
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/login");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,18 +10,20 @@ public class CustomAuthenticationStateProvider(ILocalStorageService localStorage
|
|||||||
private string? _token;
|
private string? _token;
|
||||||
private ClaimsPrincipal _currentUser = new(new ClaimsIdentity());
|
private ClaimsPrincipal _currentUser = new(new ClaimsIdentity());
|
||||||
|
|
||||||
public override Task<AuthenticationState> GetAuthenticationStateAsync()
|
public override async Task<AuthenticationState> GetAuthenticationStateAsync()
|
||||||
{
|
{
|
||||||
|
_token = await localStorage.GetItemAsync<string>("authToken");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_token))
|
if (string.IsNullOrEmpty(_token))
|
||||||
{
|
{
|
||||||
return Task.FromResult(new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity())));
|
return await Task.FromResult(new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity())));
|
||||||
}
|
}
|
||||||
|
|
||||||
var handler = new JwtSecurityTokenHandler();
|
var handler = new JwtSecurityTokenHandler();
|
||||||
var jwtToken = handler.ReadJwtToken(_token);
|
var jwtToken = handler.ReadJwtToken(_token);
|
||||||
var identity = new ClaimsIdentity(jwtToken.Claims, "jwt");
|
var identity = new ClaimsIdentity(jwtToken.Claims, "jwt", JwtRegisteredClaimNames.Sub, null);
|
||||||
_currentUser = new ClaimsPrincipal(identity);
|
_currentUser = new ClaimsPrincipal(identity);
|
||||||
return Task.FromResult(new AuthenticationState(_currentUser));
|
return await Task.FromResult(new AuthenticationState(_currentUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task MarkUserAsAuthenticated(string? token)
|
public async Task MarkUserAsAuthenticated(string? token)
|
||||||
@@ -30,7 +32,7 @@ public class CustomAuthenticationStateProvider(ILocalStorageService localStorage
|
|||||||
await localStorage.SetItemAsync("authToken", token);
|
await localStorage.SetItemAsync("authToken", token);
|
||||||
var handler = new JwtSecurityTokenHandler();
|
var handler = new JwtSecurityTokenHandler();
|
||||||
var jwtToken = handler.ReadJwtToken(token);
|
var jwtToken = handler.ReadJwtToken(token);
|
||||||
var identity = new ClaimsIdentity(jwtToken.Claims, "jwt");
|
var identity = new ClaimsIdentity(jwtToken.Claims, "jwt", JwtRegisteredClaimNames.Sub, null);
|
||||||
_currentUser = new ClaimsPrincipal(identity);
|
_currentUser = new ClaimsPrincipal(identity);
|
||||||
NotifyAuthenticationStateChanged(Task.FromResult(new AuthenticationState(_currentUser)));
|
NotifyAuthenticationStateChanged(Task.FromResult(new AuthenticationState(_currentUser)));
|
||||||
}
|
}
|
||||||
@@ -42,21 +44,8 @@ public class CustomAuthenticationStateProvider(ILocalStorageService localStorage
|
|||||||
_currentUser = new ClaimsPrincipal(new ClaimsIdentity());
|
_currentUser = new ClaimsPrincipal(new ClaimsIdentity());
|
||||||
NotifyAuthenticationStateChanged(Task.FromResult(new AuthenticationState(_currentUser)));
|
NotifyAuthenticationStateChanged(Task.FromResult(new AuthenticationState(_currentUser)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InitializeAsync()
|
|
||||||
{
|
|
||||||
_token = await localStorage.GetItemAsync<string>("authToken");
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(_token))
|
|
||||||
{
|
|
||||||
var handler = new JwtSecurityTokenHandler();
|
|
||||||
var jwtToken = handler.ReadJwtToken(_token);
|
|
||||||
var identity = new ClaimsIdentity(jwtToken.Claims, "jwt");
|
|
||||||
_currentUser = new ClaimsPrincipal(identity);
|
|
||||||
NotifyAuthenticationStateChanged(Task.FromResult(new AuthenticationState(_currentUser)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string? GetToken() => _token;
|
public string? GetToken() => _token;
|
||||||
|
public ClaimsPrincipal GetCurrentUser() => _currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
|||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddAuthorizationCore();
|
builder.Services.AddAuthorizationCore();
|
||||||
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthenticationStateProvider>();
|
builder.Services.AddScoped<CustomAuthenticationStateProvider>();
|
||||||
|
|
||||||
builder.Services.AddHttpClient("FaKrosnoApi", client =>
|
builder.Services.AddHttpClient("FaKrosnoApi", client =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace OrdersManagement.Services;
|
|||||||
|
|
||||||
public class CustomerOrderService(
|
public class CustomerOrderService(
|
||||||
IHttpClientFactory httpClientFactory,
|
IHttpClientFactory httpClientFactory,
|
||||||
AuthenticationStateProvider authenticationStateProvider)
|
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
: ServiceBase<CustomerOrderDto>(httpClientFactory, authenticationStateProvider)
|
: ServiceBase<CustomerOrderDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<CustomerOrderDto>?> GetCustomerOrdersAsync()
|
public async Task<IEnumerable<CustomerOrderDto>?> GetCustomerOrdersAsync()
|
||||||
@@ -25,7 +25,7 @@ public class CustomerOrderService(
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await GetByIdAsync($"api/CustomerOrders/by-order-number/?customerOrderNumber={customerOrderNumber}");
|
return await GetEntityAsync($"api/CustomerOrders/by-order-number/?customerOrderNumber={customerOrderNumber}");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using SytelineSaAppEfDataModel.Dtos;
|
|||||||
|
|
||||||
namespace OrdersManagement.Services
|
namespace OrdersManagement.Services
|
||||||
{
|
{
|
||||||
public class EdiCustomerOrderService(IHttpClientFactory httpClientFactory, AuthenticationStateProvider authenticationStateProvider, ErrorLogService errorLogService) : ServiceBase<EdiCustomerOrderDto>(httpClientFactory, authenticationStateProvider)
|
public class EdiCustomerOrderService(IHttpClientFactory httpClientFactory, CustomAuthenticationStateProvider authenticationStateProvider, ErrorLogService errorLogService) : ServiceBase<EdiCustomerOrderDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<EdiCustomerOrderDto>?> GetEdiCustomerOrdersAsync()
|
public async Task<IEnumerable<EdiCustomerOrderDto>?> GetEdiCustomerOrdersAsync()
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@ namespace OrdersManagement.Services
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await GetByIdAsync($"api/EdiCustomerOrders/by-order-number/?customerOrderNumber={customerOrderNumber}");
|
return await GetEntityAsync($"api/EdiCustomerOrders/by-order-number/?customerOrderNumber={customerOrderNumber}");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace OrdersManagement.Services;
|
|||||||
|
|
||||||
public class ErrorLogService(
|
public class ErrorLogService(
|
||||||
IHttpClientFactory httpClientFactory,
|
IHttpClientFactory httpClientFactory,
|
||||||
AuthenticationStateProvider authenticationStateProvider)
|
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
: ServiceBase<ErrorLogDto>(httpClientFactory, authenticationStateProvider)
|
: ServiceBase<ErrorLogDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<ErrorLogDto>?> GetErrorLogsAsync(Guid customerOrderNumber)
|
public async Task<IEnumerable<ErrorLogDto>?> GetErrorLogsAsync(Guid customerOrderNumber)
|
||||||
|
|||||||
@@ -2,27 +2,30 @@ using OrdersManagementDataModel.Dtos;
|
|||||||
|
|
||||||
namespace OrdersManagement.Services;
|
namespace OrdersManagement.Services;
|
||||||
|
|
||||||
public class HangfireService(HttpClient httpClient)
|
public class HangfireService(
|
||||||
|
IHttpClientFactory httpClientFactory,
|
||||||
|
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
|
: ServiceBase<TaskSchedulerDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<TaskSchedulerDto>?> GetTaskSchedulersAsync()
|
public async Task<IEnumerable<TaskSchedulerDto>?> GetTaskSchedulersAsync()
|
||||||
{
|
{
|
||||||
return await httpClient.GetFromJsonAsync<IEnumerable<TaskSchedulerDto>>("api/HangfireJobs/GetTasks");
|
return await GetListAsync("api/HangfireJobs/");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TaskSchedulerDto?> GetTaskSchedulerAsync(Guid id)
|
public async Task<TaskSchedulerDto?> GetTaskSchedulerAsync(Guid id)
|
||||||
{
|
{
|
||||||
return await httpClient.GetFromJsonAsync<TaskSchedulerDto>($"api/HangfireJobs/{id}");
|
return await GetEntityAsync($"api/HangfireJobs/{id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> AddTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
public async Task<int> AddTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
||||||
{
|
{
|
||||||
HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync("api/HangfireJobs/AddTask", taskSchedulerDto);
|
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/add", taskSchedulerDto);
|
||||||
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> DeleteTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
public async Task<int> DeleteTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
||||||
{
|
{
|
||||||
HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync("api/HangfireJobs/DeleteTask", taskSchedulerDto);
|
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/delete", taskSchedulerDto);
|
||||||
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,40 +2,38 @@ using OrdersManagementDataModel.Dtos;
|
|||||||
|
|
||||||
namespace OrdersManagement.Services;
|
namespace OrdersManagement.Services;
|
||||||
|
|
||||||
public class RoleService(HttpClient httpClient)
|
public class RoleService(
|
||||||
|
IHttpClientFactory httpClientFactory,
|
||||||
|
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
|
: ServiceBase<RoleDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<RoleDto>?> GetRolesAsync()
|
public async Task<IEnumerable<RoleDto>?> GetRolesAsync()
|
||||||
{
|
{
|
||||||
return await httpClient.GetFromJsonAsync<IEnumerable<RoleDto>>("api/Roles");
|
return await GetListAsync("api/Roles");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RoleDto?> GetRoleAsync(Guid roleId)
|
public async Task<RoleDto?> GetRoleAsync(Guid roleId)
|
||||||
{
|
{
|
||||||
return await httpClient.GetFromJsonAsync<RoleDto>($"api/Roles/by-id/?id={roleId}");
|
return await GetEntityAsync($"api/Roles/by-id/?id={roleId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RoleDto?> GetRoleByNameAsync(string roleName)
|
public async Task<RoleDto?> GetRoleByNameAsync(string roleName)
|
||||||
{
|
{
|
||||||
return await httpClient.GetFromJsonAsync<RoleDto>($"api/Roles/by-name/?name={roleName}");
|
return await GetEntityAsync($"api/Roles/by-name/?name={roleName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddRoleAsync(RoleDto role)
|
public async Task<HttpResponseMessage> AddRoleAsync(RoleDto role)
|
||||||
{
|
{
|
||||||
await httpClient.PostAsJsonAsync("api/Roles", role);
|
return await PostAsJsonAsync("api/Roles", role);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateRoleAsync(RoleDto role)
|
public async Task<HttpResponseMessage> UpdateRoleAsync(RoleDto role)
|
||||||
{
|
{
|
||||||
await httpClient.PutAsJsonAsync("api/Roles", role);
|
return await PutAsJsonAsync("api/Roles", role);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteRoleAsync(Guid roleId)
|
public async Task<HttpResponseMessage> DeleteRoleAsync(Guid roleId)
|
||||||
{
|
{
|
||||||
await httpClient.DeleteAsync($"api/Roles/?id={roleId}");
|
return await DeleteAsync($"api/Roles/?id={roleId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// public async Task<IEnumerable<UserDto>?> GetUsersInRoleAsync(Guid roleId)
|
|
||||||
// {
|
|
||||||
// return await httpClient.GetFromJsonAsync<IEnumerable<UserDto>>($"api/Roles/{roleId}/Users");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace OrdersManagement.Services;
|
|||||||
|
|
||||||
public class ScheduleOrderService(
|
public class ScheduleOrderService(
|
||||||
IHttpClientFactory httpClientFactory,
|
IHttpClientFactory httpClientFactory,
|
||||||
AuthenticationStateProvider authenticationStateProvider)
|
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
: ServiceBase<ScheduleOrderDto>(httpClientFactory, authenticationStateProvider)
|
: ServiceBase<ScheduleOrderDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<ScheduleOrderDto>?> GetScheduleOrdersAsync()
|
public async Task<IEnumerable<ScheduleOrderDto>?> GetScheduleOrdersAsync()
|
||||||
@@ -27,7 +27,7 @@ public class ScheduleOrderService(
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await GetByIdAsync($"api/ScheduleOrders/{scheduleOrderId}");
|
return await GetEntityAsync($"api/ScheduleOrders/{scheduleOrderId}");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,26 +4,28 @@ namespace OrdersManagement.Services;
|
|||||||
|
|
||||||
public class ServiceBase<T> where T : class
|
public class ServiceBase<T> where T : class
|
||||||
{
|
{
|
||||||
private readonly AuthenticationStateProvider _authenticationStateProvider;
|
private readonly CustomAuthenticationStateProvider _authenticationStateProvider;
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
|
|
||||||
protected ServiceBase(IHttpClientFactory httpClientFactory, AuthenticationStateProvider authenticationStateProvider)
|
protected ServiceBase(IHttpClientFactory httpClientFactory, CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
{
|
{
|
||||||
_authenticationStateProvider = authenticationStateProvider;
|
_authenticationStateProvider = authenticationStateProvider;
|
||||||
_httpClient = httpClientFactory.CreateClient("FaKrosnoApi");
|
_httpClient = httpClientFactory.CreateClient("FaKrosnoApi");
|
||||||
|
|
||||||
_ = Configure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<IEnumerable<T>?> GetListAsync(string request)
|
protected async Task<IEnumerable<T>?> GetListAsync(string request)
|
||||||
{
|
{
|
||||||
|
Configure();
|
||||||
|
|
||||||
var response = await _httpClient.GetAsync(request);
|
var response = await _httpClient.GetAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
return await response.Content.ReadFromJsonAsync<IEnumerable<T>>();
|
return await response.Content.ReadFromJsonAsync<IEnumerable<T>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<T?> GetByIdAsync(string request)
|
protected async Task<T?> GetEntityAsync(string request)
|
||||||
{
|
{
|
||||||
|
Configure();
|
||||||
|
|
||||||
var response = await _httpClient.GetAsync(request);
|
var response = await _httpClient.GetAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
return await response.Content.ReadFromJsonAsync<T>();
|
return await response.Content.ReadFromJsonAsync<T>();
|
||||||
@@ -31,22 +33,54 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<HttpResponseMessage> PostAsync(string request)
|
protected async Task<HttpResponseMessage> PostAsync(string request)
|
||||||
{
|
{
|
||||||
|
Configure();
|
||||||
|
|
||||||
var response = await _httpClient.PostAsync(request, null);
|
var response = await _httpClient.PostAsync(request, null);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Configure()
|
protected async Task<HttpResponseMessage> PostAsJsonAsync(string request, T obj)
|
||||||
{
|
{
|
||||||
var token = await GetToken();
|
Configure();
|
||||||
|
|
||||||
|
var response = await _httpClient.PostAsJsonAsync(request, obj);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<HttpResponseMessage> PostAsJsonAsync(string request, object obj)
|
||||||
|
{
|
||||||
|
Configure();
|
||||||
|
|
||||||
|
var response = await _httpClient.PostAsJsonAsync(request, obj);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<HttpResponseMessage> PutAsJsonAsync(string request, T obj)
|
||||||
|
{
|
||||||
|
Configure();
|
||||||
|
|
||||||
|
var response = await _httpClient.PutAsJsonAsync(request, obj);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<HttpResponseMessage> DeleteAsync(string request)
|
||||||
|
{
|
||||||
|
Configure();
|
||||||
|
|
||||||
|
var response = await _httpClient.DeleteAsync(request);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Configure()
|
||||||
|
{
|
||||||
|
var token = _authenticationStateProvider.GetToken();
|
||||||
|
|
||||||
_httpClient.DefaultRequestHeaders.Authorization =
|
_httpClient.DefaultRequestHeaders.Authorization =
|
||||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string?> GetToken()
|
|
||||||
{
|
|
||||||
await ((CustomAuthenticationStateProvider)_authenticationStateProvider).InitializeAsync();
|
|
||||||
return ((CustomAuthenticationStateProvider)_authenticationStateProvider).GetToken();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,31 @@
|
|||||||
using Blazored.LocalStorage;
|
|
||||||
using Microsoft.AspNetCore.Components.Authorization;
|
|
||||||
using OrdersManagement.Models;
|
using OrdersManagement.Models;
|
||||||
using OrdersManagementDataModel.Dtos;
|
using OrdersManagementDataModel.Dtos;
|
||||||
|
|
||||||
namespace OrdersManagement.Services;
|
namespace OrdersManagement.Services;
|
||||||
|
|
||||||
public class UserService(IHttpClientFactory clientFactory, AuthenticationStateProvider authStateProvider)
|
public class UserService(
|
||||||
|
IHttpClientFactory httpClientFactory,
|
||||||
|
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||||
|
: ServiceBase<UserDto>(httpClientFactory, authenticationStateProvider)
|
||||||
{
|
{
|
||||||
private readonly HttpClient _httpClient = clientFactory.CreateClient("FaKrosnoApi");
|
private readonly HttpClient _httpClient = httpClientFactory.CreateClient("FaKrosnoApi");
|
||||||
|
|
||||||
public async Task<IEnumerable<UserDto>?> GetUsersAsync()
|
public async Task<IEnumerable<UserDto>?> GetUsersAsync()
|
||||||
{
|
{
|
||||||
return await _httpClient.GetFromJsonAsync<IEnumerable<UserDto>>("api/Users");
|
return await GetListAsync("api/Users");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserDto?> AuthenticateUserAsync(string login, string password)
|
public async Task<UserDto?> AuthenticateUserAsync(string login, string password)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await _httpClient.PostAsJsonAsync("api/Users/login", new { Login = login, Password = password });
|
var response = await PostAsJsonAsync("api/Users/login", new { Login = login, Password = password });
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
var result = await response.Content.ReadFromJsonAsync<LoginResponseDto>();
|
var result = await response.Content.ReadFromJsonAsync<LoginResponseDto>();
|
||||||
|
|
||||||
if (result?.Token == null) return null;
|
if (result?.Token == null) return null;
|
||||||
|
|
||||||
await ((CustomAuthenticationStateProvider)authStateProvider).MarkUserAsAuthenticated(result.Token);
|
await authenticationStateProvider.MarkUserAsAuthenticated(result.Token);
|
||||||
return await GetUserByUsernameAsync(login);
|
return await GetUserByUsernameAsync(login);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,26 +38,26 @@ public class UserService(IHttpClientFactory clientFactory, AuthenticationStatePr
|
|||||||
|
|
||||||
public async Task<UserDto?> GetUserAsync(Guid userId)
|
public async Task<UserDto?> GetUserAsync(Guid userId)
|
||||||
{
|
{
|
||||||
return await _httpClient.GetFromJsonAsync<UserDto>($"api/Users/by-id/?id={userId}");
|
return await GetEntityAsync($"api/Users/by-id/?id={userId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserDto?> GetUserByUsernameAsync(string username)
|
public async Task<UserDto?> GetUserByUsernameAsync(string username)
|
||||||
{
|
{
|
||||||
return await _httpClient.GetFromJsonAsync<UserDto>($"api/Users/by-username/?username={username}");
|
return await GetEntityAsync($"api/Users/by-username/?username={username}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<HttpResponseMessage> AddUserAsync(UserDto user)
|
public async Task<HttpResponseMessage> AddUserAsync(UserDto user)
|
||||||
{
|
{
|
||||||
return await _httpClient.PostAsJsonAsync("api/Users", user);
|
return await PostAsJsonAsync("api/Users", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateUserAsync(UserDto user)
|
public async Task<HttpResponseMessage> UpdateUserAsync(UserDto user)
|
||||||
{
|
{
|
||||||
await _httpClient.PutAsJsonAsync("api/Users", user);
|
return await PutAsJsonAsync("api/Users", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteUserAsync(Guid userId)
|
public async Task<HttpResponseMessage> DeleteUserAsync(Guid userId)
|
||||||
{
|
{
|
||||||
await _httpClient.DeleteAsync($"api/Users/?id={userId}");
|
return await DeleteAsync($"api/Users/?id={userId}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63429,3 +63429,89 @@ html, body {
|
|||||||
.e-grid .e-row.highlight-red .e-rowcell {
|
.e-grid .e-row.highlight-red .e-rowcell {
|
||||||
background-color: #ffcccc !important;
|
background-color: #ffcccc !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.e-menu-container {
|
||||||
|
background-color: #bad9ff; /* Tło głównego menu */
|
||||||
|
border: none; /* Usunięcie domyślnego obramowania */
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Czcionka spójna z projektem */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stylizacja elementów menu na poziomie głównym */
|
||||||
|
.e-menu-container .e-menu .e-menu-item {
|
||||||
|
color: #1a3c66; /* Ciemniejszy niebieski dla kontrastu */
|
||||||
|
font-size: 14px; /* Rozmiar czcionki */
|
||||||
|
padding: 8px 16px; /* Wewnętrzne odstępy */
|
||||||
|
transition: background-color 0.3s ease; /* Płynne przejścia */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stylizacja przy najechaniu (hover) */
|
||||||
|
.e-menu-container .e-menu .e-menu-item:hover {
|
||||||
|
background-color: #b3d9ff; /* Jasniejsze tło przy najechaniu */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stylizacja przy fokusie */
|
||||||
|
.e-menu-container .e-menu .e-menu-item.e-focused {
|
||||||
|
background-color: #b3d9ff; /* Tło przy fokusie */
|
||||||
|
color: #1a3c66; /* Kolor tekstu */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stylizacja wybranego elementu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item.e-selected {
|
||||||
|
background-color: #8ec6fe; /* Tło wybranego elementu */
|
||||||
|
color: #1a3c66; /* Kolor tekstu */
|
||||||
|
font-weight: 600; /* Pogrubienie dla wybranego */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stylizacja ikon w menu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-menu-icon {
|
||||||
|
margin-right: 8px; /* Odstęp między ikoną a tekstem */
|
||||||
|
color: #1a3c66; /* Kolor ikon */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stylizacja podmenu (poziom zagnieżdżony) */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-ul {
|
||||||
|
background-color: #bad9ff; /* Tło podmenu */
|
||||||
|
border: 1px solid #8ec6fe; /* Delikatne obramowanie podmenu */
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Cień dla efektu unoszenia */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Elementy w podmenu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-ul .e-menu-item {
|
||||||
|
color: #1a3c66; /* Kolor tekstu w podmenu */
|
||||||
|
padding: 6px 14px; /* Mniejsze odstępy w podmenu */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hover w podmenu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-ul .e-menu-item:hover {
|
||||||
|
background-color: #b3d9ff; /* Tło przy najechaniu w podmenu */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fokus w podmenu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-ul .e-menu-item.e-focused {
|
||||||
|
background-color: #b3d9ff; /* Tło przy fokusie w podmenu */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wybrany element w podmenu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-ul .e-menu-item.e-selected {
|
||||||
|
background-color: #8ec6fe; /* Tło wybranego elementu w podmenu */
|
||||||
|
color: #1a3c66;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Strzałka wskazująca podmenu */
|
||||||
|
.e-menu-container .e-menu .e-menu-item .e-caret {
|
||||||
|
color: #1a3c66; /* Kolor strzałki */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dostosowanie dla poziomego menu */
|
||||||
|
.e-menu-container.e-horizontal .e-menu-item {
|
||||||
|
display: inline-block; /* Zapewnia poziomy układ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsywność (opcjonalna) */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.e-menu-container .e-menu .e-menu-item {
|
||||||
|
font-size: 12px; /* Mniejszy tekst na urządzeniach mobilnych */
|
||||||
|
padding: 6px 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ public class TaskSchedulerService(OrdersManagementDbContext context, IMapper map
|
|||||||
public async Task<IEnumerable<TaskSchedulerDto>> GetTaskSchedulers()
|
public async Task<IEnumerable<TaskSchedulerDto>> GetTaskSchedulers()
|
||||||
{
|
{
|
||||||
List<TaskSchedulerDto> taskSchedulers =
|
List<TaskSchedulerDto> taskSchedulers =
|
||||||
(await Task.FromResult(OrdersManagementQueries.GetSchedulers(context))).ToList();
|
await context.TaskSchedulers.Select(x => mapper.Map<TaskSchedulerDto>(x)).ToListAsync();
|
||||||
|
|
||||||
return taskSchedulers;
|
return taskSchedulers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user