isite 2022.8.3 → 2022.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/apps/client-side/app.js +255 -182
- package/apps/client-side/site_files/css/bootstrap5-addon.css +87 -4
- package/apps/client-side/site_files/css/bootstrap5.css +1 -1
- package/apps/client-side/site_files/css/bootstrap5.css.map +1 -0
- package/apps/client-side/site_files/css/dropdown.css +22 -4
- package/apps/client-side/site_files/css/effect.css +342 -283
- package/apps/client-side/site_files/css/images.css +10 -7
- package/apps/client-side/site_files/css/layout.css +37 -44
- package/apps/client-side/site_files/css/modal.css +1 -1
- package/apps/client-side/site_files/css/normalize.css +146 -0
- package/apps/client-side/site_files/css/scrollbar.css +9 -5
- package/apps/client-side/site_files/css/table.css +3 -3
- package/apps/client-side/site_files/html/directive/i-button.html +5 -0
- package/apps/client-side/site_files/html/directive/i-checkbox.html +4 -0
- package/apps/client-side/site_files/html/directive/i-checklist.html +6 -0
- package/apps/client-side/site_files/html/directive/i-control.html +5 -0
- package/apps/client-side/site_files/html/directive/i-date.html +24 -0
- package/apps/client-side/site_files/html/directive/i-datetime.html +31 -0
- package/apps/client-side/site_files/html/{sub/i-file.content.html → directive/i-file.html} +3 -5
- package/apps/client-side/site_files/html/directive/i-image.html +7 -0
- package/apps/client-side/site_files/html/directive/i-list.html +20 -0
- package/apps/client-side/site_files/html/directive/i-radio.html +4 -0
- package/apps/client-side/site_files/html/directive/i-textarea.html +4 -0
- package/apps/client-side/site_files/html/directive/i-treenode.html +20 -0
- package/apps/client-side/site_files/html/directive/i-treeview.html +13 -0
- package/apps/client-side/site_files/html/directive/i-upload.html +5 -0
- package/apps/client-side/site_files/html/directive-core/i-date.html +64 -0
- package/apps/client-side/site_files/html/directive-core/i-list.html +22 -0
- package/apps/client-side/site_files/images/no.jpg +0 -0
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +278 -998
- package/apps/client-side/site_files/js/bootstrap.js.map +1 -0
- package/apps/client-side/site_files/js/directive.js +1865 -2044
- package/apps/client-side/site_files/js/directive.min.js +2 -2
- package/apps/client-side/site_files/js/site.js +19 -3
- package/apps/security/site_files/html/login_modal.html +18 -26
- package/index.js +277 -278
- package/isite_files/images/no.jpg +0 -0
- package/lib/cookie.js +3 -5
- package/lib/email.js +108 -0
- package/lib/integrated.js +10 -26
- package/lib/parser.js +519 -509
- package/lib/routing.js +23 -15
- package/lib/security.js +1109 -1081
- package/lib/sessions.js +182 -247
- package/object-options/index.js +24 -4
- package/object-options/lib/fn.js +6 -3
- package/package.json +5 -3
- package/pull.bat +3 -0
- package/push.bat +2 -5
- package/apps/client-side/site_files/html/sub/i-date2.content.html +0 -64
- package/apps/client-side/site_files/html/sub/i-list.content.html +0 -31
- package/apps/client-side/site_files/html/sub/i-list2.content.html +0 -22
|
@@ -29,15 +29,7 @@ app.directive('iControl', function () {
|
|
|
29
29
|
$('.i-list .dropdown-content').css('display', 'none');
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
|
-
template:
|
|
33
|
-
<div class="mb-3 {{class2}}">
|
|
34
|
-
<label for="{{id2}}" class="form-label">{{label}}</label>
|
|
35
|
-
<input id="{{id2}}" ng-disabled="disabled" autofocus v="{{v}}" type="{{type}}" ng-model="ngModel" ng-change="ngChange()" ngKeydown="ngKeydown()" class="form-control" placeholder="{{placeholder}}" aria-label="{{label}}" />
|
|
36
|
-
<div class="invalid-feedback">
|
|
37
|
-
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
`,
|
|
32
|
+
template: `/*##client-side/directive/i-control.html*/`,
|
|
41
33
|
};
|
|
42
34
|
});
|
|
43
35
|
|
|
@@ -68,12 +60,7 @@ app.directive('iTextarea', function () {
|
|
|
68
60
|
$('.popup').hide();
|
|
69
61
|
});
|
|
70
62
|
},
|
|
71
|
-
template:
|
|
72
|
-
<div class="mb-3">
|
|
73
|
-
<label for="{{id2}}" class="form-label">{{label}}</label>
|
|
74
|
-
<textarea ng-disabled="disabled" class="form-control" id="{{id2}}" ng-model="ngModel" ng-change="ngChange()" v="{{v}}" rows="{{rows}}"></textarea>
|
|
75
|
-
</div>
|
|
76
|
-
`,
|
|
63
|
+
template: `/*##client-side/directive/i-textarea.html*/`,
|
|
77
64
|
};
|
|
78
65
|
});
|
|
79
66
|
|
|
@@ -102,14 +89,7 @@ app.directive('iCheckbox', function ($timeout) {
|
|
|
102
89
|
}, 100);
|
|
103
90
|
};
|
|
104
91
|
},
|
|
105
|
-
template:
|
|
106
|
-
<div class="form-check">
|
|
107
|
-
<input ng-change="changed()" ng-disabled="disabled" class="form-check-input" type="checkbox" ng-model="ngModel" id="{{id2}}">
|
|
108
|
-
<label class="form-check-label" for="{{id2}}">
|
|
109
|
-
{{label}}
|
|
110
|
-
</label>
|
|
111
|
-
</div>
|
|
112
|
-
`,
|
|
92
|
+
template: `/*##client-side/directive/i-checkbox.html*/`,
|
|
113
93
|
};
|
|
114
94
|
});
|
|
115
95
|
|
|
@@ -121,6 +101,7 @@ app.directive('iRadio', function () {
|
|
|
121
101
|
label: '@',
|
|
122
102
|
group: '@',
|
|
123
103
|
id2: '@',
|
|
104
|
+
ngValue: '@',
|
|
124
105
|
ngModel: '=',
|
|
125
106
|
ngChange: '&',
|
|
126
107
|
},
|
|
@@ -131,18 +112,10 @@ app.directive('iRadio', function () {
|
|
|
131
112
|
attrs.disabled = '';
|
|
132
113
|
}
|
|
133
114
|
|
|
134
|
-
$scope.group = $scope.group || attrs.
|
|
115
|
+
$scope.group = $scope.group || attrs.ngModel.replaceAll('.', '_');
|
|
135
116
|
$scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
|
|
136
117
|
},
|
|
137
|
-
template:
|
|
138
|
-
<div class="form-check">
|
|
139
|
-
<input class="form-check-input" type="radio" ng-change="ngChange()" ng-disabled="disabled" ng-model="ngModel" id="{{id2}}" name="{{group}}" >
|
|
140
|
-
<label class="form-check-label" for="exampleRadios1">
|
|
141
|
-
{{label}}
|
|
142
|
-
</label>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
`,
|
|
118
|
+
template: `/*##client-side/directive/i-radio.html*/`,
|
|
146
119
|
};
|
|
147
120
|
});
|
|
148
121
|
|
|
@@ -158,41 +131,55 @@ app.directive('iButton', function () {
|
|
|
158
131
|
},
|
|
159
132
|
link: function ($scope, element, attrs, ctrl) {
|
|
160
133
|
$scope.type = $scope.type || '';
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
$scope.
|
|
134
|
+
$scope.class = $scope.class = 'btn-dark';
|
|
135
|
+
$scope.fa = $scope.fa || $scope.label ? '' : 'fas fa-play';
|
|
136
|
+
|
|
137
|
+
if ($scope.type.like('*add*') || $scope.type.like('*new*')) {
|
|
138
|
+
$scope.fa = 'fas fa-plus';
|
|
139
|
+
$scope.class = 'btn-primary';
|
|
167
140
|
} else if ($scope.type.like('*update*') || $scope.type.like('*edit*')) {
|
|
168
|
-
$scope.fa = 'edit';
|
|
141
|
+
$scope.fa = 'fas fa-edit';
|
|
142
|
+
$scope.class = 'btn-warning';
|
|
169
143
|
} else if ($scope.type.like('*save*')) {
|
|
170
|
-
$scope.fa = 'save';
|
|
144
|
+
$scope.fa = 'fas fa-save';
|
|
145
|
+
$scope.class = 'btn-success';
|
|
146
|
+
} else if ($scope.type.like('*view*') || $scope.type.like('*details*')) {
|
|
147
|
+
$scope.fa = 'fas fa-eye';
|
|
148
|
+
$scope.class = 'btn-info';
|
|
171
149
|
} else if ($scope.type.like('*delete*') || $scope.type.like('*remove*')) {
|
|
172
|
-
$scope.fa = 'trash';
|
|
150
|
+
$scope.fa = 'fas fa-trash';
|
|
151
|
+
$scope.class = 'btn-danger';
|
|
152
|
+
} else if ($scope.type.like('*exit*') || $scope.type.like('*close*')) {
|
|
153
|
+
$scope.fa = 'fas fa-times-circle';
|
|
154
|
+
$scope.class = 'btn-danger';
|
|
173
155
|
} else if ($scope.type.like('*print*')) {
|
|
174
|
-
$scope.fa = 'print';
|
|
175
|
-
|
|
176
|
-
$scope.fa = 'search';
|
|
156
|
+
$scope.fa = 'fas fa-print';
|
|
157
|
+
$scope.class = 'btn-secondary';
|
|
177
158
|
} else if ($scope.type.like('*export*') || $scope.type.like('*excel*')) {
|
|
178
|
-
$scope.fa = '
|
|
179
|
-
|
|
180
|
-
|
|
159
|
+
$scope.fa = 'fas fa-file-export';
|
|
160
|
+
$scope.class = 'btn-secondary';
|
|
161
|
+
} else if ($scope.type.like('*search*') || $scope.type.like('*find*')) {
|
|
162
|
+
$scope.fa = 'fas fa-search';
|
|
163
|
+
$scope.class = 'btn-light';
|
|
164
|
+
} else if ($scope.type.like('*login*') || $scope.type.like('*signin*')) {
|
|
165
|
+
$scope.fa = 'fas fa-sign-in-alt';
|
|
166
|
+
$scope.class = 'btn-light';
|
|
167
|
+
} else if ($scope.type.like('*logout*') || $scope.type.like('*signout*')) {
|
|
168
|
+
$scope.fa = 'fas fa-sign-out-alt';
|
|
169
|
+
$scope.class = 'btn-light';
|
|
170
|
+
}
|
|
171
|
+
if ($scope.type.like('*default*')) {
|
|
172
|
+
$scope.class = '';
|
|
181
173
|
}
|
|
182
174
|
$scope.$watch('loading', (loading) => {
|
|
183
|
-
if (loading === 'true'
|
|
184
|
-
$scope.busy = true
|
|
175
|
+
if (loading === 'true') {
|
|
176
|
+
$scope.busy = true;
|
|
185
177
|
} else {
|
|
186
|
-
$scope.busy = false
|
|
178
|
+
$scope.busy = false;
|
|
187
179
|
}
|
|
188
180
|
});
|
|
189
181
|
},
|
|
190
|
-
template:
|
|
191
|
-
<button class="btn {{class}}" type="button" ng-click="click()" ng-disabled="busy">
|
|
192
|
-
<span ng-show="busy" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
193
|
-
{{label}}
|
|
194
|
-
</button>
|
|
195
|
-
`,
|
|
182
|
+
template: `/*##client-side/directive/i-button.html*/`,
|
|
196
183
|
};
|
|
197
184
|
});
|
|
198
185
|
app.directive('iList', [
|
|
@@ -220,9 +207,10 @@ app.directive('iList', [
|
|
|
220
207
|
items: '=',
|
|
221
208
|
},
|
|
222
209
|
link: function ($scope, element, attrs, ctrl) {
|
|
223
|
-
$scope.
|
|
224
|
-
$scope.
|
|
225
|
-
|
|
210
|
+
$scope.primary = $scope.primary || 'id';
|
|
211
|
+
$scope.display = $scope.display || 'name';
|
|
212
|
+
$scope.display2 = $scope.display2 || '';
|
|
213
|
+
$scope.space = $scope.space || ' - ';
|
|
226
214
|
attrs.ngValue = attrs.ngValue || '';
|
|
227
215
|
|
|
228
216
|
$scope.searchElement = $(element).find('.dropdown .search');
|
|
@@ -306,7 +294,11 @@ app.directive('iList', [
|
|
|
306
294
|
|
|
307
295
|
if (items) {
|
|
308
296
|
items.forEach((item) => {
|
|
309
|
-
|
|
297
|
+
if ($scope.display2) {
|
|
298
|
+
item.$display = $scope.getValue(item) + $scope.space + $scope.getValue2(item);
|
|
299
|
+
} else {
|
|
300
|
+
item.$display = $scope.getValue(item);
|
|
301
|
+
}
|
|
310
302
|
});
|
|
311
303
|
}
|
|
312
304
|
|
|
@@ -314,7 +306,12 @@ app.directive('iList', [
|
|
|
314
306
|
items.forEach((item) => {
|
|
315
307
|
if (isite.getValue(item, $scope.primary) == isite.getValue($scope.ngModel, $scope.primary)) {
|
|
316
308
|
$scope.ngModel = item;
|
|
317
|
-
|
|
309
|
+
if ($scope.display2) {
|
|
310
|
+
item.$display = $scope.getValue(item) + $scope.space + $scope.getValue2(item);
|
|
311
|
+
} else {
|
|
312
|
+
item.$display = $scope.getValue(item);
|
|
313
|
+
}
|
|
314
|
+
|
|
318
315
|
input.val(item.$display);
|
|
319
316
|
}
|
|
320
317
|
});
|
|
@@ -327,20 +324,30 @@ app.directive('iList', [
|
|
|
327
324
|
$scope.ngModel = ngModel;
|
|
328
325
|
|
|
329
326
|
if (ngModel) {
|
|
330
|
-
|
|
327
|
+
if ($scope.display2) {
|
|
328
|
+
input.val(' ' + $scope.getNgModelValue(ngModel) + $scope.space + $scope.getNgModelValue2(ngModel));
|
|
329
|
+
} else {
|
|
330
|
+
input.val(' ' + $scope.getNgModelValue(ngModel));
|
|
331
|
+
}
|
|
331
332
|
}
|
|
332
333
|
});
|
|
333
334
|
|
|
334
335
|
$scope.updateModel = function (item) {
|
|
335
336
|
$scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
|
|
336
|
-
|
|
337
|
+
if ($scope.display2) {
|
|
338
|
+
input.val($scope.getNgModelValue($scope.ngModel) + $scope.space + $scope.getNgModelValue2($scope.ngModel));
|
|
339
|
+
} else {
|
|
340
|
+
input.val($scope.getNgModelValue($scope.ngModel));
|
|
341
|
+
}
|
|
337
342
|
$timeout(() => {
|
|
338
|
-
$scope.ngChange
|
|
339
|
-
|
|
343
|
+
if ($scope.ngChange) {
|
|
344
|
+
$scope.ngChange();
|
|
345
|
+
}
|
|
346
|
+
}, 100);
|
|
340
347
|
$scope.hide();
|
|
341
348
|
};
|
|
342
349
|
},
|
|
343
|
-
template: `/*##client-side/
|
|
350
|
+
template: `/*##client-side/directive/i-list.html*/`,
|
|
344
351
|
};
|
|
345
352
|
},
|
|
346
353
|
]);
|
|
@@ -364,13 +371,15 @@ app.directive('iChecklist', [
|
|
|
364
371
|
link: function ($scope, element, attrs, ctrl) {
|
|
365
372
|
$scope.primary = $scope.primary || 'id';
|
|
366
373
|
$scope.display = $scope.display || 'name';
|
|
367
|
-
$scope.class2 = $scope.class2 || '
|
|
374
|
+
$scope.class2 = $scope.class2 || 'col';
|
|
368
375
|
$scope.selectedItems = [];
|
|
369
376
|
|
|
370
377
|
$scope.$watch('ngModel', (ngModel) => {
|
|
371
378
|
$scope.reload();
|
|
372
379
|
});
|
|
373
|
-
|
|
380
|
+
$scope.$watch('items', (ngModel) => {
|
|
381
|
+
$scope.reload();
|
|
382
|
+
});
|
|
374
383
|
$scope.reload = function () {
|
|
375
384
|
$scope.selectedItems = [];
|
|
376
385
|
|
|
@@ -435,143 +444,91 @@ app.directive('iChecklist', [
|
|
|
435
444
|
}, 100);
|
|
436
445
|
};
|
|
437
446
|
},
|
|
438
|
-
template:
|
|
439
|
-
<div class="check-list">
|
|
440
|
-
<label class="title margin"> {{label}} </label>
|
|
441
|
-
<div class="row">
|
|
442
|
-
<i-checkbox class="{{class2}}" label="{{item[display]}}" ng-repeat="item in items" ng-model="item.$selected" ng-change="change(item);"></i-checkbox>
|
|
443
|
-
</div>
|
|
444
|
-
</div>
|
|
445
|
-
`,
|
|
447
|
+
template: `/*##client-side/directive/i-checklist.html*/`,
|
|
446
448
|
};
|
|
447
449
|
},
|
|
448
450
|
]);
|
|
451
|
+
|
|
449
452
|
app.directive('iDate', function () {
|
|
450
453
|
return {
|
|
451
|
-
link: function (scope, element, attrs) {
|
|
452
|
-
if (typeof attrs.disabled !== 'undefined') {
|
|
453
|
-
attrs.disabled = 'disabled';
|
|
454
|
-
} else {
|
|
455
|
-
attrs.disabled = '';
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
$(element)
|
|
459
|
-
.find('select')
|
|
460
|
-
.focus(() => {
|
|
461
|
-
$('.popup').hide();
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
scope.days1 = [];
|
|
465
|
-
for (let i = 1; i < 32; i++) {
|
|
466
|
-
scope.days1.push(i);
|
|
467
|
-
}
|
|
468
|
-
scope.years1 = [];
|
|
469
|
-
for (let i = 1900; i < 2100; i++) {
|
|
470
|
-
scope.years1.push(i);
|
|
471
|
-
}
|
|
472
|
-
scope.monthes1 = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
473
|
-
},
|
|
474
454
|
restrict: 'E',
|
|
475
|
-
|
|
455
|
+
required: 'ngModel',
|
|
476
456
|
scope: {
|
|
477
|
-
v: '@',
|
|
478
457
|
label: '@',
|
|
479
|
-
|
|
458
|
+
V: '@',
|
|
459
|
+
year: '@',
|
|
480
460
|
ngModel: '=',
|
|
461
|
+
ngChange: '&',
|
|
481
462
|
},
|
|
482
|
-
template: `
|
|
483
|
-
<div class="row i-date">
|
|
484
|
-
|
|
485
|
-
<div class=" control">
|
|
486
|
-
<label> {{label}} </label>
|
|
487
|
-
<div class="row">
|
|
488
|
-
<div class="col3 day">
|
|
489
|
-
<select ng-disabled="disabled" v="{{v}}" ng-model="ngModel.day" class="appearance-none no-border-left no-border-radius" >
|
|
490
|
-
<option ng-repeat="d1 in days1" ng-value="d1"> {{d1}} </option>
|
|
491
|
-
</select>
|
|
492
|
-
</div>
|
|
493
|
-
<div class="col5 month">
|
|
494
|
-
<select ng-disabled="disabled" v="{{v}}" ng-model="ngModel.month" class="appearance-none no-border-left no-border-right no-border-radius" >
|
|
495
|
-
<option ng-repeat="m1 in monthes1" ng-value="$index"> {{m1}} </option>
|
|
496
|
-
</select>
|
|
497
|
-
</div>
|
|
498
|
-
<div class="col4 year">
|
|
499
|
-
<select ng-disabled="disabled" v="{{v}}" ng-model="ngModel.year" class="appearance-none no-border-right no-border-radius" >
|
|
500
|
-
<option ng-repeat="y1 in years1" ng-value="y1"> {{y1}} </option>
|
|
501
|
-
</select>
|
|
502
|
-
</div>
|
|
503
|
-
</div>
|
|
504
|
-
</div>
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
</div>
|
|
508
|
-
`,
|
|
509
|
-
};
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
app.directive('iDate2', function () {
|
|
513
|
-
return {
|
|
514
463
|
link: function ($scope, element, attrs) {
|
|
515
464
|
if (typeof attrs.disabled !== 'undefined') {
|
|
516
465
|
attrs.disabled = 'disabled';
|
|
517
466
|
} else {
|
|
518
467
|
attrs.disabled = '';
|
|
519
468
|
}
|
|
469
|
+
$scope.year = $scope.year ? parseInt($scope.year) : 1960;
|
|
520
470
|
|
|
521
|
-
$scope.
|
|
522
|
-
$scope.m_search = attrs.month || '';
|
|
523
|
-
$scope.d_search = attrs.day || '';
|
|
471
|
+
$scope.model = {};
|
|
524
472
|
|
|
525
|
-
$scope.
|
|
473
|
+
$scope.days = [];
|
|
526
474
|
for (let i = 1; i < 32; i++) {
|
|
527
|
-
$scope.
|
|
475
|
+
$scope.days.push({
|
|
528
476
|
id: i,
|
|
529
477
|
name: i,
|
|
530
478
|
});
|
|
531
479
|
}
|
|
532
|
-
$scope.
|
|
533
|
-
for (let i =
|
|
534
|
-
$scope.
|
|
480
|
+
$scope.years = [];
|
|
481
|
+
for (let i = $scope.year; i < 2100; i++) {
|
|
482
|
+
$scope.years.push({
|
|
535
483
|
id: i,
|
|
536
484
|
name: i,
|
|
537
485
|
});
|
|
538
486
|
}
|
|
539
|
-
|
|
540
|
-
$scope.
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
487
|
+
$scope.lang = site.session ? site.session.lang : 'en';
|
|
488
|
+
if ($scope.lang === 'ar') {
|
|
489
|
+
$scope.monthes = [
|
|
490
|
+
{ id: 0, name: 'يناير' },
|
|
491
|
+
{ id: 1, name: 'فبراير' },
|
|
492
|
+
{ id: 2, name: 'مارس' },
|
|
493
|
+
{ id: 3, name: 'ابريل' },
|
|
494
|
+
{ id: 4, name: 'مايو' },
|
|
495
|
+
{ id: 5, name: 'يونيو' },
|
|
496
|
+
{ id: 6, name: 'يوليو' },
|
|
497
|
+
{ id: 7, name: 'اغسطس' },
|
|
498
|
+
{ id: 8, name: 'سبتمبر' },
|
|
499
|
+
{ id: 9, name: 'اكتوبر' },
|
|
500
|
+
{ id: 10, name: 'نوفمبر' },
|
|
501
|
+
{ id: 11, name: 'ديسمبر' },
|
|
502
|
+
];
|
|
503
|
+
} else {
|
|
504
|
+
$scope.monthes = [
|
|
505
|
+
{ id: 0, name: 'Jan' },
|
|
506
|
+
{ id: 1, name: 'Feb' },
|
|
507
|
+
{ id: 2, name: 'Mar' },
|
|
508
|
+
{ id: 3, name: 'Aper' },
|
|
509
|
+
{ id: 4, name: 'May' },
|
|
510
|
+
{ id: 5, name: 'June' },
|
|
511
|
+
{ id: 6, name: 'Jule' },
|
|
512
|
+
{ id: 7, name: 'Aug' },
|
|
513
|
+
{ id: 8, name: 'Sep' },
|
|
514
|
+
{ id: 9, name: 'Oct' },
|
|
515
|
+
{ id: 10, name: 'Nov' },
|
|
516
|
+
{ id: 11, name: 'Des' },
|
|
517
|
+
];
|
|
518
|
+
}
|
|
556
519
|
|
|
557
520
|
$scope.$watch('ngModel', function (ngModel) {
|
|
558
521
|
if (ngModel) {
|
|
559
522
|
ngModel = new Date(ngModel);
|
|
560
523
|
$scope.model = $scope.model || {};
|
|
561
|
-
$scope.model.
|
|
562
|
-
$scope.model.
|
|
563
|
-
$scope.model.
|
|
564
|
-
$scope.model.month_name = $scope.monthes1.find((m) => m.id == $scope.model.month).name;
|
|
565
|
-
$scope.model.year = ngModel.getFullYear();
|
|
566
|
-
$scope.model.year_name = $scope.model.year;
|
|
524
|
+
$scope.model.selectedDay = $scope.days.find((d) => d.id == ngModel.getDate());
|
|
525
|
+
$scope.model.selectedMonth = $scope.monthes.find((m) => m.id == ngModel.getMonth());
|
|
526
|
+
$scope.model.selectedYear = $scope.years.find((y) => y.id == ngModel.getFullYear());
|
|
567
527
|
} else {
|
|
568
528
|
$scope.model = $scope.model || {};
|
|
569
|
-
$scope.model.
|
|
570
|
-
$scope.model.
|
|
571
|
-
$scope.model.
|
|
572
|
-
$scope.model.month_name = '';
|
|
573
|
-
$scope.model.year = 0;
|
|
574
|
-
$scope.model.year_name = '';
|
|
529
|
+
$scope.model.selectedDay = null;
|
|
530
|
+
$scope.model.selectedMonth = null;
|
|
531
|
+
$scope.model.selectedYear = null;
|
|
575
532
|
}
|
|
576
533
|
});
|
|
577
534
|
|
|
@@ -579,21 +536,12 @@ app.directive('iDate2', function () {
|
|
|
579
536
|
$scope.ngModel = new Date();
|
|
580
537
|
};
|
|
581
538
|
$scope.updateDate = function (date) {
|
|
582
|
-
if (
|
|
583
|
-
$scope.model.
|
|
584
|
-
$scope.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
} else if (date.day) {
|
|
589
|
-
$scope.model.day = date.day.id;
|
|
590
|
-
$scope.model.day_name = date.day.name;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if ($scope.model && $scope.model.year && $scope.model.day && $scope.model.month > -1) {
|
|
594
|
-
$scope.ngModel = new Date($scope.model.year, $scope.model.month, $scope.model.day, 0, 0, 0);
|
|
595
|
-
} else {
|
|
596
|
-
delete $scope.ngModel;
|
|
539
|
+
if ($scope.model.selectedDay && $scope.model.selectedMonth && $scope.model.selectedYear) {
|
|
540
|
+
$scope.ngModel = new Date($scope.model.selectedYear.id, $scope.model.selectedMonth.id, $scope.model.selectedDay.id, 0, 0, 0);
|
|
541
|
+
$scope.editOnly = false;
|
|
542
|
+
if ($scope.ngChange) {
|
|
543
|
+
$scope.ngChange();
|
|
544
|
+
}
|
|
597
545
|
}
|
|
598
546
|
};
|
|
599
547
|
},
|
|
@@ -605,266 +553,124 @@ app.directive('iDate2', function () {
|
|
|
605
553
|
label: '@',
|
|
606
554
|
ngModel: '=',
|
|
607
555
|
},
|
|
608
|
-
template: `/*##client-side/
|
|
556
|
+
template: `/*##client-side/directive/i-date.html*/`,
|
|
609
557
|
};
|
|
610
558
|
});
|
|
611
559
|
|
|
612
|
-
app.directive('
|
|
560
|
+
app.directive('iDatetime', function () {
|
|
613
561
|
return {
|
|
562
|
+
restrict: 'E',
|
|
563
|
+
required: 'ngModel',
|
|
564
|
+
scope: {
|
|
565
|
+
label: '@',
|
|
566
|
+
V: '@',
|
|
567
|
+
ngYear: '@',
|
|
568
|
+
ngModel: '=',
|
|
569
|
+
ngChange: '&',
|
|
570
|
+
},
|
|
614
571
|
link: function ($scope, element, attrs) {
|
|
615
572
|
if (typeof attrs.disabled !== 'undefined') {
|
|
616
573
|
attrs.disabled = 'disabled';
|
|
617
574
|
} else {
|
|
618
575
|
attrs.disabled = '';
|
|
619
576
|
}
|
|
577
|
+
$scope.year = $scope.ngYear ? parseInt($scope.ngYear) : 1960;
|
|
620
578
|
|
|
621
579
|
$scope.model = {};
|
|
622
580
|
|
|
623
581
|
$scope.hours = [];
|
|
624
|
-
for (let i =
|
|
625
|
-
$scope.hours.push(
|
|
582
|
+
for (let i = 0; i < 24; i++) {
|
|
583
|
+
$scope.hours.push({
|
|
584
|
+
id: i,
|
|
585
|
+
name: i < 10 ? '0' + i : i,
|
|
586
|
+
});
|
|
626
587
|
}
|
|
627
|
-
|
|
628
588
|
$scope.minutes = [];
|
|
629
589
|
for (let i = 0; i < 60; i++) {
|
|
630
|
-
$scope.minutes.push(
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
$(element)
|
|
634
|
-
.find('select')
|
|
635
|
-
.focus(() => {
|
|
636
|
-
$('.popup').hide();
|
|
590
|
+
$scope.minutes.push({
|
|
591
|
+
id: i,
|
|
592
|
+
name: i < 10 ? '0' + i : i,
|
|
637
593
|
});
|
|
638
|
-
|
|
639
|
-
$scope.$watch('ngModel', function (ngModel) {
|
|
640
|
-
if (ngModel) {
|
|
641
|
-
ngModel.date = new Date(ngModel.date);
|
|
642
|
-
$scope.model = $scope.model || {};
|
|
643
|
-
$scope.model.hour = ngModel.hour;
|
|
644
|
-
$scope.model.minute = ngModel.minute;
|
|
645
|
-
} else {
|
|
646
|
-
$scope.model = $scope.model || {};
|
|
647
|
-
$scope.model.hour = 0;
|
|
648
|
-
$scope.model.minute = 0;
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
|
|
652
|
-
$scope.updateTime = function () {
|
|
653
|
-
if ($scope.model) {
|
|
654
|
-
$scope.ngModel = $scope.ngModel || {};
|
|
655
|
-
$scope.ngModel.hour = $scope.model.hour;
|
|
656
|
-
$scope.ngModel.minute = $scope.model.minute;
|
|
657
|
-
$scope.ngModel.date = new Date(null, null, null, $scope.model.hour, $scope.model.minute, null);
|
|
658
|
-
} else {
|
|
659
|
-
delete $scope.ngModel;
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
},
|
|
663
|
-
restrict: 'E',
|
|
664
|
-
require: 'ngModel',
|
|
665
|
-
scope: {
|
|
666
|
-
v: '@',
|
|
667
|
-
disabled: '@',
|
|
668
|
-
label: '@',
|
|
669
|
-
ngModel: '=',
|
|
670
|
-
},
|
|
671
|
-
template: `
|
|
672
|
-
<div class="row i-time">
|
|
673
|
-
<div class=" control ">
|
|
674
|
-
<label class="text-center"> {{label}} </label>
|
|
675
|
-
<div class="row">
|
|
676
|
-
<div class="col6 right">
|
|
677
|
-
<div class="row">
|
|
678
|
-
<div class="col2"></div>
|
|
679
|
-
<div class="col8">
|
|
680
|
-
<select ng-disabled="disabled" ng-model="model.minute" ng-change="updateTime()" class="small appearance-none no-border-left no-border-radius" >
|
|
681
|
-
<option ng-repeat="m in minutes" ng-value="m"> {{m}}</option>
|
|
682
|
-
</select>
|
|
683
|
-
</div>
|
|
684
|
-
<div class="col2"></div>
|
|
685
|
-
</div>
|
|
686
|
-
|
|
687
|
-
</div>
|
|
688
|
-
<div class="col6">
|
|
689
|
-
<div class="row">
|
|
690
|
-
<div class="col2 space right">
|
|
691
|
-
<span> : </span>
|
|
692
|
-
</div>
|
|
693
|
-
<div class="col8">
|
|
694
|
-
<select ng-disabled="disabled" ng-model="model.hour" ng-change="updateTime()" class="large blue appearance-none no-border-left no-border-radius" >
|
|
695
|
-
<option ng-repeat="h in hours" ng-value="h"> {{h}} </option>
|
|
696
|
-
</select>
|
|
697
|
-
</div>
|
|
698
|
-
|
|
699
|
-
</div>
|
|
700
|
-
|
|
701
|
-
</div>
|
|
702
|
-
</div>
|
|
703
|
-
</div>
|
|
704
|
-
`,
|
|
705
|
-
};
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
app.directive('iDatetime2', function () {
|
|
709
|
-
return {
|
|
710
|
-
link: function ($scope, element, attrs) {
|
|
711
|
-
if (typeof attrs.disabled !== 'undefined') {
|
|
712
|
-
attrs.disabled = 'disabled';
|
|
713
|
-
} else {
|
|
714
|
-
attrs.disabled = '';
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
$scope.hour1 = [];
|
|
718
|
-
for (let i = 1; i < 25; i++) {
|
|
719
|
-
$scope.hour1.push(i);
|
|
720
594
|
}
|
|
721
595
|
|
|
722
|
-
$scope.
|
|
723
|
-
for (let i = 1; i <
|
|
724
|
-
$scope.
|
|
596
|
+
$scope.days = [];
|
|
597
|
+
for (let i = 1; i < 32; i++) {
|
|
598
|
+
$scope.days.push({
|
|
599
|
+
id: i,
|
|
725
600
|
name: i,
|
|
726
601
|
});
|
|
727
602
|
}
|
|
728
603
|
|
|
729
|
-
$scope.
|
|
730
|
-
for (let i =
|
|
731
|
-
$scope.
|
|
604
|
+
$scope.years = [];
|
|
605
|
+
for (let i = $scope.year; i < 2100; i++) {
|
|
606
|
+
$scope.years.push({
|
|
607
|
+
id: i,
|
|
608
|
+
name: i,
|
|
609
|
+
});
|
|
732
610
|
}
|
|
733
|
-
$scope.
|
|
734
|
-
|
|
735
|
-
$scope.
|
|
611
|
+
$scope.lang = site.session ? site.session.lang : 'en';
|
|
612
|
+
if ($scope.lang === 'ar') {
|
|
613
|
+
$scope.monthes = [
|
|
614
|
+
{ id: 0, name: 'يناير' },
|
|
615
|
+
{ id: 1, name: 'فبراير' },
|
|
616
|
+
{ id: 2, name: 'مارس' },
|
|
617
|
+
{ id: 3, name: 'ابريل' },
|
|
618
|
+
{ id: 4, name: 'مايو' },
|
|
619
|
+
{ id: 5, name: 'يونيو' },
|
|
620
|
+
{ id: 6, name: 'يوليو' },
|
|
621
|
+
{ id: 7, name: 'اغسطس' },
|
|
622
|
+
{ id: 8, name: 'سبتمبر' },
|
|
623
|
+
{ id: 9, name: 'اكتوبر' },
|
|
624
|
+
{ id: 10, name: 'نوفمبر' },
|
|
625
|
+
{ id: 11, name: 'ديسمبر' },
|
|
626
|
+
];
|
|
627
|
+
} else {
|
|
628
|
+
$scope.monthes = [
|
|
629
|
+
{ id: 0, name: 'Jan' },
|
|
630
|
+
{ id: 1, name: 'Feb' },
|
|
631
|
+
{ id: 2, name: 'Mar' },
|
|
632
|
+
{ id: 3, name: 'Aper' },
|
|
633
|
+
{ id: 4, name: 'May' },
|
|
634
|
+
{ id: 5, name: 'June' },
|
|
635
|
+
{ id: 6, name: 'Jule' },
|
|
636
|
+
{ id: 7, name: 'Aug' },
|
|
637
|
+
{ id: 8, name: 'Sep' },
|
|
638
|
+
{ id: 9, name: 'Oct' },
|
|
639
|
+
{ id: 10, name: 'Nov' },
|
|
640
|
+
{ id: 11, name: 'Des' },
|
|
641
|
+
];
|
|
736
642
|
}
|
|
737
|
-
$scope.monthes1 = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
738
|
-
|
|
739
|
-
$scope.model = null;
|
|
740
|
-
|
|
741
|
-
$(element)
|
|
742
|
-
.find('select')
|
|
743
|
-
.focus(() => {
|
|
744
|
-
$('.popup').hide();
|
|
745
|
-
});
|
|
746
643
|
|
|
747
644
|
$scope.$watch('ngModel', function (ngModel) {
|
|
748
645
|
if (ngModel) {
|
|
749
646
|
ngModel = new Date(ngModel);
|
|
750
647
|
$scope.model = $scope.model || {};
|
|
751
|
-
$scope.model.
|
|
752
|
-
$scope.model.
|
|
753
|
-
$scope.model.
|
|
754
|
-
$scope.model.
|
|
755
|
-
$scope.model.
|
|
648
|
+
$scope.model.selectedDay = $scope.days.find((d) => d.id == ngModel.getDate());
|
|
649
|
+
$scope.model.selectedMonth = $scope.monthes.find((m) => m.id == ngModel.getMonth());
|
|
650
|
+
$scope.model.selectedYear = $scope.years.find((y) => y.id == ngModel.getFullYear());
|
|
651
|
+
$scope.model.selectedHour = $scope.hours.find((y) => y.id == ngModel.getHours());
|
|
652
|
+
$scope.model.selectedMinute = $scope.minutes.find((y) => y.id == ngModel.getMinutes());
|
|
756
653
|
} else {
|
|
757
654
|
$scope.model = $scope.model || {};
|
|
758
|
-
$scope.model.
|
|
759
|
-
$scope.model.
|
|
760
|
-
$scope.model.
|
|
761
|
-
$scope.model.
|
|
762
|
-
$scope.model.
|
|
655
|
+
$scope.model.selectedDay = null;
|
|
656
|
+
$scope.model.selectedMonth = null;
|
|
657
|
+
$scope.model.selectedYear = null;
|
|
658
|
+
$scope.model.selectedHour = null;
|
|
659
|
+
$scope.model.selectedMinute = null;
|
|
763
660
|
}
|
|
764
661
|
});
|
|
765
662
|
|
|
766
|
-
$scope.
|
|
767
|
-
|
|
768
|
-
$scope.ngModel = new Date($scope.model.year, $scope.model.month, $scope.model.day, $scope.model.hour, $scope.model.minute);
|
|
769
|
-
} else {
|
|
770
|
-
delete $scope.ngModel;
|
|
771
|
-
}
|
|
663
|
+
$scope.setDay = function () {
|
|
664
|
+
$scope.ngModel = new Date();
|
|
772
665
|
};
|
|
773
|
-
},
|
|
774
|
-
restrict: 'E',
|
|
775
|
-
require: 'ngModel',
|
|
776
|
-
scope: {
|
|
777
|
-
v: '@',
|
|
778
|
-
disabled: '@',
|
|
779
|
-
label: '@',
|
|
780
|
-
ngModel: '=',
|
|
781
|
-
},
|
|
782
|
-
template: `
|
|
783
|
-
<div class="row i-datetime2">
|
|
784
|
-
|
|
785
|
-
<div class=" control">
|
|
786
|
-
<label> {{label}} </label>
|
|
787
|
-
<div class="row">
|
|
788
|
-
|
|
789
|
-
<div class="col2 day">
|
|
790
|
-
<select v="{{v}}" ng-disabled="disabled" ng-model="model.day" ng-change="updateDate()" class="appearance-none no-border-left no-border-radius" >
|
|
791
|
-
<option ng-repeat="d1 in days1" ng-value="d1"> {{d1}} </option>
|
|
792
|
-
</select>
|
|
793
|
-
</div>
|
|
794
|
-
<div class="col5 month">
|
|
795
|
-
<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" >
|
|
796
|
-
<option ng-repeat="m1 in monthes1" ng-value="$index"> {{m1}} </option>
|
|
797
|
-
</select>
|
|
798
|
-
</div>
|
|
799
|
-
<div class="col3 year">
|
|
800
|
-
<select v="{{v}}" ng-disabled="disabled" ng-model="model.year" ng-change="updateDate()" class="appearance-none no-border-right no-border-radius" >
|
|
801
|
-
<option ng-repeat="y1 in years1" ng-value="y1"> {{y1}} </option>
|
|
802
|
-
</select>
|
|
803
|
-
</div>
|
|
804
|
-
|
|
805
|
-
<div class="col1 hour">
|
|
806
|
-
<select v="{{v}}" ng-disabled="disabled" ng-model="model.hour" ng-change="updateDate()" class="appearance-none no-border-radius" >
|
|
807
|
-
<option ng-repeat="h1 in hour1" ng-value="h1"> {{h1}} </option>
|
|
808
|
-
</select>
|
|
809
|
-
</div>
|
|
810
|
-
<div class="col1 minute">
|
|
811
|
-
<select v="{{v}}" ng-disabled="disabled" ng-model="model.minute" ng-change="updateDate()" class="green appearance-none no-border-right no-border-radius" >
|
|
812
|
-
<option ng-repeat="m1 in minute_list" ng-value="m1.name" class="green"> {{m1.name}} </option>
|
|
813
|
-
</select>
|
|
814
|
-
</div>
|
|
815
|
-
|
|
816
|
-
</div>
|
|
817
|
-
</div>
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
</div>
|
|
821
|
-
`,
|
|
822
|
-
};
|
|
823
|
-
});
|
|
824
|
-
|
|
825
|
-
app.directive('iMonth2', function () {
|
|
826
|
-
return {
|
|
827
|
-
link: function ($scope, element, attrs) {
|
|
828
|
-
if (typeof attrs.disabled !== 'undefined') {
|
|
829
|
-
attrs.disabled = 'disabled';
|
|
830
|
-
} else {
|
|
831
|
-
attrs.disabled = '';
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
$scope.years = [];
|
|
835
|
-
for (let i = 1900; i < 2100; i++) {
|
|
836
|
-
$scope.years.push(i);
|
|
837
|
-
}
|
|
838
|
-
$scope.monthes = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
839
|
-
|
|
840
|
-
$scope.model = null;
|
|
841
|
-
|
|
842
|
-
$(element)
|
|
843
|
-
.find('select')
|
|
844
|
-
.focus(() => {
|
|
845
|
-
$('.popup').hide();
|
|
846
|
-
});
|
|
847
|
-
|
|
848
|
-
$scope.$watch('ngModel', function (ngModel) {
|
|
849
|
-
if (ngModel) {
|
|
850
|
-
ngModel = new Date(ngModel);
|
|
851
|
-
$scope.model = $scope.model || {};
|
|
852
|
-
$scope.model.day = 1;
|
|
853
|
-
$scope.model.month = ngModel.getMonth();
|
|
854
|
-
$scope.model.year = ngModel.getFullYear();
|
|
855
|
-
} else {
|
|
856
|
-
$scope.model = $scope.model || {};
|
|
857
|
-
$scope.model.day = 0;
|
|
858
|
-
$scope.model.month = -1;
|
|
859
|
-
$scope.model.year = 0;
|
|
860
|
-
}
|
|
861
|
-
});
|
|
862
666
|
|
|
863
|
-
$scope.updateDate = function () {
|
|
864
|
-
if ($scope.model && $scope.model.
|
|
865
|
-
$scope.ngModel = new Date($scope.model.
|
|
866
|
-
|
|
867
|
-
|
|
667
|
+
$scope.updateDate = function (date) {
|
|
668
|
+
if ($scope.model.selectedDay && $scope.model.selectedMonth && $scope.model.selectedYear && $scope.model.selectedHour && $scope.model.selectedMinute) {
|
|
669
|
+
$scope.ngModel = new Date($scope.model.selectedYear.id, $scope.model.selectedMonth.id, $scope.model.selectedDay.id, $scope.model.selectedHour.id, $scope.model.selectedMinute.id, 0);
|
|
670
|
+
$scope.editOnly = false;
|
|
671
|
+
if ($scope.ngChange) {
|
|
672
|
+
$scope.ngChange();
|
|
673
|
+
}
|
|
868
674
|
}
|
|
869
675
|
};
|
|
870
676
|
},
|
|
@@ -872,389 +678,47 @@ app.directive('iMonth2', function () {
|
|
|
872
678
|
require: 'ngModel',
|
|
873
679
|
scope: {
|
|
874
680
|
v: '@',
|
|
875
|
-
label: '@',
|
|
876
681
|
disabled: '@',
|
|
682
|
+
label: '@',
|
|
877
683
|
ngModel: '=',
|
|
878
684
|
},
|
|
879
|
-
template:
|
|
880
|
-
<div class="row i-date2">
|
|
881
|
-
|
|
882
|
-
<div class=" control">
|
|
883
|
-
<label> {{label}} </label>
|
|
884
|
-
<div class="row">
|
|
885
|
-
|
|
886
|
-
<div class="col7 month">
|
|
887
|
-
<select ng-disabled="disabled" v="{{v}}" ng-model="model.month" ng-change="updateDate()" class="appearance-none no-border-left no-border-radius" >
|
|
888
|
-
<option ng-repeat="m1 in monthes" ng-value="$index"> {{m1}} </option>
|
|
889
|
-
</select>
|
|
890
|
-
</div>
|
|
891
|
-
|
|
892
|
-
<div class="col5 year">
|
|
893
|
-
<select ng-disabled="disabled" v="{{v}}" ng-model="model.year" ng-change="updateDate()" class="appearance-none no-border-right no-border-radius" >
|
|
894
|
-
<option ng-repeat="y1 in years" ng-value="y1"> {{y1}} </option>
|
|
895
|
-
</select>
|
|
896
|
-
</div>
|
|
897
|
-
|
|
898
|
-
</div>
|
|
899
|
-
</div>
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
</div>
|
|
903
|
-
`,
|
|
685
|
+
template: `/*##client-side/directive/i-datetime.html*/`,
|
|
904
686
|
};
|
|
905
687
|
});
|
|
906
688
|
|
|
907
|
-
app.directive('iFulldate', [
|
|
908
|
-
'$http',
|
|
909
|
-
function ($http) {
|
|
910
|
-
return {
|
|
911
|
-
link: function ($scope, element, attrs, ngModel) {
|
|
912
|
-
let _busy = !1;
|
|
913
|
-
|
|
914
|
-
if (typeof attrs.disabled !== 'undefined') {
|
|
915
|
-
attrs.disabled = 'disabled';
|
|
916
|
-
} else {
|
|
917
|
-
attrs.disabled = '';
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
$(element)
|
|
921
|
-
.find('select')
|
|
922
|
-
.focus(() => {
|
|
923
|
-
$('.popup').hide();
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
$scope.days1 = [];
|
|
927
|
-
for (let i = 1; i < 32; i++) {
|
|
928
|
-
$scope.days1.push(i);
|
|
929
|
-
}
|
|
930
|
-
$scope.years1 = [];
|
|
931
|
-
for (let i = 1950; i < 2030; i++) {
|
|
932
|
-
$scope.years1.push(i);
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
$scope.monthes1 = ['يناير', 'فبراير', 'مارس', 'ابريل', 'مايو', 'يونيو', 'يوليو', 'اغسطس', 'سبتمبر', 'اكتوبر', 'نوفمبر', 'ديسمبر'];
|
|
936
|
-
|
|
937
|
-
$scope.days2 = [];
|
|
938
|
-
for (let i = 1; i < 31; i++) {
|
|
939
|
-
$scope.days2.push(i);
|
|
940
|
-
}
|
|
941
|
-
$scope.years2 = [];
|
|
942
|
-
for (let i = 1370; i < 1450; i++) {
|
|
943
|
-
$scope.years2.push(i);
|
|
944
|
-
}
|
|
945
|
-
$scope.monthes2 = ['محرم', 'صفر', 'ربيع اول', 'ربيع ثان', 'جمادى اول', 'جمادى ثان', 'رجب', 'شعبان', 'رمضان', 'شوال', 'ذى القعدة', 'ذى الحجة'];
|
|
946
|
-
|
|
947
|
-
$scope.model = {};
|
|
948
|
-
|
|
949
|
-
$scope.$watch('ngModel', function (ngModel) {
|
|
950
|
-
if (ngModel) {
|
|
951
|
-
$scope.model = ngModel;
|
|
952
|
-
} else {
|
|
953
|
-
$scope.model = {};
|
|
954
|
-
}
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
$scope.$watch('ngModel.date', function (date) {
|
|
958
|
-
if (date) {
|
|
959
|
-
if (typeof date == 'string') {
|
|
960
|
-
date = new Date(date);
|
|
961
|
-
}
|
|
962
|
-
$scope.model = $scope.model || {};
|
|
963
|
-
$scope.model.date = date;
|
|
964
|
-
$scope.model.day = date.getDate();
|
|
965
|
-
$scope.model.month = date.getMonth();
|
|
966
|
-
$scope.model.year = date.getFullYear();
|
|
967
|
-
$scope.get_hijri_date();
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
|
|
971
|
-
$scope.get_hijri_date = function () {
|
|
972
|
-
if ($scope.model && $scope.model.year && $scope.model.day) {
|
|
973
|
-
ngModel.$setViewValue($scope.model);
|
|
974
|
-
if (_busy) {
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
_busy = !0;
|
|
978
|
-
$scope.model.date = new Date($scope.model.year, $scope.model.month, $scope.model.day);
|
|
979
|
-
$http({
|
|
980
|
-
method: 'POST',
|
|
981
|
-
url: '/api/get_hijri_date',
|
|
982
|
-
data: {
|
|
983
|
-
date: $scope.model.year + '/' + ($scope.model.month + 1) + '/' + $scope.model.day,
|
|
984
|
-
},
|
|
985
|
-
})
|
|
986
|
-
.then((response) => {
|
|
987
|
-
if (response.data.done) {
|
|
988
|
-
$scope.model.hijri = response.data.hijri;
|
|
989
|
-
$scope.model.day2 = parseInt($scope.model.hijri.split('/')[2]);
|
|
990
|
-
$scope.model.month2 = parseInt($scope.model.hijri.split('/')[1]) - 1;
|
|
991
|
-
$scope.model.year2 = parseInt($scope.model.hijri.split('/')[0]);
|
|
992
|
-
ngModel.$setViewValue($scope.model);
|
|
993
|
-
_busy = !1;
|
|
994
|
-
}
|
|
995
|
-
})
|
|
996
|
-
.catch(() => {
|
|
997
|
-
_busy = !1;
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
|
|
1002
|
-
$scope.get_normal_date = function () {
|
|
1003
|
-
if ($scope.model && $scope.model.year2 && $scope.model.day2) {
|
|
1004
|
-
ngModel.$setViewValue($scope.model);
|
|
1005
|
-
if (_busy) {
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
_busy = !0;
|
|
1009
|
-
$http({
|
|
1010
|
-
method: 'POST',
|
|
1011
|
-
url: '/api/get_normal_date',
|
|
1012
|
-
data: {
|
|
1013
|
-
hijri: $scope.model.year2 + '/' + ($scope.model.month2 + 1) + '/' + $scope.model.day2,
|
|
1014
|
-
},
|
|
1015
|
-
})
|
|
1016
|
-
.then((response) => {
|
|
1017
|
-
if (response.data.done) {
|
|
1018
|
-
$scope.model.date = new Date(response.data.date);
|
|
1019
|
-
$scope.model.day = parseInt(response.data.date.split('/')[2]);
|
|
1020
|
-
$scope.model.month = parseInt(response.data.date.split('/')[1]) - 1;
|
|
1021
|
-
$scope.model.year = parseInt(response.data.date.split('/')[0]);
|
|
1022
|
-
ngModel.$setViewValue($scope.model);
|
|
1023
|
-
_busy = !1;
|
|
1024
|
-
}
|
|
1025
|
-
})
|
|
1026
|
-
.catch(() => {
|
|
1027
|
-
_busy = !1;
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
};
|
|
1031
|
-
},
|
|
1032
|
-
restrict: 'E',
|
|
1033
|
-
require: 'ngModel',
|
|
1034
|
-
scope: {
|
|
1035
|
-
v: '@',
|
|
1036
|
-
label1: '@',
|
|
1037
|
-
label2: '@',
|
|
1038
|
-
disabled: '@',
|
|
1039
|
-
ngModel: '=',
|
|
1040
|
-
ngChange: '&',
|
|
1041
|
-
},
|
|
1042
|
-
template: `
|
|
1043
|
-
<div class="row i-date">
|
|
1044
|
-
|
|
1045
|
-
<div class="col6 control">
|
|
1046
|
-
<label> {{label1}} </label>
|
|
1047
|
-
<div class="row">
|
|
1048
|
-
<div class="col3 day">
|
|
1049
|
-
<select ng-change="get_hijri_date()" ng-disabled="disabled" v="{{v}}" ng-model="model.day" class="appearance-none no-border-left no-border-radius">
|
|
1050
|
-
<option ng-repeat="d1 in days1" ng-value="d1"> {{d1}} </option>
|
|
1051
|
-
</select>
|
|
1052
|
-
</div>
|
|
1053
|
-
<div class="col5 month">
|
|
1054
|
-
<select ng-change="get_hijri_date()" ng-disabled="disabled" v="{{v}}" ng-model="model.month" class="appearance-none no-border-left no-border-right no-border-radius">
|
|
1055
|
-
<option ng-repeat="m1 in monthes1" ng-value="$index"> {{m1}} </option>
|
|
1056
|
-
</select>
|
|
1057
|
-
</div>
|
|
1058
|
-
<div class="col4 year">
|
|
1059
|
-
<select ng-change="get_hijri_date()" ng-disabled="disabled" v="{{v}}" ng-model="model.year" class="appearance-none no-border-right no-border-radius">
|
|
1060
|
-
<option ng-repeat="y1 in years1" ng-value="y1"> {{y1}} </option>
|
|
1061
|
-
</select>
|
|
1062
|
-
</div>
|
|
1063
|
-
</div>
|
|
1064
|
-
</div>
|
|
1065
|
-
|
|
1066
|
-
<div class="col6 control">
|
|
1067
|
-
<label> {{label2}} </label>
|
|
1068
|
-
<div class="row">
|
|
1069
|
-
<div class="col3 day">
|
|
1070
|
-
<select ng-change="get_normal_date()" ng-disabled="disabled" v="{{v}}" ng-model="model.day2" class="appearance-none no-border-left no-border-radius">
|
|
1071
|
-
<option ng-repeat="d2 in days2" ng-value="d2"> {{d2}} </option>
|
|
1072
|
-
</select>
|
|
1073
|
-
</div>
|
|
1074
|
-
<div class="col5 month">
|
|
1075
|
-
<select ng-change="get_normal_date()" ng-disabled="disabled" v="{{v}}" ng-model="model.month2" class="appearance-none no-border-left no-border-right no-border-radius">
|
|
1076
|
-
<option ng-repeat="m2 in monthes2" ng-value="$index"> {{m2}} </option>
|
|
1077
|
-
</select>
|
|
1078
|
-
</div>
|
|
1079
|
-
<div class="col4 year">
|
|
1080
|
-
<select ng-change="get_normal_date()" ng-disabled="disabled" v="{{v}}" ng-model="model.year2" class="appearance-none no-border-right no-border-radius">
|
|
1081
|
-
<option ng-repeat="y2 in years2" ng-value="y2"> {{y2}} </option>
|
|
1082
|
-
</select>
|
|
1083
|
-
</div>
|
|
1084
|
-
</div>
|
|
1085
|
-
</div>
|
|
1086
|
-
|
|
1087
|
-
</div>
|
|
1088
|
-
`,
|
|
1089
|
-
};
|
|
1090
|
-
},
|
|
1091
|
-
]);
|
|
1092
|
-
|
|
1093
|
-
app.directive('iChecklist2', [
|
|
1094
|
-
'$interval',
|
|
1095
|
-
function ($interval) {
|
|
1096
|
-
return {
|
|
1097
|
-
restrict: 'E',
|
|
1098
|
-
required: 'ngModel',
|
|
1099
|
-
scope: {
|
|
1100
|
-
label: '@',
|
|
1101
|
-
primary: '@',
|
|
1102
|
-
display: '@',
|
|
1103
|
-
ngModel: '=',
|
|
1104
|
-
items: '=',
|
|
1105
|
-
like: '&',
|
|
1106
|
-
},
|
|
1107
|
-
link: function ($scope, element, attrs, ctrl) {
|
|
1108
|
-
attrs.primary = attrs.primary || 'id';
|
|
1109
|
-
|
|
1110
|
-
$scope.selectedItems = [];
|
|
1111
|
-
|
|
1112
|
-
$scope.$watch('ngModel', (ngModel) => {
|
|
1113
|
-
$scope.reload();
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
$scope.reload = function () {
|
|
1117
|
-
$scope.selectedItems = [];
|
|
1118
|
-
|
|
1119
|
-
if ($scope.ngModel) {
|
|
1120
|
-
$scope.ngModel.forEach((mitem) => {
|
|
1121
|
-
$scope.selectedItems.push(mitem);
|
|
1122
|
-
});
|
|
1123
|
-
|
|
1124
|
-
if ($scope.items) {
|
|
1125
|
-
$scope.items.forEach((mitem) => {
|
|
1126
|
-
let exist = !1;
|
|
1127
|
-
$scope.selectedItems.forEach((sitem) => {
|
|
1128
|
-
if (mitem[$scope.primary] === sitem[$scope.primary]) {
|
|
1129
|
-
exist = !0;
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
if (exist) {
|
|
1133
|
-
mitem.$selected = !0;
|
|
1134
|
-
} else {
|
|
1135
|
-
mitem.$selected = !1;
|
|
1136
|
-
}
|
|
1137
|
-
});
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
if (!$scope.ngModel) {
|
|
1141
|
-
$scope.selectedItems = [];
|
|
1142
|
-
if ($scope.items) {
|
|
1143
|
-
$scope.items.forEach((mitem) => {
|
|
1144
|
-
mitem.$selected = !1;
|
|
1145
|
-
});
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
$scope.change = function (item) {
|
|
1151
|
-
if (item.$selected) {
|
|
1152
|
-
let exsits = !1;
|
|
1153
|
-
$scope.selectedItems.forEach((sitem) => {
|
|
1154
|
-
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1155
|
-
exsits = !0;
|
|
1156
|
-
}
|
|
1157
|
-
});
|
|
1158
|
-
if (!exsits) {
|
|
1159
|
-
$scope.selectedItems.push(item);
|
|
1160
|
-
}
|
|
1161
|
-
} else {
|
|
1162
|
-
$scope.selectedItems.forEach((sitem, index) => {
|
|
1163
|
-
if (sitem[$scope.primary] === item[$scope.primary]) {
|
|
1164
|
-
$scope.selectedItems.splice(index, 1);
|
|
1165
|
-
}
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
$scope.ngModel = $scope.selectedItems;
|
|
1170
|
-
};
|
|
1171
|
-
},
|
|
1172
|
-
template: `
|
|
1173
|
-
<div class="row padding check-list">
|
|
1174
|
-
<label class="title"> {{label}} </label>
|
|
1175
|
-
<div class="control" ng-repeat="item in items">
|
|
1176
|
-
<label class="checkbox" >
|
|
1177
|
-
<span > {{item[display]}} </span>
|
|
1178
|
-
<input type="checkbox" ng-model="item.$selected" ng-change="change(item)" >
|
|
1179
|
-
<span class="checkmark"></span>
|
|
1180
|
-
</label>
|
|
1181
|
-
</div>
|
|
1182
|
-
</div>
|
|
1183
|
-
`,
|
|
1184
|
-
};
|
|
1185
|
-
},
|
|
1186
|
-
]);
|
|
1187
|
-
|
|
1188
|
-
app.directive('iRadiolist', [
|
|
1189
|
-
'$interval',
|
|
1190
|
-
function ($interval) {
|
|
1191
|
-
return {
|
|
1192
|
-
restrict: 'E',
|
|
1193
|
-
required: 'ngModel',
|
|
1194
|
-
scope: {
|
|
1195
|
-
label: '@',
|
|
1196
|
-
display: '@',
|
|
1197
|
-
ngModel: '=',
|
|
1198
|
-
items: '=',
|
|
1199
|
-
},
|
|
1200
|
-
link: function (scope, element, attrs) {
|
|
1201
|
-
scope.model = scope.ngModel;
|
|
1202
|
-
|
|
1203
|
-
scope.code = 'radio_' + Math.random();
|
|
1204
|
-
|
|
1205
|
-
scope.change = function (item) {
|
|
1206
|
-
scope.ngModel = item;
|
|
1207
|
-
};
|
|
1208
|
-
|
|
1209
|
-
scope.isChecked = function (item) {
|
|
1210
|
-
if (item && scope.ngModel && scope.ngModel.id === item.id) {
|
|
1211
|
-
return !0;
|
|
1212
|
-
}
|
|
1213
|
-
return !1;
|
|
1214
|
-
};
|
|
1215
|
-
},
|
|
1216
|
-
template: `
|
|
1217
|
-
<div class="row padding radio-list">
|
|
1218
|
-
<label class="title"> {{label}} </label>
|
|
1219
|
-
<div class="control" ng-repeat="item in items">
|
|
1220
|
-
<label class="radio" >
|
|
1221
|
-
<span > {{item[display]}} </span>
|
|
1222
|
-
<input name="{{code}}" type="radio" ng-model="model" ng-checked="isChecked(item)" ng-click="change(item)" ng-change="change(item)" >
|
|
1223
|
-
<span class="checkmark"></span>
|
|
1224
|
-
</label>
|
|
1225
|
-
</div>
|
|
1226
|
-
</div>
|
|
1227
|
-
`,
|
|
1228
|
-
};
|
|
1229
|
-
},
|
|
1230
|
-
]);
|
|
1231
|
-
|
|
1232
689
|
app.directive('iFile', [
|
|
1233
690
|
'$interval',
|
|
1234
691
|
'isite',
|
|
1235
|
-
|
|
692
|
+
'$timeout',
|
|
693
|
+
function ($interval, isite, $timeout) {
|
|
1236
694
|
return {
|
|
1237
695
|
restrict: 'E',
|
|
1238
696
|
required: 'ngModel',
|
|
1239
697
|
scope: {
|
|
1240
698
|
label: '@',
|
|
699
|
+
view: '@',
|
|
700
|
+
accept: '@',
|
|
1241
701
|
folder: '@',
|
|
1242
702
|
ngModel: '=',
|
|
1243
703
|
ngClick: '&',
|
|
1244
704
|
onSelected: '&',
|
|
705
|
+
ngChange: '&',
|
|
1245
706
|
},
|
|
1246
707
|
link: function ($scope, element, attrs, ctrl) {
|
|
1247
|
-
$scope.label = $scope.label || '
|
|
708
|
+
$scope.label = $scope.label || '';
|
|
709
|
+
$scope.folder = $scope.folder || 'default';
|
|
710
|
+
$scope.accept = $scope.accept ? $scope.accept : '';
|
|
711
|
+
$scope.viewOnly = $scope.view === undefined ? false : true;
|
|
712
|
+
|
|
1248
713
|
let input = $(element).find('input')[0];
|
|
1249
714
|
let button = $(element).find('button')[0];
|
|
1250
|
-
|
|
1251
|
-
$scope.viewOnly = !0;
|
|
1252
|
-
}
|
|
715
|
+
|
|
1253
716
|
let progress = $(element).find('.progress')[0];
|
|
1254
717
|
$(progress).hide();
|
|
1255
|
-
|
|
718
|
+
|
|
1256
719
|
$scope.id = Math.random().toString().replace('.', '_');
|
|
1257
|
-
|
|
720
|
+
|
|
721
|
+
if (!$scope.viewOnly) {
|
|
1258
722
|
button.addEventListener('click', function () {
|
|
1259
723
|
input.click();
|
|
1260
724
|
});
|
|
@@ -1278,7 +742,7 @@ app.directive('iFile', [
|
|
|
1278
742
|
|
|
1279
743
|
if (file) {
|
|
1280
744
|
$scope.ngModel = file;
|
|
1281
|
-
|
|
745
|
+
$scope.changed();
|
|
1282
746
|
}
|
|
1283
747
|
}
|
|
1284
748
|
);
|
|
@@ -1289,11 +753,19 @@ app.directive('iFile', [
|
|
|
1289
753
|
|
|
1290
754
|
$scope.$watch('ngModel', (ngModel) => {
|
|
1291
755
|
if (ngModel) {
|
|
1292
|
-
|
|
756
|
+
button.setAttribute('url', ngModel);
|
|
1293
757
|
}
|
|
1294
758
|
});
|
|
759
|
+
|
|
760
|
+
$scope.changed = function () {
|
|
761
|
+
$timeout(() => {
|
|
762
|
+
if ($scope.ngChange) {
|
|
763
|
+
$scope.ngChange();
|
|
764
|
+
}
|
|
765
|
+
}, 200);
|
|
766
|
+
};
|
|
1295
767
|
},
|
|
1296
|
-
template: `/*##client-side/
|
|
768
|
+
template: `/*##client-side/directive/i-file.html*/`,
|
|
1297
769
|
};
|
|
1298
770
|
},
|
|
1299
771
|
]);
|
|
@@ -1301,24 +773,30 @@ app.directive('iFile', [
|
|
|
1301
773
|
app.directive('iImage', [
|
|
1302
774
|
'$interval',
|
|
1303
775
|
'isite',
|
|
1304
|
-
|
|
776
|
+
'$timeout',
|
|
777
|
+
function ($interval, isite, $timeout) {
|
|
1305
778
|
return {
|
|
1306
779
|
restrict: 'E',
|
|
1307
780
|
required: 'ngModel',
|
|
1308
781
|
scope: {
|
|
1309
782
|
folder: '@',
|
|
783
|
+
view: '@',
|
|
784
|
+
accept: '@',
|
|
1310
785
|
ngModel: '=',
|
|
1311
786
|
ngClick: '&',
|
|
787
|
+
ngChange: '&',
|
|
1312
788
|
},
|
|
1313
789
|
link: function ($scope, element, attrs, ctrl) {
|
|
1314
790
|
$scope.folder = $scope.folder || 'default';
|
|
791
|
+
$scope.accept = $scope.accept ? $scope.accept : 'image/*';
|
|
792
|
+
$scope.viewOnly = $scope.view === undefined ? false : true;
|
|
1315
793
|
|
|
1316
794
|
let input = $(element).find('input')[0];
|
|
1317
795
|
let img = $(element).find('img')[0];
|
|
1318
796
|
let progress = $(element).find('.progress')[0];
|
|
1319
797
|
$(progress).hide();
|
|
1320
798
|
|
|
1321
|
-
if (
|
|
799
|
+
if (!$scope.viewOnly) {
|
|
1322
800
|
img.addEventListener('click', function () {
|
|
1323
801
|
input.click();
|
|
1324
802
|
});
|
|
@@ -1342,6 +820,11 @@ app.directive('iImage', [
|
|
|
1342
820
|
|
|
1343
821
|
if (image) {
|
|
1344
822
|
$scope.ngModel = image;
|
|
823
|
+
if ($scope.ngChange) {
|
|
824
|
+
$timeout(() => {
|
|
825
|
+
$scope.ngChange();
|
|
826
|
+
}, 200);
|
|
827
|
+
}
|
|
1345
828
|
}
|
|
1346
829
|
}
|
|
1347
830
|
);
|
|
@@ -1353,39 +836,27 @@ app.directive('iImage', [
|
|
|
1353
836
|
}
|
|
1354
837
|
});
|
|
1355
838
|
},
|
|
1356
|
-
template:
|
|
1357
|
-
<div class=" text-center pointer">
|
|
1358
|
-
<input class="hidden" type="file" name="fileToUpload" accept="image/*"/>
|
|
1359
|
-
<img class="rounded" ng-src="{{ngModel.url}}" ngClick="ngClick()" onerror="this.src='/images/no.jpg'" />
|
|
1360
|
-
<div class="progress row">
|
|
1361
|
-
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100" style="width: {{value}}%"></div>
|
|
1362
|
-
</div>
|
|
1363
|
-
</div>
|
|
1364
|
-
`,
|
|
839
|
+
template: `/*##client-side/directive/i-image.html*/`,
|
|
1365
840
|
};
|
|
1366
841
|
},
|
|
1367
842
|
]);
|
|
1368
|
-
|
|
1369
843
|
app.directive('iUpload', [
|
|
1370
844
|
'$interval',
|
|
1371
845
|
'isite',
|
|
1372
846
|
function ($interval, isite) {
|
|
1373
847
|
return {
|
|
1374
848
|
restrict: 'E',
|
|
1375
|
-
required: 'ngModel',
|
|
1376
849
|
scope: {
|
|
1377
850
|
label: '@',
|
|
1378
851
|
api: '@',
|
|
1379
852
|
type: '@',
|
|
1380
|
-
|
|
853
|
+
view: '@',
|
|
1381
854
|
ngClick: '&',
|
|
1382
855
|
onUploaded: '&',
|
|
1383
856
|
},
|
|
1384
|
-
link: function (scope, element, attrs, ctrl) {
|
|
1385
|
-
scope.type = scope.type || 'bg-green';
|
|
1386
|
-
|
|
857
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
1387
858
|
let input = $(element).find('input')[0];
|
|
1388
|
-
let a = $(element).find('
|
|
859
|
+
let a = $(element).find('button')[0];
|
|
1389
860
|
let progress = $(element).find('progress')[0];
|
|
1390
861
|
$(progress).hide();
|
|
1391
862
|
|
|
@@ -1396,180 +867,28 @@ app.directive('iUpload', [
|
|
|
1396
867
|
}
|
|
1397
868
|
|
|
1398
869
|
input.addEventListener('change', function () {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
870
|
+
if ($scope.api) {
|
|
871
|
+
isite.upload(
|
|
872
|
+
this.files,
|
|
873
|
+
{
|
|
874
|
+
api: $scope.api,
|
|
875
|
+
},
|
|
876
|
+
(err, file, e) => {
|
|
877
|
+
if (e) {
|
|
878
|
+
$(progress).show();
|
|
879
|
+
progress.value = e.loaded;
|
|
880
|
+
progress.max = e.total;
|
|
881
|
+
}
|
|
1410
882
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
883
|
+
if (file) {
|
|
884
|
+
$scope.onUploaded(file);
|
|
885
|
+
}
|
|
1414
886
|
}
|
|
1415
|
-
|
|
1416
|
-
);
|
|
1417
|
-
});
|
|
1418
|
-
|
|
1419
|
-
scope.$watch('ngModel', (ngModel) => {
|
|
1420
|
-
if (ngModel) {
|
|
1421
|
-
a.setAttribute('url', ngModel);
|
|
887
|
+
);
|
|
1422
888
|
}
|
|
1423
889
|
});
|
|
1424
890
|
},
|
|
1425
|
-
template:
|
|
1426
|
-
<form class="form text-center pointer">
|
|
1427
|
-
<input class="hidden" type="file" name="file" />
|
|
1428
|
-
<a class="btn {{type}}" ngClick="ngClick()" url="{{ngModel}}"> {{label}} </a>
|
|
1429
|
-
<progress class="row"></progress>
|
|
1430
|
-
</form>
|
|
1431
|
-
`,
|
|
1432
|
-
};
|
|
1433
|
-
},
|
|
1434
|
-
]);
|
|
1435
|
-
|
|
1436
|
-
app.directive('iFiles', [
|
|
1437
|
-
'$interval',
|
|
1438
|
-
'isite',
|
|
1439
|
-
function ($interval, isite) {
|
|
1440
|
-
return {
|
|
1441
|
-
restrict: 'E',
|
|
1442
|
-
required: 'ngModel',
|
|
1443
|
-
scope: {
|
|
1444
|
-
category: '@',
|
|
1445
|
-
label: '@',
|
|
1446
|
-
ngModel: '=',
|
|
1447
|
-
},
|
|
1448
|
-
link: function (scope, element, attrs, ctrl) {
|
|
1449
|
-
if (attrs.view === '') {
|
|
1450
|
-
scope.viewOnly = !0;
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
let progress = $(element).find('progress')[0];
|
|
1454
|
-
|
|
1455
|
-
scope.category = scope.category || 'default';
|
|
1456
|
-
scope.id = Math.random().toString().replace('.', '_');
|
|
1457
|
-
scope.deleteFile = function (file) {
|
|
1458
|
-
isite.deleteFile(file, () => {
|
|
1459
|
-
for (let i = 0; i < scope.ngModel.length; i++) {
|
|
1460
|
-
let f = scope.ngModel[i];
|
|
1461
|
-
if (f.url === file.url) {
|
|
1462
|
-
scope.ngModel.splice(i, 1);
|
|
1463
|
-
return;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
});
|
|
1467
|
-
};
|
|
1468
|
-
|
|
1469
|
-
let setEvent = !1;
|
|
1470
|
-
$interval(() => {
|
|
1471
|
-
if (setEvent) {
|
|
1472
|
-
return;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
if (attrs.view !== '') {
|
|
1476
|
-
let btn = document.querySelector('#btn_' + scope.id);
|
|
1477
|
-
if (btn) {
|
|
1478
|
-
setEvent = !0;
|
|
1479
|
-
btn.addEventListener('click', function () {
|
|
1480
|
-
document.querySelector('#input_' + scope.id).click();
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
let input = document.querySelector('#input_' + scope.id);
|
|
1485
|
-
if (input) {
|
|
1486
|
-
input.addEventListener('change', function () {
|
|
1487
|
-
isite.uploadFile(
|
|
1488
|
-
this.files,
|
|
1489
|
-
{
|
|
1490
|
-
category: scope.category,
|
|
1491
|
-
},
|
|
1492
|
-
(err, file, e) => {
|
|
1493
|
-
if (e) {
|
|
1494
|
-
$(progress).show();
|
|
1495
|
-
progress.value = e.loaded;
|
|
1496
|
-
progress.max = e.total;
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
if (file) {
|
|
1500
|
-
if (typeof scope.ngModel === 'undefined') {
|
|
1501
|
-
scope.ngModel = [];
|
|
1502
|
-
}
|
|
1503
|
-
scope.ngModel.push(file);
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
);
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
} else {
|
|
1510
|
-
setEvent = !0;
|
|
1511
|
-
}
|
|
1512
|
-
}, 500);
|
|
1513
|
-
},
|
|
1514
|
-
template: `
|
|
1515
|
-
<div class="files">
|
|
1516
|
-
<label> {{label}} </label>
|
|
1517
|
-
<form ng-if="viewOnly !== !0" id="img_{{id}}" class="form text-center pointer">
|
|
1518
|
-
<input id="input_{{id}}" class="hidden" type="file" name="file" />
|
|
1519
|
-
<a id="btn_{{id}}" class="btn bg-green"> <i class="fa fa-upload white"></i> </a>
|
|
1520
|
-
</form>
|
|
1521
|
-
<progress class="row"></progress>
|
|
1522
|
-
<div class="padding">
|
|
1523
|
-
|
|
1524
|
-
<div class="row padding" ng-repeat="f in ngModel">
|
|
1525
|
-
<h2>
|
|
1526
|
-
<a class="btn default bg-blue" href="{{f.url}}"> <i class="fa fa-2x fa-download white"></i> </a>
|
|
1527
|
-
<a ng-if="viewOnly !== !0" class="btn default bg-red" ng-click="deleteFile(f)"> <i class="fa fa-trash white"></i> </a>
|
|
1528
|
-
<span> {{f.name}} </span>
|
|
1529
|
-
</h2>
|
|
1530
|
-
</div>
|
|
1531
|
-
</div>
|
|
1532
|
-
</div>
|
|
1533
|
-
|
|
1534
|
-
`,
|
|
1535
|
-
};
|
|
1536
|
-
},
|
|
1537
|
-
]);
|
|
1538
|
-
|
|
1539
|
-
app.directive('iDrag', [
|
|
1540
|
-
'$document',
|
|
1541
|
-
function ($document) {
|
|
1542
|
-
return function (scope, element, attr) {
|
|
1543
|
-
var startX = 0,
|
|
1544
|
-
startY = 0,
|
|
1545
|
-
x = 0,
|
|
1546
|
-
y = 0;
|
|
1547
|
-
|
|
1548
|
-
element.css({
|
|
1549
|
-
position: 'relative',
|
|
1550
|
-
});
|
|
1551
|
-
|
|
1552
|
-
element.on('mousedown', function (event) {
|
|
1553
|
-
event.preventDefault();
|
|
1554
|
-
startX = event.screenX - x;
|
|
1555
|
-
startY = event.screenY - y;
|
|
1556
|
-
$document.on('mousemove', mousemove);
|
|
1557
|
-
$document.on('mouseup', mouseup);
|
|
1558
|
-
});
|
|
1559
|
-
|
|
1560
|
-
function mousemove(event) {
|
|
1561
|
-
y = event.screenY - startY;
|
|
1562
|
-
x = event.screenX - startX;
|
|
1563
|
-
element.css({
|
|
1564
|
-
top: y + 'px',
|
|
1565
|
-
left: x + 'px',
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
function mouseup() {
|
|
1570
|
-
$document.off('mousemove', mousemove);
|
|
1571
|
-
$document.off('mouseup', mouseup);
|
|
1572
|
-
}
|
|
891
|
+
template: `/*##client-side/directive/i-upload.html*/`,
|
|
1573
892
|
};
|
|
1574
893
|
},
|
|
1575
894
|
]);
|
|
@@ -1687,23 +1006,7 @@ app.directive('iTreeview', [
|
|
|
1687
1006
|
}
|
|
1688
1007
|
});
|
|
1689
1008
|
},
|
|
1690
|
-
template:
|
|
1691
|
-
<div class="treeview">
|
|
1692
|
-
<ul >
|
|
1693
|
-
<li ng-dblclick="$event.preventDefault();$event.stopPropagation();source.$actions = !0" ng-mouseleave="source.$actions = !1">
|
|
1694
|
-
|
|
1695
|
-
<i ng-hide="openTree" class="fa fa-folder"></i> <i ng-show="openTree" class="fa fa-folder"></i>
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
<span ng-click="openTree = !openTree" class="title"> {{label}} <small class="display"> [ {{ngModel.v_display}} ] </small> </span>
|
|
1699
|
-
<div class="actions" ng-show="source.$actions === !0">
|
|
1700
|
-
<i-button type="add default" ng-click="ngClick($event , ngModel);ngNode($event , ngModel)"></i-button>
|
|
1701
|
-
</div>
|
|
1702
|
-
<i-treenode display="{{display}}" ng-click="ngClick($event)" ng-add="ngAdd()" ng-edit="ngEdit()" ng-delete="ngDelete()" ng-show="openTree" ng-model="ngModel" nodes="v_nodes" ></i-treenode>
|
|
1703
|
-
</li>
|
|
1704
|
-
</ul>
|
|
1705
|
-
</div>
|
|
1706
|
-
`,
|
|
1009
|
+
template: `/*##client-side/directive/i-treeview.html*/`,
|
|
1707
1010
|
};
|
|
1708
1011
|
},
|
|
1709
1012
|
]);
|
|
@@ -1808,30 +1111,7 @@ app.directive('iTreenode', [
|
|
|
1808
1111
|
node.$selected = !0;
|
|
1809
1112
|
};
|
|
1810
1113
|
},
|
|
1811
|
-
template:
|
|
1812
|
-
<div class="treenode">
|
|
1813
|
-
<ul >
|
|
1814
|
-
<li ng-repeat="node in nodes" >
|
|
1815
|
-
<div class="row" ng-dblclick="$event.preventDefault();$event.stopPropagation();node.$actions = !0;source.$actions = !1" ng-mouseleave="node.$actions = !1">
|
|
1816
|
-
<span ng-show="node.nodes.length > 0" ng-click="node.$expand = !node.$expand;">
|
|
1817
|
-
<i ng-hide="node.$expand" class="fa fa-caret-left"></i> <i ng-show="node.$expand" class="fa fa-caret-down"></i>
|
|
1818
|
-
</span>
|
|
1819
|
-
<span ng-hide="node.nodes.length > 0" >
|
|
1820
|
-
<i class="fa fa-file"></i>
|
|
1821
|
-
</span>
|
|
1822
|
-
|
|
1823
|
-
<span class="text" ng-class="{'selected' : node.$selected == !0}" ng-click="ngClick($event , node);node.$expand = !node.$expand;selected(node);updateModal(node)" > {{node[display]}} </span>
|
|
1824
|
-
<div class="actions" ng-show="node.$actions === !0">
|
|
1825
|
-
<i-button type="add default" ng-click="ngAdd(node)"></i-button>
|
|
1826
|
-
<i-button type="edit default" ng-click="ngEdit(node)"></i-button>
|
|
1827
|
-
<i-button type="delete default" ng-click="ngDelete(node)"></i-button>
|
|
1828
|
-
</div>
|
|
1829
|
-
</div>
|
|
1830
|
-
<i-treenode display="{{display}}" ng-click="ngClick($event)" ng-add="ngAdd()" ng-edit="ngEdit()" ng-delete="ngDelete()" ng-show="node.$expand" ng-model="ngModel" nodes="node.nodes" nodes="node.nodes"></i-treenode>
|
|
1831
|
-
</li>
|
|
1832
|
-
</ul>
|
|
1833
|
-
</div>
|
|
1834
|
-
`,
|
|
1114
|
+
template: `/*##client-side/directive/i-treenode.html*/`,
|
|
1835
1115
|
};
|
|
1836
1116
|
},
|
|
1837
1117
|
]);
|