isite 2022.5.3 → 2022.5.6

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