From 4eb5c56b626a798486a7cafb50ee5d687749d0cb Mon Sep 17 00:00:00 2001 From: chrisala Date: Fri, 6 Dec 2024 13:22:34 +1100 Subject: [PATCH] IPPRS / RCS reporting WIP #3369 --- .../ala/merit/OrganisationController.groovy | 9 +- .../org/ala/merit/OrganisationService.groovy | 2 +- grails-app/views/organisation/_admin.gsp | 5 +- .../views/organisation/_serviceTargets.gsp | 16 +-- grails-app/views/organisation/index.gsp | 11 +- .../scripts/releases/4.1/configureIPPRS.js | 105 ++++++++++++++++++ src/main/scripts/utils/addService.js | 3 +- 7 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 src/main/scripts/releases/4.1/configureIPPRS.js diff --git a/grails-app/controllers/au/org/ala/merit/OrganisationController.groovy b/grails-app/controllers/au/org/ala/merit/OrganisationController.groovy index 0109f6935..0b3c5f519 100644 --- a/grails-app/controllers/au/org/ala/merit/OrganisationController.groovy +++ b/grails-app/controllers/au/org/ala/merit/OrganisationController.groovy @@ -51,7 +51,6 @@ class OrganisationController { dashboard: dashboard, roles:roles, user:user, - services: organisationService.findApplicableServices(organisation, metadataService.getProjectServices()), isAdmin:orgRole?.role == RoleService.PROJECT_ADMIN_ROLE, isGrantManager:orgRole?.role == RoleService.GRANT_MANAGER_ROLE, content:content(organisation)] @@ -73,10 +72,15 @@ class OrganisationController { def dashboardReports = [[name:'dashboard', label:'Activity Outputs']] Map availableReportCategories = null + List services = null + List targetPeriods = null if (adminVisible) { dashboardReports += [name:'announcements', label:'Announcements'] availableReportCategories = settingService.getJson(SettingPageType.ORGANISATION_REPORT_CONFIG) + services = organisationService.findApplicableServices(organisation, metadataService.getProjectServices()) + targetPeriods = organisationService.generateTargetPeriods(organisation) } + boolean showTargets = services != null List reportOrder = null if (reportingVisible) { @@ -102,13 +106,12 @@ class OrganisationController { List projects = organisation.projects ?: [] List programGroups = organisation.config?.programGroups ?: [] Map projectGroups = projectGroupingHelper.groupProjectsByProgram(projects, programGroups, ["organisationId:"+organisation.organisationId], true) - List targetPeriods = organisationService.generateTargetPeriods(organisation) [about : [label: 'About', visible: true, stopBinding: false, type:'tab', default:!reportingVisible, displayedPrograms:projectGroups.displayedPrograms, servicesDashboard:[visible:true]], projects : [label: 'Reporting', template:"/shared/projectListByProgram", visible: reportingVisible, stopBinding:true, default:reportingVisible, type: 'tab', reports:organisation.reports, adHocReportTypes:adHocReportTypes, reportOrder:reportOrder, hideDueDate:true, displayedPrograms:projectGroups.displayedPrograms, reportsFirst:true, declarationType:SettingPageType.RDP_REPORT_DECLARATION], sites : [label: 'Sites', visible: reportingVisible, type: 'tab', stopBinding:true, projectCount:organisation.projects?.size()?:0, showShapefileDownload:adminVisible], dashboard : [label: 'Dashboard', visible: reportingVisible, stopBinding:true, type: 'tab', template:'/shared/dashboard', reports:dashboardReports], - admin : [label: 'Admin', visible: adminVisible, type: 'tab', template:'admin', showEditAnnoucements:showEditAnnoucements, availableReportCategories:availableReportCategories, targetPeriods:targetPeriods]] + admin : [label: 'Admin', visible: adminVisible, type: 'tab', template:'admin', showEditAnnoucements:showEditAnnoucements, availableReportCategories:availableReportCategories, targetPeriods:targetPeriods, services: services, showTargets:showTargets]] } diff --git a/grails-app/services/au/org/ala/merit/OrganisationService.groovy b/grails-app/services/au/org/ala/merit/OrganisationService.groovy index 3cb455599..f17932c0c 100644 --- a/grails-app/services/au/org/ala/merit/OrganisationService.groovy +++ b/grails-app/services/au/org/ala/merit/OrganisationService.groovy @@ -359,7 +359,7 @@ class OrganisationService { def findApplicableServices(Map organisation, List allServices) { List supportedServices = organisation.config?.organisationReports?.collect{it.activityType}?.findAll{it} - List result = allServices + List result = [] if (supportedServices) { result = allServices.findAll{ supportedServices.intersect(it.outputs.formName) } } diff --git a/grails-app/views/organisation/_admin.gsp b/grails-app/views/organisation/_admin.gsp index d219ecc6a..607fff012 100644 --- a/grails-app/views/organisation/_admin.gsp +++ b/grails-app/views/organisation/_admin.gsp @@ -9,8 +9,9 @@ Reporting Configuration + Targets - +
@@ -153,9 +154,11 @@
+

