diff --git a/pointMaster/Controllers/PrintController.cs b/pointMaster/Controllers/PrintController.cs new file mode 100644 index 0000000..456218b --- /dev/null +++ b/pointMaster/Controllers/PrintController.cs @@ -0,0 +1,42 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using pointMaster.Data; +using pointMaster.Models; +using QRCoder; +using System.Drawing; + +namespace pointMaster.Controllers +{ + public class PrintController : Controller + { + private readonly DataContext context; + + public PrintController(DataContext context) + { + this.context = context; + } + + public async Task Patruljer() + { + var vm = new PrintPatruljerModel(); + + vm.patruljer = await context.Patruljer.Include(x => x.PatruljeMedlems).ToListAsync(); + + foreach (var item in vm.patruljer) + { + QRCodeGenerator QrGenerator = new QRCodeGenerator(); + QRCodeData QrCodeInfo = QrGenerator.CreateQrCode("https://smallbenji.tech", QRCodeGenerator.ECCLevel.Q); + + vm.QRcode.Add(item.Id, "data:image/png;base64," + Convert.ToBase64String(new PngByteQRCode(QrCodeInfo).GetGraphic(20))); + } + + return View(vm); + } + + } + public class PrintPatruljerModel + { + public List patruljer { get; set; } = null!; + public Dictionary QRcode { get; set; } = new Dictionary(); + } +} diff --git a/pointMaster/Views/Patrulje/Index.cshtml b/pointMaster/Views/Patrulje/Index.cshtml index e31b6f6..7fc7e52 100644 --- a/pointMaster/Views/Patrulje/Index.cshtml +++ b/pointMaster/Views/Patrulje/Index.cshtml @@ -4,6 +4,7 @@ }

Patruljer

Opret patrulje +Print patruljer @foreach (var patrulje in Model.patruljeModels) {
diff --git a/pointMaster/Views/Print/Patruljer.cshtml b/pointMaster/Views/Print/Patruljer.cshtml new file mode 100644 index 0000000..06c666e --- /dev/null +++ b/pointMaster/Views/Print/Patruljer.cshtml @@ -0,0 +1,25 @@ +@model pointMaster.Controllers.PrintPatruljerModel; +@{ + Layout = "_Point"; + ViewData["Title"] = "Patruljer"; +} + +@foreach (var patrulje in Model.patruljer) +{ + +} + + \ No newline at end of file diff --git a/pointMaster/Views/Shared/_Point.cshtml b/pointMaster/Views/Shared/_Point.cshtml index 1f0ac79..63e7d3c 100644 --- a/pointMaster/Views/Shared/_Point.cshtml +++ b/pointMaster/Views/Shared/_Point.cshtml @@ -7,6 +7,7 @@ + @RenderBody() diff --git a/pointMaster/pointMaster.csproj b/pointMaster/pointMaster.csproj index 3f38408..66363bd 100644 --- a/pointMaster/pointMaster.csproj +++ b/pointMaster/pointMaster.csproj @@ -20,6 +20,7 @@ + diff --git a/pointMaster/wwwroot/css/point.css b/pointMaster/wwwroot/css/point.css index f4dabd8..a60d05b 100644 --- a/pointMaster/wwwroot/css/point.css +++ b/pointMaster/wwwroot/css/point.css @@ -37,3 +37,31 @@ .sendButton .btn { margin: auto; } + +.print-card { + display: flex; + border: 1px solid black; + margin-bottom: 1rem; +} + +.print-card .patrulje-info { + padding: 5px; + padding-left: 1rem; +} + +.print-card .patrulje-info h1 { + font-size: 4rem; +} + +.print-card .patrulje-info p { + font-size: 1.75rem; + line-height: 1rem; +} + +.print-card img { + padding: 10px; +} + +.print-card .flex-grow { + flex-grow: 1; +} \ No newline at end of file