Cleanup and fix
This commit is contained in:
@@ -42,7 +42,7 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
public class HeaderNavViewModel
|
public class HeaderNavViewModel
|
||||||
{
|
{
|
||||||
public List<NavUrl> links { get; set; } = null!;
|
public List<NavUrl> links { get; set; }
|
||||||
}
|
}
|
||||||
public class NavUrl
|
public class NavUrl
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ namespace pointMaster.Controllers
|
|||||||
this.Title = title;
|
this.Title = title;
|
||||||
this.Url = url;
|
this.Url = url;
|
||||||
}
|
}
|
||||||
public string Url { get; set; } = null!;
|
public string Url { get; set; }
|
||||||
public string Title { get; set; } = null!;
|
public string Title { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ namespace pointMaster.Controllers
|
|||||||
vm.Points = vm.Points.OrderByDescending(x => x.point).ToList();
|
vm.Points = vm.Points.OrderByDescending(x => x.point).ToList();
|
||||||
vm.Turnout = vm.Turnout.OrderByDescending(x => x.point).ToList();
|
vm.Turnout = vm.Turnout.OrderByDescending(x => x.point).ToList();
|
||||||
|
|
||||||
|
var postId = Request.Cookies["Post"];
|
||||||
|
if (postId != null)
|
||||||
|
{
|
||||||
|
int.TryParse(postId, out var id);
|
||||||
|
var post = await context.Poster.FindAsync(id);
|
||||||
|
vm.Post = post;
|
||||||
|
}
|
||||||
|
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
@@ -77,13 +84,14 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
public class HomePageViewModel
|
public class HomePageViewModel
|
||||||
{
|
{
|
||||||
public List<PatruljePlacering> Samlet { get; set; } = null!;
|
public List<PatruljePlacering> Samlet { get; set; }
|
||||||
public List<PatruljePlacering> Turnout { get; set; } = null!;
|
public List<PatruljePlacering> Turnout { get; set; }
|
||||||
public List<PatruljePlacering> Points { get; set; } = null!;
|
public List<PatruljePlacering> Points { get; set; }
|
||||||
|
public Post Post { get; set; }
|
||||||
}
|
}
|
||||||
public class PatruljePlacering
|
public class PatruljePlacering
|
||||||
{
|
{
|
||||||
public Patrulje Patrulje { get; set; } = null!;
|
public Patrulje Patrulje { get; set; }
|
||||||
public int point { get; set; }
|
public int point { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,9 +129,9 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
public class IndexViewModel
|
public class IndexViewModel
|
||||||
{
|
{
|
||||||
public List<Patrulje> patruljeModels { get; set; } = null!;
|
public List<Patrulje> patruljeModels { get; set; }
|
||||||
public Dictionary<int, int> patruljePoints { get; set; } = null!;
|
public Dictionary<int, int> patruljePoints { get; set; }
|
||||||
public Dictionary<int, int> patruljeTurnout { get; set; } = null!;
|
public Dictionary<int, int> patruljeTurnout { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,28 +190,28 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
public class SelectPostViewModel
|
public class SelectPostViewModel
|
||||||
{
|
{
|
||||||
public List<Post> Poster { get; set; } = null!;
|
public List<Post> Poster { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GivPointViewModel
|
public class GivPointViewModel
|
||||||
{
|
{
|
||||||
public Post Runde { get; set; } = null!;
|
public Post Runde { get; set; }
|
||||||
public Patrulje Patrulje { get; set; } = null!;
|
public Patrulje Patrulje { get; set; }
|
||||||
public Point points { get; set; } = new Point();
|
public Point points { get; set; } = new Point();
|
||||||
}
|
}
|
||||||
public class SkiftPatruljeViewModel
|
public class SkiftPatruljeViewModel
|
||||||
{
|
{
|
||||||
public List<Patrulje> Patruljer { get; set; } = null!;
|
public List<Patrulje> Patruljer { get; set; }
|
||||||
public Post? post { get; set; } = null!;
|
public Post? post { get; set; }
|
||||||
}
|
}
|
||||||
public class PointViewModel
|
public class PointViewModel
|
||||||
{
|
{
|
||||||
public List<Point> points { get; set; } = null!;
|
public List<Point> points { get; set; }
|
||||||
public bool AllowedToDelete { get; set; } = false;
|
public bool AllowedToDelete { get; set; } = false;
|
||||||
}
|
}
|
||||||
public class PatruljeInfoModel
|
public class PatruljeInfoModel
|
||||||
{
|
{
|
||||||
public Patrulje patrulje { get; set; } = null!;
|
public Patrulje patrulje { get; set; }
|
||||||
public int totalPoints { get; set; }
|
public int totalPoints { get; set; }
|
||||||
public int totalTurnout { get; set; }
|
public int totalTurnout { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
public class RundeViewModel
|
public class RundeViewModel
|
||||||
{
|
{
|
||||||
public List<Post> Rounds { get; set; } = null!;
|
public List<Post> Rounds { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,36 @@ namespace pointMaster.Controllers
|
|||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> Poster()
|
||||||
|
{
|
||||||
|
var vm = new PrintPosterModel();
|
||||||
|
|
||||||
|
vm.poster = await context.Poster.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
vm.QRcode = new Dictionary<int, string>();
|
||||||
|
|
||||||
|
foreach (var item in vm.poster)
|
||||||
|
{
|
||||||
|
QRCodeGenerator QrGenerator = new QRCodeGenerator();
|
||||||
|
QRCodeData QrCodeInfo = QrGenerator.CreateQrCode(Request.Host.Host + "/point/selectpost/" + item.Id, 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 class PrintPatruljerModel
|
||||||
{
|
{
|
||||||
public List<Patrulje> patruljer { get; set; } = null!;
|
public List<Patrulje> patruljer { get; set; }
|
||||||
public Dictionary<int, string> QRcode { get; set; } = new Dictionary<int, string>();
|
public Dictionary<int, string> QRcode { get; set; } = new Dictionary<int, string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PrintPosterModel
|
||||||
|
{
|
||||||
|
public List<Post> poster { get; set; }
|
||||||
|
public Dictionary<int, string> QRcode { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ namespace pointMaster.Controllers
|
|||||||
public class PointChartModel
|
public class PointChartModel
|
||||||
{
|
{
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; }
|
||||||
[JsonProperty("data")]
|
[JsonProperty("data")]
|
||||||
public List<PointChartDataModel> Data { get; set; } = null!;
|
public List<PointChartDataModel> Data { get; set; }
|
||||||
|
|
||||||
public static async Task<List<PointChartModel>> Calculate(DataContext dataContext)
|
public static async Task<List<PointChartModel>> Calculate(DataContext dataContext)
|
||||||
{
|
{
|
||||||
@@ -101,14 +101,14 @@ namespace pointMaster.Controllers
|
|||||||
}
|
}
|
||||||
public class PointChartDataModel
|
public class PointChartDataModel
|
||||||
{
|
{
|
||||||
public string x { get; set; } = null!;
|
public string x { get; set; }
|
||||||
public int y { get; set; }
|
public int y { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StatModel
|
public class StatModel
|
||||||
{
|
{
|
||||||
public string Title { get; set; } = null!;
|
public string Title { get; set; }
|
||||||
public string Value { get; set; } = null!;
|
public string Value { get; set; }
|
||||||
|
|
||||||
public static async Task<List<StatModel>> Calculate(DataContext dataContext)
|
public static async Task<List<StatModel>> Calculate(DataContext dataContext)
|
||||||
{
|
{
|
||||||
@@ -156,9 +156,9 @@ namespace pointMaster.Controllers
|
|||||||
public class PointRatioModel
|
public class PointRatioModel
|
||||||
{
|
{
|
||||||
[JsonProperty("names")]
|
[JsonProperty("names")]
|
||||||
public List<string> Names { get; set; } = null!;
|
public List<string> Names { get; set; }
|
||||||
[JsonProperty("data")]
|
[JsonProperty("data")]
|
||||||
public List<int> Data { get; set; } = null!;
|
public List<int> Data { get; set; }
|
||||||
|
|
||||||
public static async Task<PointRatioModel> Calculate(DataContext dataContext)
|
public static async Task<PointRatioModel> Calculate(DataContext dataContext)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h1>Velkommen til PointMaster</h1>
|
<h1>Velkommen til PointMaster</h1>
|
||||||
|
@if(Model.Post != null)
|
||||||
|
{
|
||||||
|
<p>Du giver point som @Model.Post.Name</p>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -21,11 +25,11 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@for (var i = 0; i < Model.Points.Count; i++)
|
@for (var i = 0; i < Model.Points.Count; i++)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>@(i + 1)</td>
|
<td>@(i + 1)</td>
|
||||||
<td>@Model.Points[i].Patrulje.Name</td>
|
<td>@Model.Points[i].Patrulje.Name</td>
|
||||||
<td>@Model.Points[i].point</td>
|
<td>@Model.Points[i].point</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -9,10 +9,13 @@
|
|||||||
<div class="print-card">
|
<div class="print-card">
|
||||||
<div class="patrulje-info">
|
<div class="patrulje-info">
|
||||||
<h1>@patrulje.Name</h1>
|
<h1>@patrulje.Name</h1>
|
||||||
<p>Medlemmer:</p>
|
@if(patrulje.PatruljeMedlems.Any())
|
||||||
@foreach (var medlem in patrulje.PatruljeMedlems)
|
|
||||||
{
|
{
|
||||||
<p>@medlem.Name</p>
|
<p>Medlemmer:</p>
|
||||||
|
@foreach (var medlem in patrulje.PatruljeMedlems)
|
||||||
|
{
|
||||||
|
<p>@medlem.Name</p>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow"></div>
|
<div class="flex-grow"></div>
|
||||||
|
|||||||
20
pointMaster/Views/Print/Poster.cshtml
Normal file
20
pointMaster/Views/Print/Poster.cshtml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@model pointMaster.Controllers.PrintPosterModel;
|
||||||
|
@{
|
||||||
|
Layout = "_Point";
|
||||||
|
ViewData["Title"] = "Patruljer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@foreach (var post in Model.poster)
|
||||||
|
{
|
||||||
|
<div class="print-card">
|
||||||
|
<div class="patrulje-info">
|
||||||
|
<h1>@post.Name</h1>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow"></div>
|
||||||
|
<img src="@Model.QRcode[post.Id]" width="300" height="300" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
print()
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user