Service Targets

+
diff --git a/grails-app/views/organisation/_serviceTargets.gsp b/grails-app/views/organisation/_serviceTargets.gsp index b2b540a81..9f5dc2714 100644 --- a/grails-app/views/organisation/_serviceTargets.gsp +++ b/grails-app/views/organisation/_serviceTargets.gsp @@ -7,23 +7,24 @@ ${serviceName ?: "Service"} Target measure - Total to be delivered ${totalHelpText} The overall total of Organsiation Services to be delivered during the organisation delivery period. - Note: this total is not necessarily the sum of the minimum annual targets set out for the service. + Overall target ${totalHelpText} Delivery date ${deliveryHelpText} - Minimum annual targets ${minHelptext ?:"Specify the minimum total target for each Project Service to be delivered each financial year. Note: the sum of these targets will not necessarily equal the total services to be delivered."} + ${periodTargetsLabel ?: "Targets by date"} +
+ @@ -63,16 +64,7 @@ -%{-- --}% -%{-- --}% -%{-- --}% -%{-- --}% -%{-- --}% -%{-- --}% -%{-- --}% diff --git a/grails-app/views/organisation/index.gsp b/grails-app/views/organisation/index.gsp index 2f57cbd25..526a86b1a 100644 --- a/grails-app/views/organisation/index.gsp +++ b/grails-app/views/organisation/index.gsp @@ -45,9 +45,7 @@ returnTo: '${g.createLink(action:'index', id:"${organisation.organisationId}")}', dashboardCategoryUrl: "${g.createLink(controller: 'report', action: 'activityOutputs', params: [fq:'organisationFacet:'+organisation.name])}", reportOwner: {organisationId:'${organisation.organisationId}'}, - projects : , - services: - + projects : }; @@ -82,11 +80,16 @@ var organisation =; var availableReportCategories = ; + var services = ; + var targetPeriods = ; var config = _.extend({ reportingConfigSelector:'#reporting-config form', availableReportCategories:availableReportCategories, - targetPeriods: + targetPeriods: targetPeriods, + services: services + }, fcConfig); + var organisationViewModel = new OrganisationPageViewModel(organisation, config); ko.applyBindings(organisationViewModel); diff --git a/src/main/scripts/releases/4.1/configureIPPRS.js b/src/main/scripts/releases/4.1/configureIPPRS.js new file mode 100644 index 000000000..d1c126a8e --- /dev/null +++ b/src/main/scripts/releases/4.1/configureIPPRS.js @@ -0,0 +1,105 @@ +load("../../utils/uuid.js"); +load( "../../utils/audit.js"); +load( "../../utils/addService.js"); + +let adminUserId = '' +addService("Indigenous Procurement", NumberInt(47), 'Regional Capacity Services Report', 'Regional capacity services - reporting', undefined, adminUserId); + + +// These have been pre-generated as there is value in having the same id in all environments +var indigenousWorkforcePerformanceScoreId = '5d28e47f-5182-4ad7-91f7-074908fb66e4'; +var indigenousSupplyChainPerformanceScoreId = 'f7a537fd-cb38-4392-a0db-5e02beec6aa0'; + +var scores = [ + { + "category": "Indigenous Procurement", + "configuration": { + "childAggregations": [{ + "property": "data.workforcePerformancePercentage", + "type": "AVERAGE" + }] + }, + "description": "", + "displayType": "", + "entity": "Activity", + "entityTypes": [], + "isOutputTarget": true, + "label": "Indigenous workforce performance", + "outputType": "Regional capacity services - reporting", + "scoreId": indigenousWorkforcePerformanceScoreId, + "status": "active" + }, + { + "category": "Indigenous Procurement", + "configuration": { + "childAggregations": [{ + "property": "data.workforcePerformancePercentage", + "type": "AVERAGE" + }] + }, + "description": "", + "displayType": "", + "entity": "Activity", + "entityTypes": [], + "isOutputTarget": true, + "label": "Indigenous supply chain performance", + "outputType": "Regional capacity services - reporting", + "scoreId": indigenousSupplyChainPerformanceScoreId, + "status": "active" + } +]; + +for (var i=0; i