isite 2022.5.4 → 2022.5.7

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