From f7f37e0684f211af4bb13d484295c284964cd21c Mon Sep 17 00:00:00 2001 From: DominikNoga Date: Wed, 23 Oct 2024 14:39:31 +0200 Subject: [PATCH] ANGOLASUP-938: Enabled report configuration from the UI level --- .../_home-page-report.scss | 0 .../home-page-report.component.js | 34 ++++++++++++++ .../home-page-report.controller.js | 46 +++++++++++++++++++ .../home-page-report.html | 8 ++++ .../home-page-report.module.js | 29 ++++++++++++ src/openlmis-home/home.html | 10 +--- src/openlmis-home/openlmis-home.module.js | 3 +- 7 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 src/openlmis-home-page-report/_home-page-report.scss create mode 100644 src/openlmis-home-page-report/home-page-report.component.js create mode 100644 src/openlmis-home-page-report/home-page-report.controller.js create mode 100644 src/openlmis-home-page-report/home-page-report.html create mode 100644 src/openlmis-home-page-report/home-page-report.module.js diff --git a/src/openlmis-home-page-report/_home-page-report.scss b/src/openlmis-home-page-report/_home-page-report.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/openlmis-home-page-report/home-page-report.component.js b/src/openlmis-home-page-report/home-page-report.component.js new file mode 100644 index 0000000..656a802 --- /dev/null +++ b/src/openlmis-home-page-report/home-page-report.component.js @@ -0,0 +1,34 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc component + * @name openlmis-home-page-report.component:openlmisHomePageReport + * + * @description + * Component responsible for displaying home page embedded report + */ + angular + .module('openlmis-home-page-report') + .component('openlmisHomePageReport', { + templateUrl: 'openlmis-home-page-report/home-page-report.html', + controller: 'OpenlmisHomePageReportController', + controllerAs: 'vm' + }); +})(); diff --git a/src/openlmis-home-page-report/home-page-report.controller.js b/src/openlmis-home-page-report/home-page-report.controller.js new file mode 100644 index 0000000..e014d41 --- /dev/null +++ b/src/openlmis-home-page-report/home-page-report.controller.js @@ -0,0 +1,46 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc controller + * @name openlmis-home-page-report.controller:OpenlmisHomePageReportController * + * @description + * Manages the openlmis-home-page-report component + */ + angular + .module('openlmis-home-page-report') + .controller('OpenlmisHomePageReportController', OpenlmisHomePageReportController); + + OpenlmisHomePageReportController.$inject = ['reportEmbeddedService', '$sce']; + + function OpenlmisHomePageReportController(reportEmbeddedService, $sce) { + var vm = this; + var DASHBOARD_REPORT_URL = '3a792c67-1221-4d15-bbc9-cb3573b53e4c'; + vm.report = undefined; + vm.$onInit = onInit; + + function onInit() { + reportEmbeddedService.get(DASHBOARD_REPORT_URL).then(function(report) { + vm.report = report; + var trustedUrl = $sce.trustAsResourceUrl(vm.report.url); + vm.report.url = trustedUrl; + }); + } + } +})(); diff --git a/src/openlmis-home-page-report/home-page-report.html b/src/openlmis-home-page-report/home-page-report.html new file mode 100644 index 0000000..2f2ed0f --- /dev/null +++ b/src/openlmis-home-page-report/home-page-report.html @@ -0,0 +1,8 @@ + diff --git a/src/openlmis-home-page-report/home-page-report.module.js b/src/openlmis-home-page-report/home-page-report.module.js new file mode 100644 index 0000000..715330a --- /dev/null +++ b/src/openlmis-home-page-report/home-page-report.module.js @@ -0,0 +1,29 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @module openlmis-home-page-report + * + * @description + * Responsible for displaying embedded home page report + */ + angular.module('openlmis-home-page-report', [ + 'report-embedded' + ]); +})(); diff --git a/src/openlmis-home/home.html b/src/openlmis-home/home.html index 7b520fb..00b8644 100644 --- a/src/openlmis-home/home.html +++ b/src/openlmis-home/home.html @@ -35,14 +35,6 @@

- + diff --git a/src/openlmis-home/openlmis-home.module.js b/src/openlmis-home/openlmis-home.module.js index c62aaa9..6fb9bf8 100644 --- a/src/openlmis-home/openlmis-home.module.js +++ b/src/openlmis-home/openlmis-home.module.js @@ -32,7 +32,8 @@ // OAM-18: Homepage UI alerts 'openlmis-home-alerts-panel', // OAM-18: ends here - 'ui.router' + 'ui.router', + 'openlmis-home-page-report' ]); })();