Authorization, Shipments - Batch/Print views.

This commit is contained in:
Stoyan Zlatev
2023-04-05 15:05:33 +02:00
parent fdfb42da9e
commit 220308088f
41 changed files with 909 additions and 86 deletions
@@ -117,4 +117,12 @@ table.table table.table {
.text-teal {
color: var(--bs-teal);
}
.btn.btn-link:hover {
text-decoration: underline !important;
}
.bg-whitesmoke {
background-color: whitesmoke !important
}
@@ -0,0 +1,23 @@
namespace LaaProductionWeb.App_Infrastructure
{
using System.Security.Claims;
using System.Web.Mvc;
public class AllowedRolesAttribute : AuthorizeAttribute
{
public AllowedRolesAttribute(params string[] roles)
=> this.Roles = string.Join(",", roles);
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
if (filterContext.HttpContext.User is ClaimsPrincipal claimsPrincipal)
{
filterContext.Result = new RedirectResult($"/Account/Authorize?role={this.Roles}");
}
else
{
base.HandleUnauthorizedRequest(filterContext);
}
}
}
}
@@ -0,0 +1,48 @@
namespace LaaProductionWeb.App_Infrastructure
{
using LaaProductionWeb.Services.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Web.Mvc;
public class AuthorizationFilter : IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext)
{
if (filterContext.HttpContext.User is ClaimsPrincipal claimsPrincipal)
{
this.GetWindowsUser(claimsPrincipal, out string primarySID, out string domainName, out string userName);
var accountService = ServiceProvider.Current.GetService<IAccountService>();
var windowsUser = accountService.GetOrCreateWindowsUser(primarySID, domainName, userName);
var claims = new List<Claim> { new Claim(ClaimTypes.NameIdentifier, $"{windowsUser.UserId}") };
foreach (var role in windowsUser.Roles)
{
claims.Add(new Claim(ClaimTypes.Role, role));
}
var claimsIdentity = new ClaimsIdentity(claims, nameof(ClaimsPrincipal), ClaimTypes.Name, ClaimTypes.Role);
claimsPrincipal.AddIdentity(claimsIdentity);
}
}
private void GetWindowsUser(ClaimsPrincipal claimsPrincipal, out string primarySID, out string domainName, out string userName)
{
var nameTokens = claimsPrincipal
.FindFirst(ClaimTypes.Name)
?.Value
?.ToLower()
?.Split(new[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries)
?? Array.Empty<string>();
primarySID = claimsPrincipal.FindFirst(ClaimTypes.PrimarySid)?.Value;
domainName = nameTokens.FirstOrDefault();
userName = nameTokens.LastOrDefault();
}
}
}
@@ -4,6 +4,8 @@
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Web.Mvc;
public static class ControllersExtensions
@@ -32,5 +34,25 @@
return serviceProvider;
}
public static int NameIdentifier(this IPrincipal principal)
{
if (principal is ClaimsPrincipal claimsPrincipal)
{
var nameIdentifier = claimsPrincipal.FindFirst(ClaimTypes.NameIdentifier)?.Value;
if (int.TryParse($"{nameIdentifier}", out int userId))
{
return userId;
}
}
return -1;
}
public static T NameIdentifier<T>(this ViewContext viewContext)
{
return default(T);
}
}
}
@@ -0,0 +1,12 @@
namespace LaaProductionWeb.App_Infrastructure
{
using System.Web.Mvc;
public class ExceptionFilter : IExceptionFilter
{
public void OnException(ExceptionContext filterContext)
{
filterContext.Result = new RedirectResult("/");
}
}
}
@@ -0,0 +1,39 @@
namespace LaaProductionWeb.App_Infrastructure
{
using Microsoft.Extensions.DependencyInjection;
using System;
public class ServiceProvider
{
private readonly IServiceProvider services;
private ServiceProvider(IServiceProvider services)
=> this.services = services;
public T GetService<T>() where T : class
{
if (this.services.GetService<T>() is T service)
{
return service;
}
return default(T);
}
public static ServiceProvider Current { get; private set; }
internal static void SetServiceProvider(IServiceProvider serviceProvider)
=> Current = new ServiceProvider(serviceProvider);
}
public static class ServiceProviderExtensions
{
public static IServiceProvider RegisterServiceProvider(this IServiceProvider serviceProvider)
{
ServiceProvider.SetServiceProvider(serviceProvider);
return serviceProvider;
}
}
}
@@ -1,12 +1,15 @@
namespace LaaProductionWeb
{
using LaaProductionWeb.App_Infrastructure;
using System.Web.Mvc;
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
filters.Add(new ExceptionFilter());
filters.Add(new AuthorizationFilter());
}
}
}
@@ -12,7 +12,8 @@
=> new ServiceCollection()
.ConfigureServices()
.BuildServiceProvider()
.BuildControllerFactory();
.BuildControllerFactory()
.RegisterServiceProvider();
static IServiceCollection ConfigureServices(this IServiceCollection services)
{
@@ -0,0 +1,61 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.App_Infrastructure;
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System.Collections.Generic;
using System.Web.Mvc;
[Authorize]
public class AccountController : Controller
{
private readonly IAccountService accountService;
public AccountController(IAccountService accountService)
=> this.accountService = accountService;
[HttpGet]
public ActionResult Authorize(string role)
{
var userId = this.User.NameIdentifier();
var permissionsModel = this.accountService
.GetPermissionModelForUser(userId, role);
return this.View(model: permissionsModel);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Authorize(PermissionsModel model)
{
if (this.ModelState.IsValid)
{
this.accountService.RequestPermissions(model);
}
return this.View(model);
}
[HttpGet]
[AllowedRoles("Admin")]
public ActionResult Permissions()
{
var model = this.accountService.GetUsersWithPendingRoles();
return this.View(model);
}
[HttpPost]
[AllowedRoles("Admin")]
[ValidateAntiForgeryToken]
public ActionResult Permissions(List<UserPermissions> model)
{
this.accountService.SaveUserPermissions(model);
model = this.accountService.GetUsersWithPendingRoles();
return this.View(model);
}
}
}
@@ -1,11 +1,12 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.App_Infrastructure;
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System.Web.Mvc;
[Authorize]
[AllowedRoles("Protocol")]
public class ProtocolController : Controller
{
public const string FilePDF = nameof(FilePDF);
@@ -20,6 +21,11 @@
{
var orderClientModel = this.protocolService.FindOrder(orderId);
if (orderClientModel.FileId > 0)
{
return this.RedirectToAction(nameof(Document), orderClientModel);
}
return this.View(orderClientModel);
}
@@ -28,7 +34,11 @@
{
var files = this.Request.Files;
if (files.Count > 0)
if (model.OrderId is null || model.OrderId <= 0)
{
this.TempData[FilePDF] = $"Bitte Auftrag auswählen.";
}
else if (files.Count > 0)
{
var file = this.Request.Files.Get(0);
@@ -66,6 +76,15 @@
return this.View(model);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult DeleteFile(int fileId, int orderId)
{
this.protocolService.DeleteFile(fileId);
return this.RedirectToAction(nameof(this.Index), new { orderId });
}
public ActionResult Clients(string search = null)
{
var clientsOrders = this.protocolService.FindOrdersByClient(search);
@@ -1,5 +1,6 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.App_Infrastructure;
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
@@ -12,7 +13,7 @@
using SystemFile = System.IO.File;
[Authorize]
[AllowedRoles("Shipment")]
public class ShipmentsController : Controller
{
private readonly IShipmentsService shipmentsService;
@@ -131,13 +131,18 @@
</ItemGroup>
<ItemGroup>
<Compile Include="App_Infrastructure\ApplicationSettings.cs" />
<Compile Include="App_Infrastructure\AuthorizationFilter.cs" />
<Compile Include="App_Infrastructure\ControllerFactory.cs" />
<Compile Include="App_Infrastructure\ControllersExtensions.cs" />
<Compile Include="App_Infrastructure\ExceptionFilter.cs" />
<Compile Include="App_Infrastructure\AllowedRolesAttribute.cs" />
<Compile Include="App_Infrastructure\ServiceProvider.cs" />
<Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\ServicesConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ProtocolController.cs" />
<Compile Include="Controllers\SearchController.cs" />
@@ -168,6 +173,9 @@
<ItemGroup>
<None Include="packages.config" />
<Content Include="Views\Shared\_PrintLayout.cshtml" />
<Content Include="Views\Account\Authorize.cshtml" />
<Content Include="Views\Account\UserRole.cshtml" />
<Content Include="Views\Account\Permissions.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
@@ -198,6 +206,7 @@
<Name>LaaProductionWeb.Services</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
@@ -0,0 +1,35 @@
@model PermissionsModel
@using LaaProductionWeb.Services.Models
<div class="d-flex justify-content-center align-items-center h-100">
@if (this.Model.Role.Pending is null)
{
<div class="col-md-3 card p-5">
<form action="/Account/Authorize" method="post" autocomplete="off">
@this.Html.AntiForgeryToken()
@this.Html.HiddenFor(x => x.UserId)
@this.Html.Partial(nameof(UserRole), this.Model.Role, new ViewDataDictionary { { "namePattern", $"{nameof(this.Model.Role)}.{{0}}" } })
<h5 class="mb-3">Ihnen fehlt die Berechtigung – '@this.Model.Role.DisplayName'.</h5>
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.FirstName, new { @class = "form-control", placeholder = "Vorname" })
@this.Html.LabelFor(x => x.FirstName, new { @class = "text-secondary" })
@this.Html.ValidationMessageFor(x => x.FirstName, string.Empty, new { @class = "small text-danger" })
</div>
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.LastName, new { @class = "form-control", placeholder = "Vorname" })
@this.Html.LabelFor(x => x.LastName, new { @class = "text-secondary" })
@this.Html.ValidationMessageFor(x => x.LastName, string.Empty, new { @class = "small text-danger" })
</div>
<button type="submit" class="btn btn-primary py-3 w-100">Berechtigung anfordern</button>
</form>
</div>
}
else
{
<div class="col-md-3 card p-5 border-success">
<h1 class="text-center text-success"><i class="bi bi-shield-exclamation"></i></h1>
<h6 class="text-center text-success">Ihre anfrage für die berechtigung – '@this.Model.Role.DisplayName' ist in bearbeitung ...</h6>
</div>
}
</div>
@@ -0,0 +1,60 @@
@model List<LaaProductionWeb.Services.Models.UserPermissions>
@if (this.Model.Any())
{
<form action="/Account/Permissions" method="post" autocomplete="off">
@this.Html.AntiForgeryToken()
<ul class="list-group list-group-flush mb-3">
@{
var usersCount = this.Model.Count;
for (int userIndex = 0; userIndex < usersCount; userIndex++)
{
var user = this.Model[userIndex];
var hiddenUserId = $"[{userIndex}].{nameof(user.UserId)}";
var hiddenUserName = $"[{userIndex}].{nameof(user.DisplayName)}";
<li class="list-group-item">
<input type="hidden" name="@hiddenUserId" value="@user.UserId" />
<input type="hidden" name="@hiddenUserName" value="@user.DisplayName" />
<h5>@user.DisplayName</h5>
</li>
<li class="list-group-item">
<table>
<thead>
<tr>
<th class="text-secondary white-space-nowrap small px-3">Role Id</th>
<th class="text-secondary white-space-nowrap small px-3">Role Name</th>
<th class="text-secondary white-space-nowrap small px-3">Is Approved</th>
<th class="text-secondary white-space-nowrap small px-3">Is Deleted</th>
</tr>
</thead>
<tbody>
@{
var rolesCount = user.Roles.Count;
for (int roleIndex = 0; roleIndex < rolesCount; roleIndex++)
{
var role = user.Roles[roleIndex];
var hiddenRoleId = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.RoleId)}";
var hiddenRoleName = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.RoleName)}";
var roleApproved = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.Approved)}";
var roleDeleted = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.Deleted)}";
<tr>
<td class="px-3">@role.RoleId <input type="hidden" name="@hiddenRoleId" value="@role.RoleId" /></td>
<td class="px-3">@role.RoleName <input type="hidden" name="@hiddenRoleName" value="@role.RoleName" /></td>
<td class="px-3">@this.Html.CheckBox(roleApproved, role.Approved, new { @class = "form-check-input" })</td>
<td class="px-3">@this.Html.CheckBox(roleDeleted, role.Deleted, new { @class = "form-check-input" })</td>
</tr>
}
}
</tbody>
</table>
</li>
}
}
</ul>
<button type="submit" class="btn btn-primary py-2 px-5 ms-3">Änderungen speichern</button>
</form>
}
@@ -0,0 +1,14 @@
@model LaaProductionWeb.Services.Models.UserRole
@{
var namePattern = "{0}";
if (this.ViewData.TryGetValue(nameof(namePattern), out object value))
{
namePattern = $"{value}";
}
}
@this.Html.Hidden(string.Format(namePattern, nameof(this.Model.RoleId)), this.Model.RoleId)
@this.Html.Hidden(string.Format(namePattern, nameof(this.Model.RoleName)), this.Model.RoleName)
@this.Html.Hidden(string.Format(namePattern, nameof(this.Model.DisplayName)), this.Model.DisplayName)
@@ -53,7 +53,7 @@
{
<tr>
<td class="va-middle">@item.PosNr</td>
<td class="va-middle white-space-nowrap px-5">@item.SerialNr</td>
<td class="va-middle white-space-nowrap">@item.SerialNr</td>
<td class="text-center">
<bi class="@testPassed(item.HeliumTest)"></bi>
</td>
@@ -2,12 +2,13 @@
@using LaaProductionWeb.Services.Models
<form>
<form action="/Protocol/DeleteFile" method="post" class="nav justify-content-end bg-whitesmoke">
@this.Html.AntiForgeryToken()
@this.Html.HiddenFor(x => x.FileId)
@this.Html.HiddenFor(x => x.OrderId)
@this.Html.HiddenFor(x => x.ClientId)
@this.Html.HiddenFor(x => x.ClientName)
@this.Html.HiddenFor(x => x.Positions)
<button class="btn btn-link text-danger nav-link">
<i class="bi bi-trash"></i> Delete
</button>
</form>
<div class="container-fluid h-100 p-0">
@@ -13,7 +13,7 @@
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="client_name">Client</label></td>
<td class="p-1 dropdown">
<td class="p-1 dropdown w-75">
<input id="client_name" class="form-control border-0 rounded-0" value="@this.Model.ClientName" />
<ul class="dropdown-menu mt-2 w-100" id="client_name_options">
<li class="text-secondary bg-light text-normal">Search by client name</li>
@@ -22,7 +22,7 @@
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="order_no">Order No.</label></td>
<td class="p-1">
<td class="p-1 w-75">
<input id="order_no" class="form-control border-0 rounded-0" value="@this.Model.OrderId" />
<ul class="dropdown-menu mt-2 w-100" id="order_no_options">
<li class="text-secondary bg-light text-normal">Search by order no.</li>
@@ -31,7 +31,7 @@
</tr>
<tr class="border-bottom-0">
<td class="py-1 white-space-nowrap va-middle">Positions</td>
<td class="p-1">
<td class="p-1 w-75">
<div class="form-control border-0 rounded-0">
@if (string.IsNullOrWhiteSpace(this.Model.Positions))
{
@@ -61,7 +61,7 @@
</div>
@if (this.TempData.TryGetValue(ProtocolController.FilePDF, out object errorMessage))
{
<div class="text-danger small">
<div class="text-danger small fw-normal">
@($"{errorMessage}")
</div>
}
@@ -17,7 +17,7 @@
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="client_name">Client</label></td>
<td class="p-1 dropdown">
<td class="p-1 w-75">
<div class="form-control border-0 rounded-0">
@if (string.IsNullOrWhiteSpace(this.Model.ClientName))
{
@@ -32,7 +32,7 @@
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="order_no">Order No.</label></td>
<td class="p-1">
<td class="p-1 w-75">
<div class="form-control border-0 rounded-0">
@if (this.Model.OrderId is null)
{
@@ -47,7 +47,7 @@
</tr>
<tr class="border-bottom-0">
<td class="py-1 white-space-nowrap va-middle">Positions</td>
<td class="p-1">
<td class="p-1 w-75">
<div class="form-control border-0 rounded-0">
@if (string.IsNullOrWhiteSpace(this.Model.Positions))
{
@@ -63,7 +63,7 @@
</table>
</th>
<th class="text-center va-middle w-auto p-3">
<img src="~/App_Content/svg/sensus_xylem_logo.svg" width="210" class="mx-5" />
<img src="~/App_Content/svg/sensus_xylem_logo.svg" width="130" class="mx-5" />
</th>
</tr>
</thead>
@@ -6,22 +6,37 @@
<div class="d-flex justify-content-center">
<div id="batch" class="print-page border rounded shadow-sm mt-5 p-5">
<div class="table-responsive">
<table>
<table class="table table-borderless table-striped">
<tr>
<th colspan="2" class="fs-5">Paletten Begleitschein</th>
<th colspan="2" class="fs-5">@this.Model.ClientName</th>
</tr>
<tr>
<td class="py-0 pe-3 white-space-nowrap">Kunden-Auftrag/Pos.Nr.</td>
<td class="py-0 pe-3">@this.Model.OrderNr/@this.Model.PositionNr</td>
<td class="py-0 pe-3 white-space-nowrap">Fertigungsauftrags-Nr.</td>
<td class="py-0 pe-3">@this.Model.ProductionOrderNr</td>
<th class="py-0 white-space-nowrap">Kunden-Auftrag</th>
<td class="py-0">@this.Model.OrderNr</td>
<th class="py-0 white-space-nowrap">Fertigungsauftrags-Nr.</th>
<td class="py-0">@this.Model.ProductionOrderNr</td>
</tr>
@{
var isFirst = true;
foreach (var position in this.Model.Positions)
{
<tr>
<th class="py-0">@(isFirst ? "Position Nr" : string.Empty)</th>
<td class="py-0">@position.PositionNr</td>
<th class="py-0">@(isFirst ? "Bezeichnung" : string.Empty)</th>
<td class="py-0">@position.Description</td>
</tr>
isFirst = false;
}
}
<tr>
<td class="py-0 pe-3 white-space-nowrap">Auftragsmenge</td>
<td class="py-0 pe-3">@this.Model.TotlalItemsCount</td>
<td class="py-0 pe-3 white-space-nowrap">Typ</td>
<td class="py-0 pe-3">@this.Model.ItemsType</td>
<th class="py-0 white-space-nowrap">Palettemenge</th>
<td class="py-0">@this.Model.ItemsCount</td>
<th class="py-0 white-space-nowrap">Auftragsmenge</th>
<td class="py-0">@this.Model.TotlalItemsCount</td>
</tr>
</table>
<table class="table table-borderless table-striped">
@@ -42,7 +57,7 @@
{
<tr class="is_scaned_@(item.IsScaned ? 1 : 0)">
<td class="va-middle @(item.IsScaned ? null : "text-secondary")">@(count++).</td>
<td class="va-middle w-100 @(item.IsScaned ? null : "text-secondary")">@item.BarcodeNr</td>
<td class="va-middle w-100 @(item.IsScaned ? null : "text-secondary")">(@item.PositionNr) @item.BarcodeNr</td>
<td class="va-middle w-100 text-center">
<svg class="barcode"
jsbarcode-format="auto"
@@ -52,7 +67,7 @@
jsbarcode-lineColor="@(item.IsScaned ? "black" : "#ced4da")"
jsbarcode-height="50"
jsbarcode-margin="0"
jsbarcode-textmargin="0"
jsbarcode-textMargin="0"
jsbarcode-fontoptions="bold">
</svg>
</td>
@@ -31,14 +31,12 @@
</button>
</div>
</form>
@if (this.IsPost || this.Model.HasOrder)
{
@{
this.Html.RenderAction(nameof(ShipmentsController.Scan), this.Model.OrderScanModel);
}
</div>
<div class="col-md-9 h-100 scrollable-sm pb-5">
@if (this.IsPost || this.Model.HasOrder)
{
@{
this.Html.RenderAction(nameof(ShipmentsController.Batch), this.Model.OrderScanModel);
}
</div>
@@ -18,16 +18,31 @@
<th colspan="2" class="fs-4">@this.Model.ClientName</th>
</tr>
<tr>
<td class="py-0 white-space-nowrap">Kunden-Auftrag/Pos.Nr.</td>
<td class="py-0 fw-normal">@this.Model.OrderNr/@this.Model.PositionNr</td>
<td class="py-0 white-space-nowrap">Kunden-Auftrag</td>
<td class="py-0 fw-normal">@this.Model.OrderNr</td>
<td class="py-0 white-space-nowrap">Fertigungsauftrags-Nr.</td>
<td class="py-0 fw-normal">@this.Model.ProductionOrderNr</td>
</tr>
@{
var isFirst = true;
foreach (var position in this.Model.Positions)
{
<tr>
<td class="py-0">@(isFirst ? "Position Nr" : string.Empty)</td>
<td class="py-0 fw-normal">@position.PositionNr</td>
<td class="py-0">@(isFirst ? "Bezeichnung" : string.Empty)</td>
<td class="py-0 fw-normal">@position.Description</td>
</tr>
isFirst = false;
}
}
<tr>
<td class="py-0 white-space-nowrap">Palettenmenge</td>
<td class="py-0 fw-normal">@this.Model.ItemsCount</td>
<td class="py-0 white-space-nowrap">Auftragsmenge</td>
<td class="py-0 fw-normal">@this.Model.TotlalItemsCount</td>
<td class="py-0 white-space-nowrap">Typ</td>
<td class="py-0 fw-normal">@this.Model.ItemsType</td>
</tr>
</thead>
</table>
@@ -35,10 +50,10 @@
</tr>
<tr>
<th class="small">No.</th>
<th class="small">Serial No.</th>
<th class="small">Pos.</th>
<th class="small"></th>
<th class="small">No.</th>
<th class="small">Serial No.</th>
<th class="small">Pos.</th>
<th class="small"></th>
</tr>
</thead>
@@ -49,26 +64,28 @@
var item = items[i];
<tr>
<td class="va-middle">@(i + 1)</td>
<td class="va-middle">@item.BarcodeNr</td>
<td class="va-middle">
<td class="fs-5">@(i + 1).</td>
<td class="fs-5">@item.PositionNr</td>
<td class="py-0">
<svg class="barcode"
jsbarcode-height="50"
jsbarcode-height="70"
jsbarcode-format="auto"
jsbarcode-displayValue="false"
jsbarcode-displayValue="true"
jsbarcode-textMargin="0"
jsbarcode-background="transparent"
jsbarcode-value="@item.BarcodeNr" />
</td>
@if (ni < itemsLength)
{
var nitem = items[ni];
<td class="va-middle">@(ni + 1)</td>
<td class="va-middle">@nitem.BarcodeNr</td>
<td class="va-middle">
<td class="fs-5" >@(ni + 1).</td>
<td class="fs-5">@nitem.PositionNr</td>
<td class="py-0">
<svg class="barcode"
jsbarcode-height="50"
jsbarcode-height="70"
jsbarcode-format="auto"
jsbarcode-displayValue="false"
jsbarcode-displayValue="true"
jsbarcode-textMargin="0"
jsbarcode-background="transparent"
jsbarcode-value="@nitem.BarcodeNr" />
</td>