Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 1 | (function () { |
| 2 | 'use strict'; |
| 3 | |
| 4 | angular.module('mCord') |
| 5 | .directive('imsiDetails', function () { |
| 6 | return { |
| 7 | restrict: 'E', |
| 8 | scope: {}, |
| 9 | controllerAs: 'vm', |
| 10 | templateUrl: 'app/view/imsi-details/imsi-details.tpl.html', |
Matteo Scandolo | 05bff8c | 2016-06-13 16:55:20 -0700 | [diff] [blame^] | 11 | controller: function($scope, $stateParams, $uibModal, _, Imsi){ |
Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 12 | |
| 13 | Imsi.get({id: $stateParams.id}).$promise |
| 14 | .then((imsi) => { |
| 15 | this.imsi = imsi; |
| 16 | return imsi.getProfiles() |
| 17 | }) |
| 18 | .then(profiles => { |
Matteo Scandolo | 05bff8c | 2016-06-13 16:55:20 -0700 | [diff] [blame^] | 19 | this.profiles = profiles; |
Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 20 | }); |
| 21 | |
| 22 | this.config = { |
| 23 | exclude: ['UeStatus'], |
| 24 | formName: 'updateEnode', |
| 25 | actions: [ |
| 26 | { |
| 27 | label: 'Update', |
| 28 | icon: 'ok', |
Matteo Scandolo | 05bff8c | 2016-06-13 16:55:20 -0700 | [diff] [blame^] | 29 | cb: (imsi) => { |
| 30 | imsi.$save(); |
Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 31 | }, |
| 32 | class: 'primary-border' |
| 33 | } |
| 34 | ] |
| 35 | }; |
Matteo Scandolo | 05bff8c | 2016-06-13 16:55:20 -0700 | [diff] [blame^] | 36 | |
| 37 | this.addProfile = () => { |
| 38 | const _this = this; |
| 39 | this.modalInstance = $uibModal.open({ |
| 40 | animation: true, |
| 41 | templateUrl: 'addProfileToImsi', |
| 42 | controllerAs: 'vm', |
| 43 | controller: function ($uibModalInstance) { |
| 44 | this.modal = $uibModalInstance; |
| 45 | this.callback = (profile) => { |
| 46 | console.log(_this.imsi); |
| 47 | $scope.$broadcast('profile.add', {targetId: _this.imsi.IMSI, profile: profile}); |
| 48 | }; |
| 49 | this.imsi = _this.imsi; |
| 50 | } |
| 51 | }); |
| 52 | }; |
Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 53 | } |
| 54 | } |
| 55 | }); |
| 56 | }()); |