isite 2022.5.5 → 2022.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/client-side/site_files/js/directive.js +1589 -1576
- package/package.json +1 -1
|
@@ -2,205 +2,218 @@ var app = app || angular.module('myApp', []);
|
|
|
2
2
|
window.$ = window.jQuery;
|
|
3
3
|
|
|
4
4
|
app.filter('xdate', function () {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
return function (item) {
|
|
6
|
+
if (item) {
|
|
7
|
+
if (item.day2) {
|
|
8
|
+
return `${item.day} - ${item.month + 1} - ${item.year} -- ${item.day2} - ${item.month2 + 1} - ${item.year2}`;
|
|
9
|
+
} else {
|
|
10
|
+
return `${item.day} - ${item.month + 1} - ${item.year}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
14
|
});
|
|
15
15
|
app.filter('xmoney', function () {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return function (value) {
|
|
17
|
+
return site.toMoney(value, false);
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
app.filter('xmoney2', function () {
|
|
21
|
+
return function (value) {
|
|
22
|
+
if (value) {
|
|
23
|
+
let arr = value.toString().split('.');
|
|
24
|
+
if (arr[1] && arr[1].length === 3 && parseInt(arr[1][2]) === 5) {
|
|
25
|
+
arr[1] = arr[1][0] + arr[1][1] + 9;
|
|
26
|
+
value = arr.join('.');
|
|
27
|
+
}
|
|
28
|
+
return parseFloat( value).toFixed(2);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
19
32
|
});
|
|
20
33
|
app.service('isite', [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
'$http',
|
|
35
|
+
function ($http) {
|
|
36
|
+
this.getValue = function (obj, property) {
|
|
37
|
+
if (!obj || !property) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
if (property == '_') {
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
31
44
|
|
|
32
|
-
|
|
45
|
+
let arr = property.split('.');
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
if (arr.length === 1) {
|
|
48
|
+
return obj[arr[0]];
|
|
49
|
+
}
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
if (arr.length === 2) {
|
|
52
|
+
return obj[arr[0]][arr[1]];
|
|
53
|
+
}
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
if (arr.length === 3) {
|
|
56
|
+
return obj[arr[0]][arr[1]][arr[2]];
|
|
57
|
+
}
|
|
45
58
|
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
48
61
|
|
|
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
|
-
|
|
62
|
+
this.uploadImage = function (files, options, callback) {
|
|
63
|
+
options = Object.assign(
|
|
64
|
+
{
|
|
65
|
+
category: 'default',
|
|
66
|
+
},
|
|
67
|
+
options
|
|
68
|
+
);
|
|
69
|
+
callback = callback || function () {};
|
|
70
|
+
|
|
71
|
+
var fd = new FormData();
|
|
72
|
+
fd.append('fileToUpload', files[0]);
|
|
73
|
+
$http
|
|
74
|
+
.post('/api/upload/image/' + options.category, fd, {
|
|
75
|
+
withCredentials: !0,
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': undefined,
|
|
78
|
+
},
|
|
79
|
+
uploadEventHandlers: {
|
|
80
|
+
progress: function (e) {
|
|
81
|
+
callback(null, null, e);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
transformRequest: angular.identity,
|
|
85
|
+
})
|
|
86
|
+
.then(
|
|
87
|
+
function (res) {
|
|
88
|
+
if (res.data && res.data.done) {
|
|
89
|
+
callback(null, res.data.image_url);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
function (error) {
|
|
93
|
+
callback(error, null, null);
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
};
|
|
84
97
|
|
|
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
|
-
|
|
98
|
+
this.uploadFile = function (files, options, callback) {
|
|
99
|
+
options = Object.assign(
|
|
100
|
+
{
|
|
101
|
+
category: 'default',
|
|
102
|
+
},
|
|
103
|
+
options
|
|
104
|
+
);
|
|
105
|
+
callback = callback || function () {};
|
|
106
|
+
|
|
107
|
+
var fd = new FormData();
|
|
108
|
+
fd.append('fileToUpload', files[0]);
|
|
109
|
+
$http
|
|
110
|
+
.post('/api/upload/file/' + options.category, fd, {
|
|
111
|
+
withCredentials: !0,
|
|
112
|
+
headers: {
|
|
113
|
+
'Content-Type': undefined,
|
|
114
|
+
},
|
|
115
|
+
uploadEventHandlers: {
|
|
116
|
+
progress: function (e) {
|
|
117
|
+
callback(null, null, e);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
transformRequest: angular.identity,
|
|
121
|
+
})
|
|
122
|
+
.then(
|
|
123
|
+
function (res) {
|
|
124
|
+
if (res.data && res.data.done && res.data.file) {
|
|
125
|
+
callback(null, {
|
|
126
|
+
name: res.data.file.name,
|
|
127
|
+
url: res.data.file.url,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
function (error) {
|
|
132
|
+
callback(error, null, null);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
};
|
|
123
136
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
this.deleteFile = function (file, callback) {
|
|
138
|
+
callback = callback || function () {};
|
|
139
|
+
callback();
|
|
140
|
+
};
|
|
128
141
|
|
|
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
|
-
|
|
142
|
+
this.upload = function (files, options, callback) {
|
|
143
|
+
options = Object.assign(
|
|
144
|
+
{
|
|
145
|
+
api: '/api/upload/file',
|
|
146
|
+
},
|
|
147
|
+
options
|
|
148
|
+
);
|
|
149
|
+
callback = callback || function () {};
|
|
150
|
+
|
|
151
|
+
var fd = new FormData();
|
|
152
|
+
fd.append('fileToUpload', files[0]);
|
|
153
|
+
$http
|
|
154
|
+
.post(options.api, fd, {
|
|
155
|
+
withCredentials: !0,
|
|
156
|
+
headers: {
|
|
157
|
+
'Content-Type': undefined,
|
|
158
|
+
},
|
|
159
|
+
uploadEventHandlers: {
|
|
160
|
+
progress: function (e) {
|
|
161
|
+
callback(null, null, e);
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
transformRequest: angular.identity,
|
|
165
|
+
})
|
|
166
|
+
.then(
|
|
167
|
+
function (res) {
|
|
168
|
+
if (res.data && res.data.done && res.data.file) {
|
|
169
|
+
callback(null, {
|
|
170
|
+
name: res.data.file.name,
|
|
171
|
+
url: res.data.file.url,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
function (error) {
|
|
176
|
+
callback(error, null, null);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
},
|
|
168
181
|
]);
|
|
169
182
|
|
|
170
183
|
app.directive('iDate', function () {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
184
|
+
return {
|
|
185
|
+
link: function (scope, element, attrs) {
|
|
186
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
187
|
+
attrs.disabled = 'disabled';
|
|
188
|
+
} else {
|
|
189
|
+
attrs.disabled = '';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
$(element)
|
|
193
|
+
.find('select')
|
|
194
|
+
.focus(() => {
|
|
195
|
+
$('.popup').hide();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
scope.days1 = [];
|
|
199
|
+
for (let i = 1; i < 32; i++) {
|
|
200
|
+
scope.days1.push(i);
|
|
201
|
+
}
|
|
202
|
+
scope.years1 = [];
|
|
203
|
+
for (let i = 1900; i < 2100; i++) {
|
|
204
|
+
scope.years1.push(i);
|
|
205
|
+
}
|
|
206
|
+
scope.monthes1 = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
207
|
+
},
|
|
208
|
+
restrict: 'E',
|
|
209
|
+
require: 'ngModel',
|
|
210
|
+
scope: {
|
|
211
|
+
v: '@',
|
|
212
|
+
label: '@',
|
|
213
|
+
disabled: '@',
|
|
214
|
+
ngModel: '=',
|
|
215
|
+
},
|
|
216
|
+
template: `
|
|
204
217
|
<div class="row i-date">
|
|
205
218
|
|
|
206
219
|
<div class=" control">
|
|
@@ -227,169 +240,169 @@ app.directive('iDate', function () {
|
|
|
227
240
|
|
|
228
241
|
</div>
|
|
229
242
|
`,
|
|
230
|
-
|
|
243
|
+
};
|
|
231
244
|
});
|
|
232
245
|
|
|
233
246
|
app.directive('iDate2', function () {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
247
|
+
return {
|
|
248
|
+
link: function ($scope, element, attrs) {
|
|
249
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
250
|
+
attrs.disabled = 'disabled';
|
|
251
|
+
} else {
|
|
252
|
+
attrs.disabled = '';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
$scope.y_search = attrs.year || '202';
|
|
256
|
+
$scope.m_search = attrs.month || '';
|
|
257
|
+
$scope.d_search = attrs.day || '';
|
|
258
|
+
|
|
259
|
+
$scope.days1 = [];
|
|
260
|
+
for (let i = 1; i < 32; i++) {
|
|
261
|
+
$scope.days1.push({
|
|
262
|
+
id: i,
|
|
263
|
+
name: i,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
$scope.years1 = [];
|
|
267
|
+
for (let i = 1900; i < 2100; i++) {
|
|
268
|
+
$scope.years1.push({
|
|
269
|
+
id: i,
|
|
270
|
+
name: i,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
$scope.monthes1 = [
|
|
275
|
+
{ id: 0, name: 'يناير / Jan' },
|
|
276
|
+
{ id: 1, name: 'فبراير / Feb' },
|
|
277
|
+
{ id: 2, name: 'مارس / Mar' },
|
|
278
|
+
{ id: 3, name: 'ابريل / Aper' },
|
|
279
|
+
{ id: 4, name: 'مايو / May' },
|
|
280
|
+
{ id: 5, name: 'يونيو / June' },
|
|
281
|
+
{ id: 6, name: 'يوليو / Jule' },
|
|
282
|
+
{ id: 7, name: 'اغسطس / Aug' },
|
|
283
|
+
{ id: 8, name: 'سبتمبر / Sep' },
|
|
284
|
+
{ id: 9, name: 'اكتوبر / Oct' },
|
|
285
|
+
{ id: 10, name: 'نوفمبر / Nov' },
|
|
286
|
+
{ id: 11, name: 'ديسمبر / Des' },
|
|
287
|
+
];
|
|
288
|
+
|
|
289
|
+
$scope.model = null;
|
|
290
|
+
|
|
291
|
+
$scope.$watch('ngModel', function (ngModel) {
|
|
292
|
+
if (ngModel) {
|
|
293
|
+
ngModel = new Date(ngModel);
|
|
294
|
+
$scope.model = $scope.model || {};
|
|
295
|
+
$scope.model.day = ngModel.getDate();
|
|
296
|
+
$scope.model.day_name = $scope.model.day;
|
|
297
|
+
$scope.model.month = ngModel.getMonth();
|
|
298
|
+
$scope.model.month_name = $scope.monthes1.find((m) => m.id == $scope.model.month).name;
|
|
299
|
+
$scope.model.year = ngModel.getFullYear();
|
|
300
|
+
$scope.model.year_name = $scope.model.year;
|
|
301
|
+
} else {
|
|
302
|
+
$scope.model = $scope.model || {};
|
|
303
|
+
$scope.model.day = 0;
|
|
304
|
+
$scope.model.day_name = '';
|
|
305
|
+
$scope.model.month = -1;
|
|
306
|
+
$scope.model.month_name = '';
|
|
307
|
+
$scope.model.year = 0;
|
|
308
|
+
$scope.model.year_name = '';
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
$scope.setDay = function () {
|
|
313
|
+
$scope.ngModel = new Date();
|
|
314
|
+
};
|
|
315
|
+
$scope.updateDate = function (date) {
|
|
316
|
+
if (date.year) {
|
|
317
|
+
$scope.model.year = date.year.id;
|
|
318
|
+
$scope.model.year_name = date.year.name;
|
|
319
|
+
} else if (date.month) {
|
|
320
|
+
$scope.model.month = date.month.id;
|
|
321
|
+
$scope.model.month_name = date.month.name;
|
|
322
|
+
} else if (date.day) {
|
|
323
|
+
$scope.model.day = date.day.id;
|
|
324
|
+
$scope.model.day_name = date.day.name;
|
|
325
|
+
}
|
|
313
326
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
if ($scope.model && $scope.model.year && $scope.model.day && $scope.model.month > -1) {
|
|
328
|
+
$scope.ngModel = new Date($scope.model.year, $scope.model.month, $scope.model.day, 0, 0, 0);
|
|
329
|
+
} else {
|
|
330
|
+
delete $scope.ngModel;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
restrict: 'E',
|
|
335
|
+
require: 'ngModel',
|
|
336
|
+
scope: {
|
|
337
|
+
v: '@',
|
|
338
|
+
disabled: '@',
|
|
339
|
+
label: '@',
|
|
340
|
+
ngModel: '=',
|
|
341
|
+
},
|
|
342
|
+
template: `/*##client-side/sub/i-date2.content.html*/`,
|
|
343
|
+
};
|
|
331
344
|
});
|
|
332
345
|
|
|
333
346
|
app.directive('iTime', function () {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
347
|
+
return {
|
|
348
|
+
link: function ($scope, element, attrs) {
|
|
349
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
350
|
+
attrs.disabled = 'disabled';
|
|
351
|
+
} else {
|
|
352
|
+
attrs.disabled = '';
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
$scope.model = {};
|
|
356
|
+
|
|
357
|
+
$scope.hours = [];
|
|
358
|
+
for (let i = 1; i < 25; i++) {
|
|
359
|
+
$scope.hours.push(i);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
$scope.minutes = [];
|
|
363
|
+
for (let i = 0; i < 60; i++) {
|
|
364
|
+
$scope.minutes.push(i);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
$(element)
|
|
368
|
+
.find('select')
|
|
369
|
+
.focus(() => {
|
|
370
|
+
$('.popup').hide();
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
$scope.$watch('ngModel', function (ngModel) {
|
|
374
|
+
if (ngModel) {
|
|
375
|
+
ngModel.date = new Date(ngModel.date);
|
|
376
|
+
$scope.model = $scope.model || {};
|
|
377
|
+
$scope.model.hour = ngModel.hour;
|
|
378
|
+
$scope.model.minute = ngModel.minute;
|
|
379
|
+
} else {
|
|
380
|
+
$scope.model = $scope.model || {};
|
|
381
|
+
$scope.model.hour = 0;
|
|
382
|
+
$scope.model.minute = 0;
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
$scope.updateTime = function () {
|
|
387
|
+
if ($scope.model) {
|
|
388
|
+
$scope.ngModel = $scope.ngModel || {};
|
|
389
|
+
$scope.ngModel.hour = $scope.model.hour;
|
|
390
|
+
$scope.ngModel.minute = $scope.model.minute;
|
|
391
|
+
$scope.ngModel.date = new Date(null, null, null, $scope.model.hour, $scope.model.minute, null);
|
|
392
|
+
} else {
|
|
393
|
+
delete $scope.ngModel;
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
},
|
|
397
|
+
restrict: 'E',
|
|
398
|
+
require: 'ngModel',
|
|
399
|
+
scope: {
|
|
400
|
+
v: '@',
|
|
401
|
+
disabled: '@',
|
|
402
|
+
label: '@',
|
|
403
|
+
ngModel: '=',
|
|
404
|
+
},
|
|
405
|
+
template: `
|
|
393
406
|
<div class="row i-time">
|
|
394
407
|
<div class=" control ">
|
|
395
408
|
<label class="text-center"> {{label}} </label>
|
|
@@ -423,84 +436,84 @@ app.directive('iTime', function () {
|
|
|
423
436
|
</div>
|
|
424
437
|
</div>
|
|
425
438
|
`,
|
|
426
|
-
|
|
439
|
+
};
|
|
427
440
|
});
|
|
428
441
|
|
|
429
442
|
app.directive('iDatetime2', function () {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
443
|
+
return {
|
|
444
|
+
link: function ($scope, element, attrs) {
|
|
445
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
446
|
+
attrs.disabled = 'disabled';
|
|
447
|
+
} else {
|
|
448
|
+
attrs.disabled = '';
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
$scope.hour1 = [];
|
|
452
|
+
for (let i = 1; i < 25; i++) {
|
|
453
|
+
$scope.hour1.push(i);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
$scope.minute_list = [];
|
|
457
|
+
for (let i = 1; i < 60; i++) {
|
|
458
|
+
$scope.minute_list.push({
|
|
459
|
+
name: i,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
$scope.days1 = [];
|
|
464
|
+
for (let i = 1; i < 32; i++) {
|
|
465
|
+
$scope.days1.push(i);
|
|
466
|
+
}
|
|
467
|
+
$scope.years1 = [];
|
|
468
|
+
for (let i = 1900; i < 2100; i++) {
|
|
469
|
+
$scope.years1.push(i);
|
|
470
|
+
}
|
|
471
|
+
$scope.monthes1 = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
472
|
+
|
|
473
|
+
$scope.model = null;
|
|
474
|
+
|
|
475
|
+
$(element)
|
|
476
|
+
.find('select')
|
|
477
|
+
.focus(() => {
|
|
478
|
+
$('.popup').hide();
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
$scope.$watch('ngModel', function (ngModel) {
|
|
482
|
+
if (ngModel) {
|
|
483
|
+
ngModel = new Date(ngModel);
|
|
484
|
+
$scope.model = $scope.model || {};
|
|
485
|
+
$scope.model.hour = ngModel.getHours();
|
|
486
|
+
$scope.model.minute = ngModel.getMinutes();
|
|
487
|
+
$scope.model.day = ngModel.getDate();
|
|
488
|
+
$scope.model.month = ngModel.getMonth();
|
|
489
|
+
$scope.model.year = ngModel.getFullYear();
|
|
490
|
+
} else {
|
|
491
|
+
$scope.model = $scope.model || {};
|
|
492
|
+
$scope.model.hour = 0;
|
|
493
|
+
$scope.model.minute = 0;
|
|
494
|
+
$scope.model.day = 0;
|
|
495
|
+
$scope.model.month = -1;
|
|
496
|
+
$scope.model.year = 0;
|
|
497
|
+
}
|
|
498
|
+
});
|
|
486
499
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
500
|
+
$scope.updateDate = function () {
|
|
501
|
+
if ($scope.model && $scope.model.year && $scope.model.day) {
|
|
502
|
+
$scope.ngModel = new Date($scope.model.year, $scope.model.month, $scope.model.day, $scope.model.hour, $scope.model.minute);
|
|
503
|
+
} else {
|
|
504
|
+
delete $scope.ngModel;
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
},
|
|
508
|
+
restrict: 'E',
|
|
509
|
+
require: 'ngModel',
|
|
510
|
+
scope: {
|
|
511
|
+
v: '@',
|
|
512
|
+
disabled: '@',
|
|
513
|
+
label: '@',
|
|
514
|
+
ngModel: '=',
|
|
515
|
+
},
|
|
516
|
+
template: `
|
|
504
517
|
<div class="row i-datetime2">
|
|
505
518
|
|
|
506
519
|
<div class=" control">
|
|
@@ -540,64 +553,64 @@ app.directive('iDatetime2', function () {
|
|
|
540
553
|
|
|
541
554
|
</div>
|
|
542
555
|
`,
|
|
543
|
-
|
|
556
|
+
};
|
|
544
557
|
});
|
|
545
558
|
|
|
546
559
|
app.directive('iMonth2', function () {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
560
|
+
return {
|
|
561
|
+
link: function ($scope, element, attrs) {
|
|
562
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
563
|
+
attrs.disabled = 'disabled';
|
|
564
|
+
} else {
|
|
565
|
+
attrs.disabled = '';
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
$scope.years = [];
|
|
569
|
+
for (let i = 1900; i < 2100; i++) {
|
|
570
|
+
$scope.years.push(i);
|
|
571
|
+
}
|
|
572
|
+
$scope.monthes = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
573
|
+
|
|
574
|
+
$scope.model = null;
|
|
575
|
+
|
|
576
|
+
$(element)
|
|
577
|
+
.find('select')
|
|
578
|
+
.focus(() => {
|
|
579
|
+
$('.popup').hide();
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
$scope.$watch('ngModel', function (ngModel) {
|
|
583
|
+
if (ngModel) {
|
|
584
|
+
ngModel = new Date(ngModel);
|
|
585
|
+
$scope.model = $scope.model || {};
|
|
586
|
+
$scope.model.day = 1;
|
|
587
|
+
$scope.model.month = ngModel.getMonth();
|
|
588
|
+
$scope.model.year = ngModel.getFullYear();
|
|
589
|
+
} else {
|
|
590
|
+
$scope.model = $scope.model || {};
|
|
591
|
+
$scope.model.day = 0;
|
|
592
|
+
$scope.model.month = -1;
|
|
593
|
+
$scope.model.year = 0;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
583
596
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
597
|
+
$scope.updateDate = function () {
|
|
598
|
+
if ($scope.model && $scope.model.year) {
|
|
599
|
+
$scope.ngModel = new Date($scope.model.year, $scope.model.month, 1);
|
|
600
|
+
} else {
|
|
601
|
+
delete $scope.ngModel;
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
},
|
|
605
|
+
restrict: 'E',
|
|
606
|
+
require: 'ngModel',
|
|
607
|
+
scope: {
|
|
608
|
+
v: '@',
|
|
609
|
+
label: '@',
|
|
610
|
+
disabled: '@',
|
|
611
|
+
ngModel: '=',
|
|
612
|
+
},
|
|
613
|
+
template: `
|
|
601
614
|
<div class="row i-date2">
|
|
602
615
|
|
|
603
616
|
<div class=" control">
|
|
@@ -622,145 +635,145 @@ app.directive('iMonth2', function () {
|
|
|
622
635
|
|
|
623
636
|
</div>
|
|
624
637
|
`,
|
|
625
|
-
|
|
638
|
+
};
|
|
626
639
|
});
|
|
627
640
|
|
|
628
641
|
app.directive('iFulldate', [
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
if (typeof attrs.disabled !== 'undefined') {
|
|
636
|
-
attrs.disabled = 'disabled';
|
|
637
|
-
} else {
|
|
638
|
-
attrs.disabled = '';
|
|
639
|
-
}
|
|
642
|
+
'$http',
|
|
643
|
+
function ($http) {
|
|
644
|
+
return {
|
|
645
|
+
link: function ($scope, element, attrs, ngModel) {
|
|
646
|
+
let _busy = !1;
|
|
640
647
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
648
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
649
|
+
attrs.disabled = 'disabled';
|
|
650
|
+
} else {
|
|
651
|
+
attrs.disabled = '';
|
|
652
|
+
}
|
|
646
653
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
for (let i = 1950; i < 2030; i++) {
|
|
653
|
-
$scope.years1.push(i);
|
|
654
|
-
}
|
|
654
|
+
$(element)
|
|
655
|
+
.find('select')
|
|
656
|
+
.focus(() => {
|
|
657
|
+
$('.popup').hide();
|
|
658
|
+
});
|
|
655
659
|
|
|
656
|
-
|
|
660
|
+
$scope.days1 = [];
|
|
661
|
+
for (let i = 1; i < 32; i++) {
|
|
662
|
+
$scope.days1.push(i);
|
|
663
|
+
}
|
|
664
|
+
$scope.years1 = [];
|
|
665
|
+
for (let i = 1950; i < 2030; i++) {
|
|
666
|
+
$scope.years1.push(i);
|
|
667
|
+
}
|
|
657
668
|
|
|
658
|
-
|
|
659
|
-
for (let i = 1; i < 31; i++) {
|
|
660
|
-
$scope.days2.push(i);
|
|
661
|
-
}
|
|
662
|
-
$scope.years2 = [];
|
|
663
|
-
for (let i = 1370; i < 1450; i++) {
|
|
664
|
-
$scope.years2.push(i);
|
|
665
|
-
}
|
|
666
|
-
$scope.monthes2 = ['محرم', 'صفر', 'ربيع اول', 'ربيع ثان', 'جمادى اول', 'جمادى ثان', 'رجب', 'شعبان', 'رمضان', 'شوال', 'ذى القعدة', 'ذى الحجة'];
|
|
669
|
+
$scope.monthes1 = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
667
670
|
|
|
668
|
-
|
|
671
|
+
$scope.days2 = [];
|
|
672
|
+
for (let i = 1; i < 31; i++) {
|
|
673
|
+
$scope.days2.push(i);
|
|
674
|
+
}
|
|
675
|
+
$scope.years2 = [];
|
|
676
|
+
for (let i = 1370; i < 1450; i++) {
|
|
677
|
+
$scope.years2.push(i);
|
|
678
|
+
}
|
|
679
|
+
$scope.monthes2 = ['محرم', 'صفر', 'ربيع اول', 'ربيع ثان', 'جمادى اول', 'جمادى ثان', 'رجب', 'شعبان', 'رمضان', 'شوال', 'ذى القعدة', 'ذى الحجة'];
|
|
669
680
|
|
|
670
|
-
|
|
671
|
-
if (ngModel) {
|
|
672
|
-
$scope.model = ngModel;
|
|
673
|
-
} else {
|
|
674
|
-
$scope.model = {};
|
|
675
|
-
}
|
|
676
|
-
});
|
|
681
|
+
$scope.model = {};
|
|
677
682
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
$scope.model.day = date.getDate();
|
|
686
|
-
$scope.model.month = date.getMonth();
|
|
687
|
-
$scope.model.year = date.getFullYear();
|
|
688
|
-
$scope.get_hijri_date();
|
|
689
|
-
}
|
|
690
|
-
});
|
|
683
|
+
$scope.$watch('ngModel', function (ngModel) {
|
|
684
|
+
if (ngModel) {
|
|
685
|
+
$scope.model = ngModel;
|
|
686
|
+
} else {
|
|
687
|
+
$scope.model = {};
|
|
688
|
+
}
|
|
689
|
+
});
|
|
691
690
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
691
|
+
$scope.$watch('ngModel.date', function (date) {
|
|
692
|
+
if (date) {
|
|
693
|
+
if (typeof date == 'string') {
|
|
694
|
+
date = new Date(date);
|
|
695
|
+
}
|
|
696
|
+
$scope.model = $scope.model || {};
|
|
697
|
+
$scope.model.date = date;
|
|
698
|
+
$scope.model.day = date.getDate();
|
|
699
|
+
$scope.model.month = date.getMonth();
|
|
700
|
+
$scope.model.year = date.getFullYear();
|
|
701
|
+
$scope.get_hijri_date();
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
$scope.get_hijri_date = function () {
|
|
706
|
+
if ($scope.model && $scope.model.year && $scope.model.day) {
|
|
707
|
+
ngModel.$setViewValue($scope.model);
|
|
708
|
+
if (_busy) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
_busy = !0;
|
|
712
|
+
$scope.model.date = new Date($scope.model.year, $scope.model.month, $scope.model.day);
|
|
713
|
+
$http({
|
|
714
|
+
method: 'POST',
|
|
715
|
+
url: '/api/get_hijri_date',
|
|
716
|
+
data: {
|
|
717
|
+
date: $scope.model.year + '/' + ($scope.model.month + 1) + '/' + $scope.model.day,
|
|
718
|
+
},
|
|
719
|
+
})
|
|
720
|
+
.then((response) => {
|
|
721
|
+
if (response.data.done) {
|
|
722
|
+
$scope.model.hijri = response.data.hijri;
|
|
723
|
+
$scope.model.day2 = parseInt($scope.model.hijri.split('/')[2]);
|
|
724
|
+
$scope.model.month2 = parseInt($scope.model.hijri.split('/')[1]) - 1;
|
|
725
|
+
$scope.model.year2 = parseInt($scope.model.hijri.split('/')[0]);
|
|
726
|
+
ngModel.$setViewValue($scope.model);
|
|
727
|
+
_busy = !1;
|
|
728
|
+
}
|
|
729
|
+
})
|
|
730
|
+
.catch(() => {
|
|
731
|
+
_busy = !1;
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
$scope.get_normal_date = function () {
|
|
737
|
+
if ($scope.model && $scope.model.year2 && $scope.model.day2) {
|
|
738
|
+
ngModel.$setViewValue($scope.model);
|
|
739
|
+
if (_busy) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
_busy = !0;
|
|
743
|
+
$http({
|
|
744
|
+
method: 'POST',
|
|
745
|
+
url: '/api/get_normal_date',
|
|
746
|
+
data: {
|
|
747
|
+
hijri: $scope.model.year2 + '/' + ($scope.model.month2 + 1) + '/' + $scope.model.day2,
|
|
748
|
+
},
|
|
749
|
+
})
|
|
750
|
+
.then((response) => {
|
|
751
|
+
if (response.data.done) {
|
|
752
|
+
$scope.model.date = new Date(response.data.date);
|
|
753
|
+
$scope.model.day = parseInt(response.data.date.split('/')[2]);
|
|
754
|
+
$scope.model.month = parseInt(response.data.date.split('/')[1]) - 1;
|
|
755
|
+
$scope.model.year = parseInt(response.data.date.split('/')[0]);
|
|
756
|
+
ngModel.$setViewValue($scope.model);
|
|
757
|
+
_busy = !1;
|
|
758
|
+
}
|
|
759
|
+
})
|
|
760
|
+
.catch(() => {
|
|
761
|
+
_busy = !1;
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
},
|
|
766
|
+
restrict: 'E',
|
|
767
|
+
require: 'ngModel',
|
|
768
|
+
scope: {
|
|
769
|
+
v: '@',
|
|
770
|
+
label1: '@',
|
|
771
|
+
label2: '@',
|
|
772
|
+
disabled: '@',
|
|
773
|
+
ngModel: '=',
|
|
774
|
+
ngChange: '&',
|
|
775
|
+
},
|
|
776
|
+
template: `
|
|
764
777
|
<div class="row i-date">
|
|
765
778
|
|
|
766
779
|
<div class="col6 control">
|
|
@@ -807,128 +820,128 @@ app.directive('iFulldate', [
|
|
|
807
820
|
|
|
808
821
|
</div>
|
|
809
822
|
`,
|
|
810
|
-
|
|
811
|
-
|
|
823
|
+
};
|
|
824
|
+
},
|
|
812
825
|
]);
|
|
813
826
|
|
|
814
827
|
app.directive('iControl', function () {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
828
|
+
return {
|
|
829
|
+
restrict: 'E',
|
|
830
|
+
require: 'ngModel',
|
|
831
|
+
scope: {
|
|
832
|
+
v: '@',
|
|
833
|
+
id2: '@',
|
|
834
|
+
label: '@',
|
|
835
|
+
type: '@',
|
|
836
|
+
disabled: '@',
|
|
837
|
+
ngModel: '=',
|
|
838
|
+
ngChange: '&',
|
|
839
|
+
ngKeydown: '&',
|
|
840
|
+
},
|
|
841
|
+
link: function (scope, element, attrs, ctrl) {
|
|
842
|
+
attrs.type = attrs.type || 'text';
|
|
843
|
+
|
|
844
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
845
|
+
attrs.disabled = 'disabled';
|
|
846
|
+
} else {
|
|
847
|
+
attrs.disabled = '';
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
$(element)
|
|
851
|
+
.find('input')
|
|
852
|
+
.focus(() => {
|
|
853
|
+
$('.i-list .dropdown-content').css('display', 'none');
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
scope.$watch(attrs.ngModel, function (v) {});
|
|
857
|
+
},
|
|
858
|
+
template: `
|
|
846
859
|
<div class="control">
|
|
847
860
|
<label> {{label}} </label>
|
|
848
861
|
<input id="{{id2}}" ng-disabled="disabled" autofocus v="{{v}}" type="{{type}}" ng-model="ngModel" ng-change="ngChange()" ngKeydown="ngKeydown()">
|
|
849
862
|
</div>
|
|
850
863
|
`,
|
|
851
|
-
|
|
864
|
+
};
|
|
852
865
|
});
|
|
853
866
|
|
|
854
867
|
app.directive('iTextarea', function () {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
868
|
+
return {
|
|
869
|
+
restrict: 'E',
|
|
870
|
+
require: 'ngModel',
|
|
871
|
+
scope: {
|
|
872
|
+
v: '@',
|
|
873
|
+
label: '@',
|
|
874
|
+
disabled: '@',
|
|
875
|
+
rows: '@',
|
|
876
|
+
ngModel: '=',
|
|
877
|
+
ngChange: '&',
|
|
878
|
+
},
|
|
879
|
+
link: function (scope, element, attrs, ctrl) {
|
|
880
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
881
|
+
attrs.disabled = 'disabled';
|
|
882
|
+
} else {
|
|
883
|
+
attrs.disabled = '';
|
|
884
|
+
}
|
|
885
|
+
scope.rows = scope.rows || 4;
|
|
886
|
+
|
|
887
|
+
$(element)
|
|
888
|
+
.find('textarea')
|
|
889
|
+
.focus(() => {
|
|
890
|
+
$('.popup').hide();
|
|
891
|
+
});
|
|
892
|
+
},
|
|
893
|
+
template: `
|
|
881
894
|
<div class="control">
|
|
882
895
|
<label> {{label}} </label>
|
|
883
896
|
<textarea ng-disabled="disabled" rows="{{rows}}" v="{{v}}" ng-model="ngModel" ng-change="ngChange()"></textarea>
|
|
884
897
|
</div>
|
|
885
898
|
`,
|
|
886
|
-
|
|
899
|
+
};
|
|
887
900
|
});
|
|
888
901
|
|
|
889
902
|
app.directive('iCheckbox', function () {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
903
|
+
return {
|
|
904
|
+
restrict: 'E',
|
|
905
|
+
require: 'ngModel',
|
|
906
|
+
scope: {
|
|
907
|
+
label: '@',
|
|
908
|
+
ngModel: '=',
|
|
909
|
+
ngChange: '&',
|
|
910
|
+
},
|
|
911
|
+
link: function (scope, element, attrs, ctrl) {
|
|
912
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
913
|
+
attrs.disabled = 'disabled';
|
|
914
|
+
} else {
|
|
915
|
+
attrs.disabled = '';
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
scope.updateModal = function (ngModel) {
|
|
919
|
+
if (attrs.disabled == 'disabled') {
|
|
920
|
+
return !1;
|
|
921
|
+
} else {
|
|
922
|
+
scope.ngModel = !ngModel;
|
|
923
|
+
return !0;
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
},
|
|
927
|
+
template: `
|
|
915
928
|
<div class="selector" ng-class="{'selected' : ngModel , 'un-selected' : !ngModel }" ng-click="updateModal(ngModel);ngChange($event , ngModel)">
|
|
916
929
|
<i ng-show="!ngModel" class="fa fa-square"></i> <i ng-show="ngModel" class="fa fa-check"></i> {{label}}
|
|
917
930
|
</div>
|
|
918
931
|
`,
|
|
919
|
-
|
|
932
|
+
};
|
|
920
933
|
});
|
|
921
934
|
|
|
922
935
|
app.directive('iCheckbox2', function () {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
936
|
+
return {
|
|
937
|
+
restrict: 'E',
|
|
938
|
+
require: 'ngModel',
|
|
939
|
+
scope: {
|
|
940
|
+
label: '@',
|
|
941
|
+
ngModel: '=',
|
|
942
|
+
},
|
|
943
|
+
link: function (scope, element, attrs, ctrl) {},
|
|
944
|
+
template: `
|
|
932
945
|
<div class="control">
|
|
933
946
|
<label class="checkbox">
|
|
934
947
|
<span class="title"> {{label}} </span>
|
|
@@ -937,85 +950,85 @@ app.directive('iCheckbox2', function () {
|
|
|
937
950
|
</label>
|
|
938
951
|
</div>
|
|
939
952
|
`,
|
|
940
|
-
|
|
953
|
+
};
|
|
941
954
|
});
|
|
942
955
|
|
|
943
956
|
app.directive('iRadio', function () {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
957
|
+
return {
|
|
958
|
+
restrict: 'E',
|
|
959
|
+
require: 'ngModel',
|
|
960
|
+
scope: {
|
|
961
|
+
label: '@',
|
|
962
|
+
ngValue: '@',
|
|
963
|
+
group: '@',
|
|
964
|
+
ngModel: '=',
|
|
965
|
+
},
|
|
966
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
967
|
+
if (!attrs.group) {
|
|
968
|
+
attrs.group = attrs.ngModel;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
$scope.changeModal = function (ngValue) {
|
|
972
|
+
$scope.ngModel = ngValue;
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
$scope.$watch('ngModel', (ngModel) => {
|
|
976
|
+
if (ngModel) {
|
|
977
|
+
if (ngModel == $scope.ngValue) {
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
});
|
|
968
981
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
982
|
+
$scope.$watch('ngValue', (ngValue) => {
|
|
983
|
+
if (ngValue) {
|
|
984
|
+
if (ngValue == $scope.ngModel) {
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
},
|
|
989
|
+
template: `
|
|
977
990
|
<div group="{{group}}" class="selector" ng-class="{'selected' : ngModel == ngValue , 'un-selected' : ngModel != ngValue }" ng-click="changeModal(ngValue);ngChange($event , ngModel , ngValue)">
|
|
978
991
|
<i ng-show="ngModel != ngValue" class="fa fa-circle"></i> <i ng-show="ngModel == ngValue" class="fa fa-circle"></i> {{label}}
|
|
979
992
|
</div>
|
|
980
993
|
`,
|
|
981
|
-
|
|
994
|
+
};
|
|
982
995
|
});
|
|
983
996
|
|
|
984
997
|
app.directive('iRadio2', function () {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
998
|
+
return {
|
|
999
|
+
restrict: 'E',
|
|
1000
|
+
require: 'ngModel',
|
|
1001
|
+
scope: {
|
|
1002
|
+
label: '@',
|
|
1003
|
+
ngValue: '@',
|
|
1004
|
+
group: '@',
|
|
1005
|
+
ngModel: '=',
|
|
1006
|
+
},
|
|
1007
|
+
link: function (scope, element, attrs, ctrl) {
|
|
1008
|
+
if (!attrs.group) {
|
|
1009
|
+
attrs.group = attrs.ngModel;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
let input = $(element).find('input');
|
|
1013
|
+
|
|
1014
|
+
scope.$watch('ngModel', (ngModel) => {
|
|
1015
|
+
if (ngModel) {
|
|
1016
|
+
scope.ngModel = ngModel;
|
|
1017
|
+
if (ngModel == scope.ngValue) {
|
|
1018
|
+
input.prop('checked', !0);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1009
1022
|
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1023
|
+
scope.$watch('ngValue', (ngValue) => {
|
|
1024
|
+
if (ngValue) {
|
|
1025
|
+
if (ngValue == scope.ngModel) {
|
|
1026
|
+
input.prop('checked', !0);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
},
|
|
1031
|
+
template: `
|
|
1019
1032
|
<div class="control">
|
|
1020
1033
|
<label class="radio">
|
|
1021
1034
|
<span > {{label}} </span>
|
|
@@ -1024,281 +1037,281 @@ app.directive('iRadio2', function () {
|
|
|
1024
1037
|
</label>
|
|
1025
1038
|
</div>
|
|
1026
1039
|
`,
|
|
1027
|
-
|
|
1040
|
+
};
|
|
1028
1041
|
});
|
|
1029
1042
|
|
|
1030
1043
|
app.directive('iButton', function () {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1044
|
+
return {
|
|
1045
|
+
restrict: 'E',
|
|
1046
|
+
scope: {
|
|
1047
|
+
label: '@',
|
|
1048
|
+
type: '@',
|
|
1049
|
+
click: '@',
|
|
1050
|
+
fa: '@',
|
|
1051
|
+
},
|
|
1052
|
+
link: function (scope, element, attrs, ctrl) {
|
|
1053
|
+
if (!attrs.fa && attrs.type) {
|
|
1054
|
+
if (attrs.type.like('*exit*') || attrs.type.like('*close*')) {
|
|
1055
|
+
attrs.fa = 'times';
|
|
1056
|
+
} else if (attrs.type.like('*view*') || attrs.type.like('*details*')) {
|
|
1057
|
+
attrs.fa = 'file';
|
|
1058
|
+
} else if (attrs.type.like('*add*') || attrs.type.like('*new*')) {
|
|
1059
|
+
attrs.fa = 'plus-circle';
|
|
1060
|
+
} else if (attrs.type.like('*update*') || attrs.type.like('*edit*')) {
|
|
1061
|
+
attrs.fa = 'edit';
|
|
1062
|
+
} else if (attrs.type.like('*save*')) {
|
|
1063
|
+
attrs.fa = 'save';
|
|
1064
|
+
} else if (attrs.type.like('*delete*') || attrs.type.like('*remove*')) {
|
|
1065
|
+
attrs.fa = 'trash';
|
|
1066
|
+
} else if (attrs.type.like('*print*')) {
|
|
1067
|
+
attrs.fa = 'print';
|
|
1068
|
+
} else if (attrs.type.like('*search*')) {
|
|
1069
|
+
attrs.fa = 'search';
|
|
1070
|
+
} else if (attrs.type.like('*export*') || attrs.type.like('*excel*')) {
|
|
1071
|
+
attrs.fa = 'table';
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
template: `
|
|
1063
1076
|
<a class="btn {{type}}">
|
|
1064
1077
|
{{label}}
|
|
1065
1078
|
<i ng-show="fa" class="fa fa-{{fa}}" aria-hidden="true"></i> </a>
|
|
1066
1079
|
`,
|
|
1067
|
-
|
|
1080
|
+
};
|
|
1068
1081
|
});
|
|
1069
1082
|
|
|
1070
1083
|
app.directive('iList', [
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
if (typeof attrs.ngAdd == 'undefined') {
|
|
1110
|
-
$scope.fa_add = 'fa-search';
|
|
1111
|
-
} else {
|
|
1112
|
-
$scope.fa_add = 'fa-plus';
|
|
1113
|
-
}
|
|
1084
|
+
'$interval',
|
|
1085
|
+
'$timeout',
|
|
1086
|
+
'isite',
|
|
1087
|
+
function ($interval, $timeout, isite) {
|
|
1088
|
+
return {
|
|
1089
|
+
restrict: 'E',
|
|
1090
|
+
require: 'ngModel',
|
|
1091
|
+
scope: {
|
|
1092
|
+
v: '@',
|
|
1093
|
+
label: '@',
|
|
1094
|
+
display: '@',
|
|
1095
|
+
display2: '@',
|
|
1096
|
+
disabled: '@',
|
|
1097
|
+
css: '@',
|
|
1098
|
+
space: '@',
|
|
1099
|
+
primary: '@',
|
|
1100
|
+
ngValue: '@',
|
|
1101
|
+
ngModel: '=',
|
|
1102
|
+
ngSearch: '=',
|
|
1103
|
+
ngChange: '&',
|
|
1104
|
+
ngAdd: '&',
|
|
1105
|
+
items: '=',
|
|
1106
|
+
},
|
|
1107
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
1108
|
+
$scope.display = attrs.display = attrs.display || 'name';
|
|
1109
|
+
$scope.primary = attrs.primary = attrs.primary || 'id';
|
|
1110
|
+
attrs.space = attrs.space || ' ';
|
|
1111
|
+
attrs.ngValue = attrs.ngValue || '';
|
|
1112
|
+
|
|
1113
|
+
$scope.searchElement = $(element).find('.dropdown .search');
|
|
1114
|
+
$scope.popupElement = $(element).find('.dropdown .dropdown-content');
|
|
1115
|
+
|
|
1116
|
+
if (typeof attrs.disabled !== 'undefined') {
|
|
1117
|
+
attrs.disabled = 'disabled';
|
|
1118
|
+
} else {
|
|
1119
|
+
attrs.disabled = '';
|
|
1120
|
+
}
|
|
1114
1121
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1122
|
+
if (typeof attrs.ngAdd == 'undefined') {
|
|
1123
|
+
$scope.fa_add = 'fa-search';
|
|
1124
|
+
} else {
|
|
1125
|
+
$scope.fa_add = 'fa-plus';
|
|
1126
|
+
}
|
|
1120
1127
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
() => {
|
|
1127
|
-
$scope.popupElement.css('display', 'none');
|
|
1128
|
-
},
|
|
1129
|
-
);
|
|
1130
|
-
$scope.focus = function () {
|
|
1131
|
-
$('.i-list .dropdown-content').css('display', 'none');
|
|
1132
|
-
$scope.popupElement.css('display', 'block');
|
|
1133
|
-
$scope.searchElement.focus();
|
|
1134
|
-
};
|
|
1135
|
-
$scope.hide = function () {
|
|
1136
|
-
$scope.popupElement.css('display', 'none');
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
$scope.getValue = function (item) {
|
|
1140
|
-
let v = isite.getValue(item, $scope.display);
|
|
1141
|
-
return v || '';
|
|
1142
|
-
};
|
|
1143
|
-
|
|
1144
|
-
$scope.getValue2 = function (item) {
|
|
1145
|
-
if ($scope.display2) {
|
|
1146
|
-
return isite.getValue(item, $scope.display2) || '';
|
|
1147
|
-
}
|
|
1148
|
-
return '';
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
|
-
$scope.getNgModelValue = function (ngModel) {
|
|
1152
|
-
if (ngModel && $scope.display && $scope.ngValue) {
|
|
1153
|
-
return isite.getValue(ngModel, $scope.display.replace($scope.ngValue + '.', '')) || '';
|
|
1154
|
-
} else if (ngModel && $scope.display) {
|
|
1155
|
-
return isite.getValue(ngModel, $scope.display) || '';
|
|
1156
|
-
}
|
|
1157
|
-
return '';
|
|
1158
|
-
};
|
|
1159
|
-
|
|
1160
|
-
$scope.getNgModelValue2 = function (ngModel) {
|
|
1161
|
-
if (ngModel && $scope.display2 && $scope.ngValue) {
|
|
1162
|
-
return isite.getValue(ngModel, $scope.display2.replace($scope.ngValue + '.', '')) || '';
|
|
1163
|
-
} else if (ngModel && $scope.display2) {
|
|
1164
|
-
return isite.getValue(ngModel, $scope.display2) || '';
|
|
1165
|
-
}
|
|
1166
|
-
return '';
|
|
1167
|
-
};
|
|
1128
|
+
if (typeof attrs.ngSearch == 'undefined') {
|
|
1129
|
+
$scope.showSearch = !1;
|
|
1130
|
+
} else {
|
|
1131
|
+
$scope.showSearch = !0;
|
|
1132
|
+
}
|
|
1168
1133
|
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1134
|
+
let input = $(element).find('input');
|
|
1135
|
+
$(element).hover(
|
|
1136
|
+
() => {
|
|
1137
|
+
$scope.popupElement.css('display', 'block');
|
|
1138
|
+
},
|
|
1139
|
+
() => {
|
|
1140
|
+
$scope.popupElement.css('display', 'none');
|
|
1141
|
+
}
|
|
1142
|
+
);
|
|
1143
|
+
$scope.focus = function () {
|
|
1144
|
+
$('.i-list .dropdown-content').css('display', 'none');
|
|
1145
|
+
$scope.popupElement.css('display', 'block');
|
|
1146
|
+
$scope.searchElement.focus();
|
|
1147
|
+
};
|
|
1148
|
+
$scope.hide = function () {
|
|
1149
|
+
$scope.popupElement.css('display', 'none');
|
|
1150
|
+
};
|
|
1175
1151
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1152
|
+
$scope.getValue = function (item) {
|
|
1153
|
+
let v = isite.getValue(item, $scope.display);
|
|
1154
|
+
return v || '';
|
|
1155
|
+
};
|
|
1178
1156
|
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1157
|
+
$scope.getValue2 = function (item) {
|
|
1158
|
+
if ($scope.display2) {
|
|
1159
|
+
return isite.getValue(item, $scope.display2) || '';
|
|
1160
|
+
}
|
|
1161
|
+
return '';
|
|
1162
|
+
};
|
|
1184
1163
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
});
|
|
1164
|
+
$scope.getNgModelValue = function (ngModel) {
|
|
1165
|
+
if (ngModel && $scope.display && $scope.ngValue) {
|
|
1166
|
+
return isite.getValue(ngModel, $scope.display.replace($scope.ngValue + '.', '')) || '';
|
|
1167
|
+
} else if (ngModel && $scope.display) {
|
|
1168
|
+
return isite.getValue(ngModel, $scope.display) || '';
|
|
1169
|
+
}
|
|
1170
|
+
return '';
|
|
1171
|
+
};
|
|
1195
1172
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1173
|
+
$scope.getNgModelValue2 = function (ngModel) {
|
|
1174
|
+
if (ngModel && $scope.display2 && $scope.ngValue) {
|
|
1175
|
+
return isite.getValue(ngModel, $scope.display2.replace($scope.ngValue + '.', '')) || '';
|
|
1176
|
+
} else if (ngModel && $scope.display2) {
|
|
1177
|
+
return isite.getValue(ngModel, $scope.display2) || '';
|
|
1178
|
+
}
|
|
1179
|
+
return '';
|
|
1180
|
+
};
|
|
1198
1181
|
|
|
1199
|
-
|
|
1182
|
+
$scope.getNgValue = function (item) {
|
|
1183
|
+
if (item && $scope.ngValue) {
|
|
1184
|
+
return isite.getValue(item, $scope.ngValue);
|
|
1185
|
+
}
|
|
1186
|
+
return item;
|
|
1187
|
+
};
|
|
1200
1188
|
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
}
|
|
1204
|
-
});
|
|
1189
|
+
$scope.$watch('items', (items) => {
|
|
1190
|
+
input.val('');
|
|
1205
1191
|
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1192
|
+
if (items) {
|
|
1193
|
+
items.forEach((item) => {
|
|
1194
|
+
item.$display = $scope.getValue(item) + attrs.space + $scope.getValue2(item);
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
if (items && $scope.ngModel) {
|
|
1199
|
+
items.forEach((item) => {
|
|
1200
|
+
if (isite.getValue(item, $scope.primary) == isite.getValue($scope.ngModel, $scope.primary)) {
|
|
1201
|
+
$scope.ngModel = item;
|
|
1202
|
+
item.$display = $scope.getValue(item) + attrs.space + $scope.getValue2(item);
|
|
1203
|
+
input.val(item.$display);
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
|
|
1209
|
+
$scope.$watch('ngModel', (ngModel) => {
|
|
1210
|
+
input.val('');
|
|
1211
|
+
|
|
1212
|
+
$scope.ngModel = ngModel;
|
|
1213
|
+
|
|
1214
|
+
if (ngModel) {
|
|
1215
|
+
input.val(' ' + $scope.getNgModelValue(ngModel) + attrs.space + $scope.getNgModelValue2(ngModel));
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
|
|
1219
|
+
$scope.updateModel = function (item) {
|
|
1220
|
+
$scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
|
|
1221
|
+
input.val($scope.getNgModelValue($scope.ngModel) + attrs.space + $scope.getNgModelValue2($scope.ngModel));
|
|
1222
|
+
$timeout(() => {
|
|
1223
|
+
$scope.ngChange();
|
|
1224
|
+
});
|
|
1225
|
+
$scope.hide();
|
|
1216
1226
|
};
|
|
1217
|
-
|
|
1227
|
+
},
|
|
1228
|
+
template: `/*##client-side/sub/i-list2.content.html*/`,
|
|
1229
|
+
};
|
|
1230
|
+
},
|
|
1218
1231
|
]);
|
|
1219
1232
|
|
|
1220
1233
|
app.directive('iChecklist', [
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1234
|
+
'$interval',
|
|
1235
|
+
function ($interval) {
|
|
1236
|
+
return {
|
|
1237
|
+
restrict: 'E',
|
|
1238
|
+
required: 'ngModel',
|
|
1239
|
+
scope: {
|
|
1240
|
+
label: '@',
|
|
1241
|
+
primary: '@',
|
|
1242
|
+
display: '@',
|
|
1243
|
+
ngModel: '=',
|
|
1244
|
+
items: '=',
|
|
1245
|
+
like: '&',
|
|
1246
|
+
},
|
|
1247
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
1248
|
+
attrs.primary = attrs.primary || 'id';
|
|
1249
|
+
|
|
1250
|
+
$scope.selectedItems = [];
|
|
1251
|
+
|
|
1252
|
+
$scope.$watch('ngModel', (ngModel) => {
|
|
1253
|
+
$scope.reload();
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
$scope.reload = function () {
|
|
1257
|
+
$scope.selectedItems = [];
|
|
1258
|
+
|
|
1259
|
+
if ($scope.ngModel) {
|
|
1260
|
+
$scope.ngModel.forEach((mitem) => {
|
|
1261
|
+
$scope.selectedItems.push(mitem);
|
|
1262
|
+
});
|
|
1238
1263
|
|
|
1239
|
-
|
|
1240
|
-
|
|
1264
|
+
if ($scope.items) {
|
|
1265
|
+
$scope.items.forEach((mitem) => {
|
|
1266
|
+
let exist = !1;
|
|
1267
|
+
$scope.selectedItems.forEach((sitem) => {
|
|
1268
|
+
if (mitem[$scope.primary] === sitem[$scope.primary]) {
|
|
1269
|
+
exist = !0;
|
|
1270
|
+
}
|
|
1241
1271
|
});
|
|
1272
|
+
if (exist) {
|
|
1273
|
+
mitem.$selected = !0;
|
|
1274
|
+
} else {
|
|
1275
|
+
mitem.$selected = !1;
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
if (!$scope.ngModel) {
|
|
1281
|
+
$scope.selectedItems = [];
|
|
1282
|
+
if ($scope.items) {
|
|
1283
|
+
$scope.items.forEach((mitem) => {
|
|
1284
|
+
mitem.$selected = !1;
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1242
1289
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
if ($scope.ngModel) {
|
|
1247
|
-
$scope.ngModel.forEach((mitem) => {
|
|
1248
|
-
$scope.selectedItems.push(mitem);
|
|
1249
|
-
});
|
|
1250
|
-
|
|
1251
|
-
if ($scope.items) {
|
|
1252
|
-
$scope.items.forEach((mitem) => {
|
|
1253
|
-
let exist = !1;
|
|
1254
|
-
$scope.selectedItems.forEach((sitem) => {
|
|
1255
|
-
if (mitem[$scope.primary] === sitem[$scope.primary]) {
|
|
1256
|
-
exist = !0;
|
|
1257
|
-
}
|
|
1258
|
-
});
|
|
1259
|
-
if (exist) {
|
|
1260
|
-
mitem.$selected = !0;
|
|
1261
|
-
} else {
|
|
1262
|
-
mitem.$selected = !1;
|
|
1263
|
-
}
|
|
1264
|
-
});
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
if (!$scope.ngModel) {
|
|
1268
|
-
$scope.selectedItems = [];
|
|
1269
|
-
if ($scope.items) {
|
|
1270
|
-
$scope.items.forEach((mitem) => {
|
|
1271
|
-
mitem.$selected = !1;
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
$scope.change = function (item) {
|
|
1278
|
-
item.$selected = !item.$selected;
|
|
1279
|
-
|
|
1280
|
-
if (item.$selected) {
|
|
1281
|
-
let exsits = !1;
|
|
1282
|
-
$scope.selectedItems.forEach((sitem) => {
|
|
1283
|
-
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1284
|
-
exsits = !0;
|
|
1285
|
-
}
|
|
1286
|
-
});
|
|
1287
|
-
if (!exsits) {
|
|
1288
|
-
$scope.selectedItems.push(item);
|
|
1289
|
-
}
|
|
1290
|
-
} else {
|
|
1291
|
-
$scope.selectedItems.forEach((sitem, index) => {
|
|
1292
|
-
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1293
|
-
$scope.selectedItems.splice(index, 1);
|
|
1294
|
-
}
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1290
|
+
$scope.change = function (item) {
|
|
1291
|
+
item.$selected = !item.$selected;
|
|
1297
1292
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1293
|
+
if (item.$selected) {
|
|
1294
|
+
let exsits = !1;
|
|
1295
|
+
$scope.selectedItems.forEach((sitem) => {
|
|
1296
|
+
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1297
|
+
exsits = !0;
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
if (!exsits) {
|
|
1301
|
+
$scope.selectedItems.push(item);
|
|
1302
|
+
}
|
|
1303
|
+
} else {
|
|
1304
|
+
$scope.selectedItems.forEach((sitem, index) => {
|
|
1305
|
+
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1306
|
+
$scope.selectedItems.splice(index, 1);
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
$scope.ngModel = $scope.selectedItems;
|
|
1312
|
+
};
|
|
1313
|
+
},
|
|
1314
|
+
template: `
|
|
1302
1315
|
<div class="row padding check-list">
|
|
1303
1316
|
<label class="title"> {{label}} </label>
|
|
1304
1317
|
<div ng-repeat="item in items" ng-click="change(item);ngChange($event , item);" class="selector" ng-class="{'selected' : item.$selected , 'un-selected' : !item.$selected }" >
|
|
@@ -1306,90 +1319,90 @@ app.directive('iChecklist', [
|
|
|
1306
1319
|
</div>
|
|
1307
1320
|
</div>
|
|
1308
1321
|
`,
|
|
1309
|
-
|
|
1310
|
-
|
|
1322
|
+
};
|
|
1323
|
+
},
|
|
1311
1324
|
]);
|
|
1312
1325
|
|
|
1313
1326
|
app.directive('iChecklist2', [
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1327
|
+
'$interval',
|
|
1328
|
+
function ($interval) {
|
|
1329
|
+
return {
|
|
1330
|
+
restrict: 'E',
|
|
1331
|
+
required: 'ngModel',
|
|
1332
|
+
scope: {
|
|
1333
|
+
label: '@',
|
|
1334
|
+
primary: '@',
|
|
1335
|
+
display: '@',
|
|
1336
|
+
ngModel: '=',
|
|
1337
|
+
items: '=',
|
|
1338
|
+
like: '&',
|
|
1339
|
+
},
|
|
1340
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
1341
|
+
attrs.primary = attrs.primary || 'id';
|
|
1342
|
+
|
|
1343
|
+
$scope.selectedItems = [];
|
|
1344
|
+
|
|
1345
|
+
$scope.$watch('ngModel', (ngModel) => {
|
|
1346
|
+
$scope.reload();
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
$scope.reload = function () {
|
|
1350
|
+
$scope.selectedItems = [];
|
|
1351
|
+
|
|
1352
|
+
if ($scope.ngModel) {
|
|
1353
|
+
$scope.ngModel.forEach((mitem) => {
|
|
1354
|
+
$scope.selectedItems.push(mitem);
|
|
1355
|
+
});
|
|
1331
1356
|
|
|
1332
|
-
|
|
1333
|
-
|
|
1357
|
+
if ($scope.items) {
|
|
1358
|
+
$scope.items.forEach((mitem) => {
|
|
1359
|
+
let exist = !1;
|
|
1360
|
+
$scope.selectedItems.forEach((sitem) => {
|
|
1361
|
+
if (mitem[$scope.primary] === sitem[$scope.primary]) {
|
|
1362
|
+
exist = !0;
|
|
1363
|
+
}
|
|
1334
1364
|
});
|
|
1365
|
+
if (exist) {
|
|
1366
|
+
mitem.$selected = !0;
|
|
1367
|
+
} else {
|
|
1368
|
+
mitem.$selected = !1;
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
if (!$scope.ngModel) {
|
|
1374
|
+
$scope.selectedItems = [];
|
|
1375
|
+
if ($scope.items) {
|
|
1376
|
+
$scope.items.forEach((mitem) => {
|
|
1377
|
+
mitem.$selected = !1;
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1335
1382
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
} else {
|
|
1355
|
-
mitem.$selected = !1;
|
|
1356
|
-
}
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
if (!$scope.ngModel) {
|
|
1361
|
-
$scope.selectedItems = [];
|
|
1362
|
-
if ($scope.items) {
|
|
1363
|
-
$scope.items.forEach((mitem) => {
|
|
1364
|
-
mitem.$selected = !1;
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
};
|
|
1369
|
-
|
|
1370
|
-
$scope.change = function (item) {
|
|
1371
|
-
if (item.$selected) {
|
|
1372
|
-
let exsits = !1;
|
|
1373
|
-
$scope.selectedItems.forEach((sitem) => {
|
|
1374
|
-
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1375
|
-
exsits = !0;
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
if (!exsits) {
|
|
1379
|
-
$scope.selectedItems.push(item);
|
|
1380
|
-
}
|
|
1381
|
-
} else {
|
|
1382
|
-
$scope.selectedItems.forEach((sitem, index) => {
|
|
1383
|
-
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1384
|
-
$scope.selectedItems.splice(index, 1);
|
|
1385
|
-
}
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1383
|
+
$scope.change = function (item) {
|
|
1384
|
+
if (item.$selected) {
|
|
1385
|
+
let exsits = !1;
|
|
1386
|
+
$scope.selectedItems.forEach((sitem) => {
|
|
1387
|
+
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1388
|
+
exsits = !0;
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
if (!exsits) {
|
|
1392
|
+
$scope.selectedItems.push(item);
|
|
1393
|
+
}
|
|
1394
|
+
} else {
|
|
1395
|
+
$scope.selectedItems.forEach((sitem, index) => {
|
|
1396
|
+
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1397
|
+
$scope.selectedItems.splice(index, 1);
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1388
1401
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1402
|
+
$scope.ngModel = $scope.selectedItems;
|
|
1403
|
+
};
|
|
1404
|
+
},
|
|
1405
|
+
template: `
|
|
1393
1406
|
<div class="row padding check-list">
|
|
1394
1407
|
<label class="title"> {{label}} </label>
|
|
1395
1408
|
<div class="control" ng-repeat="item in items">
|
|
@@ -1401,39 +1414,39 @@ app.directive('iChecklist2', [
|
|
|
1401
1414
|
</div>
|
|
1402
1415
|
</div>
|
|
1403
1416
|
`,
|
|
1404
|
-
|
|
1405
|
-
|
|
1417
|
+
};
|
|
1418
|
+
},
|
|
1406
1419
|
]);
|
|
1407
1420
|
|
|
1408
1421
|
app.directive('iRadiolist', [
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1422
|
+
'$interval',
|
|
1423
|
+
function ($interval) {
|
|
1424
|
+
return {
|
|
1425
|
+
restrict: 'E',
|
|
1426
|
+
required: 'ngModel',
|
|
1427
|
+
scope: {
|
|
1428
|
+
label: '@',
|
|
1429
|
+
display: '@',
|
|
1430
|
+
ngModel: '=',
|
|
1431
|
+
items: '=',
|
|
1432
|
+
},
|
|
1433
|
+
link: function (scope, element, attrs) {
|
|
1434
|
+
scope.model = scope.ngModel;
|
|
1435
|
+
|
|
1436
|
+
scope.code = 'radio_' + Math.random();
|
|
1437
|
+
|
|
1438
|
+
scope.change = function (item) {
|
|
1439
|
+
scope.ngModel = item;
|
|
1440
|
+
};
|
|
1428
1441
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1442
|
+
scope.isChecked = function (item) {
|
|
1443
|
+
if (item && scope.ngModel && scope.ngModel.id === item.id) {
|
|
1444
|
+
return !0;
|
|
1445
|
+
}
|
|
1446
|
+
return !1;
|
|
1447
|
+
};
|
|
1448
|
+
},
|
|
1449
|
+
template: `
|
|
1437
1450
|
<div class="row padding radio-list">
|
|
1438
1451
|
<label class="title"> {{label}} </label>
|
|
1439
1452
|
<div class="control" ng-repeat="item in items">
|
|
@@ -1445,267 +1458,267 @@ app.directive('iRadiolist', [
|
|
|
1445
1458
|
</div>
|
|
1446
1459
|
</div>
|
|
1447
1460
|
`,
|
|
1448
|
-
|
|
1449
|
-
|
|
1461
|
+
};
|
|
1462
|
+
},
|
|
1450
1463
|
]);
|
|
1451
1464
|
|
|
1452
1465
|
app.directive('iFile', [
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
input.addEventListener('change', function () {
|
|
1479
|
-
scope.ngModel = this.files[0].path;
|
|
1480
|
-
scope.onSelected(this.files[0].path);
|
|
1481
|
-
scope.$applyAsync();
|
|
1482
|
-
});
|
|
1466
|
+
'$interval',
|
|
1467
|
+
'isite',
|
|
1468
|
+
function ($interval, isite) {
|
|
1469
|
+
return {
|
|
1470
|
+
restrict: 'E',
|
|
1471
|
+
required: 'ngModel',
|
|
1472
|
+
scope: {
|
|
1473
|
+
label: '@',
|
|
1474
|
+
type: '@',
|
|
1475
|
+
ngModel: '=',
|
|
1476
|
+
ngClick: '&',
|
|
1477
|
+
onSelected: '&',
|
|
1478
|
+
},
|
|
1479
|
+
link: function (scope, element, attrs, ctrl) {
|
|
1480
|
+
scope.type = scope.type || 'bg-green';
|
|
1481
|
+
|
|
1482
|
+
let input = $(element).find('input')[0];
|
|
1483
|
+
let a = $(element).find('a')[0];
|
|
1484
|
+
|
|
1485
|
+
if (attrs.view !== '') {
|
|
1486
|
+
a.addEventListener('click', function () {
|
|
1487
|
+
input.click();
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1483
1490
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
+
input.addEventListener('change', function () {
|
|
1492
|
+
scope.ngModel = this.files[0].path;
|
|
1493
|
+
scope.onSelected(this.files[0].path);
|
|
1494
|
+
scope.$applyAsync();
|
|
1495
|
+
});
|
|
1496
|
+
|
|
1497
|
+
scope.$watch('ngModel', (ngModel) => {
|
|
1498
|
+
if (ngModel) {
|
|
1499
|
+
a.setAttribute('url', ngModel);
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
},
|
|
1503
|
+
template: `
|
|
1491
1504
|
<form class="form text-center pointer">
|
|
1492
1505
|
<input class="hidden" type="file" name="file" />
|
|
1493
1506
|
<a class="btn {{type}}" ngClick="ngClick()" url="{{ngModel}}"> {{label}} </a>
|
|
1494
1507
|
</form>
|
|
1495
1508
|
`,
|
|
1496
|
-
|
|
1497
|
-
|
|
1509
|
+
};
|
|
1510
|
+
},
|
|
1498
1511
|
]);
|
|
1499
1512
|
|
|
1500
1513
|
app.directive('iImage', [
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
input.addEventListener('change', function () {
|
|
1527
|
-
isite.uploadImage(
|
|
1528
|
-
this.files,
|
|
1529
|
-
{
|
|
1530
|
-
category: scope.category,
|
|
1531
|
-
},
|
|
1532
|
-
(err, image_url, e) => {
|
|
1533
|
-
if (e) {
|
|
1534
|
-
$(progress).show();
|
|
1535
|
-
progress.value = e.loaded;
|
|
1536
|
-
progress.max = e.total;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
if (image_url) {
|
|
1540
|
-
scope.ngModel = image_url;
|
|
1541
|
-
}
|
|
1542
|
-
},
|
|
1543
|
-
);
|
|
1544
|
-
});
|
|
1514
|
+
'$interval',
|
|
1515
|
+
'isite',
|
|
1516
|
+
function ($interval, isite) {
|
|
1517
|
+
return {
|
|
1518
|
+
restrict: 'E',
|
|
1519
|
+
required: 'ngModel',
|
|
1520
|
+
scope: {
|
|
1521
|
+
category: '@',
|
|
1522
|
+
ngModel: '=',
|
|
1523
|
+
ngClick: '&',
|
|
1524
|
+
},
|
|
1525
|
+
link: function (scope, element, attrs, ctrl) {
|
|
1526
|
+
scope.category = scope.category || 'default';
|
|
1527
|
+
|
|
1528
|
+
let input = $(element).find('input')[0];
|
|
1529
|
+
let img = $(element).find('img')[0];
|
|
1530
|
+
let progress = $(element).find('progress')[0];
|
|
1531
|
+
$(progress).hide();
|
|
1532
|
+
|
|
1533
|
+
if (attrs.view !== '') {
|
|
1534
|
+
img.addEventListener('click', function () {
|
|
1535
|
+
input.click();
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1545
1538
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1539
|
+
input.addEventListener('change', function () {
|
|
1540
|
+
isite.uploadImage(
|
|
1541
|
+
this.files,
|
|
1542
|
+
{
|
|
1543
|
+
category: scope.category,
|
|
1551
1544
|
},
|
|
1552
|
-
|
|
1545
|
+
(err, image_url, e) => {
|
|
1546
|
+
if (e) {
|
|
1547
|
+
$(progress).show();
|
|
1548
|
+
progress.value = e.loaded;
|
|
1549
|
+
progress.max = e.total;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
if (image_url) {
|
|
1553
|
+
scope.ngModel = image_url;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
);
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
scope.$watch('ngModel', (ngModel) => {
|
|
1560
|
+
if (ngModel) {
|
|
1561
|
+
img.setAttribute('src', ngModel);
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
},
|
|
1565
|
+
template: `
|
|
1553
1566
|
<form class="form text-center pointer">
|
|
1554
1567
|
<input class="hidden" type="file" name="file" />
|
|
1555
1568
|
<img class="bg-white" ng-src="{{ngModel}}" ngClick="ngClick()" onerror="this.src='/images/no.jpg'" />
|
|
1556
1569
|
<progress class="row"></progress>
|
|
1557
1570
|
</form>
|
|
1558
1571
|
`,
|
|
1559
|
-
|
|
1560
|
-
|
|
1572
|
+
};
|
|
1573
|
+
},
|
|
1561
1574
|
]);
|
|
1562
1575
|
|
|
1563
1576
|
app.directive('iUpload', [
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
input.addEventListener('change', function () {
|
|
1593
|
-
isite.upload(
|
|
1594
|
-
this.files,
|
|
1595
|
-
{
|
|
1596
|
-
api: scope.api,
|
|
1597
|
-
},
|
|
1598
|
-
(err, file, e) => {
|
|
1599
|
-
if (e) {
|
|
1600
|
-
$(progress).show();
|
|
1601
|
-
progress.value = e.loaded;
|
|
1602
|
-
progress.max = e.total;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
if (file) {
|
|
1606
|
-
scope.ngModel = file;
|
|
1607
|
-
scope.onUploaded();
|
|
1608
|
-
}
|
|
1609
|
-
},
|
|
1610
|
-
);
|
|
1611
|
-
});
|
|
1577
|
+
'$interval',
|
|
1578
|
+
'isite',
|
|
1579
|
+
function ($interval, isite) {
|
|
1580
|
+
return {
|
|
1581
|
+
restrict: 'E',
|
|
1582
|
+
required: 'ngModel',
|
|
1583
|
+
scope: {
|
|
1584
|
+
label: '@',
|
|
1585
|
+
api: '@',
|
|
1586
|
+
type: '@',
|
|
1587
|
+
ngModel: '=',
|
|
1588
|
+
ngClick: '&',
|
|
1589
|
+
onUploaded: '&',
|
|
1590
|
+
},
|
|
1591
|
+
link: function (scope, element, attrs, ctrl) {
|
|
1592
|
+
scope.type = scope.type || 'bg-green';
|
|
1593
|
+
|
|
1594
|
+
let input = $(element).find('input')[0];
|
|
1595
|
+
let a = $(element).find('a')[0];
|
|
1596
|
+
let progress = $(element).find('progress')[0];
|
|
1597
|
+
$(progress).hide();
|
|
1598
|
+
|
|
1599
|
+
if (attrs.view !== '') {
|
|
1600
|
+
a.addEventListener('click', function () {
|
|
1601
|
+
input.click();
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1612
1604
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1605
|
+
input.addEventListener('change', function () {
|
|
1606
|
+
isite.upload(
|
|
1607
|
+
this.files,
|
|
1608
|
+
{
|
|
1609
|
+
api: scope.api,
|
|
1618
1610
|
},
|
|
1619
|
-
|
|
1611
|
+
(err, file, e) => {
|
|
1612
|
+
if (e) {
|
|
1613
|
+
$(progress).show();
|
|
1614
|
+
progress.value = e.loaded;
|
|
1615
|
+
progress.max = e.total;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
if (file) {
|
|
1619
|
+
scope.ngModel = file;
|
|
1620
|
+
scope.onUploaded();
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
);
|
|
1624
|
+
});
|
|
1625
|
+
|
|
1626
|
+
scope.$watch('ngModel', (ngModel) => {
|
|
1627
|
+
if (ngModel) {
|
|
1628
|
+
a.setAttribute('url', ngModel);
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
},
|
|
1632
|
+
template: `
|
|
1620
1633
|
<form class="form text-center pointer">
|
|
1621
1634
|
<input class="hidden" type="file" name="file" />
|
|
1622
1635
|
<a class="btn {{type}}" ngClick="ngClick()" url="{{ngModel}}"> {{label}} </a>
|
|
1623
1636
|
<progress class="row"></progress>
|
|
1624
1637
|
</form>
|
|
1625
1638
|
`,
|
|
1626
|
-
|
|
1627
|
-
|
|
1639
|
+
};
|
|
1640
|
+
},
|
|
1628
1641
|
]);
|
|
1629
1642
|
|
|
1630
1643
|
app.directive('iFiles', [
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1644
|
+
'$interval',
|
|
1645
|
+
'isite',
|
|
1646
|
+
function ($interval, isite) {
|
|
1647
|
+
return {
|
|
1648
|
+
restrict: 'E',
|
|
1649
|
+
required: 'ngModel',
|
|
1650
|
+
scope: {
|
|
1651
|
+
category: '@',
|
|
1652
|
+
label: '@',
|
|
1653
|
+
ngModel: '=',
|
|
1654
|
+
},
|
|
1655
|
+
link: function (scope, element, attrs, ctrl) {
|
|
1656
|
+
if (attrs.view === '') {
|
|
1657
|
+
scope.viewOnly = !0;
|
|
1658
|
+
}
|
|
1646
1659
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1660
|
+
let progress = $(element).find('progress')[0];
|
|
1661
|
+
|
|
1662
|
+
scope.category = scope.category || 'default';
|
|
1663
|
+
scope.id = Math.random().toString().replace('.', '_');
|
|
1664
|
+
scope.deleteFile = function (file) {
|
|
1665
|
+
isite.deleteFile(file, () => {
|
|
1666
|
+
for (let i = 0; i < scope.ngModel.length; i++) {
|
|
1667
|
+
let f = scope.ngModel[i];
|
|
1668
|
+
if (f.url === file.url) {
|
|
1669
|
+
scope.ngModel.splice(i, 1);
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
let setEvent = !1;
|
|
1677
|
+
$interval(() => {
|
|
1678
|
+
if (setEvent) {
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
if (attrs.view !== '') {
|
|
1683
|
+
let btn = document.querySelector('#btn_' + scope.id);
|
|
1684
|
+
if (btn) {
|
|
1685
|
+
setEvent = !0;
|
|
1686
|
+
btn.addEventListener('click', function () {
|
|
1687
|
+
document.querySelector('#input_' + scope.id).click();
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
let input = document.querySelector('#input_' + scope.id);
|
|
1692
|
+
if (input) {
|
|
1693
|
+
input.addEventListener('change', function () {
|
|
1694
|
+
isite.uploadFile(
|
|
1695
|
+
this.files,
|
|
1696
|
+
{
|
|
1697
|
+
category: scope.category,
|
|
1698
|
+
},
|
|
1699
|
+
(err, file, e) => {
|
|
1700
|
+
if (e) {
|
|
1701
|
+
$(progress).show();
|
|
1702
|
+
progress.value = e.loaded;
|
|
1703
|
+
progress.max = e.total;
|
|
1667
1704
|
}
|
|
1668
1705
|
|
|
1669
|
-
if (
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
document.querySelector('#input_' + scope.id).click();
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
let input = document.querySelector('#input_' + scope.id);
|
|
1679
|
-
if (input) {
|
|
1680
|
-
input.addEventListener('change', function () {
|
|
1681
|
-
isite.uploadFile(
|
|
1682
|
-
this.files,
|
|
1683
|
-
{
|
|
1684
|
-
category: scope.category,
|
|
1685
|
-
},
|
|
1686
|
-
(err, file, e) => {
|
|
1687
|
-
if (e) {
|
|
1688
|
-
$(progress).show();
|
|
1689
|
-
progress.value = e.loaded;
|
|
1690
|
-
progress.max = e.total;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
if (file) {
|
|
1694
|
-
if (typeof scope.ngModel === 'undefined') {
|
|
1695
|
-
scope.ngModel = [];
|
|
1696
|
-
}
|
|
1697
|
-
scope.ngModel.push(file);
|
|
1698
|
-
}
|
|
1699
|
-
},
|
|
1700
|
-
);
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
} else {
|
|
1704
|
-
setEvent = !0;
|
|
1706
|
+
if (file) {
|
|
1707
|
+
if (typeof scope.ngModel === 'undefined') {
|
|
1708
|
+
scope.ngModel = [];
|
|
1709
|
+
}
|
|
1710
|
+
scope.ngModel.push(file);
|
|
1705
1711
|
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1712
|
+
}
|
|
1713
|
+
);
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
} else {
|
|
1717
|
+
setEvent = !0;
|
|
1718
|
+
}
|
|
1719
|
+
}, 500);
|
|
1720
|
+
},
|
|
1721
|
+
template: `
|
|
1709
1722
|
<div class="files">
|
|
1710
1723
|
<label> {{label}} </label>
|
|
1711
1724
|
<form ng-if="viewOnly !== !0" id="img_{{id}}" class="form text-center pointer">
|
|
@@ -1726,162 +1739,162 @@ app.directive('iFiles', [
|
|
|
1726
1739
|
</div>
|
|
1727
1740
|
|
|
1728
1741
|
`,
|
|
1729
|
-
|
|
1730
|
-
|
|
1742
|
+
};
|
|
1743
|
+
},
|
|
1731
1744
|
]);
|
|
1732
1745
|
|
|
1733
1746
|
app.directive('iDrag', [
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1747
|
+
'$document',
|
|
1748
|
+
function ($document) {
|
|
1749
|
+
return function (scope, element, attr) {
|
|
1750
|
+
var startX = 0,
|
|
1751
|
+
startY = 0,
|
|
1752
|
+
x = 0,
|
|
1753
|
+
y = 0;
|
|
1754
|
+
|
|
1755
|
+
element.css({
|
|
1756
|
+
position: 'relative',
|
|
1757
|
+
});
|
|
1758
|
+
|
|
1759
|
+
element.on('mousedown', function (event) {
|
|
1760
|
+
event.preventDefault();
|
|
1761
|
+
startX = event.screenX - x;
|
|
1762
|
+
startY = event.screenY - y;
|
|
1763
|
+
$document.on('mousemove', mousemove);
|
|
1764
|
+
$document.on('mouseup', mouseup);
|
|
1765
|
+
});
|
|
1766
|
+
|
|
1767
|
+
function mousemove(event) {
|
|
1768
|
+
y = event.screenY - startY;
|
|
1769
|
+
x = event.screenX - startX;
|
|
1770
|
+
element.css({
|
|
1771
|
+
top: y + 'px',
|
|
1772
|
+
left: x + 'px',
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
function mouseup() {
|
|
1777
|
+
$document.off('mousemove', mousemove);
|
|
1778
|
+
$document.off('mouseup', mouseup);
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
},
|
|
1782
|
+
]);
|
|
1745
1783
|
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1784
|
+
app.directive('iTreeview', [
|
|
1785
|
+
'$interval',
|
|
1786
|
+
'$timeout',
|
|
1787
|
+
'isite',
|
|
1788
|
+
function ($interval, $timeout, isite) {
|
|
1789
|
+
return {
|
|
1790
|
+
restrict: 'E',
|
|
1791
|
+
require: 'ngModel',
|
|
1792
|
+
scope: {
|
|
1793
|
+
v: '@',
|
|
1794
|
+
label: '@',
|
|
1795
|
+
display: '@',
|
|
1796
|
+
display2: '@',
|
|
1797
|
+
disabled: '@',
|
|
1798
|
+
space: '@',
|
|
1799
|
+
primary: '@',
|
|
1800
|
+
ngValue: '@',
|
|
1801
|
+
ngModel: '=',
|
|
1802
|
+
ngSearch: '=',
|
|
1803
|
+
ngChange: '&',
|
|
1804
|
+
ngClick: '&',
|
|
1805
|
+
ngAdd: '&',
|
|
1806
|
+
ngNode: '&',
|
|
1807
|
+
ngEdit: '&',
|
|
1808
|
+
ngDelete: '&',
|
|
1809
|
+
nodes: '=',
|
|
1810
|
+
},
|
|
1811
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
1812
|
+
attrs.display = attrs.display || 'name';
|
|
1813
|
+
attrs.primary = attrs.primary || 'id';
|
|
1814
|
+
attrs.space = attrs.space || ' ';
|
|
1815
|
+
attrs.ngValue = attrs.ngValue || '';
|
|
1816
|
+
|
|
1817
|
+
$scope.source = {};
|
|
1818
|
+
|
|
1819
|
+
$scope.setNodes = function (v_node) {
|
|
1820
|
+
v_node.nodes.forEach((v_node2) => {
|
|
1821
|
+
v_node2.nodes = v_node2.nodes || [];
|
|
1822
|
+
$scope.nodes.forEach((node) => {
|
|
1823
|
+
if (node.$parent_id == v_node2.id) {
|
|
1824
|
+
node.v_display = node.v_display || '';
|
|
1825
|
+
node.v_display += node[attrs.display];
|
|
1826
|
+
|
|
1827
|
+
let exist = !1;
|
|
1828
|
+
v_node2.nodes.forEach((n) => {
|
|
1829
|
+
if (n.id == node.id) {
|
|
1830
|
+
exist = !0;
|
|
1831
|
+
}
|
|
1832
|
+
});
|
|
1833
|
+
if (!exist) {
|
|
1834
|
+
v_node2.nodes.push(node);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1752
1837
|
});
|
|
1838
|
+
$scope.setNodes(v_node2);
|
|
1839
|
+
});
|
|
1840
|
+
};
|
|
1753
1841
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1842
|
+
$scope.v_nodes = [];
|
|
1843
|
+
|
|
1844
|
+
$scope.$watch('ngModel', (ngModel) => {
|
|
1845
|
+
if (ngModel) {
|
|
1846
|
+
$scope.ngModel = ngModel;
|
|
1847
|
+
$scope.ngModel.v_display = $scope.ngModel.v_display || ngModel[attrs.display];
|
|
1848
|
+
}
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
$scope.$watch('nodes', (nodes) => {
|
|
1852
|
+
$scope.v_nodes = [];
|
|
1853
|
+
if (nodes) {
|
|
1854
|
+
nodes.forEach((node) => {
|
|
1855
|
+
node.$parent_id = node.parent_id || 0;
|
|
1856
|
+
node.v_display = node.v_display || '';
|
|
1857
|
+
node.v_display += node[attrs.display];
|
|
1858
|
+
if (node.$parent_id == 0) {
|
|
1859
|
+
let exist = !1;
|
|
1860
|
+
$scope.v_nodes.forEach((n) => {
|
|
1861
|
+
if (n.id == node.id) {
|
|
1862
|
+
exist = !0;
|
|
1863
|
+
}
|
|
1760
1864
|
});
|
|
1761
|
-
|
|
1865
|
+
if (!exist) {
|
|
1866
|
+
$scope.v_nodes.push(node);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1762
1870
|
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
$document.off('mouseup', mouseup);
|
|
1766
|
-
}
|
|
1767
|
-
};
|
|
1768
|
-
},
|
|
1769
|
-
]);
|
|
1871
|
+
$scope.v_nodes.forEach((v_node) => {
|
|
1872
|
+
v_node.nodes = v_node.nodes || [];
|
|
1770
1873
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
return {
|
|
1777
|
-
restrict: 'E',
|
|
1778
|
-
require: 'ngModel',
|
|
1779
|
-
scope: {
|
|
1780
|
-
v: '@',
|
|
1781
|
-
label: '@',
|
|
1782
|
-
display: '@',
|
|
1783
|
-
display2: '@',
|
|
1784
|
-
disabled: '@',
|
|
1785
|
-
space: '@',
|
|
1786
|
-
primary: '@',
|
|
1787
|
-
ngValue: '@',
|
|
1788
|
-
ngModel: '=',
|
|
1789
|
-
ngSearch: '=',
|
|
1790
|
-
ngChange: '&',
|
|
1791
|
-
ngClick: '&',
|
|
1792
|
-
ngAdd: '&',
|
|
1793
|
-
ngNode: '&',
|
|
1794
|
-
ngEdit: '&',
|
|
1795
|
-
ngDelete: '&',
|
|
1796
|
-
nodes: '=',
|
|
1797
|
-
},
|
|
1798
|
-
link: function ($scope, element, attrs, ctrl) {
|
|
1799
|
-
attrs.display = attrs.display || 'name';
|
|
1800
|
-
attrs.primary = attrs.primary || 'id';
|
|
1801
|
-
attrs.space = attrs.space || ' ';
|
|
1802
|
-
attrs.ngValue = attrs.ngValue || '';
|
|
1803
|
-
|
|
1804
|
-
$scope.source = {};
|
|
1805
|
-
|
|
1806
|
-
$scope.setNodes = function (v_node) {
|
|
1807
|
-
v_node.nodes.forEach((v_node2) => {
|
|
1808
|
-
v_node2.nodes = v_node2.nodes || [];
|
|
1809
|
-
$scope.nodes.forEach((node) => {
|
|
1810
|
-
if (node.$parent_id == v_node2.id) {
|
|
1811
|
-
node.v_display = node.v_display || '';
|
|
1812
|
-
node.v_display += node[attrs.display];
|
|
1813
|
-
|
|
1814
|
-
let exist = !1;
|
|
1815
|
-
v_node2.nodes.forEach((n) => {
|
|
1816
|
-
if (n.id == node.id) {
|
|
1817
|
-
exist = !0;
|
|
1818
|
-
}
|
|
1819
|
-
});
|
|
1820
|
-
if (!exist) {
|
|
1821
|
-
v_node2.nodes.push(node);
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
});
|
|
1825
|
-
$scope.setNodes(v_node2);
|
|
1826
|
-
});
|
|
1827
|
-
};
|
|
1828
|
-
|
|
1829
|
-
$scope.v_nodes = [];
|
|
1830
|
-
|
|
1831
|
-
$scope.$watch('ngModel', (ngModel) => {
|
|
1832
|
-
if (ngModel) {
|
|
1833
|
-
$scope.ngModel = ngModel;
|
|
1834
|
-
$scope.ngModel.v_display = $scope.ngModel.v_display || ngModel[attrs.display];
|
|
1835
|
-
}
|
|
1836
|
-
});
|
|
1874
|
+
nodes.forEach((node) => {
|
|
1875
|
+
node.$parent_id = node.parent_id || 0;
|
|
1876
|
+
if (node.$parent_id == v_node.id) {
|
|
1877
|
+
node.v_display = node.v_display || '';
|
|
1878
|
+
node.v_display += node[attrs.display];
|
|
1837
1879
|
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
if (
|
|
1841
|
-
|
|
1842
|
-
node.$parent_id = node.parent_id || 0;
|
|
1843
|
-
node.v_display = node.v_display || '';
|
|
1844
|
-
node.v_display += node[attrs.display];
|
|
1845
|
-
if (node.$parent_id == 0) {
|
|
1846
|
-
let exist = !1;
|
|
1847
|
-
$scope.v_nodes.forEach((n) => {
|
|
1848
|
-
if (n.id == node.id) {
|
|
1849
|
-
exist = !0;
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1852
|
-
if (!exist) {
|
|
1853
|
-
$scope.v_nodes.push(node);
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
|
-
|
|
1858
|
-
$scope.v_nodes.forEach((v_node) => {
|
|
1859
|
-
v_node.nodes = v_node.nodes || [];
|
|
1860
|
-
|
|
1861
|
-
nodes.forEach((node) => {
|
|
1862
|
-
node.$parent_id = node.parent_id || 0;
|
|
1863
|
-
if (node.$parent_id == v_node.id) {
|
|
1864
|
-
node.v_display = node.v_display || '';
|
|
1865
|
-
node.v_display += node[attrs.display];
|
|
1866
|
-
|
|
1867
|
-
let exist = !1;
|
|
1868
|
-
v_node.nodes.forEach((n) => {
|
|
1869
|
-
if (n.id == node.id) {
|
|
1870
|
-
exist = !0;
|
|
1871
|
-
}
|
|
1872
|
-
});
|
|
1873
|
-
if (!exist) {
|
|
1874
|
-
v_node.nodes.push(node);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
});
|
|
1878
|
-
|
|
1879
|
-
$scope.setNodes(v_node);
|
|
1880
|
-
});
|
|
1880
|
+
let exist = !1;
|
|
1881
|
+
v_node.nodes.forEach((n) => {
|
|
1882
|
+
if (n.id == node.id) {
|
|
1883
|
+
exist = !0;
|
|
1881
1884
|
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
+
});
|
|
1886
|
+
if (!exist) {
|
|
1887
|
+
v_node.nodes.push(node);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
|
|
1892
|
+
$scope.setNodes(v_node);
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
},
|
|
1897
|
+
template: `
|
|
1885
1898
|
<div class="treeview">
|
|
1886
1899
|
<ul >
|
|
1887
1900
|
<li ng-dblclick="$event.preventDefault();$event.stopPropagation();source.$actions = !0" ng-mouseleave="source.$actions = !1">
|
|
@@ -1898,111 +1911,111 @@ app.directive('iTreeview', [
|
|
|
1898
1911
|
</ul>
|
|
1899
1912
|
</div>
|
|
1900
1913
|
`,
|
|
1901
|
-
|
|
1902
|
-
|
|
1914
|
+
};
|
|
1915
|
+
},
|
|
1903
1916
|
]);
|
|
1904
1917
|
|
|
1905
1918
|
app.directive('iTreenode', [
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
});
|
|
1951
|
-
}
|
|
1952
|
-
});
|
|
1953
|
-
}
|
|
1919
|
+
'$interval',
|
|
1920
|
+
'$timeout',
|
|
1921
|
+
'isite',
|
|
1922
|
+
function ($interval, $timeout, isite) {
|
|
1923
|
+
return {
|
|
1924
|
+
restrict: 'E',
|
|
1925
|
+
require: 'ngModel',
|
|
1926
|
+
scope: {
|
|
1927
|
+
v: '@',
|
|
1928
|
+
label: '@',
|
|
1929
|
+
display: '@',
|
|
1930
|
+
display2: '@',
|
|
1931
|
+
disabled: '@',
|
|
1932
|
+
space: '@',
|
|
1933
|
+
primary: '@',
|
|
1934
|
+
ngValue: '@',
|
|
1935
|
+
ngChange: '&',
|
|
1936
|
+
ngClick: '&',
|
|
1937
|
+
ngAdd: '&',
|
|
1938
|
+
ngEdit: '&',
|
|
1939
|
+
ngDelete: '&',
|
|
1940
|
+
ngModel: '=',
|
|
1941
|
+
ngSearch: '=',
|
|
1942
|
+
nodes: '=',
|
|
1943
|
+
nodes: '=',
|
|
1944
|
+
},
|
|
1945
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
1946
|
+
attrs.display = attrs.display || 'name';
|
|
1947
|
+
attrs.primary = attrs.primary || 'id';
|
|
1948
|
+
attrs.space = attrs.space || ' ';
|
|
1949
|
+
attrs.ngValue = attrs.ngValue || '';
|
|
1950
|
+
$scope.nodes = $scope.nodes || [];
|
|
1951
|
+
|
|
1952
|
+
$scope.v_nodes = [];
|
|
1953
|
+
|
|
1954
|
+
$scope.$watch('nodes', (nodes) => {
|
|
1955
|
+
$scope.v_nodes = [];
|
|
1956
|
+
if (nodes) {
|
|
1957
|
+
nodes.forEach((node, i) => {
|
|
1958
|
+
if (node.nodes) {
|
|
1959
|
+
node.nodes.forEach((node2, i) => {
|
|
1960
|
+
node2.$parent_id = node2.parent_id || node.id;
|
|
1961
|
+
node2.v_display = node.v_display || ' ';
|
|
1962
|
+
node2.v_display += ' - ' + node2[attrs.display];
|
|
1954
1963
|
});
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1968
|
+
|
|
1969
|
+
$scope.updateParentModal = function (parent, node) {
|
|
1970
|
+
if (parent) {
|
|
1971
|
+
parent.ngModel = node;
|
|
1972
|
+
if (parent.$parent) {
|
|
1973
|
+
$scope.updateParentModal(parent.$parent, node);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1955
1977
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
if (parent && parent.nodes) {
|
|
1967
|
-
parent.nodes.forEach((node) => {
|
|
1968
|
-
node.$selected = !1;
|
|
1969
|
-
});
|
|
1970
|
-
if (parent.$parent) {
|
|
1971
|
-
$scope.unSelectParent(parent.$parent);
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
};
|
|
1975
|
-
|
|
1976
|
-
$scope.unSelectNodes = function (nodes) {
|
|
1977
|
-
if (nodes) {
|
|
1978
|
-
nodes.forEach((node) => {
|
|
1979
|
-
node.$selected = !1;
|
|
1980
|
-
if (node.nodes) {
|
|
1981
|
-
$scope.unSelectNodes(node.nodes);
|
|
1982
|
-
}
|
|
1983
|
-
});
|
|
1984
|
-
}
|
|
1985
|
-
};
|
|
1978
|
+
$scope.unSelectParent = function (parent) {
|
|
1979
|
+
if (parent && parent.nodes) {
|
|
1980
|
+
parent.nodes.forEach((node) => {
|
|
1981
|
+
node.$selected = !1;
|
|
1982
|
+
});
|
|
1983
|
+
if (parent.$parent) {
|
|
1984
|
+
$scope.unSelectParent(parent.$parent);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1986
1988
|
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1989
|
+
$scope.unSelectNodes = function (nodes) {
|
|
1990
|
+
if (nodes) {
|
|
1991
|
+
nodes.forEach((node) => {
|
|
1992
|
+
node.$selected = !1;
|
|
1993
|
+
if (node.nodes) {
|
|
1994
|
+
$scope.unSelectNodes(node.nodes);
|
|
1995
|
+
}
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1991
1999
|
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2000
|
+
$scope.updateModal = function (node) {
|
|
2001
|
+
$scope.ngModel = node;
|
|
2002
|
+
$scope.updateParentModal($scope.$parent, node);
|
|
2003
|
+
};
|
|
1995
2004
|
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2005
|
+
$scope.selected = function (node) {
|
|
2006
|
+
$scope.unSelectParent($scope.$parent);
|
|
2007
|
+
$scope.unSelectNodes($scope.nodes);
|
|
2001
2008
|
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2009
|
+
if (node.nodes) {
|
|
2010
|
+
node.nodes.forEach((itm) => {
|
|
2011
|
+
itm.$selected = !1;
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
node.$selected = !0;
|
|
2016
|
+
};
|
|
2017
|
+
},
|
|
2018
|
+
template: `
|
|
2006
2019
|
<div class="treenode">
|
|
2007
2020
|
<ul >
|
|
2008
2021
|
<li ng-repeat="node in nodes" >
|
|
@@ -2026,6 +2039,6 @@ app.directive('iTreenode', [
|
|
|
2026
2039
|
</ul>
|
|
2027
2040
|
</div>
|
|
2028
2041
|
`,
|
|
2029
|
-
|
|
2030
|
-
|
|
2042
|
+
};
|
|
2043
|
+
},
|
|
2031
2044
|
]);
|