-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookingbug-angular-settings.js
186 lines (163 loc) · 5.74 KB
/
bookingbug-angular-settings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
(function() {
'use strict';
angular.module('BBAdminSettings').config(["$logProvider", function($logProvider) {
'ngInject';
$logProvider.debugEnabled(true);
}]);
}).call(this);
(function() {
'use strict';
angular.module('BBAdminSettings', ['BB', 'BBAdmin.Services', 'BBAdmin.Filters', 'BBAdmin.Controllers', 'trNgGrid']);
angular.module('BBAdminSettingsMockE2E', ['BBAdminSettings', 'BBAdminMockE2E']);
}).call(this);
(function() {
'use strict';
angular.module('BBAdminSettings').directive('adminTable', ["$log", "ModalForm", "BBModel", function($log, ModalForm, BBModel) {
var controller, link;
controller = function($scope) {
$scope.getAdministrators = function() {
var params;
params = {
company: $scope.company
};
return BBModel.Admin.Administrator.$query(params).then(function(administrators) {
$scope.admin_models = administrators;
return $scope.administrators = _.map(administrators, function(administrator) {
return _.pick(administrator, 'id', 'name', 'email', 'role');
});
});
};
$scope.newAdministrator = function() {
return ModalForm["new"]({
company: $scope.company,
title: 'New Administrator',
new_rel: 'new_administrator',
post_rel: 'administrators',
success: function(administrator) {
return $scope.administrators.push(administrator);
}
});
};
return $scope.edit = function(id) {
var admin;
admin = _.find($scope.admin_models, function(p) {
return p.id === id;
});
return ModalForm.edit({
model: admin,
title: 'Edit Administrator'
});
};
};
link = function(scope, element, attrs) {
if (scope.company) {
return scope.getAdministrators();
} else {
return BBModel.Admin.Company.$query(attrs).then(function(company) {
scope.company = company;
return scope.getAdministrators();
});
}
};
return {
controller: controller,
link: link,
templateUrl: 'admin-table/admin_table_main.html'
};
}]);
}).call(this);
(function() {
'use strict';
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
angular.module('BB.Models').factory("Admin.AdministratorModel", ["$q", "AdminAdministratorService", "BBModel", "BaseModel", function($q, AdminAdministratorService, BBModel, BaseModel) {
var Admin_Administrator;
return Admin_Administrator = (function(superClass) {
extend(Admin_Administrator, superClass);
function Admin_Administrator(data) {
Admin_Administrator.__super__.constructor.call(this, data);
}
Admin_Administrator.$query = function(params) {
return AdminAdministratorService.query(params);
};
return Admin_Administrator;
})(BaseModel);
}]);
}).call(this);
(function() {
'use strict';
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
angular.module('BB.Models').factory("Admin.UserModel", ["$q", "BBModel", "BaseModel", function($q, BBModel, BaseModel) {
var Admin_User;
return Admin_User = (function(superClass) {
extend(Admin_User, superClass);
function Admin_User(data) {
Admin_User.__super__.constructor.call(this, data);
this.companies = [];
if (data) {
if (this.$has('companies')) {
this.$get('companies').then((function(_this) {
return function(comps) {
return _this.companies = comps;
};
})(this));
}
}
}
return Admin_User;
})(BaseModel);
}]);
}).call(this);
(function() {
'use strict';
angular.module('BBAdmin.Services').factory('AdminAdministratorService', ["$q", "BBModel", function($q, BBModel) {
return {
query: function(params) {
var company, defer;
company = params.company;
defer = $q.defer();
company.$get('administrators').then(function(collection) {
return collection.$get('administrators').then(function(administrators) {
var a, models;
models = (function() {
var i, len, results;
results = [];
for (i = 0, len = administrators.length; i < len; i++) {
a = administrators[i];
results.push(new BBModel.Admin.Administrator(a));
}
return results;
})();
return defer.resolve(models);
}, function(err) {
return defer.reject(err);
});
}, function(err) {
return defer.reject(err);
});
return defer.promise;
}
};
}]);
}).call(this);
(function() {
"use strict";
angular.module("BBAdminSettings").config(["$translateProvider", function($translateProvider) {
"ngInject";
var translations;
translations = {
SETTINGS: {
ADMIN_TABLE: {
NEW_ADMINISTRATOR: "New Administrator",
EDIT: "@:COMMON.BTN.EDIT"
},
ADMIN_FORM: {
OK_BTN: "@:COMMON.BTN.OK",
CANCEL_BTN: "@:COMMON.BTN.CANCEL"
}
}
};
$translateProvider.translations("en", translations);
}]);
}).call(this);