Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 1 | /** |
| 2 | * © OpenCORD |
| 3 | * |
| 4 | * Visit http://guide.xosproject.org/devguide/addview/ for more information |
| 5 | * |
| 6 | * Created by teone on 6/13/16. |
| 7 | */ |
| 8 | |
| 9 | (function () { |
| 10 | 'use strict'; |
| 11 | angular.module('mCord') |
| 12 | .directive('profilesList', function ($uibModal) { |
| 13 | return { |
| 14 | restrict: 'E', |
| 15 | scope: {}, |
| 16 | controllerAs: 'vm', |
| 17 | templateUrl: 'app/view/profiles-list/profiles-list.tpl.html', |
| 18 | controller: function ($log, Profile) { |
| 19 | Profile.query().$promise |
| 20 | .then((profiles) => { |
| 21 | this.profiles = profiles; |
| 22 | }); |
| 23 | |
| 24 | this.tableConfig = { |
| 25 | order: true, |
| 26 | filter: 'field', |
| 27 | columns: [ |
| 28 | { |
| 29 | label: '#', |
| 30 | prop: 'Name', |
| 31 | link: item => `#/profile/${item.Name}` |
| 32 | }, |
| 33 | { |
| 34 | label: 'DlSchedType', |
| 35 | prop: 'DlSchedType' |
| 36 | }, |
| 37 | { |
| 38 | label: 'DlAllocRBRate', |
| 39 | prop: 'DlAllocRBRate' |
| 40 | }, |
| 41 | { |
| 42 | label: 'UlSchedType', |
| 43 | prop: 'UlSchedType' |
| 44 | }, |
| 45 | { |
| 46 | label: 'UlAllocRBRate', |
| 47 | prop: 'UlAllocRBRate' |
| 48 | }, |
| 49 | { |
| 50 | label: 'Start', |
Matteo Scandolo | f25db3b | 2016-06-29 17:41:27 -0700 | [diff] [blame] | 51 | prop: 'jsStart', |
| 52 | type: 'date' |
Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 53 | }, |
| 54 | { |
| 55 | label: 'End', |
Matteo Scandolo | f25db3b | 2016-06-29 17:41:27 -0700 | [diff] [blame] | 56 | prop: 'jsEnd', |
| 57 | type: 'date' |
Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 58 | } |
Matteo Scandolo | 76b29ae | 2016-07-14 13:47:51 -0700 | [diff] [blame] | 59 | ], |
| 60 | actions: [ |
| 61 | { |
| 62 | label: 'delete', |
| 63 | icon: 'remove', |
| 64 | cb: (item) => { |
| 65 | item.$delete() |
| 66 | .then(() => { |
| 67 | _.remove(this.profiles, item); |
| 68 | }) |
| 69 | .catch(e => { |
| 70 | console.log(e); |
| 71 | }) |
| 72 | }, |
| 73 | color: 'red' |
| 74 | } |
Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 75 | ] |
| 76 | }; |
| 77 | } |
| 78 | } |
| 79 | }); |
| 80 | })(); |
| 81 | |