diff --git a/admin/app/config.router.js b/admin/app/config.router.js index 754ef9d5..451013d5 100644 --- a/admin/app/config.router.js +++ b/admin/app/config.router.js @@ -24,32 +24,6 @@ app $urlRouterProvider.otherwise("login/login"); $stateProvider - .state('feed', { - abstract: true, - url: "/feed", - templateUrl: "views/common/content.html", - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['toaster']).then( - function () { - return $ocLazyLoad.load([{ - serie: true, - files: [ - 'app/services/login/login.service.js', - 'app/services/fdd/webmessageanalysis.service.js', - 'app/services/users/user/user.service.js', - 'app/controllers/users/user/user.controller.js', - 'app/controllers/login/login.controller.js' - ] - }]); - } - ); - } - ] - } - }) .state('fdd', { abstract: true, url: "/fdd", @@ -300,84 +274,6 @@ app ] } }) - .state('equipment', { - abstract: true, - url: "/equipment", - templateUrl: "views/common/content.html", - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['toaster']).then( - function () { - return $ocLazyLoad.load([{ - serie: true, - files: [ - 'app/services/login/login.service.js', - 'app/services/fdd/webmessageanalysis.service.js', - 'app/services/users/user/user.service.js', - 'app/controllers/users/user/user.controller.js', - 'app/controllers/login/login.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('combinedequipment', { - abstract: true, - url: "/combinedequipment", - templateUrl: "views/common/content.html", - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['toaster']).then( - function () { - return $ocLazyLoad.load([{ - serie: true, - files: [ - 'app/services/login/login.service.js', - 'app/services/fdd/webmessageanalysis.service.js', - 'app/services/users/user/user.service.js', - 'app/controllers/users/user/user.controller.js', - 'app/controllers/login/login.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('verification', { - abstract: true, - url: "/verification", - templateUrl: "views/common/content.html", - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['toaster']).then( - function () { - return $ocLazyLoad.load([{ - serie: true, - files: [ - 'app/services/login/login.service.js', - 'app/services/fdd/webmessageanalysis.service.js', - 'app/services/users/user/user.service.js', - 'app/controllers/users/user/user.controller.js', - 'app/controllers/login/login.controller.js' - ] - }]); - } - ); - } - ] - } - }) .state('settings', { abstract: true, url: "/settings", @@ -404,6 +300,392 @@ app ] } }) + .state('settings.category', { + url: "/category", + templateUrl: "views/settings/category/category.html", + data: { + pageTitle: 'MENU.SETTINGS.CATEGORY' + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/category/category.service.js', + 'app/controllers/settings/category/energycategory.master.controller.js', + 'app/controllers/settings/category/energycategory.controller.js', + 'app/services/settings/category/energyitem.service.js', + 'app/controllers/settings/category/energyitem.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.costcenter', { + url: "/costcenter", + templateUrl: "views/settings/costcenter/costcenter.html", + data: { + pageTitle: 'MENU.SETTINGS.COSTCENTER', + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/costcenter/costcenter.service.js', + 'app/services/settings/costcenter/costcentertariff.service.js', + 'app/services/settings/tariff/tariff.service.js', + 'app/services/settings/costcenter/costfile.service.js', + 'app/controllers/settings/costcenter/costcenter.master.controller.js', + 'app/controllers/settings/costcenter/costcenter.controller.js', + 'app/controllers/settings/costcenter/costcentertariff.controller.js', + 'app/controllers/settings/costcenter/costfile.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.tariff', { + url: "/tariff", + templateUrl: "views/settings/tariff/tariff.html", + data: { + pageTitle: 'MENU.SETTINGS.TARIFF' + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + serie: true, + files: ['js/daterangepicker/daterangepicker.min.js', 'js/daterangepicker/daterangepicker.min.css'] + }, { + name: 'daterangepicker', + files: ['js/daterangepicker/angular-daterangepicker.min.js'] + }, { + files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] + }, { + name: 'ui.footable', + files: ['js/plugins/footable/angular-footable.js'] + }, { + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/tariff/tariff.service.js', + 'app/services/settings/tariff/tariff.const.js', + 'app/services/settings/category/category.service.js', + 'app/controllers/settings/tariff/tariff.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.contact', { + url: "/contact", + templateUrl: "views/settings/contact/contact.html", + data: { + pageTitle: 'MENU.SETTINGS.CONTACT' + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/contact/contact.service.js', + 'app/controllers/settings/contact/contact.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.gateway', { + url: "/gateway", + templateUrl: "views/settings/gateway/gateway.html", + data: { + pageTitle: 'MENU.SETTINGS.GATEWAY', + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] + }, { + name: 'ui.footable', + files: ['js/plugins/footable/angular-footable.js'] + }, { + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/gateway/gateway.service.js', + 'app/controllers/settings/gateway/gateway.master.controller.js', + 'app/controllers/settings/gateway/gateway.controller.js', + ] + }]); + } + ); + } + ] + } + }) + .state('settings.datasource', { + url: "/data-source", + templateUrl: "views/settings/datasource/datasource.html", + data: { + pageTitle: 'MENU.SETTINGS.DATASOURCE' + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + + files: [ + 'app/services/settings/datasource/datasource.service.js', + 'app/services/settings/datasource/point.service.js', + 'app/services/settings/gateway/gateway.service.js', + 'app/controllers/settings/datasource/datasource.master.controller.js', + 'app/controllers/settings/datasource/datasource.controller.js', + 'app/controllers/settings/datasource/point.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.meter', { + url: "/meter", + templateUrl: "views/settings/meter/meter.html", + data: { + pageTitle: 'MENU.SETTINGS.METER', + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] + }, { + name: 'ui.footable', + files: ['js/plugins/footable/angular-footable.js'] + }, { + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/costcenter/costcenter.service.js', + 'app/services/settings/category/category.service.js', + 'app/services/settings/category/energyitem.service.js', + 'app/services/settings/meter/meter.service.js', + 'app/services/settings/meter/offlinemeter.service.js', + 'app/services/settings/meter/offlinemeterfile.service.js', + 'app/services/settings/meter/virtualmeter.service.js', + 'app/services/settings/meter/meterpoint.service.js', + 'app/services/settings/datasource/datasource.service.js', + 'app/services/settings/datasource/point.service.js', + 'app/controllers/settings/meter/meter.master.controller.js', + 'app/controllers/settings/meter/meter.controller.js', + 'app/controllers/settings/meter/offlinemeter.controller.js', + 'app/controllers/settings/meter/offlinemeterfile.controller.js', + 'app/controllers/settings/meter/virtualmeter.controller.js', + 'app/controllers/settings/meter/meterpoint.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.sensor', { + url: "/sensor", + templateUrl: "views/settings/sensor/sensor.html", + data: { + pageTitle: 'MENU.SETTINGS.SENSOR', + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] + }, { + name: 'ui.footable', + files: ['js/plugins/footable/angular-footable.js'] + }, { + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/sensor/sensor.service.js', + 'app/services/settings/sensor/sensorpoint.service.js', + 'app/services/settings/datasource/datasource.service.js', + 'app/services/settings/datasource/point.service.js', + 'app/controllers/settings/sensor/sensor.master.controller.js', + 'app/controllers/settings/sensor/sensor.controller.js', + 'app/controllers/settings/sensor/sensorpoint.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.equipment', { + url: "/equipment", + templateUrl: "views/settings/equipment/equipment.html", + data: { + pageTitle: 'MENU.SETTINGS.EQUIPMENT' + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.checkbox', 'ui.select', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/space/space.service.js', + 'app/services/settings/equipment/equipment.service.js', + 'app/services/settings/costcenter/costcenter.service.js', + 'app/services/settings/datasource/point.service.js', + 'app/services/settings/meter/meter.service.js', + 'app/services/settings/meter/offlinemeter.service.js', + 'app/services/settings/meter/virtualmeter.service.js', + 'app/services/settings/equipment/equipmentmeter.service.js', + 'app/services/settings/equipment/equipmentparameter.service.js', + 'app/controllers/settings/equipment/equipment.master.controller.js', + 'app/controllers/settings/equipment/equipment.controller.js', + 'app/controllers/settings/equipment/equipmentmeter.controller.js', + 'app/controllers/settings/equipment/equipmentparameter.controller.js' + ] + }]); + } + ); + } + ] + } + }) + .state('settings.combinedequipment', { + url: "/combinedequipment", + templateUrl: "views/settings/combinedequipment/combinedequipment.html", + data: { + pageTitle: 'MENU.SETTINGS.COMBINED_EQUIPMENT' + }, + resolve: { + deps: [ + '$ocLazyLoad', + function ($ocLazyLoad) { + return $ocLazyLoad.load(['ui.checkbox', 'ui.select', 'toaster']).then( + function () { + return $ocLazyLoad.load([{ + files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] + }, { + name: 'oitozero.ngSweetAlert', + files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] + }, { + serie: true, + files: [ + 'app/services/settings/space/space.service.js', + 'app/services/settings/combinedequipment/combinedequipment.service.js', + 'app/services/settings/costcenter/costcenter.service.js', + 'app/services/settings/datasource/point.service.js', + 'app/services/settings/equipment/equipment.service.js', + 'app/services/settings/meter/meter.service.js', + 'app/services/settings/meter/offlinemeter.service.js', + 'app/services/settings/meter/virtualmeter.service.js', + 'app/services/settings/combinedequipment/combinedequipmentequipment.service.js', + 'app/services/settings/combinedequipment/combinedequipmentmeter.service.js', + 'app/services/settings/combinedequipment/combinedequipmentparameter.service.js', + 'app/controllers/settings/combinedequipment/combinedequipment.master.controller.js', + 'app/controllers/settings/combinedequipment/combinedequipment.controller.js', + 'app/controllers/settings/combinedequipment/combinedequipmentequipment.controller.js', + 'app/controllers/settings/combinedequipment/combinedequipmentmeter.controller.js', + 'app/controllers/settings/combinedequipment/combinedequipmentparameter.controller.js' + ] + }]); + } + ); + } + ] + } + }) .state('settings.space', { url: "/space", templateUrl: "views/settings/space/space.html", @@ -635,283 +917,6 @@ app } }) - .state('settings.equipment', { - url: "/equipment", - templateUrl: "views/settings/equipment/equipment.html", - data: { - pageTitle: 'MENU.SETTINGS.EQUIPMENT' - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.checkbox', 'ui.select', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/space/space.service.js', - 'app/services/settings/equipment/equipment.service.js', - 'app/services/settings/costcenter/costcenter.service.js', - 'app/services/settings/datasource/point.service.js', - 'app/services/settings/meter/meter.service.js', - 'app/services/settings/meter/offlinemeter.service.js', - 'app/services/settings/meter/virtualmeter.service.js', - 'app/services/settings/equipment/equipmentmeter.service.js', - 'app/services/settings/equipment/equipmentparameter.service.js', - 'app/controllers/settings/equipment/equipment.master.controller.js', - 'app/controllers/settings/equipment/equipment.controller.js', - 'app/controllers/settings/equipment/equipmentmeter.controller.js', - 'app/controllers/settings/equipment/equipmentparameter.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('settings.combinedequipment', { - url: "/combinedequipment", - templateUrl: "views/settings/combinedequipment/combinedequipment.html", - data: { - pageTitle: 'MENU.SETTINGS.COMBINED_EQUIPMENT' - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.checkbox', 'ui.select', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/space/space.service.js', - 'app/services/settings/combinedequipment/combinedequipment.service.js', - 'app/services/settings/costcenter/costcenter.service.js', - 'app/services/settings/datasource/point.service.js', - 'app/services/settings/equipment/equipment.service.js', - 'app/services/settings/meter/meter.service.js', - 'app/services/settings/meter/offlinemeter.service.js', - 'app/services/settings/meter/virtualmeter.service.js', - 'app/services/settings/combinedequipment/combinedequipmentequipment.service.js', - 'app/services/settings/combinedequipment/combinedequipmentmeter.service.js', - 'app/services/settings/combinedequipment/combinedequipmentparameter.service.js', - 'app/controllers/settings/combinedequipment/combinedequipment.master.controller.js', - 'app/controllers/settings/combinedequipment/combinedequipment.controller.js', - 'app/controllers/settings/combinedequipment/combinedequipmentequipment.controller.js', - 'app/controllers/settings/combinedequipment/combinedequipmentmeter.controller.js', - 'app/controllers/settings/combinedequipment/combinedequipmentparameter.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('settings.meter', { - url: "/meter", - templateUrl: "views/settings/meter/meter.html", - data: { - pageTitle: 'MENU.SETTINGS.METER', - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] - }, { - name: 'ui.footable', - files: ['js/plugins/footable/angular-footable.js'] - }, { - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/costcenter/costcenter.service.js', - 'app/services/settings/category/category.service.js', - 'app/services/settings/category/energyitem.service.js', - 'app/services/settings/meter/meter.service.js', - 'app/services/settings/meter/offlinemeter.service.js', - 'app/services/settings/meter/offlinemeterfile.service.js', - 'app/services/settings/meter/virtualmeter.service.js', - 'app/services/settings/meter/meterpoint.service.js', - 'app/services/settings/datasource/datasource.service.js', - 'app/services/settings/datasource/point.service.js', - 'app/controllers/settings/meter/meter.master.controller.js', - 'app/controllers/settings/meter/meter.controller.js', - 'app/controllers/settings/meter/offlinemeter.controller.js', - 'app/controllers/settings/meter/offlinemeterfile.controller.js', - 'app/controllers/settings/meter/virtualmeter.controller.js', - 'app/controllers/settings/meter/meterpoint.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('settings.sensor', { - url: "/sensor", - templateUrl: "views/settings/sensor/sensor.html", - data: { - pageTitle: 'MENU.SETTINGS.SENSOR', - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] - }, { - name: 'ui.footable', - files: ['js/plugins/footable/angular-footable.js'] - }, { - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/sensor/sensor.service.js', - 'app/services/settings/sensor/sensorpoint.service.js', - 'app/services/settings/datasource/datasource.service.js', - 'app/services/settings/datasource/point.service.js', - 'app/controllers/settings/sensor/sensor.master.controller.js', - 'app/controllers/settings/sensor/sensor.controller.js', - 'app/controllers/settings/sensor/sensorpoint.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('settings.costcenter', { - url: "/costcenter", - templateUrl: "views/settings/costcenter/costcenter.html", - data: { - pageTitle: 'MENU.SETTINGS.COSTCENTER', - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/costcenter/costcenter.service.js', - 'app/services/settings/costcenter/costcentertariff.service.js', - 'app/services/settings/tariff/tariff.service.js', - 'app/services/settings/costcenter/costfile.service.js', - 'app/controllers/settings/costcenter/costcenter.master.controller.js', - 'app/controllers/settings/costcenter/costcenter.controller.js', - 'app/controllers/settings/costcenter/costcentertariff.controller.js', - 'app/controllers/settings/costcenter/costfile.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('settings.datasource', { - url: "/data-source", - templateUrl: "views/settings/datasource/datasource.html", - data: { - pageTitle: 'MENU.SETTINGS.DATASOURCE' - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - - files: [ - 'app/services/settings/datasource/datasource.service.js', - 'app/services/settings/datasource/point.service.js', - 'app/services/settings/gateway/gateway.service.js', - 'app/controllers/settings/datasource/datasource.master.controller.js', - 'app/controllers/settings/datasource/datasource.controller.js', - 'app/controllers/settings/datasource/point.controller.js' - ] - }]); - } - ); - } - ] - } - }) - .state('settings.category', { - url: "/category", - templateUrl: "views/settings/category/category.html", - data: { - pageTitle: 'MENU.SETTINGS.CATEGORY' - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/category/category.service.js', - 'app/controllers/settings/category/energycategory.master.controller.js', - 'app/controllers/settings/category/energycategory.controller.js', - 'app/services/settings/category/energyitem.service.js', - 'app/controllers/settings/category/energyitem.controller.js' - ] - }]); - } - ); - } - ] - } - }) .state('settings.energyflowdiagram', { url: "/energyflowdiagram", templateUrl: "views/settings/energyflowdiagram/energyflowdiagram.html", @@ -989,11 +994,11 @@ app ] } }) - .state('settings.contact', { - url: "/contact", - templateUrl: "views/settings/contact/contact.html", + .state('settings.menu', { + url: "/menu", + templateUrl: "views/settings/menu/menu.html", data: { - pageTitle: 'MENU.SETTINGS.CONTACT' + pageTitle: 'MENU.SETTINGS.MENU', }, resolve: { deps: [ @@ -1009,8 +1014,9 @@ app }, { serie: true, files: [ - 'app/services/settings/contact/contact.service.js', - 'app/controllers/settings/contact/contact.controller.js' + 'app/services/settings/menu/menu.service.js', + 'app/controllers/settings/menu/menu.controller.js', + 'app/controllers/settings/menu/menu.master.controller.js' ] }]); } @@ -1018,6 +1024,7 @@ app } ] } + }) .state('settings.emailserver', { url: "/emailserver", @@ -1049,43 +1056,6 @@ app ] } }) - - .state('settings.gateway', { - url: "/gateway", - templateUrl: "views/settings/gateway/gateway.html", - data: { - pageTitle: 'MENU.SETTINGS.GATEWAY', - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] - }, { - name: 'ui.footable', - files: ['js/plugins/footable/angular-footable.js'] - }, { - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/gateway/gateway.service.js', - 'app/controllers/settings/gateway/gateway.master.controller.js', - 'app/controllers/settings/gateway/gateway.controller.js', - ] - }]); - } - ); - } - ] - } - }) .state('settings.gsmmodem', { url: "/gsmmodem", templateUrl: "views/settings/gsmmodem/gsmmodem.html", @@ -1152,49 +1122,6 @@ app } }) - .state('settings.tariff', { - url: "/tariff", - templateUrl: "views/settings/tariff/tariff.html", - data: { - pageTitle: 'MENU.SETTINGS.TARIFF' - }, - resolve: { - deps: [ - '$ocLazyLoad', - function ($ocLazyLoad) { - return $ocLazyLoad.load(['ui.select', 'toaster']).then( - function () { - return $ocLazyLoad.load([{ - serie: true, - files: ['js/daterangepicker/daterangepicker.min.js', 'js/daterangepicker/daterangepicker.min.css'] - }, { - name: 'daterangepicker', - files: ['js/daterangepicker/angular-daterangepicker.min.js'] - }, { - files: ['js/plugins/footable/footable.all.min.js', 'css/plugins/footable/footable.core.css'] - }, { - name: 'ui.footable', - files: ['js/plugins/footable/angular-footable.js'] - }, { - files: ['js/plugins/sweetalert/sweetalert.min.js', 'css/plugins/sweetalert/sweetalert.css'] - }, { - name: 'oitozero.ngSweetAlert', - files: ['js/plugins/sweetalert/angular-sweetalert.min.js'] - }, { - serie: true, - files: [ - 'app/services/settings/tariff/tariff.service.js', - 'app/services/settings/tariff/tariff.const.js', - 'app/services/settings/category/category.service.js', - 'app/controllers/settings/tariff/tariff.controller.js' - ] - }]); - } - ); - } - ] - } - }) .state('users', { abstract: true, url: "/users", diff --git a/admin/app/controllers/settings/menu/menu.controller.js b/admin/app/controllers/settings/menu/menu.controller.js new file mode 100644 index 00000000..351dea6d --- /dev/null +++ b/admin/app/controllers/settings/menu/menu.controller.js @@ -0,0 +1,181 @@ +'use strict'; + +app.controller('MenuController', function ($scope, $common, $uibModal, MenuService, CostCenterService, ContactService, toaster, $translate, SweetAlert) { + $scope.menus = []; + $scope.currentMenuID = 1; + $scope.currentMenu = {}; + $scope.currentMenuChildren = []; + + $scope.getAllMenus = function () { + MenuService.getAllMenus(function (error, data) { + if (!error) { + $scope.menus = data; + } else { + $scope.menus = []; + } + //create menu tree + var treedata = { 'core': { 'data': [], "multiple": false, }, "plugins": ["wholerow"] }; + for (var i = 0; i < $scope.menus.length; i++) { + if ($scope.menus[i].parent_menu_id == null) { + var node = { + "id": $scope.menus[i].id.toString(), + "parent": '#', + "text": $scope.menus[i].name, + "state": { 'opened': true }, + }; + } else { + var node = { + "id": $scope.menus[i].id.toString(), + "parent": $scope.menus[i].parent_menu_id.toString(), + "text": $scope.menus[i].name, + "state": { 'opened': true }, + }; + }; + treedata['core']['data'].push(node); + } + + angular.element(menutree).jstree(treedata); + //menu tree selected changed event handler + angular.element(menutree).on("changed.jstree", function (e, data) { + $scope.currentMenuID = parseInt(data.selected[0]); + $scope.getMenuChildren($scope.currentMenuID); + }); + }); + }; + + $scope.refreshMenuTree = function () { + MenuService.getAllMenus(function (error, data) { + if (!error) { + $scope.menus = data; + } else { + $scope.menus = []; + } + //create menu tree + var treedata = { 'core': { 'data': [], "multiple": false, }, "plugins": ["wholerow"] }; + for (var i = 0; i < $scope.menus.length; i++) { + if ($scope.menus[i].parent_menu_id == null) { + var node = { + "id": $scope.menus[i].id.toString(), + "parent": '#', + "text": $scope.menus[i].name, + "state": { 'opened': true}, + }; + } else { + var node = { + "id": $scope.menus[i].id.toString(), + "parent": $scope.menus[i].parent_menu_id.toString(), + "text": $scope.menus[i].name, + "state": { 'opened': true}, + }; + }; + treedata['core']['data'].push(node); + } + var menutree = document.getElementById("menutree"); + angular.element(menutree).jstree(true).settings.core.data = treedata['core']['data']; + angular.element(menutree).jstree(true).refresh(); + }); + }; + + $scope.getMenuChildren = function (menuid) { + MenuService.getMenuChildren(menuid, function (error, data) { + if (!error) { + $scope.currentMenu = data["current"]; + $scope.currentMenuChildren = data["children"]; + } else { + $scope.currentMenu = {}; + $scope.currentMenuChildren = []; + } + }); + }; + + $scope.editMenu = function (menu) { + var modalInstance = $uibModal.open({ + windowClass: "animated fadeIn", + templateUrl: 'views/settings/menu/menu.model.html', + controller: 'ModalEditMenuCtrl', + resolve: { + params: function () { + return { + menu: angular.copy(menu), + menus: angular.copy($scope.menus), + timezones: angular.copy($scope.timezones), + costcenters: angular.copy($scope.costcenters), + contacts: angular.copy($scope.contacts), + }; + } + } + }); + + modalInstance.result.then(function (modifiedMenu) { + if (modifiedMenu.parent_menu != null) { + modifiedMenu.parent_menu_id = modifiedMenu.parent_menu_id; + } else { + modifiedMenu.parent_menu_id = null; + } + + MenuService.editMenu(modifiedMenu, function (error, status) { + if (angular.isDefined(status) && status == 200) { + var templateName = "COMMON.MENU"; + templateName = $translate.instant(templateName); + + var popType = 'TOASTER.SUCCESS'; + var popTitle = $common.toaster.success_title; + var popBody = $common.toaster.success_update_body; + + popType = $translate.instant(popType); + popTitle = $translate.instant(popTitle); + popBody = $translate.instant(popBody, { template: templateName }); + + toaster.pop({ + type: popType, + title: popTitle, + body: popBody, + showCloseButton: true, + }); + $scope.$emit('handleEmitMenuChanged'); + } else { + var templateName = "COMMON.MENU"; + templateName = $translate.instant(templateName); + + var popType = 'TOASTER.ERROR'; + var popTitle = $common.toaster.error_title; + var popBody = $common.toaster.error_update_body; + + popType = $translate.instant(popType); + popTitle = $translate.instant(popTitle); + popBody = $translate.instant(popBody, { template: templateName }); + + toaster.pop({ + type: popType, + title: popTitle, + body: popBody, + showCloseButton: true, + }); + } + }); + }, function () { + //do nothing; + }); + }; + + $scope.getAllMenus(); + + $scope.$on('handleBroadcastMenuChanged', function (event) { + $scope.refreshMenuTree(); + }); + +}); + + +app.controller('ModalEditMenuCtrl', function ($scope, $uibModalInstance, params) { + $scope.operation = "SETTING.EDIT_MENU"; + $scope.menu = params.menu; + + $scope.ok = function () { + $uibModalInstance.close($scope.menu); + }; + + $scope.cancel = function () { + $uibModalInstance.dismiss('cancel'); + }; +}); diff --git a/admin/app/controllers/settings/menu/menu.master.controller.js b/admin/app/controllers/settings/menu/menu.master.controller.js new file mode 100644 index 00000000..c0b5787a --- /dev/null +++ b/admin/app/controllers/settings/menu/menu.master.controller.js @@ -0,0 +1,8 @@ +'use strict'; + +app.controller('MenuMasterController', function($scope) { + + $scope.$on('handleEmitMenuChanged', function(event) { + $scope.$broadcast('handleBroadcastMenuChanged'); + }); +}); diff --git a/admin/app/services/settings/menu/menu.service.js b/admin/app/services/settings/menu/menu.service.js new file mode 100644 index 00000000..62571b5f --- /dev/null +++ b/admin/app/services/settings/menu/menu.service.js @@ -0,0 +1,32 @@ +'use strict'; +app.factory('MenuService', function($http) { + return { + getAllMenus:function(callback){ + $http.get(getAPI()+'menus') + .success(function (response, status, headers, config) { + callback(null, response); + }) + .error(function (e) { + callback(e); + }); + }, + getMenuChildren:function(menuid, callback){ + $http.get(getAPI()+'menus/'+menuid+'/children') + .success(function (response, status, headers, config) { + callback(null, response); + }) + .error(function (e) { + callback(e); + }); + }, + editMenu: function(menu, callback) { + $http.put(getAPI()+'menus/'+menu.id,{data:menu}) + .success(function (response, status, headers, config) { + callback(null, status); + }) + .error(function (e) { + callback(e); + }); + } + }; +}); diff --git a/admin/app/translations.js b/admin/app/translations.js index 863cfe07..680c90bd 100644 --- a/admin/app/translations.js +++ b/admin/app/translations.js @@ -24,7 +24,7 @@ function config($translateProvider) { DATA_SOURCE: 'Data Source', SENSOR: 'Sensor', ENERGY_FLOW_DIAGRAM: 'Energy Flow Diagram', - + MENU: 'Menu', PERIOD: { LABEL: 'Date period', YEAR: 'Year', @@ -33,8 +33,6 @@ function config($translateProvider) { HOUR: 'Hour', }, DATE: 'Date Range', - BASEMETER: 'Base Meter', - ANALYSISMETER: 'Analysis Meter', ANALYSIS: { LABEL: 'Analysis Type', ENERGY: 'Energy', @@ -144,6 +142,7 @@ function config($translateProvider) { CATEGORY: 'Energy Categories', ENERGY_FLOW_DIAGRAM: 'Energy Flow Diagram', DISTRIBUTION_SYSTEM: 'Distribution System', + MENU: 'Menu Settings', TARIFF: 'Tariff Settings', EMAIL_SERVER: 'Email Server Settings', GSM_MODEM: 'GSM Modem Settings', @@ -351,6 +350,13 @@ function config($translateProvider) { RESTORE: 'Restore', RESTORE_SUCCESS: 'Restore Success', RESTORE_FAILED: 'Restore Failed', + + SELECT_MENU: 'Select Menu', + CURRENT_SELECTED_MENU: 'Current Selected Menu', + PARENT_MENU: 'Parent Menu', + IS_HIDDEN: 'Is Hidden', + CHILD_MENUS: 'Child Menus', + EDIT_MENU: 'Edit Menu' }, CONTACT: { EMAIL: 'Email', @@ -894,8 +900,7 @@ function config($translateProvider) { DATA_SOURCE: '数据源', SENSOR: '传感器', ENERGY_FLOW_DIAGRAM: '能流图', - - UTILITY: '效用', + MENU: '菜单', PERIOD: { LABEL: '选择范围', YEAR: '年', @@ -904,8 +909,6 @@ function config($translateProvider) { HOUR: '时', }, DATE: '日期', - BASEMETER: '基准表', - ANALYSISMETER: '分析表', ANALYSIS: { LABEL: '显示方式', ENERGY: '能耗', @@ -1015,6 +1018,7 @@ function config($translateProvider) { CATEGORY: '能源分类管理', ENERGY_FLOW_DIAGRAM: '能流图管理', DISTRIBUTION_SYSTEM: '配电系统管理', + MENU: '菜单管理', TARIFF: '能源费率管理', EMAIL_SERVER: '邮件服务器设置', GSM_MODEM: '短信模块设置', @@ -1230,6 +1234,13 @@ function config($translateProvider) { RESTORE: '恢复', RESTORE_SUCCESS: '恢复成功', RESTORE_FAILED: '恢复失败', + + SELECT_MENU: '选择菜单', + CURRENT_SELECTED_MENU: '当前选定菜单', + PARENT_MENU: '上级菜单', + IS_HIDDEN: '是否隐藏', + CHILD_MENUS: '下级菜单', + EDIT_MENU: '编辑菜单' }, CONTACT: { EMAIL: '邮箱', @@ -1758,8 +1769,7 @@ function config($translateProvider) { DATA_SOURCE: 'Datenquelle', SENSOR: 'Sensor', ENERGY_FLOW_DIAGRAM: 'Energieflussdiagramm', - - UTILITY: 'Nützlichkeit', + MENU: 'Menü', PERIOD: { LABEL: 'Bereich auswählen', YEAR: 'Jahr', @@ -1768,8 +1778,6 @@ function config($translateProvider) { HOUR: 'Zeit', }, DATE: 'Datum', - BASEMETER: 'Benchmark-Tabelle', - ANALYSISMETER: 'Analysetabelle', ANALYSIS: { LABEL: 'Anzeigemethode', ENERGY: 'Energieverbrauch', @@ -1879,6 +1887,7 @@ function config($translateProvider) { CATEGORY: 'Energieklassifizierungsmanagement', ENERGY_FLOW_DIAGRAM: 'Energieflussdiagramm-Management', DISTRIBUTION_SYSTEM: 'Verwaltung des Verteilungssystems', + MENU: 'Verwaltung des Menüs', TARIFF: 'Energieratenmanagement', EMAIL_SERVER: 'Mailserver-Einstellungen', GSM_MODEM: 'SMS-Moduleinstellungen', @@ -2095,6 +2104,13 @@ function config($translateProvider) { RESTORE: 'wiederherstellen', RESTORE_SUCCESS: 'Erfolgreiche Genesung', RESTORE_FAILED: 'Wiederherstellung fehlgeschlagen', + + SELECT_MENU: 'Menü auswählen', + CURRENT_SELECTED_MENU: 'Aktuelles Menü', + PARENT_MENU: 'Superior Menü', + IS_HIDDEN: 'Ist versteckt', + CHILD_MENUS: 'Unteres Menü', + EDIT_MENU: 'Menü bearbeiten' }, CONTACT: { EMAIL: 'Briefkasten', diff --git a/admin/views/common/navigation.html b/admin/views/common/navigation.html index f2b212f2..486e6c76 100644 --- a/admin/views/common/navigation.html +++ b/admin/views/common/navigation.html @@ -30,6 +30,7 @@
  • {{ 'MENU.SETTINGS.SHOPFLOOR' | translate }}
  • {{ 'MENU.SETTINGS.ENERGY_FLOW_DIAGRAM' | translate }}
  • {{ 'MENU.SETTINGS.DISTRIBUTION_SYSTEM' | translate }}
  • +
  • {{ 'MENU.SETTINGS.MENU' | translate }}
  • {{ 'MENU.SETTINGS.EMAIL_SERVER' | translate }}
  • {{ 'MENU.SETTINGS.GSM_MODEM' | translate }}
  • {{ 'MENU.SETTINGS.KNOWLEDGEFILE' | translate }}
  • diff --git a/admin/views/settings/menu/menu.html b/admin/views/settings/menu/menu.html new file mode 100644 index 00000000..105d49b0 --- /dev/null +++ b/admin/views/settings/menu/menu.html @@ -0,0 +1,97 @@ +
    + +
    +
    +
    + + + +
    +
    +
    +
    +
    + {{'SETTING.SELECT_MENU' | translate}} +
    +
    + +
    +
    +
    +
    +
    +
    + {{'SETTING.CURRENT_SELECTED_MENU' | translate}} +
    +
    + + + + + + + + + + + + + + + + + {{ currentMenu.is_hidden==false?'SETTING.NO':'SETTING.YES' | translate }} + + + + +
    {{'SETTING.ID' | translate}}{{'SETTING.NAME' | translate}}{{'SETTING.PARENT_MENU' | translate}} + {{'SETTING.IS_HIDDEN' | translate}} + {{'SETTING.ACTION' | translate}}
    {{ currentMenu.id }}{{ currentMenu.name }}{{ currentMenu.parent_menu.name }}{{ currentMenu.is_hidden }} + {{'SETTING.EDIT' | translate}} +
    +
    +
    +
    +
    + {{'SETTING.CHILD_MENUS' | translate}} +
    +
    + + + + + + + + + + + + + + + + + + + +
    {{'SETTING.ID' | translate}}{{'SETTING.NAME' | translate}}{{'SETTING.PARENT_MENU' | translate}}{{'SETTING.IS_HIDDEN' | translate}}{{'SETTING.ACTION' | translate}}
    {{ menu.id }}{{ menu.name }}{{ menu.parent_menu.name }} + {{ menu.is_hidden==false?'SETTING.NO':'SETTING.YES' | translate }} + + {{'SETTING.EDIT' | translate}} + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/admin/views/settings/menu/menu.model.html b/admin/views/settings/menu/menu.model.html new file mode 100644 index 00000000..726636bf --- /dev/null +++ b/admin/views/settings/menu/menu.model.html @@ -0,0 +1,36 @@ +
    + + + +
    \ No newline at end of file diff --git a/myems-api/core/menu.py b/myems-api/core/menu.py index 1673f33f..596c0cf0 100644 --- a/myems-api/core/menu.py +++ b/myems-api/core/menu.py @@ -34,7 +34,7 @@ class MenuCollection: "path": row['path'], "name": row['name'], "parent_menu_id": row['parent_menu_id'], - "is_hidden": row['is_hidden']} + "is_hidden": bool(row['is_hidden'])} result.append(temp) @@ -73,7 +73,7 @@ class MenuItem: "path": rows_menu['path'], "name": rows_menu['name'], "parent_menu_id": rows_menu['parent_menu_id'], - "is_hidden": rows_menu['is_hidden']} + "is_hidden": bool(rows_menu['is_hidden'])} cursor.close() cnx.disconnect() @@ -149,7 +149,7 @@ class MenuChildrenCollection: "path": row_current_menu['path'], "name": row_current_menu['name'], "parent_menu_id": row_current_menu['parent_menu_id'], - "is_hidden": row_current_menu['is_hidden']} + "is_hidden": bool(row_current_menu['is_hidden'])} current_menu_id = row_current_menu['id'] query = (" SELECT id, path, name, parent_menu_id, is_hidden" @@ -167,7 +167,7 @@ class MenuChildrenCollection: "path": row['path'], "name": row['name'], "parent_menu": current_menu, - "is_hidden": row['is_hidden'] + "is_hidden": bool(row['is_hidden']) } ) @@ -195,43 +195,34 @@ class MenuWebCollection: cnx = mysql.connector.connect(**config.myems_system_db) cursor = cnx.cursor(dictionary=True) - query = (" SELECT id, path, parent_menu_id, is_hidden " + query = (" SELECT id, path, parent_menu_id, is_hidden " " FROM tbl_menus " - " WHERE parent_menu_id is NULL " - " AND is_hidden=0 ") + " WHERE parent_menu_id is NULL AND is_hidden == false ") cursor.execute(query) rows_menus = cursor.fetchall() first_paths = {} if rows_menus is not None and len(rows_menus) > 0: for row in rows_menus: - _id = row['id'] - path = row['path'] - first_paths[_id] = { - 'path': path, + first_paths[row['id']] = { + 'path': row['path'], 'children': [] } - query = (" SELECT id, path, parent_menu_id, is_hidden " + query = (" SELECT id, path, parent_menu_id, is_hidden " " FROM tbl_menus " - " WHERE parent_menu_id is not NULL " - " AND is_hidden=0 ") + " WHERE parent_menu_id is not NULL AND is_hidden == false ") cursor.execute(query) rows_menus = cursor.fetchall() if rows_menus is not None and len(rows_menus) > 0: for row in rows_menus: - _id = row['id'] - parent_menu_id = row['parent_menu_id'] - path = row['path'] - if parent_menu_id in first_paths.keys(): - first_paths[parent_menu_id]['children'].append(path) + if row['parent_menu_id'] in first_paths.keys(): + first_paths[row['parent_menu_id']]['children'].append(row['path']) result = dict() for _id, item in first_paths.items(): - first_path = item['path'] - children = item['children'] - result[first_path] = children + result[item['path']] = item['children'] cursor.close() cnx.disconnect()