isite 2021.11.17 → 2021.11.23

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