blob: 99204c4e191cd04173b17299ecfd74f41d73c1fa [file] [log] [blame]
Matteo Scandoloed9e3ec2016-06-13 15:20:11 -07001(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 Scandolo05bff8c2016-06-13 16:55:20 -070011 controller: function($scope, $stateParams, $uibModal, _, Imsi){
Matteo Scandoloed9e3ec2016-06-13 15:20:11 -070012
13 Imsi.get({id: $stateParams.id}).$promise
14 .then((imsi) => {
15 this.imsi = imsi;
16 return imsi.getProfiles()
17 })
18 .then(profiles => {
Matteo Scandolo05bff8c2016-06-13 16:55:20 -070019 this.profiles = profiles;
Matteo Scandoloed9e3ec2016-06-13 15:20:11 -070020 });
21
22 this.config = {
23 exclude: ['UeStatus'],
24 formName: 'updateEnode',
25 actions: [
26 {
27 label: 'Update',
28 icon: 'ok',
Matteo Scandolo05bff8c2016-06-13 16:55:20 -070029 cb: (imsi) => {
30 imsi.$save();
Matteo Scandoloed9e3ec2016-06-13 15:20:11 -070031 },
32 class: 'primary-border'
33 }
34 ]
35 };
Matteo Scandolo05bff8c2016-06-13 16:55:20 -070036
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 Scandoloed9e3ec2016-06-13 15:20:11 -070053 }
54 }
55 });
56}());