From a8819c907e077c8819b08097b5eda7a3a8895f0b Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 22 Apr 2026 21:22:03 +0000 Subject: [PATCH] Add concern page to mailer compliance flow --- platform/publicreport.go | 4 +- platform/types/{evidence.go => concern.go} | 12 +- platform/types/publicreport.go | 28 ++-- resource/publicreport_compliance.go | 2 +- ts/rmo/components/ImageViewerModal.vue | 60 +++++++++ ts/rmo/content/compliance/Address.vue | 8 +- ts/rmo/content/compliance/Concern.vue | 150 ++++++++++----------- ts/rmo/content/compliance/Evidence.vue | 12 +- ts/rmo/view/Compliance.vue | 13 +- ts/store/publicreport.ts | 9 ++ ts/type/api.ts | 32 ++++- 11 files changed, 206 insertions(+), 124 deletions(-) rename platform/types/{evidence.go => concern.go} (60%) create mode 100644 ts/rmo/components/ImageViewerModal.vue diff --git a/platform/publicreport.go b/platform/publicreport.go index fa580e17..ae70cd6d 100644 --- a/platform/publicreport.go +++ b/platform/publicreport.go @@ -67,8 +67,8 @@ func PublicreportByIDCompliance(ctx context.Context, report_id string) (*types.P return nil, fmt.Errorf("compliance report request by public id: %w", err) } if crr != nil { - result.Evidence = []*types.EvidenceComplianceReportRequest{ - &types.EvidenceComplianceReportRequest{ + result.Concerns = []*types.ConcernComplianceReportRequest{ + &types.ConcernComplianceReportRequest{ ComplianceReportRequestPublicID: crr.PublicID, }, } diff --git a/platform/types/evidence.go b/platform/types/concern.go similarity index 60% rename from platform/types/evidence.go rename to platform/types/concern.go index 3c63b944..458cb62f 100644 --- a/platform/types/evidence.go +++ b/platform/types/concern.go @@ -7,15 +7,15 @@ import ( "github.com/rs/zerolog/log" ) -type Evidence interface { +type Concern interface { PopulateURL(*mux.Router) error } -type EvidenceComplianceReportRequest struct { - ComplianceReportRequestPublicID string - URL string +type ConcernComplianceReportRequest struct { + ComplianceReportRequestPublicID string `json:"compliance_report_request_public_id"` + URL string `json:"url"` } -func (e *EvidenceComplianceReportRequest) PopulateURL(r *mux.Router) error { +func (e *ConcernComplianceReportRequest) PopulateURL(r *mux.Router) error { route_name := "compliance-request.image.pool.ByIDGet" handler := r.Get(route_name) if handler == nil { @@ -27,6 +27,6 @@ func (e *EvidenceComplianceReportRequest) PopulateURL(r *mux.Router) error { } uri.Scheme = "https" e.URL = uri.String() - log.Debug().Str("url", e.URL).Msg("populated evidence URL") + log.Debug().Str("url", e.URL).Msg("populated concern URL") return nil } diff --git a/platform/types/publicreport.go b/platform/types/publicreport.go index 0477825f..d7661bbf 100644 --- a/platform/types/publicreport.go +++ b/platform/types/publicreport.go @@ -5,20 +5,20 @@ import ( ) type PublicReport struct { - Address Address `db:"address" json:"address"` - Created time.Time `db:"created" json:"created"` - Evidence []*EvidenceComplianceReportRequest `db:"-" json:"evidence"` - ID int32 `db:"id" json:"-"` - Images []Image `db:"images" json:"images"` - Location *Location `db:"location" json:"location"` - Log []LogEntry `db:"-" json:"log"` - DistrictID *int32 `db:"organization_id" json:"-"` - District *string `db:"-" json:"district"` - PublicID string `db:"public_id" json:"public_id"` - Reporter Contact `db:"reporter" json:"reporter"` - Status string `db:"status" json:"status"` - Type string `db:"report_type" json:"type"` - URI string `db:"-" json:"uri"` + Address Address `db:"address" json:"address"` + Concerns []*ConcernComplianceReportRequest `db:"-" json:"concerns"` + Created time.Time `db:"created" json:"created"` + ID int32 `db:"id" json:"-"` + Images []Image `db:"images" json:"images"` + Location *Location `db:"location" json:"location"` + Log []LogEntry `db:"-" json:"log"` + DistrictID *int32 `db:"organization_id" json:"-"` + District *string `db:"-" json:"district"` + PublicID string `db:"public_id" json:"public_id"` + Reporter Contact `db:"reporter" json:"reporter"` + Status string `db:"status" json:"status"` + Type string `db:"report_type" json:"type"` + URI string `db:"-" json:"uri"` } type PublicReportCompliance struct { PublicReport diff --git a/resource/publicreport_compliance.go b/resource/publicreport_compliance.go index 882a66a5..3504dd88 100644 --- a/resource/publicreport_compliance.go +++ b/resource/publicreport_compliance.go @@ -209,7 +209,7 @@ func (res *complianceR) Update(ctx context.Context, r *http.Request, prf publicr func (res *complianceR) complianceHydrate(report *types.PublicReportCompliance) (*types.PublicReportCompliance, *nhttp.ErrorWithStatus) { populateDistrictURI(&report.PublicReport, res.router) populateReportURI(&report.PublicReport, res.router) - for _, e := range report.Evidence { + for _, e := range report.Concerns { e.PopulateURL(res.router.router) } return report, nil diff --git a/ts/rmo/components/ImageViewerModal.vue b/ts/rmo/components/ImageViewerModal.vue new file mode 100644 index 00000000..0fa5921c --- /dev/null +++ b/ts/rmo/components/ImageViewerModal.vue @@ -0,0 +1,60 @@ + + + + diff --git a/ts/rmo/content/compliance/Address.vue b/ts/rmo/content/compliance/Address.vue index c5aebeeb..643d93c5 100644 --- a/ts/rmo/content/compliance/Address.vue +++ b/ts/rmo/content/compliance/Address.vue @@ -65,8 +65,10 @@ const routes = useRoutes(); function doContinue() { emit("update:modelValue", props.modelValue); emit("doAddress"); - // re-add when we have the concern data to show - // router.push("./concern"); - router.push(routes.ComplianceEvidence(props.publicID)); + if (props.modelValue.concerns.length > 0) { + router.push(routes.ComplianceConcern(props.publicID)); + } else { + router.push(routes.ComplianceEvidence(props.publicID)); + } } diff --git a/ts/rmo/content/compliance/Concern.vue b/ts/rmo/content/compliance/Concern.vue index 6c2a06e6..c960bd4b 100644 --- a/ts/rmo/content/compliance/Concern.vue +++ b/ts/rmo/content/compliance/Concern.vue @@ -1,7 +1,5 @@