isite 2022.5.5 → 2022.5.8

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