Compare commits
17 Commits
7f123df4d0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
b3da331321
|
|||
|
ee130b9f51
|
|||
| 69fd806092 | |||
| b3417ae416 | |||
| 7226614b5c | |||
| c8eaf5eccf | |||
| 8c5bf9cf00 | |||
| c8934e53da | |||
|
|
dfc1488f82 | ||
|
|
ffcaef6ee6 | ||
|
|
94cb901f36 | ||
|
|
645d9f08f5 | ||
|
|
953082e9bc | ||
|
|
670ed21386 | ||
|
|
3beb8ef0d4 | ||
|
|
14280f7f97 | ||
|
|
9368810703 |
46
pointMaster/Components/DataHub.cs
Normal file
46
pointMaster/Components/DataHub.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using pointMaster.Controllers;
|
||||||
|
using pointMaster.Data;
|
||||||
|
|
||||||
|
namespace pointMaster.Components
|
||||||
|
{
|
||||||
|
[Authorize(Policy = Roles.Editor)]
|
||||||
|
public class DataHub : Hub
|
||||||
|
{
|
||||||
|
private readonly DataContext dataContext;
|
||||||
|
|
||||||
|
public DataHub(DataContext dataContext)
|
||||||
|
{
|
||||||
|
this.dataContext = dataContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task OnConnectedAsync()
|
||||||
|
{
|
||||||
|
Clients.Caller.SendAsync("ReceiveMessage", "Hey");
|
||||||
|
return base.OnConnectedAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SendData()
|
||||||
|
{
|
||||||
|
var v0 = await StatModel.Calculate(dataContext);
|
||||||
|
var v1 = await PointRatioModel.Calculate(dataContext);
|
||||||
|
var v2 = await PointChartModel.Calculate(dataContext);
|
||||||
|
|
||||||
|
var retval = new StatData()
|
||||||
|
{
|
||||||
|
Stats = v0,
|
||||||
|
PointRatio = v1,
|
||||||
|
PointChartModels = v2,
|
||||||
|
};
|
||||||
|
await Clients.All.SendAsync("StatData", retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StatData
|
||||||
|
{
|
||||||
|
public List<StatModel> Stats { get; set; }
|
||||||
|
public PointRatioModel PointRatio { get; set; }
|
||||||
|
public List<PointChartModel> PointChartModels { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Security.Claims;
|
|
||||||
|
|
||||||
namespace pointMaster.Controllers
|
namespace pointMaster.Controllers
|
||||||
{
|
{
|
||||||
@@ -43,16 +42,17 @@ 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
|
||||||
|
{
|
||||||
public NavUrl() { }
|
public NavUrl() { }
|
||||||
public NavUrl(string title, string url)
|
public NavUrl(string title, string url)
|
||||||
{
|
{
|
||||||
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ namespace pointMaster.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult Create(Patrulje patrulje)
|
public async Task<IActionResult> Create(Patrulje patrulje)
|
||||||
{
|
{
|
||||||
patrulje.DateCreated = DateTime.UtcNow;
|
patrulje.DateCreated = DateTime.UtcNow;
|
||||||
|
|
||||||
_context.Patruljer.Add(patrulje);
|
await _context.Patruljer.AddAsync(patrulje);
|
||||||
_context.SaveChanges();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> AddMedlem(int? id)
|
public async Task<IActionResult> AddMedlem(int? id)
|
||||||
@@ -106,7 +106,7 @@ namespace pointMaster.Controllers
|
|||||||
if (medlem != null)
|
if (medlem != null)
|
||||||
{
|
{
|
||||||
_context.PatruljeMedlemmer.Remove(medlem);
|
_context.PatruljeMedlemmer.Remove(medlem);
|
||||||
_context.SaveChanges();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
@@ -121,7 +121,7 @@ namespace pointMaster.Controllers
|
|||||||
if (patrulje != null)
|
if (patrulje != null)
|
||||||
{
|
{
|
||||||
_context.Patruljer.Remove(patrulje);
|
_context.Patruljer.Remove(patrulje);
|
||||||
_context.SaveChanges();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
@@ -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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using pointMaster.Data;
|
using pointMaster.Data;
|
||||||
using pointMaster.Models;
|
using pointMaster.Models;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace pointMaster.Controllers
|
namespace pointMaster.Controllers
|
||||||
{
|
{
|
||||||
@@ -89,7 +90,8 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
var patrulje = await context.Patruljer.FindAsync(id);
|
var patrulje = await context.Patruljer.FindAsync(id);
|
||||||
|
|
||||||
if (patrulje != null) {
|
if (patrulje != null)
|
||||||
|
{
|
||||||
vm.Patrulje = patrulje;
|
vm.Patrulje = patrulje;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -116,6 +118,12 @@ namespace pointMaster.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var point = context.Points.FirstOrDefault(x => x.Poster.Id == postIntId && x.Patrulje.Id == id);
|
||||||
|
if (point != null)
|
||||||
|
{
|
||||||
|
vm.points = point;
|
||||||
|
}
|
||||||
|
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,42 +183,66 @@ namespace pointMaster.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = Roles.Editor)]
|
[Authorize(Policy = Roles.Editor)]
|
||||||
public ActionResult DeletePoint(int id)
|
public async Task<ActionResult> DeletePoint(int id)
|
||||||
{
|
{
|
||||||
var point = context.Points.FirstOrDefault(p => p.Id == id);
|
var point = context.Points.FirstOrDefault(p => p.Id == id);
|
||||||
if (point == null) { return NotFound(); }
|
if (point == null) { return NotFound(); }
|
||||||
|
|
||||||
context.Points.Remove(point);
|
context.Points.Remove(point);
|
||||||
context.SaveChanges();
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult GetPointsCSV()
|
||||||
|
{
|
||||||
|
var points = context.Points.Include(x => x.Patrulje).Include(x => x.Poster).ToList();
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.AppendLine("ID;PostName;PatruljeName;Points;Turnout;");
|
||||||
|
|
||||||
|
foreach (var point in points)
|
||||||
|
{
|
||||||
|
var id = point.Id;
|
||||||
|
var q = point.Poster.Name;
|
||||||
|
var e = point.Patrulje.Name;
|
||||||
|
var p = point.Points;
|
||||||
|
var t = point.Turnout;
|
||||||
|
|
||||||
|
string line = string.Join(";", id, q, e, p, t);
|
||||||
|
|
||||||
|
sb.AppendLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(sb.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace pointMaster.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ActionResult SletPost(int id)
|
public async Task<ActionResult> SletPost(int id)
|
||||||
{
|
{
|
||||||
var post = _context.Poster.Find(id);
|
var post = _context.Poster.Find(id);
|
||||||
|
|
||||||
@@ -57,14 +57,14 @@ namespace pointMaster.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
_context.Poster.Remove(post);
|
_context.Poster.Remove(post);
|
||||||
_context.SaveChanges();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RundeViewModel
|
public class RundeViewModel
|
||||||
{
|
{
|
||||||
public List<Post> Rounds { get; set; } = null!;
|
public List<Post> Rounds { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using pointMaster.Data;
|
using pointMaster.Data;
|
||||||
using pointMaster.Models;
|
using pointMaster.Models;
|
||||||
using QRCoder;
|
using QRCoder;
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace pointMaster.Controllers
|
namespace pointMaster.Controllers
|
||||||
{
|
{
|
||||||
@@ -33,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; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,42 @@ namespace pointMaster.Controllers
|
|||||||
|
|
||||||
[HttpGet("GetPointsOverTime")]
|
[HttpGet("GetPointsOverTime")]
|
||||||
public async Task<object> GetList()
|
public async Task<object> GetList()
|
||||||
|
{
|
||||||
|
var retval = await PointChartModel.Calculate(dataContext);
|
||||||
|
|
||||||
|
var rval = JsonConvert.SerializeObject(retval, new JsonSerializerSettings()
|
||||||
|
{
|
||||||
|
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return Ok(rval);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("getstats")]
|
||||||
|
public async Task<IActionResult> GetStats()
|
||||||
|
{
|
||||||
|
var vm = await StatModel.Calculate(dataContext);
|
||||||
|
|
||||||
|
return Ok(JsonConvert.SerializeObject(vm));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("pointratio")]
|
||||||
|
public async Task<IActionResult> GetPointRatio()
|
||||||
|
{
|
||||||
|
var vm = await PointRatioModel.Calculate(dataContext);
|
||||||
|
|
||||||
|
return Ok(JsonConvert.SerializeObject(vm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class PointChartModel
|
||||||
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("data")]
|
||||||
|
public List<PointChartDataModel> Data { get; set; }
|
||||||
|
|
||||||
|
public static async Task<List<PointChartModel>> Calculate(DataContext dataContext)
|
||||||
{
|
{
|
||||||
var pointData = await dataContext.Points.Include(x => x.Patrulje).Include(x => x.Poster).ToListAsync();
|
var pointData = await dataContext.Points.Include(x => x.Patrulje).Include(x => x.Poster).ToListAsync();
|
||||||
|
|
||||||
@@ -36,7 +72,7 @@ namespace pointMaster.Controllers
|
|||||||
var total = 0;
|
var total = 0;
|
||||||
foreach (var point in group)
|
foreach (var point in group)
|
||||||
{
|
{
|
||||||
var date = DateTime.Parse(point.DateCreated.ToString());
|
var date = DateTime.Parse(point.DateCreated.ToString()).AddHours(1);
|
||||||
|
|
||||||
total += point.Points + point.Turnout;
|
total += point.Points + point.Turnout;
|
||||||
|
|
||||||
@@ -60,27 +96,32 @@ namespace pointMaster.Controllers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var rval = JsonConvert.SerializeObject(retval, new JsonSerializerSettings()
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class PointChartDataModel
|
||||||
{
|
{
|
||||||
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
|
public string x { get; set; }
|
||||||
|
public int y { get; set; }
|
||||||
});
|
|
||||||
|
|
||||||
return Ok(rval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("getstats")]
|
public class StatModel
|
||||||
public async Task<IActionResult> GetStats()
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
public static async Task<List<StatModel>> Calculate(DataContext dataContext)
|
||||||
{
|
{
|
||||||
var vm = new List<StatModel>();
|
var vm = new List<StatModel>();
|
||||||
|
|
||||||
var pointData = await dataContext.Points.ToListAsync();
|
var pointData = await dataContext.Points.ToListAsync();
|
||||||
var patruljeData = await dataContext.Patruljer.ToListAsync();
|
var patruljeData = await dataContext.Patruljer.ToListAsync();
|
||||||
var postData = await dataContext.Poster.ToListAsync();
|
var postData = await dataContext.Poster.ToListAsync();
|
||||||
|
var medlemsData = await dataContext.PatruljeMedlemmer.ToListAsync();
|
||||||
|
|
||||||
vm.Add(new StatModel
|
vm.Add(new StatModel
|
||||||
{
|
{
|
||||||
Title = "Points givet",
|
Title = "Points givet ialt",
|
||||||
Value = pointData.Sum(x => x.Points + x.Turnout).ToString()
|
Value = pointData.Sum(x => x.Points + x.Turnout).ToString()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -96,16 +137,36 @@ namespace pointMaster.Controllers
|
|||||||
Value = postData.Count().ToString()
|
Value = postData.Count().ToString()
|
||||||
});
|
});
|
||||||
|
|
||||||
return Ok(JsonConvert.SerializeObject(vm));
|
vm.Add(new StatModel
|
||||||
|
{
|
||||||
|
Title = "Transaktioner",
|
||||||
|
Value = pointData.Count().ToString()
|
||||||
|
});
|
||||||
|
|
||||||
|
vm.Add(new StatModel
|
||||||
|
{
|
||||||
|
Title = "Medlemmer",
|
||||||
|
Value = medlemsData.Count().ToString()
|
||||||
|
});
|
||||||
|
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("pointratio")]
|
public class PointRatioModel
|
||||||
public async Task<IActionResult> GetPointRatio()
|
|
||||||
{
|
{
|
||||||
var vm = new PointRatioModel();
|
[JsonProperty("names")]
|
||||||
|
public List<string> Names { get; set; }
|
||||||
|
[JsonProperty("data")]
|
||||||
|
public List<int> Data { get; set; }
|
||||||
|
|
||||||
vm.Names = new List<string>();
|
public static async Task<PointRatioModel> Calculate(DataContext dataContext)
|
||||||
vm.Data = new List<int>();
|
{
|
||||||
|
var vm = new PointRatioModel
|
||||||
|
{
|
||||||
|
Names = new List<string>(),
|
||||||
|
Data = new List<int>()
|
||||||
|
};
|
||||||
|
|
||||||
var data = await dataContext.Patruljer.Include(x => x.Points).ToListAsync();
|
var data = await dataContext.Patruljer.Include(x => x.Points).ToListAsync();
|
||||||
|
|
||||||
@@ -115,34 +176,8 @@ namespace pointMaster.Controllers
|
|||||||
vm.Data.Add(patrulje.Points.Sum(x => x.Points + x.Turnout));
|
vm.Data.Add(patrulje.Points.Sum(x => x.Points + x.Turnout));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(JsonConvert.SerializeObject(vm));
|
return vm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PointChartModel
|
|
||||||
{
|
|
||||||
[JsonProperty("name")]
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
[JsonProperty("data")]
|
|
||||||
public List<PointChartDataModel> Data { get; set; } = null!;
|
|
||||||
}
|
|
||||||
public class PointChartDataModel
|
|
||||||
{
|
|
||||||
public string x { get; set; } = null!;
|
|
||||||
public int y { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class StatModel
|
|
||||||
{
|
|
||||||
public string Title { get; set; } = null!;
|
|
||||||
public string Value { get; set; } = null!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PointRatioModel
|
|
||||||
{
|
|
||||||
[JsonProperty("names")]
|
|
||||||
public List<string> Names { get; set; } = null!;
|
|
||||||
[JsonProperty("data")]
|
|
||||||
public List<int> Data { get; set; } = null!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,14 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using pointMaster.Data;
|
|
||||||
using pointMaster.Models;
|
|
||||||
|
|
||||||
namespace pointMaster.Controllers
|
namespace pointMaster.Controllers
|
||||||
{
|
{
|
||||||
public class StatsController : Controller
|
public class StatsController : Controller
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public StatsController() { }
|
||||||
|
|
||||||
public StatsController(DataContext dataContext)
|
[Authorize(Policy = Roles.Editor)]
|
||||||
{
|
public IActionResult Index()
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
public async Task<IActionResult> Index()
|
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,45 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using pointMaster.Components;
|
||||||
|
using pointMaster.Controllers;
|
||||||
using pointMaster.Models;
|
using pointMaster.Models;
|
||||||
|
|
||||||
namespace pointMaster.Data
|
namespace pointMaster.Data
|
||||||
{
|
{
|
||||||
public class DataContext : DbContext
|
public class DataContext : DbContext
|
||||||
{
|
{
|
||||||
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
|
private readonly IHubContext<DataHub> _hubContext;
|
||||||
|
public DataContext(DbContextOptions<DataContext> options, IHubContext<DataHub> hubContext) : base(options)
|
||||||
|
{
|
||||||
|
_hubContext = hubContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int SaveChanges()
|
||||||
|
{
|
||||||
|
return base.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> SaveChangesAsync()
|
||||||
|
{
|
||||||
|
return await SaveChangesAsync(CancellationToken.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var result = await base.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
|
var v0 = await StatModel.Calculate(this);
|
||||||
|
var v1 = await PointRatioModel.Calculate(this);
|
||||||
|
var v2 = await PointChartModel.Calculate(this);
|
||||||
|
|
||||||
|
await _hubContext.Clients.All.SendAsync("StatData", new DataHub.StatData
|
||||||
|
{
|
||||||
|
Stats = v0,
|
||||||
|
PointRatio = v1,
|
||||||
|
PointChartModels = v2
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public DbSet<Patrulje> Patruljer { get; set; } = default!;
|
public DbSet<Patrulje> Patruljer { get; set; } = default!;
|
||||||
public DbSet<PatruljeMedlem> PatruljeMedlemmer { get; set; } = default!;
|
public DbSet<PatruljeMedlem> PatruljeMedlemmer { get; set; } = default!;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
public class Patrulje
|
public class Patrulje
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; }
|
||||||
public List<PatruljeMedlem> PatruljeMedlems { get; set; } = null!;
|
public List<PatruljeMedlem> PatruljeMedlems { get; set; }
|
||||||
public List<Point> Points { get; set; } = null!;
|
public List<Point> Points { get; set; }
|
||||||
public DateTime? DateCreated { get; set; }
|
public DateTime? DateCreated { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PatruljeMedlem
|
public class PatruljeMedlem
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; }
|
||||||
public int Age { get; set; }
|
public int Age { get; set; }
|
||||||
public Patrulje Patrulje { get; set; } = null!;
|
public Patrulje Patrulje { get; set; }
|
||||||
public DateTime? DateCreated { get; set; }
|
public DateTime? DateCreated { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Points { get; set; }
|
public int Points { get; set; }
|
||||||
public int Turnout { get; set; }
|
public int Turnout { get; set; }
|
||||||
public Patrulje Patrulje { get; set; } = null!;
|
public Patrulje Patrulje { get; set; }
|
||||||
public Post Poster { get; set; } = null!;
|
public Post Poster { get; set; }
|
||||||
public DateTime? DateCreated { get; set; }
|
public DateTime? DateCreated { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
public class Post
|
public class Post
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; }
|
||||||
public string Location { get; set; } = null!;
|
public string Location { get; set; }
|
||||||
public string Description { get; set; } = null!;
|
public string Description { get; set; }
|
||||||
public DateTime? DateCreated { get; set; }
|
public DateTime? DateCreated { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Keycloak.AuthServices.Authorization;
|
|||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||||
|
using pointMaster.Components;
|
||||||
using pointMaster.Controllers;
|
using pointMaster.Controllers;
|
||||||
using pointMaster.Data;
|
using pointMaster.Data;
|
||||||
|
|
||||||
@@ -55,8 +56,12 @@ builder
|
|||||||
options.ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor | Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto;
|
options.ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor | Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddSignalR();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.MapHub<DataHub>("/DataHub");
|
||||||
|
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
ViewData["Title"] = "Opret patrulje";
|
ViewData["Title"] = "Opret patrulje";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Create Patrulje</h1>
|
<h1>Opret Patrulje</h1>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<form asp-action="Create">
|
<form asp-action="Create">
|
||||||
@@ -13,6 +13,6 @@
|
|||||||
<input asp-for="Name" class="form-control" autocomplete="off"/>
|
<input asp-for="Name" class="form-control" autocomplete="off"/>
|
||||||
<span asp-validation-for="Name" class="text-danger"></span>
|
<span asp-validation-for="Name" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" class="btn btn-primary" />
|
<input type="submit" class="btn btn-primary" value="Opret"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
<form asp-action="GivPoint">
|
<form asp-action="GivPoint">
|
||||||
<div class="inputfield">
|
<div class="inputfield">
|
||||||
<h4>Point</h4>
|
<h4>Point</h4>
|
||||||
<input asp-for="points.Points" type="number" min="0" max="10" class="form-control" />
|
<input asp-for="points.Points" type="number" min="0" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
<div class="inputfield">
|
<div class="inputfield">
|
||||||
<h4>Turnout</h4>
|
<h4>Turnout</h4>
|
||||||
<input asp-for="points.Turnout" type="number" min="0" max="10" class="form-control" />
|
<input asp-for="points.Turnout" type="number" min="0" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sendButton">
|
<div class="sendButton">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<h1>@Model.patrulje.Name</h1>
|
<h1>@Model.patrulje.Name</h1>
|
||||||
|
|
||||||
<p>Total points: @Model.totalPoints</p>
|
<p>Total points: @Model.totalPoints</p>
|
||||||
<p>total turnout: @Model.totalTurnout</p>
|
<p>Total turnout: @Model.totalTurnout</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<h1>Poster</h1>
|
<h1>Poster</h1>
|
||||||
<a asp-action="Create" asp-controller="Poster" class="btn btn-primary">Opret Post</a>
|
<a asp-action="Create" asp-controller="Poster" class="btn btn-primary">Opret Post</a>
|
||||||
|
<a asp-action="Poster" asp-controller="Print" class="ms-4 btn btn-secondary">Print poster</a>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -9,11 +9,14 @@
|
|||||||
<div class="print-card">
|
<div class="print-card">
|
||||||
<div class="patrulje-info">
|
<div class="patrulje-info">
|
||||||
<h1>@patrulje.Name</h1>
|
<h1>@patrulje.Name</h1>
|
||||||
|
@if(patrulje.PatruljeMedlems.Any())
|
||||||
|
{
|
||||||
<p>Medlemmer:</p>
|
<p>Medlemmer:</p>
|
||||||
@foreach (var medlem in patrulje.PatruljeMedlems)
|
@foreach (var medlem in patrulje.PatruljeMedlems)
|
||||||
{
|
{
|
||||||
<p>@medlem.Name</p>
|
<p>@medlem.Name</p>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow"></div>
|
<div class="flex-grow"></div>
|
||||||
<img src="@Model.QRcode[patrulje.Id]" width="300" height="300" />
|
<img src="@Model.QRcode[patrulje.Id]" width="300" height="300" />
|
||||||
|
|||||||
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>
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aspnet/signalr": "^1.0.27",
|
||||||
"@vue/cli-plugin-typescript": "^5.0.8",
|
"@vue/cli-plugin-typescript": "^5.0.8",
|
||||||
"apexcharts": "^4.0.0",
|
"apexcharts": "^4.0.0",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="stat-dashboard">
|
<div class="grid">
|
||||||
<div class="stat-panel">
|
<div class="title">
|
||||||
<h1>Statistikker</h1>
|
<h1>Statistikker</h1>
|
||||||
|
</div>
|
||||||
<div class="stats">
|
<div class="stats">
|
||||||
<div
|
<div
|
||||||
class="stat"
|
v-for="(data, index) in statData"
|
||||||
v-for="(data, index) in StatData"
|
class="box"
|
||||||
:key="index"
|
|
||||||
>
|
>
|
||||||
<p class="stat-title">{{ data.Title }}</p>
|
<p class="header">{{ data.title }}</p>
|
||||||
<p class="stat-value">{{ data.Value }}</p>
|
<p class="content">{{ data.value }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="line-chart">
|
||||||
|
<div id="line-chart"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-chart">
|
<div class="pie-chart">
|
||||||
<p class="stat-title">Point over tid</p>
|
<div id="pie-chart"></div>
|
||||||
<div id="chart"></div>
|
|
||||||
<p class="stat-title">Point ratio</p>
|
|
||||||
<div id="pie"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -26,47 +25,33 @@
|
|||||||
import ApexCharts, { ApexOptions } from "apexcharts";
|
import ApexCharts, { ApexOptions } from "apexcharts";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { defineComponent, onMounted, ref } from "vue";
|
import { defineComponent, onMounted, ref } from "vue";
|
||||||
|
import { HubConnectionBuilder, LogLevel } from "@aspnet/signalr";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Stats",
|
name: "Stats",
|
||||||
setup() {
|
setup() {
|
||||||
const StatData = ref<Stat[]>([]);
|
const statData = ref<Stat[]>([]);
|
||||||
|
|
||||||
const GetStats = async () => {
|
const lineChartOptions: ApexOptions = {
|
||||||
const data = (await axios.get("/api/getstats")).data as Stat[];
|
|
||||||
|
|
||||||
StatData.value = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const initializeChart = async () => {
|
|
||||||
const options: ApexOptions = {
|
|
||||||
chart: {
|
chart: {
|
||||||
type: "line",
|
type: "line",
|
||||||
toolbar: {
|
toolbar: {
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
stroke: {
|
||||||
|
curve: "smooth"
|
||||||
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
type: "datetime",
|
type: "datetime",
|
||||||
|
labels: {
|
||||||
|
datetimeUTC: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
series: [],
|
series: [],
|
||||||
};
|
}
|
||||||
|
|
||||||
const chart = new ApexCharts(
|
const pieChartOptions: ApexOptions = {
|
||||||
document.querySelector("#chart"),
|
|
||||||
options
|
|
||||||
);
|
|
||||||
chart.render();
|
|
||||||
|
|
||||||
const data = (await axios.get("/api/GetPointsOverTime")).data;
|
|
||||||
|
|
||||||
chart.updateOptions({
|
|
||||||
series: data,
|
|
||||||
} as ApexOptions);
|
|
||||||
};
|
|
||||||
|
|
||||||
const initializePieChart = async () => {
|
|
||||||
const options: ApexOptions = {
|
|
||||||
chart: {
|
chart: {
|
||||||
type: "pie",
|
type: "pie",
|
||||||
toolbar: {
|
toolbar: {
|
||||||
@@ -76,83 +61,132 @@ export default defineComponent({
|
|||||||
series: [],
|
series: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const chart = new ApexCharts(
|
var lineChart: ApexCharts;
|
||||||
document.querySelector("#pie"),
|
var pieChart: ApexCharts;
|
||||||
options
|
|
||||||
|
const initalizeCharts = async () => {
|
||||||
|
|
||||||
|
lineChart = new ApexCharts(
|
||||||
|
document.querySelector("#line-chart"),
|
||||||
|
lineChartOptions
|
||||||
);
|
);
|
||||||
chart.render();
|
lineChart.render();
|
||||||
|
|
||||||
const data = (await axios.get("/api/pointratio")).data;
|
pieChart = new ApexCharts(
|
||||||
|
document.querySelector("#pie-chart"),
|
||||||
|
pieChartOptions
|
||||||
|
);
|
||||||
|
pieChart.render();
|
||||||
|
}
|
||||||
|
|
||||||
chart.updateOptions({
|
const initializeHub = async () => {
|
||||||
series: data.data,
|
|
||||||
labels: data.names,
|
const connection = new HubConnectionBuilder().withUrl("../DataHub").configureLogging(LogLevel.Information).build();
|
||||||
|
|
||||||
|
connection.start();
|
||||||
|
|
||||||
|
connection.on("ReceiveMessage", async (data: StatData) => {
|
||||||
|
connection.invoke("SendData");
|
||||||
|
console.log(data);
|
||||||
|
})
|
||||||
|
|
||||||
|
connection.on("StatData", (a:StatData) => {
|
||||||
|
console.log(a);
|
||||||
|
updateData(a);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateData = (data: StatData) => {
|
||||||
|
lineChart.updateOptions({
|
||||||
|
series: data.pointChartModels,
|
||||||
} as ApexOptions);
|
} as ApexOptions);
|
||||||
};
|
|
||||||
|
pieChart.updateOptions({
|
||||||
|
series: data.pointRatio.data,
|
||||||
|
labels: data.pointRatio.names,
|
||||||
|
});
|
||||||
|
|
||||||
|
statData.value = (data.stats as Stat[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await GetStats();
|
await initalizeCharts()
|
||||||
await initializeChart();
|
await initializeHub()
|
||||||
await initializePieChart();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
StatData,
|
statData,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.stat-dashboard {
|
.grid {
|
||||||
display: flex;
|
display: grid;
|
||||||
justify-content: space-between;
|
grid-template-areas:
|
||||||
flex-direction: row;
|
"a a"
|
||||||
|
"b b"
|
||||||
|
"c d";
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 640px) {
|
||||||
flex-direction: column;
|
.grid {
|
||||||
|
grid-template-areas:
|
||||||
|
"a"
|
||||||
|
"b"
|
||||||
|
"c"
|
||||||
|
"d";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-panel {
|
.title {
|
||||||
@media (max-width: 768px) {
|
grid-area: a;
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-chart {
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats {
|
.stats {
|
||||||
display: grid;
|
grid-area: b;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
display: flex;
|
||||||
gap: 2rem;
|
justify-content: space-between;
|
||||||
|
|
||||||
@media (max-width: 1000px) {
|
@media (max-width: 640px) {
|
||||||
grid-template-columns: repeat(2, 1fr);
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
margin: auto;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat {
|
margin-top: 2rem;
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
margin-bottom: 6rem;
|
||||||
padding: 10px;
|
|
||||||
height: 7rem;
|
.box {
|
||||||
width: 10rem;
|
width: 12rem;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: rgba(0,0,0,.2);
|
||||||
|
border: solid rgba(0,0,0,0.3) 1px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
|
box-shadow: 5px 5px 5px rgba(0,0,0,.1);
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-title {
|
.header {
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
margin: 0;
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-value {
|
.line-chart {
|
||||||
font-weight: 400;
|
grid-area: c;
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pie-chart {
|
||||||
|
grid-area: d;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
10
pointMaster/js/src/typings.d.ts
vendored
10
pointMaster/js/src/typings.d.ts
vendored
@@ -8,6 +8,12 @@ type Point = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Stat = {
|
type Stat = {
|
||||||
Title: string;
|
title: string;
|
||||||
Value: string;
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type StatData = {
|
||||||
|
stats: any;
|
||||||
|
pointRatio: any;
|
||||||
|
pointChartModels: any;
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<UserSecretsId>f4aae456-b78c-4976-9472-dd315dc4a61f</UserSecretsId>
|
<UserSecretsId>f4aae456-b78c-4976-9472-dd315dc4a61f</UserSecretsId>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
<PackageReference Include="Keycloak.AuthServices.Authentication" Version="2.5.3" />
|
<PackageReference Include="Keycloak.AuthServices.Authentication" Version="2.5.3" />
|
||||||
<PackageReference Include="Keycloak.AuthServices.Authorization" Version="2.5.3" />
|
<PackageReference Include="Keycloak.AuthServices.Authorization" Version="2.5.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
Reference in New Issue
Block a user