diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/ImportCompetencies.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/ImportCompetencies.cs index 133efd717f..08ff1eb0ff 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/ImportCompetencies.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/ImportCompetencies.cs @@ -187,7 +187,7 @@ public IActionResult AddAssessmentQuestions(AddAssessmentQuestionsFormData model { data.AddAssessmentQuestionsOption = 1; setBulkUploadData(data); - return RedirectToAction("Summary", "Frameworks", new { frameworkId = data.FrameworkId, tabname = data.TabName }); + return RedirectToAction("ImportSummary", "Frameworks", new { frameworkId = data.FrameworkId, tabname = data.TabName }); } } [Route("/Framework/{frameworkId}/{tabname}/Import/AssessmentQuestions/Competencies")] @@ -215,7 +215,14 @@ public IActionResult AddQuestionsToWhichCompetencies(int AddAssessmentQuestionsO var data = GetBulkUploadData(); data.AddAssessmentQuestionsOption = AddAssessmentQuestionsOption; setBulkUploadData(data); - return RedirectToAction("Summary", "Frameworks", new { frameworkId = data.FrameworkId, tabname = data.TabName }); + return RedirectToAction("ImportSummary", "Frameworks", new { frameworkId = data.FrameworkId, tabname = data.TabName }); + } + [Route("/Framework/{frameworkId}/{tabname}/Import/Summary")] + public IActionResult ImportSummary() + { + var data = GetBulkUploadData(); + var model = new ImportSummaryViewModel(data); + return View("Developer/Import/ImportSummary", model); } [Route("CancelImport")] public IActionResult CancelImport() diff --git a/DigitalLearningSolutions.Web/ViewModels/Frameworks/Import/ImportSummaryViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/Frameworks/Import/ImportSummaryViewModel.cs new file mode 100644 index 0000000000..f59c14f72d --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewModels/Frameworks/Import/ImportSummaryViewModel.cs @@ -0,0 +1,41 @@ +using DigitalLearningSolutions.Web.Helpers; +using DigitalLearningSolutions.Web.Models; +using System.Collections.Generic; + +namespace DigitalLearningSolutions.Web.ViewModels.Frameworks.Import +{ + public class ImportSummaryViewModel + { + public ImportSummaryViewModel(BulkCompetenciesData data) + { + FrameworkName = data.FrameworkName; + PublishStatusID = data.PublishStatusID; + FrameworkVocabularySingular = FrameworkVocabularyHelper.VocabularySingular(data.FrameworkVocubulary); + FrameworkVocabularyPlural = FrameworkVocabularyHelper.VocabularyPlural(data.FrameworkVocubulary); + ToProcessCount = data.CompetenciesToProcessCount; + CompetenciesToAddCount = data.CompetenciesToAddCount; + CompetenciesToReorderCount = data.CompetenciesToReorderCount; + ToUpdateOrSkipCount = data.CompetenciesToUpdateCount; + AddAssessmentQuestionsOption = data.AddAssessmentQuestionsOption; + AddDefaultAssessmentQuestions = data.AddDefaultAssessmentQuestions; + AddCustomAssessmentQuestion = data.AddCustomAssessmentQuestion; + DefaultAssessmentQuestionIDs = data.DefaultQuestionIDs; + CustomAssessmentQuestionID = data.CustomAssessmentQuestionID; + ReorderCompetenciesOption = data.ReorderCompetenciesOption; + } + public string? FrameworkName { get; set; } + public int PublishStatusID { get; set; } + public string FrameworkVocabularySingular { get; set; } + public string FrameworkVocabularyPlural { get; set; } + public int ToProcessCount { get; set; } + public int CompetenciesToAddCount { get; set; } + public int CompetenciesToReorderCount { get; set; } + public int ToUpdateOrSkipCount { get; set; } + public int AddAssessmentQuestionsOption { get; set; } = 1; //1 = only added, 2 = added and updated, 3 = all uploaded + public bool AddDefaultAssessmentQuestions { get; set; } + public bool AddCustomAssessmentQuestion { get; set; } + public List DefaultAssessmentQuestionIDs { get; set; } + public int? CustomAssessmentQuestionID { get; set; } + public int ReorderCompetenciesOption { get; set; } = 1; //1 = ignore order, 2 = apply order + } +} diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/AddQuestionsToWhichCompetencies.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/AddQuestionsToWhichCompetencies.cshtml index 0dcf3bc1f2..eef8dbabe8 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/AddQuestionsToWhichCompetencies.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/AddQuestionsToWhichCompetencies.cshtml @@ -59,10 +59,10 @@
- @(Model.CompetenciesToAddCount > 0 ? Model.CompetenciesToAddCount + " new @Model.FrameworkVocabularyPlural.ToLower() and only those of the " : "Only those of the ") @Model.CompetenciesToUpdateCount existing @Model.FrameworkVocabularyPlural.ToLower() that have been modified in the sheet will have the assessment questions added + @(Model.CompetenciesToAddCount > 0 ? Model.CompetenciesToAddCount + $" new {@Model.FrameworkVocabularyPlural.ToLower()} and only those of the " : "Only those of the ") @Model.CompetenciesToUpdateCount existing @Model.FrameworkVocabularyPlural.ToLower() that have been modified in the sheet will have the assessment questions added
diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/ImportSummary.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/ImportSummary.cshtml new file mode 100644 index 0000000000..5a782d911f --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/ImportSummary.cshtml @@ -0,0 +1,110 @@ +@inject IConfiguration Configuration +@using DigitalLearningSolutions.Web.Extensions +@using DigitalLearningSolutions.Web.ViewModels.Frameworks.Import +@using Microsoft.Extensions.Configuration +@model ImportSummaryViewModel +@{ + ViewData["Title"] = "Framework - Import Competencies"; + ViewData["Application"] = "Framework Service"; + ViewData["HeaderPathName"] = "Framework Service"; + var errorHasOccurred = !ViewData.ModelState.IsValid; + var cancelLinkData = Html.GetRouteValues(); + var process = Model.CompetenciesToAddCount > 0 && Model.ToUpdateOrSkipCount > 0 ? "add and update" : Model.CompetenciesToAddCount > 0 ? "add" : "update"; + var addQsTo = Model.AddAssessmentQuestionsOption == 1 ? "new" : Model.AddAssessmentQuestionsOption == 2 ? "new and updated" : "all"; +} + +@section NavMenuItems { + +} +@section NavBreadcrumbs { + +} +
+
+

@Model.FrameworkVocabularyPlural import summary

+

Your @Model.FrameworkVocabularySingular.ToLower() sheet is ready to be processed. Please check the details below are correct before proceeding to @process @Model.FrameworkVocabularyPlural.ToLower() in the framework @Model.FrameworkName.

+

Upload summary

+
+ +
+
+ @Model.FrameworkVocabularySingular rows uploaded +
+
+ @Model.ToProcessCount +
+ +
+ +
+
+ @Model.FrameworkVocabularyPlural to add +
+
+ @Model.CompetenciesToAddCount +
+ +
+ +
+
+ @Model.FrameworkVocabularyPlural to update +
+
+ @Model.ToUpdateOrSkipCount +
+
+
+

Additional processing steps

+
+ @if (Model.CompetenciesToReorderCount > 0) + { +
+
+ Changes to @Model.FrameworkVocabularySingular.ToLower() order +
+
+ @(Model.ReorderCompetenciesOption == 1 ? "Ignore" : "Apply") changes to @Model.FrameworkVocabularySingular.ToLower() order +
+
+ + Change @Model.FrameworkVocabularySingular.ToLower() order options + +
+
+ } +
+
+ Add questions to @addQsTo @Model.FrameworkVocabularyPlural.ToLower() in sheet +
+
+ @Model.DefaultAssessmentQuestionIDs.Count() framework default questions @(Model.AddCustomAssessmentQuestion && Model.CustomAssessmentQuestionID != null ? "AND a custom question" : "") +
+
+ + Change assessment question options + +
+
+
+ +
+ Important: +

Once @Model.FrameworkVocabularySingular.ToLower() records are processed, changes cannot be undone.

+
+
+ Back + +
+ +
+