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..9372c04 --- /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 Module.component:Component + * + * @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..de44cf0 --- /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 Module.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 @@