diff --git a/src/CareTogether.Api/OData/LiveODataModelController.cs b/src/CareTogether.Api/OData/LiveODataModelController.cs index 7a9231a47..adc96b317 100644 --- a/src/CareTogether.Api/OData/LiveODataModelController.cs +++ b/src/CareTogether.Api/OData/LiveODataModelController.cs @@ -293,7 +293,8 @@ public sealed record FamilyRequirementStatus ( [property: Key] string RequirementName, string Status, DateTimeOffset? Date, - DateTimeOffset? ExpireDate + DateTimeOffset? ExpireDate, + string? Role ); public sealed record IndividualRequirementStatus( @@ -303,7 +304,8 @@ public sealed record IndividualRequirementStatus( [property: Key] string RequirementName, string Status, DateTimeOffset? Date, - DateTimeOffset? ExpireDate + DateTimeOffset? ExpireDate, + string? Role ); public sealed record LiveModel( @@ -932,7 +934,8 @@ await accountsResource.TryGetPersonUserAccountAsync( req.RequirementName, "Complete", req.CompletedAtUtc, - req.ExpiresAtUtc + req.ExpiresAtUtc, + req.RoleName )); } } @@ -948,7 +951,8 @@ await accountsResource.TryGetPersonUserAccountAsync( req.RequirementName, "Exempted", req.DueDate, - req.ExemptionExpiresAtUtc + req.ExemptionExpiresAtUtc, + req.RoleName )); } } @@ -965,7 +969,8 @@ await accountsResource.TryGetPersonUserAccountAsync( missing.ActionName, "Pending", null, - null + null, + missing.Versions.FirstOrDefault().RoleName )); } } @@ -992,7 +997,8 @@ await accountsResource.TryGetPersonUserAccountAsync( req.RequirementName, "Complete", req.CompletedAtUtc, - req.ExpiresAtUtc + req.ExpiresAtUtc, + req.RoleName )); } } @@ -1008,7 +1014,8 @@ await accountsResource.TryGetPersonUserAccountAsync( missing.ActionName, "Pending", null, - null + null, + missing.Versions.FirstOrDefault().RoleName )); } } @@ -1024,7 +1031,8 @@ await accountsResource.TryGetPersonUserAccountAsync( exempt.RequirementName, "Exempted", exempt.DueDate, - exempt.ExemptionExpiresAtUtc + exempt.ExemptionExpiresAtUtc, + exempt.RoleName )); } } diff --git a/src/CareTogether.Core/Resources/Approvals/ApprovalModel.cs b/src/CareTogether.Core/Resources/Approvals/ApprovalModel.cs index de3e585ff..7749f60c9 100644 --- a/src/CareTogether.Core/Resources/Approvals/ApprovalModel.cs +++ b/src/CareTogether.Core/Resources/Approvals/ApprovalModel.cs @@ -79,7 +79,8 @@ DateTime timestampUtc c.CompletedAtUtc, ExpiresAtUtc: null, c.UploadedDocumentId, - c.NoteId + c.NoteId, + c.RoleName ) ), }, @@ -100,7 +101,8 @@ DateTime timestampUtc c.RequirementName, DueDate: null, c.AdditionalComments, - c.ExemptionExpiresAtUtc + c.ExemptionExpiresAtUtc, + c.RoleName ) ), }, @@ -223,7 +225,8 @@ out var volunteerEntry c.CompletedAtUtc, ExpiresAtUtc: null, c.UploadedDocumentId, - c.NoteId + c.NoteId, + c.RoleName ) ), }, @@ -243,10 +246,12 @@ out var volunteerEntry c.RequirementName, DueDate: null, c.AdditionalComments, - c.ExemptionExpiresAtUtc + c.ExemptionExpiresAtUtc, + c.RoleName ) ), }, + UnexemptVolunteerRequirement c => volunteerEntry with { ExemptedRequirements = volunteerEntry.ExemptedRequirements.RemoveAll(x => diff --git a/src/CareTogether.Core/Resources/Approvals/IApprovalsResource.cs b/src/CareTogether.Core/Resources/Approvals/IApprovalsResource.cs index 1d59f7d32..7c9decd34 100644 --- a/src/CareTogether.Core/Resources/Approvals/IApprovalsResource.cs +++ b/src/CareTogether.Core/Resources/Approvals/IApprovalsResource.cs @@ -53,7 +53,8 @@ public sealed record CompleteVolunteerFamilyRequirement( string RequirementName, DateTime CompletedAtUtc, Guid? UploadedDocumentId, - Guid? NoteId + Guid? NoteId, + string? RoleName = null ) : VolunteerFamilyCommand(FamilyId); public sealed record MarkVolunteerFamilyRequirementIncomplete( @@ -66,7 +67,8 @@ public sealed record ExemptVolunteerFamilyRequirement( Guid FamilyId, string RequirementName, string AdditionalComments, - DateTime? ExemptionExpiresAtUtc + DateTime? ExemptionExpiresAtUtc, + string? RoleName = null ) : VolunteerFamilyCommand(FamilyId); public sealed record UnexemptVolunteerFamilyRequirement(Guid FamilyId, string RequirementName) @@ -104,7 +106,8 @@ public sealed record CompleteVolunteerRequirement( string RequirementName, DateTime CompletedAtUtc, Guid? UploadedDocumentId, - Guid? NoteId + Guid? NoteId, + string? RoleName = null ) : VolunteerCommand(FamilyId, PersonId); public sealed record MarkVolunteerRequirementIncomplete( @@ -119,7 +122,8 @@ public sealed record ExemptVolunteerRequirement( Guid PersonId, string RequirementName, string AdditionalComments, - DateTime? ExemptionExpiresAtUtc + DateTime? ExemptionExpiresAtUtc, + string? RoleName = null ) : VolunteerCommand(FamilyId, PersonId); public sealed record UnexemptVolunteerRequirement( diff --git a/src/CareTogether.Core/Resources/SharedContracts.cs b/src/CareTogether.Core/Resources/SharedContracts.cs index f20c73bec..3f946586b 100644 --- a/src/CareTogether.Core/Resources/SharedContracts.cs +++ b/src/CareTogether.Core/Resources/SharedContracts.cs @@ -12,7 +12,8 @@ public sealed record CompletedRequirementInfo( DateTime CompletedAtUtc, DateTime? ExpiresAtUtc, Guid? UploadedDocumentId, - Guid? NoteId + Guid? NoteId, + string? RoleName = null ); public sealed record ExemptedRequirementInfo( @@ -21,7 +22,8 @@ public sealed record ExemptedRequirementInfo( string RequirementName, DateTime? DueDate, string AdditionalComments, - DateTime? ExemptionExpiresAtUtc + DateTime? ExemptionExpiresAtUtc, + string? RoleName = null ); public sealed record UploadedDocumentInfo( diff --git a/src/caretogether-pwa/src/GeneratedClient.ts b/src/caretogether-pwa/src/GeneratedClient.ts index 04e7bb061..c17c4dcd0 100644 --- a/src/caretogether-pwa/src/GeneratedClient.ts +++ b/src/caretogether-pwa/src/GeneratedClient.ts @@ -6500,6 +6500,7 @@ export class CompletedRequirementInfo implements ICompletedRequirementInfo { expiresAtUtc?: Date | undefined; uploadedDocumentId?: string | undefined; noteId?: string | undefined; + roleName?: string | undefined; constructor(data?: ICompletedRequirementInfo) { if (data) { @@ -6520,6 +6521,7 @@ export class CompletedRequirementInfo implements ICompletedRequirementInfo { this.expiresAtUtc = _data["expiresAtUtc"] ? new Date(_data["expiresAtUtc"].toString()) : undefined; this.uploadedDocumentId = _data["uploadedDocumentId"]; this.noteId = _data["noteId"]; + this.roleName = _data["roleName"]; } } @@ -6540,6 +6542,7 @@ export class CompletedRequirementInfo implements ICompletedRequirementInfo { data["expiresAtUtc"] = this.expiresAtUtc ? this.expiresAtUtc.toISOString() : undefined; data["uploadedDocumentId"] = this.uploadedDocumentId; data["noteId"] = this.noteId; + data["roleName"] = this.roleName; return data; } } @@ -6553,6 +6556,7 @@ export interface ICompletedRequirementInfo { expiresAtUtc?: Date | undefined; uploadedDocumentId?: string | undefined; noteId?: string | undefined; + roleName?: string | undefined; } export class ExemptedRequirementInfo implements IExemptedRequirementInfo { @@ -6562,6 +6566,7 @@ export class ExemptedRequirementInfo implements IExemptedRequirementInfo { dueDate?: Date | undefined; additionalComments!: string; exemptionExpiresAtUtc?: Date | undefined; + roleName?: string | undefined; constructor(data?: IExemptedRequirementInfo) { if (data) { @@ -6580,6 +6585,7 @@ export class ExemptedRequirementInfo implements IExemptedRequirementInfo { this.dueDate = _data["dueDate"] ? new Date(_data["dueDate"].toString()) : undefined; this.additionalComments = _data["additionalComments"]; this.exemptionExpiresAtUtc = _data["exemptionExpiresAtUtc"] ? new Date(_data["exemptionExpiresAtUtc"].toString()) : undefined; + this.roleName = _data["roleName"]; } } @@ -6598,6 +6604,7 @@ export class ExemptedRequirementInfo implements IExemptedRequirementInfo { data["dueDate"] = this.dueDate ? this.dueDate.toISOString() : undefined; data["additionalComments"] = this.additionalComments; data["exemptionExpiresAtUtc"] = this.exemptionExpiresAtUtc ? this.exemptionExpiresAtUtc.toISOString() : undefined; + data["roleName"] = this.roleName; return data; } } @@ -6609,6 +6616,7 @@ export interface IExemptedRequirementInfo { dueDate?: Date | undefined; additionalComments: string; exemptionExpiresAtUtc?: Date | undefined; + roleName?: string | undefined; } export class Arrangement implements IArrangement { @@ -11258,6 +11266,7 @@ export class CompleteVolunteerFamilyRequirement extends VolunteerFamilyCommand i completedAtUtc!: Date; uploadedDocumentId?: string | undefined; noteId?: string | undefined; + roleName?: string | undefined; constructor(data?: ICompleteVolunteerFamilyRequirement) { super(data); @@ -11272,6 +11281,7 @@ export class CompleteVolunteerFamilyRequirement extends VolunteerFamilyCommand i this.completedAtUtc = _data["completedAtUtc"] ? new Date(_data["completedAtUtc"].toString()) : undefined; this.uploadedDocumentId = _data["uploadedDocumentId"]; this.noteId = _data["noteId"]; + this.roleName = _data["roleName"]; } } @@ -11289,6 +11299,7 @@ export class CompleteVolunteerFamilyRequirement extends VolunteerFamilyCommand i data["completedAtUtc"] = this.completedAtUtc ? this.completedAtUtc.toISOString() : undefined; data["uploadedDocumentId"] = this.uploadedDocumentId; data["noteId"] = this.noteId; + data["roleName"] = this.roleName; super.toJSON(data); return data; } @@ -11300,12 +11311,14 @@ export interface ICompleteVolunteerFamilyRequirement extends IVolunteerFamilyCom completedAtUtc: Date; uploadedDocumentId?: string | undefined; noteId?: string | undefined; + roleName?: string | undefined; } export class ExemptVolunteerFamilyRequirement extends VolunteerFamilyCommand implements IExemptVolunteerFamilyRequirement { requirementName!: string; additionalComments!: string; exemptionExpiresAtUtc?: Date | undefined; + roleName?: string | undefined; constructor(data?: IExemptVolunteerFamilyRequirement) { super(data); @@ -11318,6 +11331,7 @@ export class ExemptVolunteerFamilyRequirement extends VolunteerFamilyCommand imp this.requirementName = _data["requirementName"]; this.additionalComments = _data["additionalComments"]; this.exemptionExpiresAtUtc = _data["exemptionExpiresAtUtc"] ? new Date(_data["exemptionExpiresAtUtc"].toString()) : undefined; + this.roleName = _data["roleName"]; } } @@ -11333,6 +11347,7 @@ export class ExemptVolunteerFamilyRequirement extends VolunteerFamilyCommand imp data["requirementName"] = this.requirementName; data["additionalComments"] = this.additionalComments; data["exemptionExpiresAtUtc"] = this.exemptionExpiresAtUtc ? this.exemptionExpiresAtUtc.toISOString() : undefined; + data["roleName"] = this.roleName; super.toJSON(data); return data; } @@ -11342,6 +11357,7 @@ export interface IExemptVolunteerFamilyRequirement extends IVolunteerFamilyComma requirementName: string; additionalComments: string; exemptionExpiresAtUtc?: Date | undefined; + roleName?: string | undefined; } export class MarkVolunteerFamilyRequirementIncomplete extends VolunteerFamilyCommand implements IMarkVolunteerFamilyRequirementIncomplete { @@ -12418,6 +12434,7 @@ export class CompleteVolunteerRequirement extends VolunteerCommand implements IC completedAtUtc!: Date; uploadedDocumentId?: string | undefined; noteId?: string | undefined; + roleName?: string | undefined; constructor(data?: ICompleteVolunteerRequirement) { super(data); @@ -12432,6 +12449,7 @@ export class CompleteVolunteerRequirement extends VolunteerCommand implements IC this.completedAtUtc = _data["completedAtUtc"] ? new Date(_data["completedAtUtc"].toString()) : undefined; this.uploadedDocumentId = _data["uploadedDocumentId"]; this.noteId = _data["noteId"]; + this.roleName = _data["roleName"]; } } @@ -12449,6 +12467,7 @@ export class CompleteVolunteerRequirement extends VolunteerCommand implements IC data["completedAtUtc"] = this.completedAtUtc ? this.completedAtUtc.toISOString() : undefined; data["uploadedDocumentId"] = this.uploadedDocumentId; data["noteId"] = this.noteId; + data["roleName"] = this.roleName; super.toJSON(data); return data; } @@ -12460,12 +12479,14 @@ export interface ICompleteVolunteerRequirement extends IVolunteerCommand { completedAtUtc: Date; uploadedDocumentId?: string | undefined; noteId?: string | undefined; + roleName?: string | undefined; } export class ExemptVolunteerRequirement extends VolunteerCommand implements IExemptVolunteerRequirement { requirementName!: string; additionalComments!: string; exemptionExpiresAtUtc?: Date | undefined; + roleName?: string | undefined; constructor(data?: IExemptVolunteerRequirement) { super(data); @@ -12478,6 +12499,7 @@ export class ExemptVolunteerRequirement extends VolunteerCommand implements IExe this.requirementName = _data["requirementName"]; this.additionalComments = _data["additionalComments"]; this.exemptionExpiresAtUtc = _data["exemptionExpiresAtUtc"] ? new Date(_data["exemptionExpiresAtUtc"].toString()) : undefined; + this.roleName = _data["roleName"]; } } @@ -12493,6 +12515,7 @@ export class ExemptVolunteerRequirement extends VolunteerCommand implements IExe data["requirementName"] = this.requirementName; data["additionalComments"] = this.additionalComments; data["exemptionExpiresAtUtc"] = this.exemptionExpiresAtUtc ? this.exemptionExpiresAtUtc.toISOString() : undefined; + data["roleName"] = this.roleName; super.toJSON(data); return data; } @@ -12502,6 +12525,7 @@ export interface IExemptVolunteerRequirement extends IVolunteerCommand { requirementName: string; additionalComments: string; exemptionExpiresAtUtc?: Date | undefined; + roleName?: string | undefined; } export class MarkVolunteerRequirementIncomplete extends VolunteerCommand implements IMarkVolunteerRequirementIncomplete { diff --git a/src/caretogether-pwa/src/Model/VolunteersModel.ts b/src/caretogether-pwa/src/Model/VolunteersModel.ts index de33949dc..101abdff7 100644 --- a/src/caretogether-pwa/src/Model/VolunteersModel.ts +++ b/src/caretogether-pwa/src/Model/VolunteersModel.ts @@ -61,7 +61,8 @@ export function useVolunteersModel() { _requirement: ActionRequirement, completedAtLocal: Date, documentId: string | null, - noteId: string | null + noteId: string | null, + roleName: string | null ) => { const command = commandFactory(CompleteVolunteerFamilyRequirement, { familyId: volunteerFamilyId, @@ -70,6 +71,7 @@ export function useVolunteersModel() { completedAtUtc: completedAtLocal, uploadedDocumentId: documentId ?? undefined, noteId: noteId ?? undefined, + roleName: roleName ?? undefined, }); return command; } @@ -97,13 +99,15 @@ export function useVolunteersModel() { volunteerFamilyId, requirementName: string, additionalComments: string, - exemptionExpiresAtLocal: Date | null + exemptionExpiresAtLocal: Date | null, + roleName: string | null ) => { const command = commandFactory(ExemptVolunteerFamilyRequirement, { familyId: volunteerFamilyId, requirementName: requirementName, additionalComments: additionalComments, exemptionExpiresAtUtc: exemptionExpiresAtLocal ?? undefined, + roleName: roleName ?? undefined, }); return command; } @@ -165,7 +169,8 @@ export function useVolunteersModel() { _requirement: ActionRequirement, completedAtLocal: Date, documentId: string | null, - noteId: string | null + noteId: string | null, + roleName: string | null ) => { const command = commandFactory(CompleteVolunteerRequirement, { familyId: volunteerFamilyId, @@ -175,6 +180,7 @@ export function useVolunteersModel() { completedAtUtc: completedAtLocal, uploadedDocumentId: documentId ?? undefined, noteId: noteId ?? undefined, + roleName: roleName ?? undefined, }); return command; } @@ -201,7 +207,8 @@ export function useVolunteersModel() { personId: string, requirementName: string, additionalComments: string, - exemptionExpiresAtLocal: Date | null + exemptionExpiresAtLocal: Date | null, + roleName: string | null ) => { const command = commandFactory(ExemptVolunteerRequirement, { familyId: volunteerFamilyId, @@ -209,6 +216,7 @@ export function useVolunteersModel() { requirementName: requirementName, additionalComments: additionalComments, exemptionExpiresAtUtc: exemptionExpiresAtLocal ?? undefined, + roleName: roleName ?? undefined, }); return command; } diff --git a/src/caretogether-pwa/src/Requirements/MissingRequirementDialog.tsx b/src/caretogether-pwa/src/Requirements/MissingRequirementDialog.tsx index 43763e3ab..3e5ed673f 100644 --- a/src/caretogether-pwa/src/Requirements/MissingRequirementDialog.tsx +++ b/src/caretogether-pwa/src/Requirements/MissingRequirementDialog.tsx @@ -56,6 +56,7 @@ type MissingRequirementDialogProps = { requirement: MissingArrangementRequirement | RequirementDefinition | string; context: RequirementContext; policy: ActionRequirement; + policyVersions?: { version: string; roleName: string }[]; v1CaseId?: string; canComplete: boolean; canExempt: boolean; @@ -66,6 +67,7 @@ export function MissingRequirementDialog({ requirement, context, policy, + policyVersions, v1CaseId, canComplete, canExempt, @@ -133,6 +135,8 @@ export function MissingRequirementDialog({ ? [contextFamily.partneringFamilyInfo.openV1Case] : []; + const selectedRoleName = policyVersions?.[0]?.roleName ?? null; + const closedV1Cases: V1Case[] = contextFamily?.partneringFamilyInfo?.closedV1Cases ?.slice() @@ -386,7 +390,8 @@ export function MissingRequirementDialog({ policy, completedAtLocal!, document === '' ? null : document, - noteId + noteId, + selectedRoleName ); break; } @@ -401,7 +406,8 @@ export function MissingRequirementDialog({ policy, completedAtLocal!, document === '' ? null : document, - noteId + noteId, + selectedRoleName ); break; } @@ -481,7 +487,8 @@ export function MissingRequirementDialog({ fid, requirementName, additionalComments, - exemptionExpiresAtLocal + exemptionExpiresAtLocal, + selectedRoleName ); break; } @@ -493,7 +500,8 @@ export function MissingRequirementDialog({ context.personId, requirementName, additionalComments, - exemptionExpiresAtLocal + exemptionExpiresAtLocal, + selectedRoleName ); break; } diff --git a/src/caretogether-pwa/src/Requirements/MissingRequirementRow.tsx b/src/caretogether-pwa/src/Requirements/MissingRequirementRow.tsx index c1658d1bf..758d05d51 100644 --- a/src/caretogether-pwa/src/Requirements/MissingRequirementRow.tsx +++ b/src/caretogether-pwa/src/Requirements/MissingRequirementRow.tsx @@ -134,6 +134,7 @@ export function MissingRequirementRow({ requirement={requirement} context={context} policy={requirementPolicy} + policyVersions={policyVersions} v1CaseId={v1CaseId} canComplete={canComplete} canExempt={canExempt} diff --git a/swagger.json b/swagger.json index dc85065d3..616cd27b5 100644 --- a/swagger.json +++ b/swagger.json @@ -4206,6 +4206,10 @@ "type": "string", "format": "guid", "nullable": true + }, + "roleName": { + "type": "string", + "nullable": true } } }, @@ -4242,6 +4246,10 @@ "type": "string", "format": "date-time", "nullable": true + }, + "roleName": { + "type": "string", + "nullable": true } } }, @@ -7035,6 +7043,10 @@ "type": "string", "format": "guid", "nullable": true + }, + "roleName": { + "type": "string", + "nullable": true } } } @@ -7063,6 +7075,10 @@ "type": "string", "format": "date-time", "nullable": true + }, + "roleName": { + "type": "string", + "nullable": true } } } @@ -7704,6 +7720,10 @@ "type": "string", "format": "guid", "nullable": true + }, + "roleName": { + "type": "string", + "nullable": true } } } @@ -7732,6 +7752,10 @@ "type": "string", "format": "date-time", "nullable": true + }, + "roleName": { + "type": "string", + "nullable": true } } }