Skip to content

Commit

Permalink
Fix and improve reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
k7hpn committed Oct 31, 2024
1 parent c6952a8 commit 3c07a25
Show file tree
Hide file tree
Showing 30 changed files with 685 additions and 619 deletions.
8 changes: 8 additions & 0 deletions src/GRA.Controllers/MissionControl/ReportingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public ReportingController(ILogger<ReportingController> logger,
PageTitle = "Reporting";
}

public static string Name
{
get
{
return "Reporting";
}
}

[HttpGet]
public async Task<IActionResult> Configure(int id)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,58 @@ namespace GRA.Controllers.ViewModel.MissionControl.Reporting
{
public class ReportCriteriaViewModel
{
public int ReportId { get; set; }
public string BadgeRequiredList { get; set; }

[DisplayName("Start Date")]
public DateTime? StartDate { get; set; }
[DisplayName("Select a branch")]
public int? BranchId { get; set; }

public SelectList BranchList { get; set; }
public string ChallengeRequiredList { get; set; }

[DisplayName("End Date")]
public DateTime? EndDate { get; set; }

public DateTime ProgramStartDate { get; set; }

[DisplayName("Select a system")]
public int? SystemId { get; set; }
[DisplayName("Select a group")]
public int? GroupInfoId { get; set; }

[DisplayName("Select a branch")]
public int? BranchId { get; set; }
public SelectList GroupInfosList { get; set; }
public SelectList PrizeList { get; set; }

[DisplayName("Select a program")]
public int? ProgramId { get; set; }

public SelectList ProgramList { get; set; }
public DateTime ProgramStartDate { get; set; }

[DisplayName("Badges to Report")]
public ICollection<TriggerRequirement> ReportBadges { get; set; }

public int ReportId { get; set; }

[DisplayName("Select a school district")]
public int? SchoolDistrictId { get; set; }

public SelectList SchoolDistrictList { get; set; }

[DisplayName("Select a school")]
public int? SchoolId { get; set; }

[DisplayName("Select a group")]
public int? GroupInfoId { get; set; }
public SelectList SchoolList { get; set; }

[DisplayName("Select a vendor code")]
public int? VendorCodeTypeId { get; set; }
[DisplayName("Start Date")]
public DateTime? StartDate { get; set; }

[DisplayName("Select triggers")]
public List<int> TriggerList { get; set; }
[DisplayName("Select a system")]
public int? SystemId { get; set; }

public SelectList SystemList { get; set; }
public SelectList BranchList { get; set; }
public SelectList ProgramList { get; set; }
public SelectList SchoolDistrictList { get; set; }
public SelectList SchoolList { get; set; }
public SelectList GroupInfosList { get; set; }
public SelectList VendorCodeTypeList { get; set; }
public SelectList PrizeList { get; set; }

[DisplayName("Badges to Report")]
public ICollection<TriggerRequirement> ReportBadges { get; set; }
[DisplayName("Select triggers (use SHIFT or CTRL to select multiple items)")]
public List<int> TriggerList { get; set; }

public string BadgeRequiredList { get; set; }
public string ChallengeRequiredList { get; set; }
[DisplayName("Select a vendor code")]
public int? VendorCodeTypeId { get; set; }

public SelectList VendorCodeTypeList { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,8 @@
$(".challengeScope").on("click", function (e) {
e.preventDefault();
$(this).siblings().removeClass("active");
$(this).addClass().addClass("active");
$(this).siblings().children().removeClass("active");
$(this).children().addClass("active");
challengeScope = $(this).attr("id");
page = 1;
UpdateChallengeList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@
$(".challengeScope").on("click", function (e) {
e.preventDefault();
$(this).siblings().children().removeClass("active");
$(this).children().addClass().addClass("active");
$(this).children().addClass("active");
challengeScope = $(this).attr("id");
page = 1;
UpdateChallengeList();
Expand Down
2 changes: 1 addition & 1 deletion src/GRA.Web/Areas/MissionControl/Views/Events/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@
$(".challengeScope").on("click", function (e) {
e.preventDefault();
$(this).siblings().children().removeClass("active");
$(this).children().addClass().addClass("active");
$(this).children().addClass("active");
challengeScope = $(this).attr("id");
page = 1;
UpdateChallengeList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@
$("#All").on("click", function () {
if (systemId != null) {
$(this).siblings().removeClass("active");
$(this).addClass().addClass("active");
$(this).addClass("active");
$("#systemText").text("System");
$("#branchText").text("Branch");
if (systemId != defaultSystemId) {
Expand All @@ -1144,7 +1144,7 @@
if (systemId == null || branchId != null) {
var navPill = $(this).parent().parent().parent();
navPill.siblings().removeClass("active");
navPill.addClass().addClass("active");
navPill.addClass("active");
if (branchId != null) {
$("#branchText").text("Branch");
}
Expand All @@ -1166,7 +1166,7 @@
if (branchId == null) {
var navPill = $(this).parent().parent().parent();
navPill.siblings().removeClass("active");
navPill.addClass().addClass("active");
navPill.addClass("active");
if (systemId == null) {
systemId = defaultSystemId;
$("#systemText").text($(".system-selector").first().text());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,13 @@
@model GRA.Controllers.ViewModel.MissionControl.Reporting.ReportCriteriaViewModel

<form asp-controller="Reporting" asp-action="Run" method="post" role="form" class="form-horizontal" style="margin-top: 2rem; margin-bottom: 2rem;">
<form asp-action="@nameof(ReportingController.Run)"
asp-controller="@ReportingController.Name"
class="form-horizontal"
method="post"
role="form">
<input asp-for="ReportId" type="hidden" />

<!-- TODO Fix for reporting over a time period
<div class="row" style="padding: 10px 0;">
<div class="col-12">
<btn type="button" class="btn btn-secondary time-selector" data-start="null" data-end="null">Entire program</btn>
<btn type="button" class="btn btn-secondary time-selector" data-start="@DateTime.Now.AddDays(-8).ToString("MM/dd/yyyy")" data-end="@DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy")">Last 7 days</btn>
</div>
</div>
<div class="mb-3">
<div class="col-6">
<label asp-for="StartDate" class="col-form-label"></label>
<div class="input-group date" id="pickerStart">
<span class="input-group-addon">
<span class="fas fa-calendar-alt"></span>
</span>
<input asp-for="StartDate" type="text" class="form-control" />
</div>
<span asp-validation-for="StartDate" class="text-danger"></span>
</div>
<div class="col-6">
<label asp-for="EndDate" class="col-form-label"></label>
<div class="input-group date" id="pickerEnd">
<span class="input-group-addon">
<span class="fas fa-calendar-alt"></span>
</span>
<input asp-for="EndDate" type="text" class="form-control" />
</div>
<span asp-validation-for="EndDate" class="text-danger"></span>
</div>
</div>
-->

<div class="mb-3">
<div class="my-4">
<div class="col-12">
<label asp-for="SystemId" class="col-form-label"></label>
<select asp-for="SystemId" asp-items="Model.SystemList" class="form-select">
Expand All @@ -45,7 +16,7 @@
</div>
</div>

<div class="mb-3">
<div class="row mt-4">
<div class="col-12">
<button type="submit" class="btn btn-outline-primary">
<span class="fas fa-file-alt"></span>
Expand All @@ -54,20 +25,3 @@
</div>
</div>
</form>

@section scripts
{
<script>
$("#pickerStart").data("DateTimePicker").defaultDate(moment(new Date()).subtract(2, "d").format("MM/DD/YYYY"));
$("#pickerEnd").data("DateTimePicker").defaultDate(moment(new Date()).subtract(1, "d").format("MM/DD/YYYY"));
$(".time-selector").on("click", function() {
$("#pickerStart").data("DateTimePicker").date($(this).data("start"));
var end = $(this).data("end");
if (end === "now") {
end = new Date();
}
$("#pickerEnd").data("DateTimePicker").date(end);
});
</script>
}
Loading

0 comments on commit 3c07a25

Please sign in to comment.