-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added View MQ (CRM + UI + tests) (#931)
Fixed based on PR comments Fixed compiler warning Tweak based on PR comments Tweaks based on updated designs Add MQ Backend and UI Fixed PR issues Fixed PR issues Added View MQ (CRM + UI + tests) Re-ran CRM code generation following rebase Regenerated CRM code after rebase Re-added link lost in merge conflict resolution Fixed failing test
- Loading branch information
Showing
25 changed files
with
467 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...cordSystem/src/TeachingRecordSystem.Core/Dqt/Queries/GetQualificationsByContactIdQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
public record GetQualificationsByContactIdQuery(Guid ContactId) : ICrmQuery<dfeta_qualification[]>; |
39 changes: 39 additions & 0 deletions
39
...em/src/TeachingRecordSystem.Core/Dqt/QueryHandlers/GetQualificationsByContactIdHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.PowerPlatform.Dataverse.Client; | ||
using Microsoft.Xrm.Sdk.Messages; | ||
using Microsoft.Xrm.Sdk.Query; | ||
using TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
namespace TeachingRecordSystem.Core.Dqt.QueryHandlers; | ||
|
||
public class GetQualificationsByContactIdHandler : ICrmQueryHandler<GetQualificationsByContactIdQuery, dfeta_qualification[]> | ||
{ | ||
public async Task<dfeta_qualification[]> Execute(GetQualificationsByContactIdQuery query, IOrganizationServiceAsync organizationService) | ||
{ | ||
var filter = new FilterExpression(); | ||
filter.AddCondition(dfeta_qualification.Fields.dfeta_PersonId, ConditionOperator.Equal, query.ContactId); | ||
filter.AddCondition(dfeta_qualification.Fields.StateCode, ConditionOperator.Equal, (int)dfeta_qualificationState.Active); | ||
|
||
var queryExpression = new QueryExpression(dfeta_qualification.EntityLogicalName) | ||
{ | ||
ColumnSet = new ColumnSet( | ||
dfeta_qualification.PrimaryIdAttribute, | ||
dfeta_qualification.Fields.dfeta_Type, | ||
dfeta_qualification.Fields.dfeta_CompletionorAwardDate, | ||
dfeta_qualification.Fields.dfeta_MQ_MQEstablishmentId, | ||
dfeta_qualification.Fields.dfeta_MQStartDate, | ||
dfeta_qualification.Fields.dfeta_MQ_SpecialismId, | ||
dfeta_qualification.Fields.dfeta_MQ_Date, | ||
dfeta_qualification.Fields.dfeta_MQ_Status, | ||
dfeta_qualification.Fields.StateCode), | ||
Criteria = filter | ||
}; | ||
|
||
var request = new RetrieveMultipleRequest() | ||
{ | ||
Query = queryExpression | ||
}; | ||
|
||
var result = (RetrieveMultipleResponse)await organizationService.ExecuteAsync(request); | ||
return result.EntityCollection.Entities.Select(entity => entity.ToEntity<dfeta_qualification>()).ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Qualifications.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@page "/persons/{personId}/qualifications" | ||
@using TeachingRecordSystem.SupportUi.Pages.Common; | ||
@model TeachingRecordSystem.SupportUi.Pages.Persons.PersonDetail.QualificationsModel | ||
@{ | ||
Layout = "Layout"; | ||
ViewBag.SelectedTab = PersonSubNavigationTab.Qualifications; | ||
ViewBag.PersonId = Model.PersonId; | ||
ViewBag.Search = Model.Search; | ||
ViewBag.SortBy = Model.SortBy; | ||
ViewBag.PageNumber = Model.PageNumber; | ||
ViewBag.Title = Model.Name; | ||
} | ||
|
||
@if (Model.MandatoryQualifications is null || Model.MandatoryQualifications.Length == 0) | ||
{ | ||
<p class="govuk-body" data-testid="no-mandatory-qualifications">No mandatory qualifications</p> | ||
} | ||
else | ||
{ | ||
@foreach (var mq in Model.MandatoryQualifications) | ||
{ | ||
<govuk-summary-card data-testid="[email protected]"> | ||
<govuk-summary-card-title>Mandatory qualification@(!string.IsNullOrEmpty(mq.Specialism) ? $" for {mq.Specialism!.ToLowerInvariant()}" : "")</govuk-summary-card-title> | ||
<govuk-summary-card-actions> | ||
<govuk-summary-card-action href="#" visually-hidden-text="remove qualification" data-testid="[email protected]">Remove qualification</govuk-summary-card-action> | ||
</govuk-summary-card-actions> | ||
<govuk-summary-list> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Training provider</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="[email protected]">@(!string.IsNullOrEmpty(mq.Provider) ? mq.Provider : "None")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="#" visually-hidden-text="change training provider">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Specialism</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="[email protected]">@(!string.IsNullOrEmpty(mq.Specialism) ? mq.Specialism : "None")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="#" visually-hidden-text="change specialism">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Start date</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="[email protected]">@(mq.StartDate.HasValue ? mq.StartDate!.Value.ToString("d MMMM yyyy") : "None")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="#" visually-hidden-text="change start date">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Result</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="[email protected]">@(mq.Result.HasValue ? mq.Result!.ToString() : "None")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="#" visually-hidden-text="change result">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>End date</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="[email protected]">@(mq.EndDate.HasValue ? mq.EndDate!.Value.ToString("d MMMM yyyy") : "None")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="#" visually-hidden-text="change end date">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
</govuk-summary-list> | ||
</govuk-summary-card> | ||
} | ||
} | ||
|
||
<govuk-button-link href="@LinkGenerator.MqAdd(Model.PersonId)" class="govuk-button" data-testid="add-mandatory-qualification">Add a mandatory qualification</govuk-button-link> |
Oops, something went wrong.