ng-ipa-library 0.7.9 → 1.0.0
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/{esm2015/lib/core/components/loading/loading.component.js → esm2020/lib/core/components/loading/loading.component.mjs} +5 -9
- package/esm2020/lib/core/interceptors/error.interceptor.mjs +46 -0
- package/{esm2015/lib/core/interceptors/loading.interceptor.js → esm2020/lib/core/interceptors/loading.interceptor.mjs} +3 -3
- package/esm2020/lib/core/interceptors/token.interceptor.mjs +68 -0
- package/esm2020/lib/core/services/auth.service.mjs +47 -0
- package/{esm2015/lib/core/services/error.service.js → esm2020/lib/core/services/error.service.mjs} +3 -3
- package/{esm2015/lib/core/services/loader.service.js → esm2020/lib/core/services/loader.service.mjs} +3 -3
- package/esm2020/lib/generate-form/generate-form.component.mjs +116 -0
- package/esm2020/lib/ipa-form/datepicker/datepicker.component.mjs +66 -0
- package/esm2020/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.mjs +23 -0
- package/{esm2015/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.js → esm2020/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.mjs} +3 -3
- package/{esm2015/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.js → esm2020/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.mjs} +3 -3
- package/esm2020/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.mjs +23 -0
- package/esm2020/lib/ipa-form/dropdown-input/dropdown-input.component.mjs +77 -0
- package/{esm2015/lib/ipa-form/file-upload/file-upload.component.js → esm2020/lib/ipa-form/file-upload/file-upload.component.mjs} +5 -9
- package/esm2020/lib/ipa-form/ipa-form.service.mjs +254 -0
- package/esm2020/lib/ipa-form/recaptcha/recaptcha.component.mjs +55 -0
- package/esm2020/lib/ipa-form/text-input/text-input.component.mjs +72 -0
- package/esm2020/lib/ipa-form/textarea-input/textarea-input.component.mjs +69 -0
- package/{esm2015/lib/models/apiException.js → esm2020/lib/models/apiException.mjs} +0 -0
- package/{esm2015/lib/models/apiResponse.js → esm2020/lib/models/apiResponse.mjs} +0 -0
- package/{esm2015/lib/models/breadcrumbs.model.js → esm2020/lib/models/breadcrumbs.model.mjs} +0 -0
- package/{esm2015/lib/models/decodedToken.model.js → esm2020/lib/models/decodedToken.model.mjs} +0 -0
- package/{esm2015/lib/models/exceptionUrl.model.js → esm2020/lib/models/exceptionUrl.model.mjs} +0 -0
- package/{esm2015/lib/models/generateForm.model.js → esm2020/lib/models/generateForm.model.mjs} +1 -1
- package/{esm2015/lib/models/pagedResult.js → esm2020/lib/models/pagedResult.mjs} +0 -0
- package/{esm2015/lib/models/user.model.js → esm2020/lib/models/user.model.mjs} +0 -0
- package/{esm2015/lib/ng-ipa-library.module.js → esm2020/lib/ng-ipa-library.module.mjs} +4 -4
- package/{esm2015/lib/pipes/hijri-date.pipe.js → esm2020/lib/pipes/hijri-date.pipe.mjs} +3 -3
- package/{esm2015/lib/pipes/pipes.module.js → esm2020/lib/pipes/pipes.module.mjs} +4 -4
- package/esm2020/lib/services/breadcrumbs.service.mjs +149 -0
- package/esm2020/lib/services/common.service.mjs +65 -0
- package/{esm2015/lib/share-button/share-button.component.js → esm2020/lib/share-button/share-button.component.mjs} +5 -9
- package/{esm2015/lib/share-button/share-button.module.js → esm2020/lib/share-button/share-button.module.mjs} +4 -4
- package/{esm2015/ng-ipa-library.js → esm2020/ng-ipa-library.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/{ng-ipa-library.js → ng-ipa-library.mjs} +122 -158
- package/fesm2015/ng-ipa-library.mjs.map +1 -0
- package/fesm2020/ng-ipa-library.mjs +1582 -0
- package/fesm2020/ng-ipa-library.mjs.map +1 -0
- package/lib/models/generateForm.model.d.ts +2 -0
- package/package.json +32 -19
- package/src/lib/assets/ngIPAStyle.scss +2 -1
- package/bundles/ng-ipa-library.umd.js +0 -2098
- package/bundles/ng-ipa-library.umd.js.map +0 -1
- package/esm2015/lib/core/interceptors/error.interceptor.js +0 -46
- package/esm2015/lib/core/interceptors/token.interceptor.js +0 -69
- package/esm2015/lib/core/services/auth.service.js +0 -48
- package/esm2015/lib/generate-form/generate-form.component.js +0 -120
- package/esm2015/lib/ipa-form/datepicker/datepicker.component.js +0 -70
- package/esm2015/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.js +0 -28
- package/esm2015/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.js +0 -28
- package/esm2015/lib/ipa-form/dropdown-input/dropdown-input.component.js +0 -81
- package/esm2015/lib/ipa-form/ipa-form.service.js +0 -251
- package/esm2015/lib/ipa-form/recaptcha/recaptcha.component.js +0 -59
- package/esm2015/lib/ipa-form/text-input/text-input.component.js +0 -76
- package/esm2015/lib/ipa-form/textarea-input/textarea-input.component.js +0 -73
- package/esm2015/lib/services/breadcrumbs.service.js +0 -151
- package/esm2015/lib/services/common.service.js +0 -66
- package/fesm2015/ng-ipa-library.js.map +0 -1
|
@@ -0,0 +1,1582 @@
|
|
|
1
|
+
import * as i3$1 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Pipe, NgModule, Injectable, Component, Self, ViewChild, Input, ElementRef, EventEmitter, Output } from '@angular/core';
|
|
5
|
+
import * as i2$1 from '@angular/forms';
|
|
6
|
+
import { FormControl, Validators, FormArray, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import * as i1 from 'ngx-toastr';
|
|
8
|
+
import { ToastrModule } from 'ngx-toastr';
|
|
9
|
+
export * from 'ngx-toastr';
|
|
10
|
+
import * as i2$2 from 'ngx-dropzone-wrapper';
|
|
11
|
+
import { DropzoneDirective, DropzoneModule } from 'ngx-dropzone-wrapper';
|
|
12
|
+
import * as i2$3 from 'ngx-captcha';
|
|
13
|
+
import { NgxCaptchaModule } from 'ngx-captcha';
|
|
14
|
+
import momentHijri from 'moment-hijri';
|
|
15
|
+
import * as i2 from '@ng-bootstrap/ng-bootstrap';
|
|
16
|
+
import { NgbDatepickerI18n, NgbCalendar, NgbCalendarIslamicUmalqura, NgbCalendarGregorian, NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap';
|
|
17
|
+
import * as i3 from '@ng-select/ng-select';
|
|
18
|
+
import { NgSelectModule } from '@ng-select/ng-select';
|
|
19
|
+
export * from '@ng-select/ng-select';
|
|
20
|
+
import * as i5 from '@angular/cdk/bidi';
|
|
21
|
+
import { BehaviorSubject, Observable, throwError } from 'rxjs';
|
|
22
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
23
|
+
import * as i1$2 from '@fortawesome/angular-fontawesome';
|
|
24
|
+
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
25
|
+
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
26
|
+
import { ShareIconsModule } from 'ngx-sharebuttons/icons';
|
|
27
|
+
import * as i1$1 from 'ngx-sharebuttons/popup';
|
|
28
|
+
import { ShareButtonsPopupModule } from 'ngx-sharebuttons/popup';
|
|
29
|
+
import * as i2$4 from '@angular/common/http';
|
|
30
|
+
import { HttpResponse } from '@angular/common/http';
|
|
31
|
+
import { catchError } from 'rxjs/operators';
|
|
32
|
+
|
|
33
|
+
class HijriDatePipe {
|
|
34
|
+
transform(date, format = 'iYYYY-iMM-iDD', lang = 'en') {
|
|
35
|
+
momentHijri.locale(lang);
|
|
36
|
+
return momentHijri(date).format(format);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
HijriDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: HijriDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
40
|
+
HijriDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: HijriDatePipe, name: "hijriDate" });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: HijriDatePipe, decorators: [{
|
|
42
|
+
type: Pipe,
|
|
43
|
+
args: [{
|
|
44
|
+
name: 'hijriDate',
|
|
45
|
+
}]
|
|
46
|
+
}] });
|
|
47
|
+
|
|
48
|
+
class PipesModule {
|
|
49
|
+
}
|
|
50
|
+
PipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
51
|
+
PipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PipesModule, declarations: [HijriDatePipe], exports: [HijriDatePipe] });
|
|
52
|
+
PipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PipesModule });
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PipesModule, decorators: [{
|
|
54
|
+
type: NgModule,
|
|
55
|
+
args: [{
|
|
56
|
+
declarations: [HijriDatePipe],
|
|
57
|
+
exports: [HijriDatePipe],
|
|
58
|
+
}]
|
|
59
|
+
}] });
|
|
60
|
+
|
|
61
|
+
class IPAFormService {
|
|
62
|
+
constructor(parserFormatter) {
|
|
63
|
+
this.parserFormatter = parserFormatter;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* check link is valid.
|
|
67
|
+
*/
|
|
68
|
+
static linkValidation(control) {
|
|
69
|
+
const isValidLink = /^((https?:\/\/)[\w-]+(\.[a-z-]+)+\.?(:\d+)?(\/\S*)?)$/.test(control.value);
|
|
70
|
+
return isValidLink || !control.value ? null : { link: true };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* check mp4 link is valid.
|
|
74
|
+
*/
|
|
75
|
+
static mp4LinkValidation(control) {
|
|
76
|
+
const isValidLink = /^((https?:\/\/)[\w-]+(\.[a-z-]+)+\.?(:\d+)?(\/\S*)?(\/[\w\u0600-\u06FF]+\.mp4))$/.test(control.value);
|
|
77
|
+
return isValidLink || !control.value ? null : { linkMP4: true };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* check mobile number is valid.
|
|
81
|
+
*/
|
|
82
|
+
static mobileNo(control) {
|
|
83
|
+
const isValidLink = /^05\d{8}$/.test(control.value);
|
|
84
|
+
return isValidLink || !control.value ? null : { mobileNo: true };
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* check email is valid.
|
|
88
|
+
*/
|
|
89
|
+
static email(control) {
|
|
90
|
+
const isValidLink = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/.test(control.value);
|
|
91
|
+
return isValidLink || !control.value ? null : { Email: true };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* check national ID or iqama ID is valid.
|
|
95
|
+
*/
|
|
96
|
+
static checkID(control) {
|
|
97
|
+
let isValid = false;
|
|
98
|
+
const value = control.value;
|
|
99
|
+
if (IPAFormService.nationalIdValidate(value) ||
|
|
100
|
+
IPAFormService.iqamaIdValidate(value)) {
|
|
101
|
+
isValid = true;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
isValid = false;
|
|
105
|
+
}
|
|
106
|
+
return isValid || !value ? null : { checkId: true };
|
|
107
|
+
}
|
|
108
|
+
getErrorMessage(control, patternErrorMsg = '') {
|
|
109
|
+
for (const propertyName in control?.errors) {
|
|
110
|
+
if (control?.errors.hasOwnProperty(propertyName) &&
|
|
111
|
+
(control.touched || control.dirty)) {
|
|
112
|
+
return this.getValidatorErrorMessage(propertyName, control.errors[propertyName], patternErrorMsg);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* convert gregorian date to hijri date (Based on Umm al-Qura calculations).
|
|
119
|
+
* @param date: gregorian date
|
|
120
|
+
* @param format: iDD => day: ١٥, iMM => month: ٠٤, iMMM => month: ربيع ٢,
|
|
121
|
+
* iMMMM => ربيع الثاني, iYY => year: ٤٢, iYYYY => year: ١٤٤٢,
|
|
122
|
+
* dd => ن, ddd => إثنين, dddd => الإثنين
|
|
123
|
+
* @example 'iYYYY/iM/iDهـ الموافق YYYY/M/Dم'
|
|
124
|
+
* '١٤٤٢/٠٤/١٥هـ الموافق ٢٠٢٠/١١/٣٠'
|
|
125
|
+
*/
|
|
126
|
+
convertToHijriDate(date, format = 'iYYYY-iMM-iDD', lang = 'ar-SA') {
|
|
127
|
+
momentHijri.locale(lang);
|
|
128
|
+
return momentHijri(date).format(format);
|
|
129
|
+
}
|
|
130
|
+
convertToGregorianDate(date, format = 'YYYY-MM-DD', lang = 'en') {
|
|
131
|
+
momentHijri.locale(lang);
|
|
132
|
+
const m = momentHijri.iConvert.toGregorian(date.year(), date.month(), date.date());
|
|
133
|
+
return momentHijri(new Date(m.gy, m.gm, m.gd)).format(format);
|
|
134
|
+
}
|
|
135
|
+
getCurrentHijriDate() {
|
|
136
|
+
momentHijri.locale('en');
|
|
137
|
+
return momentHijri().format('iYYYY/iMM/iDD');
|
|
138
|
+
}
|
|
139
|
+
getValidatorErrorMessage(validatorName, validatorValue, patternErrorMsg) {
|
|
140
|
+
if (validatorName === 'pattern') {
|
|
141
|
+
validatorValue = this.addPatternMsg(validatorValue, patternErrorMsg);
|
|
142
|
+
}
|
|
143
|
+
const config = {
|
|
144
|
+
required: 'هذا الحقل مطلوب',
|
|
145
|
+
pattern: `${validatorValue.message}`,
|
|
146
|
+
Email: 'خطأ في البريد الالكتروني (example@ipa.edu.sa)',
|
|
147
|
+
maxlength: `تجاوز عدد الحقل المسموح بها (${validatorValue.requiredLength}) حرف`,
|
|
148
|
+
minlength: `على الأقل عدد ${validatorValue.requiredLength} حرف.`,
|
|
149
|
+
min: `رقم اكبر من أو يساوي ${validatorValue.min}`,
|
|
150
|
+
max: `رقم اصغر من أو يساوي ${validatorValue.max}`,
|
|
151
|
+
ngbDate: this.getNgbDatepickerErrorMsg(validatorValue),
|
|
152
|
+
checkId: 'رقم الهوية أو الاقامة غير صحيح',
|
|
153
|
+
link: 'الرابط غير صحيح (http://google.com)',
|
|
154
|
+
linkMP4: 'الرابط غير صحيح (http://example.com/a.mp4)',
|
|
155
|
+
mobileNo: 'خطأ في رقم الجوال (05xxxxxxxx)',
|
|
156
|
+
};
|
|
157
|
+
return config[validatorName];
|
|
158
|
+
}
|
|
159
|
+
addPatternMsg(validatorValue, patternErrorMsg) {
|
|
160
|
+
let pattern = {
|
|
161
|
+
...validatorValue,
|
|
162
|
+
message: patternErrorMsg,
|
|
163
|
+
};
|
|
164
|
+
return pattern;
|
|
165
|
+
}
|
|
166
|
+
getNgbDatepickerErrorMsg(validatorValue) {
|
|
167
|
+
let msg = '';
|
|
168
|
+
if (validatorValue.maxDate) {
|
|
169
|
+
msg = `التاريخ المدخل "${this.parserFormatter.format(validatorValue.maxDate.actual)}" اكبر من تاريخ اليوم "${this.parserFormatter.format(validatorValue.maxDate.maxDate)}"`;
|
|
170
|
+
}
|
|
171
|
+
else if (validatorValue.minDate) {
|
|
172
|
+
msg = `التاريخ المدخل "${this.parserFormatter.format(validatorValue.minDate.actual)}" يجب ان يكون اكبر من أو يساوي تاريخ البداية "${this.parserFormatter.format(validatorValue.minDate.minDate)}"`;
|
|
173
|
+
}
|
|
174
|
+
else if (validatorValue.invalid) {
|
|
175
|
+
msg = `التاريخ المدخل غير صحيح ${validatorValue.invalid}.`;
|
|
176
|
+
}
|
|
177
|
+
return msg;
|
|
178
|
+
}
|
|
179
|
+
static convertToEn(value) {
|
|
180
|
+
let newValue = '';
|
|
181
|
+
for (let i = 0; i < value.length; i++) {
|
|
182
|
+
let ch = value.charCodeAt(i);
|
|
183
|
+
if (ch >= 1584 && ch <= 1650) {
|
|
184
|
+
let newChar = ch - 1584;
|
|
185
|
+
newValue = newValue + String.fromCharCode(newChar);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
newValue = newValue + String.fromCharCode(ch);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return newValue;
|
|
192
|
+
}
|
|
193
|
+
static nationalIdValidate(civilId) {
|
|
194
|
+
if (civilId) {
|
|
195
|
+
let strID = this.convertToEn(civilId);
|
|
196
|
+
let digits = '';
|
|
197
|
+
let counter = 0;
|
|
198
|
+
while (counter < 9) {
|
|
199
|
+
if ((counter + 1) % 2 == 0) {
|
|
200
|
+
digits = digits + strID.substring(counter, counter + 1);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
digits =
|
|
204
|
+
digits + (+strID.substring(counter, counter + 1) * 2).toString();
|
|
205
|
+
}
|
|
206
|
+
counter++;
|
|
207
|
+
}
|
|
208
|
+
let intSum = 0;
|
|
209
|
+
let intSumTemp = 0;
|
|
210
|
+
let strSum;
|
|
211
|
+
let intOddSumDigit;
|
|
212
|
+
let CheckDigit;
|
|
213
|
+
counter = 0;
|
|
214
|
+
while (counter < digits.length) {
|
|
215
|
+
intSumTemp = +digits.charAt(counter) * 1;
|
|
216
|
+
intSum += intSumTemp;
|
|
217
|
+
counter++;
|
|
218
|
+
}
|
|
219
|
+
strSum = intSum.toString();
|
|
220
|
+
if (strSum.length == 1) {
|
|
221
|
+
intOddSumDigit = intSum;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
intOddSumDigit = strSum.substring(strSum.length, strSum.length - 1);
|
|
225
|
+
}
|
|
226
|
+
if (intOddSumDigit == 0) {
|
|
227
|
+
CheckDigit = 0;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
CheckDigit = (10 - +intOddSumDigit).toString();
|
|
231
|
+
}
|
|
232
|
+
let PublicID = this.convertToEn(civilId);
|
|
233
|
+
if (CheckDigit ==
|
|
234
|
+
PublicID.substring(PublicID.length - 1, PublicID.length) &&
|
|
235
|
+
strID.length == 10 &&
|
|
236
|
+
strID.substring(0, 1) == '1') {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
static iqamaIdValidate(civilId) {
|
|
248
|
+
if (civilId) {
|
|
249
|
+
let strID = this.convertToEn(civilId);
|
|
250
|
+
let digits = '';
|
|
251
|
+
let counter = 0;
|
|
252
|
+
while (counter < 9) {
|
|
253
|
+
if ((counter + 1) % 2 == 0) {
|
|
254
|
+
digits = digits + strID.substring(counter, counter + 1);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
digits =
|
|
258
|
+
digits + (+strID.substring(counter, counter + 1) * 2).toString();
|
|
259
|
+
}
|
|
260
|
+
counter++;
|
|
261
|
+
}
|
|
262
|
+
let intSum = 0;
|
|
263
|
+
let intSumTemp = 0;
|
|
264
|
+
let strSum;
|
|
265
|
+
let intOddSumDigit;
|
|
266
|
+
let CheckDigit;
|
|
267
|
+
counter = 0;
|
|
268
|
+
while (counter < digits.length) {
|
|
269
|
+
intSumTemp = +digits.charAt(counter) * 1;
|
|
270
|
+
intSum += intSumTemp;
|
|
271
|
+
counter++;
|
|
272
|
+
}
|
|
273
|
+
strSum = intSum.toString();
|
|
274
|
+
if (strSum.length == 1) {
|
|
275
|
+
intOddSumDigit = intSum;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
intOddSumDigit = strSum.substring(strSum.length, strSum.length - 1);
|
|
279
|
+
}
|
|
280
|
+
if (intOddSumDigit == 0) {
|
|
281
|
+
CheckDigit = 0;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
CheckDigit = (10 - +intOddSumDigit).toString();
|
|
285
|
+
}
|
|
286
|
+
let PublicID = this.convertToEn(civilId);
|
|
287
|
+
if (CheckDigit ==
|
|
288
|
+
PublicID.substring(PublicID.length - 1, PublicID.length) &&
|
|
289
|
+
strID.length == 10 &&
|
|
290
|
+
strID.substring(0, 1) == '2') {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
IPAFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: IPAFormService, deps: [{ token: i2.NgbDateParserFormatter }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
303
|
+
IPAFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: IPAFormService, providedIn: 'root' });
|
|
304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: IPAFormService, decorators: [{
|
|
305
|
+
type: Injectable,
|
|
306
|
+
args: [{
|
|
307
|
+
providedIn: 'root',
|
|
308
|
+
}]
|
|
309
|
+
}], ctorParameters: function () { return [{ type: i2.NgbDateParserFormatter }]; } });
|
|
310
|
+
|
|
311
|
+
class TextInputComponent {
|
|
312
|
+
constructor(validationService, controlDir) {
|
|
313
|
+
this.validationService = validationService;
|
|
314
|
+
this.controlDir = controlDir;
|
|
315
|
+
this.type = 'text';
|
|
316
|
+
this.placeholder = 'please enter text';
|
|
317
|
+
this.label = 'text input';
|
|
318
|
+
this.required = false;
|
|
319
|
+
this.patternErrorMsg = 'invalid pattern';
|
|
320
|
+
this.pattern = '';
|
|
321
|
+
this.formControl = new FormControl('');
|
|
322
|
+
this.controlDir.valueAccessor = this;
|
|
323
|
+
}
|
|
324
|
+
ngOnInit() {
|
|
325
|
+
const control = this.controlDir.control;
|
|
326
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
327
|
+
control?.setValidators(validators);
|
|
328
|
+
control?.updateValueAndValidity();
|
|
329
|
+
this.formControl = control;
|
|
330
|
+
}
|
|
331
|
+
onChange(event) { }
|
|
332
|
+
onTouched() { }
|
|
333
|
+
writeValue(obj) {
|
|
334
|
+
this.input.nativeElement.value = obj || '';
|
|
335
|
+
}
|
|
336
|
+
registerOnChange(fn) {
|
|
337
|
+
this.onChange = fn;
|
|
338
|
+
}
|
|
339
|
+
registerOnTouched(fn) {
|
|
340
|
+
this.onTouched = fn;
|
|
341
|
+
}
|
|
342
|
+
get errorMessage() {
|
|
343
|
+
this.errorMsg = this.validationService.getErrorMessage(this.formControl, this.patternErrorMsg);
|
|
344
|
+
return this.errorMsg;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
TextInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TextInputComponent, deps: [{ token: IPAFormService }, { token: i2$1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
348
|
+
TextInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: TextInputComponent, selector: "ipa-text-input", inputs: { id: "id", type: "type", placeholder: "placeholder", label: "label", required: "required", patternErrorMsg: "patternErrorMsg", pattern: "pattern", classes: "classes", containerClasses: "containerClasses" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-floating {{containerClasses}}\">\r\n <input #input id=\"{{id}}\" class=\"form-control {{classes}}\" [type]=\"type\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""], directives: [{ type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
350
|
+
type: Component,
|
|
351
|
+
args: [{ selector: 'ipa-text-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <input #input id=\"{{id}}\" class=\"form-control {{classes}}\" [type]=\"type\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""] }]
|
|
352
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
353
|
+
type: Self
|
|
354
|
+
}] }]; }, propDecorators: { input: [{
|
|
355
|
+
type: ViewChild,
|
|
356
|
+
args: ['input', { static: true }]
|
|
357
|
+
}], id: [{
|
|
358
|
+
type: Input
|
|
359
|
+
}], type: [{
|
|
360
|
+
type: Input
|
|
361
|
+
}], placeholder: [{
|
|
362
|
+
type: Input
|
|
363
|
+
}], label: [{
|
|
364
|
+
type: Input
|
|
365
|
+
}], required: [{
|
|
366
|
+
type: Input
|
|
367
|
+
}], patternErrorMsg: [{
|
|
368
|
+
type: Input
|
|
369
|
+
}], pattern: [{
|
|
370
|
+
type: Input
|
|
371
|
+
}], classes: [{
|
|
372
|
+
type: Input
|
|
373
|
+
}], containerClasses: [{
|
|
374
|
+
type: Input
|
|
375
|
+
}] } });
|
|
376
|
+
|
|
377
|
+
class TextareaInputComponent {
|
|
378
|
+
constructor(validationService, controlDir) {
|
|
379
|
+
this.validationService = validationService;
|
|
380
|
+
this.controlDir = controlDir;
|
|
381
|
+
this.input = new ElementRef(null);
|
|
382
|
+
this.placeholder = 'please enter text';
|
|
383
|
+
this.label = 'textarea input';
|
|
384
|
+
this.required = false;
|
|
385
|
+
this.patternErrorMsg = 'invalid pattern';
|
|
386
|
+
this.formControl = new FormControl('');
|
|
387
|
+
this.controlDir.valueAccessor = this;
|
|
388
|
+
}
|
|
389
|
+
ngOnInit() {
|
|
390
|
+
const control = this.controlDir.control;
|
|
391
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
392
|
+
control?.setValidators(validators);
|
|
393
|
+
control?.updateValueAndValidity();
|
|
394
|
+
this.formControl = control;
|
|
395
|
+
}
|
|
396
|
+
onChange(event) { }
|
|
397
|
+
onTouched() { }
|
|
398
|
+
writeValue(obj) {
|
|
399
|
+
this.input.nativeElement.value = obj || '';
|
|
400
|
+
}
|
|
401
|
+
registerOnChange(fn) {
|
|
402
|
+
this.onChange = fn;
|
|
403
|
+
}
|
|
404
|
+
registerOnTouched(fn) {
|
|
405
|
+
this.onTouched = fn;
|
|
406
|
+
}
|
|
407
|
+
get errorMessage() {
|
|
408
|
+
this.errorMsg = this.validationService.getErrorMessage(this.formControl, this.patternErrorMsg);
|
|
409
|
+
return this.errorMsg;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
TextareaInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TextareaInputComponent, deps: [{ token: IPAFormService }, { token: i2$1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
413
|
+
TextareaInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: TextareaInputComponent, selector: "ipa-textarea-input", inputs: { id: "id", placeholder: "placeholder", label: "label", required: "required", patternErrorMsg: "patternErrorMsg", pattern: "pattern", classes: "classes", containerClasses: "containerClasses" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-floating {{containerClasses}}\">\r\n <textarea #input id=\"{{id}}\" class=\"form-control {{classes}}\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </textarea>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""], directives: [{ type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TextareaInputComponent, decorators: [{
|
|
415
|
+
type: Component,
|
|
416
|
+
args: [{ selector: 'ipa-textarea-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <textarea #input id=\"{{id}}\" class=\"form-control {{classes}}\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </textarea>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""] }]
|
|
417
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
418
|
+
type: Self
|
|
419
|
+
}] }]; }, propDecorators: { input: [{
|
|
420
|
+
type: ViewChild,
|
|
421
|
+
args: ['input', { static: true }]
|
|
422
|
+
}], id: [{
|
|
423
|
+
type: Input
|
|
424
|
+
}], placeholder: [{
|
|
425
|
+
type: Input
|
|
426
|
+
}], label: [{
|
|
427
|
+
type: Input
|
|
428
|
+
}], required: [{
|
|
429
|
+
type: Input
|
|
430
|
+
}], patternErrorMsg: [{
|
|
431
|
+
type: Input
|
|
432
|
+
}], pattern: [{
|
|
433
|
+
type: Input
|
|
434
|
+
}], classes: [{
|
|
435
|
+
type: Input
|
|
436
|
+
}], containerClasses: [{
|
|
437
|
+
type: Input
|
|
438
|
+
}] } });
|
|
439
|
+
|
|
440
|
+
class DropdownInputComponent {
|
|
441
|
+
constructor(validationService, controlDir) {
|
|
442
|
+
this.validationService = validationService;
|
|
443
|
+
this.controlDir = controlDir;
|
|
444
|
+
this.label = 'text input';
|
|
445
|
+
this.items = [];
|
|
446
|
+
this.required = false;
|
|
447
|
+
this.searchable = false;
|
|
448
|
+
this.notFoundText = 'لا يوجد بيانات';
|
|
449
|
+
this.formControl = new FormControl('');
|
|
450
|
+
this.controlDir.valueAccessor = this;
|
|
451
|
+
}
|
|
452
|
+
ngOnInit() {
|
|
453
|
+
const control = this.controlDir.control;
|
|
454
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
455
|
+
control?.setValidators(validators);
|
|
456
|
+
control?.updateValueAndValidity();
|
|
457
|
+
this.formControl = control;
|
|
458
|
+
this.formControl.patchValue(null);
|
|
459
|
+
}
|
|
460
|
+
onChange(event) { }
|
|
461
|
+
onTouched() { }
|
|
462
|
+
writeValue(obj) {
|
|
463
|
+
if (this.input)
|
|
464
|
+
this.input.value = obj || '';
|
|
465
|
+
}
|
|
466
|
+
registerOnChange(fn) {
|
|
467
|
+
this.onChange = fn;
|
|
468
|
+
}
|
|
469
|
+
registerOnTouched(fn) {
|
|
470
|
+
this.onTouched = fn;
|
|
471
|
+
}
|
|
472
|
+
get errorMessage() {
|
|
473
|
+
this.errorMsg = this.validationService.getErrorMessage(this.formControl);
|
|
474
|
+
return this.errorMsg;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
DropdownInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: DropdownInputComponent, deps: [{ token: IPAFormService }, { token: i2$1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
478
|
+
DropdownInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: DropdownInputComponent, selector: "ipa-dropdown-input", inputs: { id: "id", label: "label", items: "items", textField: "textField", valueField: "valueField", required: "required", searchable: "searchable", notFoundText: "notFoundText", classes: "classes", containerClasses: "containerClasses" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["select"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-floating {{containerClasses}}\"\r\n [ngClass]=\"{'was-validated': (controlDir.control?.dirty || controlDir.control?.touched) && required}\">\r\n\r\n <!-- searchable is false -->\r\n <ng-container *ngIf=\"!searchable\">\r\n <select #select id=\"{{id}}\" class=\"form-select {{classes}}\" [required]=\"required\" [formControl]=\"formControl\">\r\n <option *ngFor=\"let item of items\" [value]=\"valueField ? item[valueField] : item\">\r\n {{textField ? item[textField] : item}}</option>\r\n </select>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n </ng-container>\r\n\r\n <!-- searchable is true -->\r\n <ng-select *ngIf=\"searchable\" #select dir=\"rtl\" class=\"{{classes}}\" [formControl]=\"formControl\" [items]=\"items\"\r\n [placeholder]=\"label\" [notFoundText]=\"notFoundText\" [required]=\"required\" [bindValue]=\"valueField\"\r\n [bindLabel]=\"textField\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </ng-select>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""], components: [{ type: i3.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }], directives: [{ type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }] });
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: DropdownInputComponent, decorators: [{
|
|
480
|
+
type: Component,
|
|
481
|
+
args: [{ selector: 'ipa-dropdown-input', template: "<div class=\"form-floating {{containerClasses}}\"\r\n [ngClass]=\"{'was-validated': (controlDir.control?.dirty || controlDir.control?.touched) && required}\">\r\n\r\n <!-- searchable is false -->\r\n <ng-container *ngIf=\"!searchable\">\r\n <select #select id=\"{{id}}\" class=\"form-select {{classes}}\" [required]=\"required\" [formControl]=\"formControl\">\r\n <option *ngFor=\"let item of items\" [value]=\"valueField ? item[valueField] : item\">\r\n {{textField ? item[textField] : item}}</option>\r\n </select>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n </ng-container>\r\n\r\n <!-- searchable is true -->\r\n <ng-select *ngIf=\"searchable\" #select dir=\"rtl\" class=\"{{classes}}\" [formControl]=\"formControl\" [items]=\"items\"\r\n [placeholder]=\"label\" [notFoundText]=\"notFoundText\" [required]=\"required\" [bindValue]=\"valueField\"\r\n [bindLabel]=\"textField\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </ng-select>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""] }]
|
|
482
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
483
|
+
type: Self
|
|
484
|
+
}] }]; }, propDecorators: { input: [{
|
|
485
|
+
type: ViewChild,
|
|
486
|
+
args: ['select', { static: true }]
|
|
487
|
+
}], id: [{
|
|
488
|
+
type: Input
|
|
489
|
+
}], label: [{
|
|
490
|
+
type: Input
|
|
491
|
+
}], items: [{
|
|
492
|
+
type: Input
|
|
493
|
+
}], textField: [{
|
|
494
|
+
type: Input
|
|
495
|
+
}], valueField: [{
|
|
496
|
+
type: Input
|
|
497
|
+
}], required: [{
|
|
498
|
+
type: Input
|
|
499
|
+
}], searchable: [{
|
|
500
|
+
type: Input
|
|
501
|
+
}], notFoundText: [{
|
|
502
|
+
type: Input
|
|
503
|
+
}], classes: [{
|
|
504
|
+
type: Input
|
|
505
|
+
}], containerClasses: [{
|
|
506
|
+
type: Input
|
|
507
|
+
}] } });
|
|
508
|
+
|
|
509
|
+
class LoaderService {
|
|
510
|
+
constructor() {
|
|
511
|
+
this.isLoading = new BehaviorSubject(false);
|
|
512
|
+
this.urls = [];
|
|
513
|
+
}
|
|
514
|
+
setExceptionUrls(urls) {
|
|
515
|
+
this.urls = urls;
|
|
516
|
+
}
|
|
517
|
+
addExceptionUrl(url) {
|
|
518
|
+
this.urls.push(url);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
LoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
522
|
+
LoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoaderService, providedIn: 'root' });
|
|
523
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoaderService, decorators: [{
|
|
524
|
+
type: Injectable,
|
|
525
|
+
args: [{
|
|
526
|
+
providedIn: 'root',
|
|
527
|
+
}]
|
|
528
|
+
}], ctorParameters: function () { return []; } });
|
|
529
|
+
|
|
530
|
+
class LoaderComponent {
|
|
531
|
+
constructor(loaderService, cdr) {
|
|
532
|
+
this.loaderService = loaderService;
|
|
533
|
+
this.cdr = cdr;
|
|
534
|
+
}
|
|
535
|
+
ngAfterViewInit() {
|
|
536
|
+
this.loaderService.isLoading.subscribe((v) => {
|
|
537
|
+
this.loading = v;
|
|
538
|
+
this.cdr.detectChanges();
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
LoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoaderComponent, deps: [{ token: LoaderService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
543
|
+
LoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: LoaderComponent, selector: "ipa-loader", ngImport: i0, template: "<div id=\"cover-spin\" *ngIf=\"loading\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n", styles: ["#cover-spin{display:flex}\n"], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
545
|
+
type: Component,
|
|
546
|
+
args: [{ selector: 'ipa-loader', template: "<div id=\"cover-spin\" *ngIf=\"loading\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n", styles: ["#cover-spin{display:flex}\n"] }]
|
|
547
|
+
}], ctorParameters: function () { return [{ type: LoaderService }, { type: i0.ChangeDetectorRef }]; } });
|
|
548
|
+
|
|
549
|
+
class FileUploadComponent {
|
|
550
|
+
constructor(
|
|
551
|
+
// private authService: AuthService,
|
|
552
|
+
toastrService) {
|
|
553
|
+
this.toastrService = toastrService;
|
|
554
|
+
this.label = '';
|
|
555
|
+
this.required = false;
|
|
556
|
+
this.acceptedFiles = '';
|
|
557
|
+
this.multiple = 1; // set maxFiles (NOT uploadMultiple)in the config object,
|
|
558
|
+
this.maxFileSize = 2;
|
|
559
|
+
this.method = 'POST';
|
|
560
|
+
this.autoUpload = false;
|
|
561
|
+
this.apiUrl = 'apiUrl';
|
|
562
|
+
this.successUpload = new EventEmitter();
|
|
563
|
+
this.fileAdded = new EventEmitter();
|
|
564
|
+
this.fileDeleted = new EventEmitter();
|
|
565
|
+
this.dragEnter = false;
|
|
566
|
+
this.errors = [];
|
|
567
|
+
this.filesAdded = [];
|
|
568
|
+
this.currentFiles = [];
|
|
569
|
+
}
|
|
570
|
+
ngOnInit() {
|
|
571
|
+
this.label = 'رفع ' + this.label;
|
|
572
|
+
this.config = {
|
|
573
|
+
url: this.apiUrl,
|
|
574
|
+
method: this.method,
|
|
575
|
+
headers: {
|
|
576
|
+
Authorization: 'Bearer ' + this.authorization,
|
|
577
|
+
},
|
|
578
|
+
maxFilesize: this.maxFileSize,
|
|
579
|
+
maxFiles: this.multiple,
|
|
580
|
+
uploadMultiple: this.multiple > 1,
|
|
581
|
+
dictInvalidFileType: 'صيغة الملف غير مسموح بها',
|
|
582
|
+
dictFileTooBig: 'الحجم تجاوز الحد المسموح',
|
|
583
|
+
dictMaxFilesExceeded: 'الرجاء حذف الملفات الموجودة حاليا لتتمكن من رفع هذا الملف',
|
|
584
|
+
acceptedFiles: this.acceptedFiles,
|
|
585
|
+
autoProcessQueue: this.autoUpload,
|
|
586
|
+
previewTemplate: '<span></span>',
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
operationCompleted(e) {
|
|
590
|
+
if (this.filesAdded.length > 0) {
|
|
591
|
+
this.successUpload.emit(this.filesAdded);
|
|
592
|
+
this.filesAdded = [];
|
|
593
|
+
}
|
|
594
|
+
this.dropzoneDir.reset();
|
|
595
|
+
}
|
|
596
|
+
onUploadSuccess(e) {
|
|
597
|
+
const file = e[0];
|
|
598
|
+
if (file.status === 'success') {
|
|
599
|
+
this.filesAdded.push(file);
|
|
600
|
+
}
|
|
601
|
+
this.toastrService.success('تم تحميل المرفقات بنجاح');
|
|
602
|
+
}
|
|
603
|
+
onUploadError(e) {
|
|
604
|
+
if (e[1]) {
|
|
605
|
+
this.errors = [];
|
|
606
|
+
this.errors.push(`${e[1]} (${e[0].name})`);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
fileWasAdded(e) {
|
|
610
|
+
const myDropzone = this.dropzoneDir.dropzone();
|
|
611
|
+
if (this.multiple === 1) {
|
|
612
|
+
this.currentFiles = [];
|
|
613
|
+
this.filesAdded = [];
|
|
614
|
+
this.errors = [];
|
|
615
|
+
const files = myDropzone.files;
|
|
616
|
+
if (files.length > 1) {
|
|
617
|
+
myDropzone.removeFile(files[0]);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
this.currentFiles.push(e);
|
|
621
|
+
this.fileAdded.emit(e);
|
|
622
|
+
}
|
|
623
|
+
sending(e) {
|
|
624
|
+
this.errors = [];
|
|
625
|
+
}
|
|
626
|
+
reset(e) { }
|
|
627
|
+
deleteFile(file) {
|
|
628
|
+
this.currentFiles = this.currentFiles.filter((x) => x.name !== file.name && x.size !== file.size);
|
|
629
|
+
this.errors = [];
|
|
630
|
+
this.fileDeleted.emit();
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
FileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: FileUploadComponent, deps: [{ token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Component });
|
|
634
|
+
FileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: FileUploadComponent, selector: "ipa-file-upload", inputs: { label: "label", required: "required", acceptedFiles: "acceptedFiles", multiple: "multiple", maxFileSize: "maxFileSize", method: "method", autoUpload: "autoUpload", apiUrl: "apiUrl", authorization: "authorization" }, outputs: { successUpload: "successUpload", fileAdded: "fileAdded", fileDeleted: "fileDeleted" }, viewQueries: [{ propertyName: "dropzoneDir", first: true, predicate: DropzoneDirective, descendants: true }], ngImport: i0, template: "<div class=\"file-upload\">\r\n <div class=\"upload-overlay\" [dropzone]=\"config\" (error)=\"onUploadError($event)\"\r\n (queueComplete)=\"operationCompleted($event)\" (success)=\"onUploadSuccess($event)\" (dragenter)=\"dragEnter = true\"\r\n (dragLeave)=\"dragEnter = false\" (drop)=\"dragEnter = false\" (dragEnd)=\"dragEnter = false\"\r\n [class.active-border]=\"dragEnter\" (sending)=\"sending($event)\" (reset)=\"reset($event)\"\r\n (addedFile)=\"fileWasAdded($event)\">\r\n </div>\r\n <div class=\"upload-btn-wrapper\">\r\n <div>\r\n <div class=\"subtitle mb-2\">\r\n {{label}}\r\n <span *ngIf=\"required\" class=\"required\">*</span>\r\n </div>\r\n <hr>\r\n <span style=\"font-size: 12px;\">\u0642\u0645 \u0628\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0647\u0646\u0627</span>\r\n <i class=\"fas fa-upload upload-icon mr-2\"></i>\r\n </div>\r\n <div *ngIf=\"acceptedFiles.length > 0\" class=\"allowed-extensions\">\r\n \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627:\r\n <span class=\"extensions\">{{ acceptedFiles }}</span>\r\n </div>\r\n <div class=\"allowed-extensions\">\r\n \u0627\u0642\u0635\u0649 \u062D\u062C\u0645 \u0644\u0644\u0645\u0631\u0641\u0642:\r\n <span class=\"extensions\">{{ maxFileSize }} MB</span>\r\n </div>\r\n </div>\r\n</div>\r\n<div id=\"attachment-status\" style=\"text-align: center; margin-top:10px;\">\r\n <span style=\"font-size: 14px; margin: auto; font-weight:bold;\" *ngFor=\"let file of currentFiles\">\r\n {{ file.name }} <i (click)=\"deleteFile(file)\" class=\"fas fa-trash\"\r\n style=\"color:firebrick; cursor: pointer;\"></i>\r\n <br>\r\n </span>\r\n <ul class=\"list-unstyled\">\r\n <li class=\"text-danger\" style=\"font-size: 12px;\" *ngFor=\"let error of errors\">{{error}}</li>\r\n </ul>\r\n</div>", styles: [".subtitle{border-bottom:none;display:block;line-height:2}.file-upload{border:dashed 1px #ccc;display:block;min-height:150px;border-radius:15px;width:350px;cursor:pointer;position:relative;margin:auto}.upload-overlay{position:absolute;width:100%;height:100%}.upload-btn-wrapper{text-align:center}.upload-icon{margin-right:5px}.list-unstyled{margin:10px!important;padding:14px!important;list-style:none}.allowed-extensions{color:#4d7297}.required{color:#dc3545;font-size:20px}\n"], directives: [{ type: i2$2.DropzoneDirective, selector: "[dropzone]", inputs: ["disabled", "dropzone"], outputs: ["init", "error", "success", "sending", "canceled", "complete", "processing", "drop", "dragStart", "dragEnd", "dragEnter", "dragOver", "dragLeave", "thumbnail", "addedFile", "addedFiles", "removedFile", "uploadProgress", "maxFilesReached", "maxFilesExceeded", "errorMultiple", "successMultiple", "sendingMultiple", "canceledMultiple", "completeMultiple", "processingMultiple", "reset", "queueComplete", "totalUploadProgress"], exportAs: ["ngxDropzone"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
635
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
636
|
+
type: Component,
|
|
637
|
+
args: [{ selector: 'ipa-file-upload', template: "<div class=\"file-upload\">\r\n <div class=\"upload-overlay\" [dropzone]=\"config\" (error)=\"onUploadError($event)\"\r\n (queueComplete)=\"operationCompleted($event)\" (success)=\"onUploadSuccess($event)\" (dragenter)=\"dragEnter = true\"\r\n (dragLeave)=\"dragEnter = false\" (drop)=\"dragEnter = false\" (dragEnd)=\"dragEnter = false\"\r\n [class.active-border]=\"dragEnter\" (sending)=\"sending($event)\" (reset)=\"reset($event)\"\r\n (addedFile)=\"fileWasAdded($event)\">\r\n </div>\r\n <div class=\"upload-btn-wrapper\">\r\n <div>\r\n <div class=\"subtitle mb-2\">\r\n {{label}}\r\n <span *ngIf=\"required\" class=\"required\">*</span>\r\n </div>\r\n <hr>\r\n <span style=\"font-size: 12px;\">\u0642\u0645 \u0628\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0647\u0646\u0627</span>\r\n <i class=\"fas fa-upload upload-icon mr-2\"></i>\r\n </div>\r\n <div *ngIf=\"acceptedFiles.length > 0\" class=\"allowed-extensions\">\r\n \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627:\r\n <span class=\"extensions\">{{ acceptedFiles }}</span>\r\n </div>\r\n <div class=\"allowed-extensions\">\r\n \u0627\u0642\u0635\u0649 \u062D\u062C\u0645 \u0644\u0644\u0645\u0631\u0641\u0642:\r\n <span class=\"extensions\">{{ maxFileSize }} MB</span>\r\n </div>\r\n </div>\r\n</div>\r\n<div id=\"attachment-status\" style=\"text-align: center; margin-top:10px;\">\r\n <span style=\"font-size: 14px; margin: auto; font-weight:bold;\" *ngFor=\"let file of currentFiles\">\r\n {{ file.name }} <i (click)=\"deleteFile(file)\" class=\"fas fa-trash\"\r\n style=\"color:firebrick; cursor: pointer;\"></i>\r\n <br>\r\n </span>\r\n <ul class=\"list-unstyled\">\r\n <li class=\"text-danger\" style=\"font-size: 12px;\" *ngFor=\"let error of errors\">{{error}}</li>\r\n </ul>\r\n</div>", styles: [".subtitle{border-bottom:none;display:block;line-height:2}.file-upload{border:dashed 1px #ccc;display:block;min-height:150px;border-radius:15px;width:350px;cursor:pointer;position:relative;margin:auto}.upload-overlay{position:absolute;width:100%;height:100%}.upload-btn-wrapper{text-align:center}.upload-icon{margin-right:5px}.list-unstyled{margin:10px!important;padding:14px!important;list-style:none}.allowed-extensions{color:#4d7297}.required{color:#dc3545;font-size:20px}\n"] }]
|
|
638
|
+
}], ctorParameters: function () { return [{ type: i1.ToastrService }]; }, propDecorators: { dropzoneDir: [{
|
|
639
|
+
type: ViewChild,
|
|
640
|
+
args: [DropzoneDirective, { static: false }]
|
|
641
|
+
}], label: [{
|
|
642
|
+
type: Input
|
|
643
|
+
}], required: [{
|
|
644
|
+
type: Input
|
|
645
|
+
}], acceptedFiles: [{
|
|
646
|
+
type: Input
|
|
647
|
+
}], multiple: [{
|
|
648
|
+
type: Input
|
|
649
|
+
}], maxFileSize: [{
|
|
650
|
+
type: Input
|
|
651
|
+
}], method: [{
|
|
652
|
+
type: Input
|
|
653
|
+
}], autoUpload: [{
|
|
654
|
+
type: Input
|
|
655
|
+
}], apiUrl: [{
|
|
656
|
+
type: Input
|
|
657
|
+
}], authorization: [{
|
|
658
|
+
type: Input
|
|
659
|
+
}], successUpload: [{
|
|
660
|
+
type: Output
|
|
661
|
+
}], fileAdded: [{
|
|
662
|
+
type: Output
|
|
663
|
+
}], fileDeleted: [{
|
|
664
|
+
type: Output
|
|
665
|
+
}] } });
|
|
666
|
+
|
|
667
|
+
class RecaptchaComponent {
|
|
668
|
+
constructor(controlDir) {
|
|
669
|
+
this.controlDir = controlDir;
|
|
670
|
+
this.siteKey = '6LefJQYdAAAAAIlxmfkjNlWidMk8VukIZcs6lO5e';
|
|
671
|
+
this.recaptchaSize = 'normal';
|
|
672
|
+
this.lang = 'ar';
|
|
673
|
+
this.recaptchaType = 'image';
|
|
674
|
+
this.theme = 'light';
|
|
675
|
+
this.useGlobalDomain = true;
|
|
676
|
+
this.formControl = new FormControl('');
|
|
677
|
+
this.controlDir.valueAccessor = this;
|
|
678
|
+
}
|
|
679
|
+
ngOnInit() {
|
|
680
|
+
const control = this.controlDir.control;
|
|
681
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
682
|
+
control?.setValidators(validators);
|
|
683
|
+
control?.updateValueAndValidity();
|
|
684
|
+
this.formControl = control;
|
|
685
|
+
}
|
|
686
|
+
onChange(event) { }
|
|
687
|
+
onTouched() { }
|
|
688
|
+
writeValue(obj) { }
|
|
689
|
+
registerOnChange(fn) {
|
|
690
|
+
this.onChange = fn;
|
|
691
|
+
}
|
|
692
|
+
registerOnTouched(fn) {
|
|
693
|
+
this.onTouched = fn;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
RecaptchaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: RecaptchaComponent, deps: [{ token: i2$1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
697
|
+
RecaptchaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: RecaptchaComponent, selector: "ipa-recaptcha", inputs: { siteKey: "siteKey", recaptchaSize: "recaptchaSize", lang: "lang", recaptchaType: "recaptchaType", theme: "theme", useGlobalDomain: "useGlobalDomain" }, ngImport: i0, template: "<ngx-recaptcha2 [siteKey]=\"siteKey\" [size]=\"recaptchaSize\" [hl]=\"lang\" [theme]=\"theme\" [type]=\"recaptchaType\"\n [useGlobalDomain]=\"useGlobalDomain\" [formControl]=\"formControl\">\n</ngx-recaptcha2>", styles: [""], components: [{ type: i2$3.ReCaptcha2Component, selector: "ngx-recaptcha2", inputs: ["theme", "size", "hl"] }], directives: [{ type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
698
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: RecaptchaComponent, decorators: [{
|
|
699
|
+
type: Component,
|
|
700
|
+
args: [{ selector: 'ipa-recaptcha', template: "<ngx-recaptcha2 [siteKey]=\"siteKey\" [size]=\"recaptchaSize\" [hl]=\"lang\" [theme]=\"theme\" [type]=\"recaptchaType\"\n [useGlobalDomain]=\"useGlobalDomain\" [formControl]=\"formControl\">\n</ngx-recaptcha2>", styles: [""] }]
|
|
701
|
+
}], ctorParameters: function () { return [{ type: i2$1.NgControl, decorators: [{
|
|
702
|
+
type: Self
|
|
703
|
+
}] }]; }, propDecorators: { siteKey: [{
|
|
704
|
+
type: Input
|
|
705
|
+
}], recaptchaSize: [{
|
|
706
|
+
type: Input
|
|
707
|
+
}], lang: [{
|
|
708
|
+
type: Input
|
|
709
|
+
}], recaptchaType: [{
|
|
710
|
+
type: Input
|
|
711
|
+
}], theme: [{
|
|
712
|
+
type: Input
|
|
713
|
+
}], useGlobalDomain: [{
|
|
714
|
+
type: Input
|
|
715
|
+
}] } });
|
|
716
|
+
|
|
717
|
+
class GenerateFormComponent {
|
|
718
|
+
constructor(validationService) {
|
|
719
|
+
this.validationService = validationService;
|
|
720
|
+
this.recaptchaSize = 'normal';
|
|
721
|
+
this.lang = 'ar';
|
|
722
|
+
this.recaptchaType = 'image';
|
|
723
|
+
this.theme = 'light';
|
|
724
|
+
this.useGlobalDomain = true;
|
|
725
|
+
// file upload outputs
|
|
726
|
+
this.successUpload = new EventEmitter();
|
|
727
|
+
this.fileAdded = new EventEmitter();
|
|
728
|
+
this.fileDeleted = new EventEmitter();
|
|
729
|
+
}
|
|
730
|
+
ngOnInit() {
|
|
731
|
+
this.createForm();
|
|
732
|
+
}
|
|
733
|
+
get formControls() {
|
|
734
|
+
return this.generateForm.get('items');
|
|
735
|
+
}
|
|
736
|
+
getErrorMessage(formControlName) {
|
|
737
|
+
const formControl = this.generateForm.controls[formControlName];
|
|
738
|
+
this.errorMsg = this.validationService.getErrorMessage(formControl);
|
|
739
|
+
return this.errorMsg;
|
|
740
|
+
}
|
|
741
|
+
SuccessUpload(event) {
|
|
742
|
+
this.successUpload.emit(event);
|
|
743
|
+
}
|
|
744
|
+
FileAdded(file, formControlName) {
|
|
745
|
+
this.generateForm.controls[formControlName].patchValue(file);
|
|
746
|
+
this.fileAdded.emit(file);
|
|
747
|
+
}
|
|
748
|
+
FileDeleted(event, formControlName) {
|
|
749
|
+
this.generateForm.controls[formControlName].patchValue(null);
|
|
750
|
+
this.fileDeleted.emit(event);
|
|
751
|
+
}
|
|
752
|
+
createForm() {
|
|
753
|
+
this.form.columns.forEach((column) => {
|
|
754
|
+
if (column.type === 'checkbox') {
|
|
755
|
+
this.addCheckboxControl(column);
|
|
756
|
+
}
|
|
757
|
+
else {
|
|
758
|
+
this.generateForm.addControl(column.englishName, new FormControl(null, [
|
|
759
|
+
column.required ? Validators.required : Validators.nullValidator,
|
|
760
|
+
Validators.maxLength(column.size),
|
|
761
|
+
column.type === 'number'
|
|
762
|
+
? Validators.min(1)
|
|
763
|
+
: Validators.nullValidator,
|
|
764
|
+
]));
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
addCheckboxControl(column) {
|
|
769
|
+
let checkboxGroup = new FormArray(column.data.map((item) => {
|
|
770
|
+
return new FormGroup({
|
|
771
|
+
[column.valueField]: new FormControl(item[column.valueField]),
|
|
772
|
+
[column.textField]: new FormControl(item[column.textField]),
|
|
773
|
+
checkbox: new FormControl(false, Validators.required),
|
|
774
|
+
});
|
|
775
|
+
}));
|
|
776
|
+
this.generateForm.addControl(column.englishName, new FormControl(null, column.required ? Validators.required : Validators.nullValidator));
|
|
777
|
+
this.generateForm.addControl('items', checkboxGroup);
|
|
778
|
+
checkboxGroup.valueChanges.subscribe((value) => {
|
|
779
|
+
if (this.getCheckboxSelectedValues(value)) {
|
|
780
|
+
this.generateForm.controls[column.englishName].patchValue(value);
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
this.generateForm.controls[column.englishName].patchValue(null);
|
|
784
|
+
this.generateForm.controls[column.englishName].markAsTouched();
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
getCheckboxSelectedValues(items) {
|
|
789
|
+
let selectedItems = items.filter((item) => item.checkbox);
|
|
790
|
+
return selectedItems.length > 0 ? selectedItems : null;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
GenerateFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: GenerateFormComponent, deps: [{ token: IPAFormService }], target: i0.ɵɵFactoryTarget.Component });
|
|
794
|
+
GenerateFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: GenerateFormComponent, selector: "ipa-generate-form", inputs: { generateForm: "generateForm", form: "form", siteKey: "siteKey", recaptchaSize: "recaptchaSize", lang: "lang", recaptchaType: "recaptchaType", theme: "theme", useGlobalDomain: "useGlobalDomain" }, outputs: { successUpload: "successUpload", fileAdded: "fileAdded", fileDeleted: "fileDeleted" }, ngImport: i0, template: "<form [formGroup]=\"generateForm\">\r\n <ng-container *ngFor=\"let column of form.columns\">\r\n <div [ngSwitch]=\"column.type\">\r\n <!-- TEXTAREA -->\r\n <div *ngSwitchCase=\"'textArea'\">\r\n <ipa-textarea-input [formControlName]=\"column.englishName\" [id]=\"column.englishName\"\r\n [label]=\"column.arabicLabel\" [required]=\"column.required\" [pattern]=\"column.validationPattern!\"\r\n [patternErrorMsg]=\"column.patternErrorMsg!\" [classes]=\"column.inputClasses!\"\r\n [containerClasses]=\"column.containerClasses!\"></ipa-textarea-input>\r\n </div>\r\n\r\n <!-- DROP DOWN LIST -->\r\n <div *ngSwitchCase=\"'select'\">\r\n <ipa-dropdown-input [formControlName]=\"column.englishName\" [id]=\"column.englishName\"\r\n [label]=\"column.arabicLabel\" [items]=\"column.data!\" [valueField]=\"column.valueField!\"\r\n [textField]=\"column.textField!\" [required]=\"column.required\" [searchable]=\"column.searchable\"\r\n [notFoundText]=\"column.notFoundText\" [classes]=\"column.inputClasses!\"\r\n [containerClasses]=\"column.containerClasses!\">\r\n </ipa-dropdown-input>\r\n </div>\r\n\r\n <!-- CHECKBOX -->\r\n <div *ngSwitchCase=\"'checkbox'\">\r\n <label [for]=\"column.englishName\">{{column.arabicLabel}}</label>\r\n <div [formArrayName]=\"'items'\" *ngFor=\"let control of formControls.controls; let i = index\">\r\n <div [formGroupName]=\"i\" [id]=\"column.englishName\">\r\n <div class=\"form-check\">\r\n <input [id]=\"column.englishName+control.value[column.valueField!]\" class=\"form-check-input\"\r\n type=\"checkbox\" formControlName=\"checkbox\">\r\n <label class=\"form-check-label\"\r\n [for]=\"column.englishName+control.value[column.valueField!]\">\r\n {{control.value[column.textField!]}}\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.englishName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- RADIO -->\r\n <div *ngSwitchCase=\"'radio'\">\r\n <label [for]=\"column.englishName\">{{column.arabicLabel}}</label>\r\n <div *ngFor=\"let item of column.data; let i = index\" [id]=\"column.englishName\">\r\n <div class=\"form-check\">\r\n <input [id]=\"column.englishName+item[column.valueField!]\" class=\"form-check-input\" type=\"radio\"\r\n [formControlName]=\"column.englishName\" [value]=\"item[column.valueField!]\">\r\n <label class=\"form-check-label\" [for]=\"column.englishName+item[column.valueField!]\">\r\n {{item[column.textField!]}}\r\n </label>\r\n </div>\r\n </div>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.englishName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- FILE UPLOAD -->\r\n <div *ngSwitchCase=\"'file'\">\r\n <ipa-file-upload [label]=\"column.arabicLabel\" [acceptedFiles]=\"column.acceptedFiles!\"\r\n [multiple]=\"column.multipleFile!\" [maxFileSize]=\"column.size!\" [method]=\"column.apiURlMethod!\"\r\n [autoUpload]=\"column.autoUploadFile!\" [apiUrl]=\"column.apiUrl?? 'apiUrl' \"\r\n [authorization]=\"column.authorization!\" ngDefaultControl [formControlName]=\"column.englishName\"\r\n (successUpload)=\"SuccessUpload($event)\" (fileAdded)=\"FileAdded($event, column.englishName)\"\r\n (fileDeleted)=\"FileDeleted($event, column.englishName)\"></ipa-file-upload>\r\n </div>\r\n\r\n <!-- recaptcha -->\r\n <div *ngSwitchCase=\"'recaptcha'\">\r\n <ipa-recaptcha [recaptchaSize]=\"recaptchaSize\" [lang]=\"lang\" [theme]=\"theme\"\r\n [recaptchaType]=\"recaptchaType\" [useGlobalDomain]=\"useGlobalDomain\"\r\n formControlName=\"{{column.englishName}}\"></ipa-recaptcha>\r\n </div>\r\n\r\n <!-- DEFAULT -->\r\n <div *ngSwitchDefault>\r\n <ipa-text-input [formControlName]=\"column.englishName\" [id]=\"column.englishName\" [type]=\"column.type\"\r\n [label]=\"column.arabicLabel\" [required]=\"column.required\" [pattern]=\"column.validationPattern!\"\r\n [patternErrorMsg]=\"column.patternErrorMsg!\" [classes]=\"column.inputClasses!\"\r\n [containerClasses]=\"column.containerClasses!\"></ipa-text-input>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</form>", styles: [""], components: [{ type: TextareaInputComponent, selector: "ipa-textarea-input", inputs: ["id", "placeholder", "label", "required", "patternErrorMsg", "pattern", "classes", "containerClasses"] }, { type: DropdownInputComponent, selector: "ipa-dropdown-input", inputs: ["id", "label", "items", "textField", "valueField", "required", "searchable", "notFoundText", "classes", "containerClasses"] }, { type: FileUploadComponent, selector: "ipa-file-upload", inputs: ["label", "required", "acceptedFiles", "multiple", "maxFileSize", "method", "autoUpload", "apiUrl", "authorization"], outputs: ["successUpload", "fileAdded", "fileDeleted"] }, { type: RecaptchaComponent, selector: "ipa-recaptcha", inputs: ["siteKey", "recaptchaSize", "lang", "recaptchaType", "theme", "useGlobalDomain"] }, { type: TextInputComponent, selector: "ipa-text-input", inputs: ["id", "type", "placeholder", "label", "required", "patternErrorMsg", "pattern", "classes", "containerClasses"] }], directives: [{ type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i2$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i2$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
795
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: GenerateFormComponent, decorators: [{
|
|
796
|
+
type: Component,
|
|
797
|
+
args: [{ selector: 'ipa-generate-form', template: "<form [formGroup]=\"generateForm\">\r\n <ng-container *ngFor=\"let column of form.columns\">\r\n <div [ngSwitch]=\"column.type\">\r\n <!-- TEXTAREA -->\r\n <div *ngSwitchCase=\"'textArea'\">\r\n <ipa-textarea-input [formControlName]=\"column.englishName\" [id]=\"column.englishName\"\r\n [label]=\"column.arabicLabel\" [required]=\"column.required\" [pattern]=\"column.validationPattern!\"\r\n [patternErrorMsg]=\"column.patternErrorMsg!\" [classes]=\"column.inputClasses!\"\r\n [containerClasses]=\"column.containerClasses!\"></ipa-textarea-input>\r\n </div>\r\n\r\n <!-- DROP DOWN LIST -->\r\n <div *ngSwitchCase=\"'select'\">\r\n <ipa-dropdown-input [formControlName]=\"column.englishName\" [id]=\"column.englishName\"\r\n [label]=\"column.arabicLabel\" [items]=\"column.data!\" [valueField]=\"column.valueField!\"\r\n [textField]=\"column.textField!\" [required]=\"column.required\" [searchable]=\"column.searchable\"\r\n [notFoundText]=\"column.notFoundText\" [classes]=\"column.inputClasses!\"\r\n [containerClasses]=\"column.containerClasses!\">\r\n </ipa-dropdown-input>\r\n </div>\r\n\r\n <!-- CHECKBOX -->\r\n <div *ngSwitchCase=\"'checkbox'\">\r\n <label [for]=\"column.englishName\">{{column.arabicLabel}}</label>\r\n <div [formArrayName]=\"'items'\" *ngFor=\"let control of formControls.controls; let i = index\">\r\n <div [formGroupName]=\"i\" [id]=\"column.englishName\">\r\n <div class=\"form-check\">\r\n <input [id]=\"column.englishName+control.value[column.valueField!]\" class=\"form-check-input\"\r\n type=\"checkbox\" formControlName=\"checkbox\">\r\n <label class=\"form-check-label\"\r\n [for]=\"column.englishName+control.value[column.valueField!]\">\r\n {{control.value[column.textField!]}}\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.englishName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- RADIO -->\r\n <div *ngSwitchCase=\"'radio'\">\r\n <label [for]=\"column.englishName\">{{column.arabicLabel}}</label>\r\n <div *ngFor=\"let item of column.data; let i = index\" [id]=\"column.englishName\">\r\n <div class=\"form-check\">\r\n <input [id]=\"column.englishName+item[column.valueField!]\" class=\"form-check-input\" type=\"radio\"\r\n [formControlName]=\"column.englishName\" [value]=\"item[column.valueField!]\">\r\n <label class=\"form-check-label\" [for]=\"column.englishName+item[column.valueField!]\">\r\n {{item[column.textField!]}}\r\n </label>\r\n </div>\r\n </div>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.englishName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- FILE UPLOAD -->\r\n <div *ngSwitchCase=\"'file'\">\r\n <ipa-file-upload [label]=\"column.arabicLabel\" [acceptedFiles]=\"column.acceptedFiles!\"\r\n [multiple]=\"column.multipleFile!\" [maxFileSize]=\"column.size!\" [method]=\"column.apiURlMethod!\"\r\n [autoUpload]=\"column.autoUploadFile!\" [apiUrl]=\"column.apiUrl?? 'apiUrl' \"\r\n [authorization]=\"column.authorization!\" ngDefaultControl [formControlName]=\"column.englishName\"\r\n (successUpload)=\"SuccessUpload($event)\" (fileAdded)=\"FileAdded($event, column.englishName)\"\r\n (fileDeleted)=\"FileDeleted($event, column.englishName)\"></ipa-file-upload>\r\n </div>\r\n\r\n <!-- recaptcha -->\r\n <div *ngSwitchCase=\"'recaptcha'\">\r\n <ipa-recaptcha [recaptchaSize]=\"recaptchaSize\" [lang]=\"lang\" [theme]=\"theme\"\r\n [recaptchaType]=\"recaptchaType\" [useGlobalDomain]=\"useGlobalDomain\"\r\n formControlName=\"{{column.englishName}}\"></ipa-recaptcha>\r\n </div>\r\n\r\n <!-- DEFAULT -->\r\n <div *ngSwitchDefault>\r\n <ipa-text-input [formControlName]=\"column.englishName\" [id]=\"column.englishName\" [type]=\"column.type\"\r\n [label]=\"column.arabicLabel\" [required]=\"column.required\" [pattern]=\"column.validationPattern!\"\r\n [patternErrorMsg]=\"column.patternErrorMsg!\" [classes]=\"column.inputClasses!\"\r\n [containerClasses]=\"column.containerClasses!\"></ipa-text-input>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</form>", styles: [""] }]
|
|
798
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }]; }, propDecorators: { generateForm: [{
|
|
799
|
+
type: Input
|
|
800
|
+
}], form: [{
|
|
801
|
+
type: Input
|
|
802
|
+
}], siteKey: [{
|
|
803
|
+
type: Input
|
|
804
|
+
}], recaptchaSize: [{
|
|
805
|
+
type: Input
|
|
806
|
+
}], lang: [{
|
|
807
|
+
type: Input
|
|
808
|
+
}], recaptchaType: [{
|
|
809
|
+
type: Input
|
|
810
|
+
}], theme: [{
|
|
811
|
+
type: Input
|
|
812
|
+
}], useGlobalDomain: [{
|
|
813
|
+
type: Input
|
|
814
|
+
}], successUpload: [{
|
|
815
|
+
type: Output
|
|
816
|
+
}], fileAdded: [{
|
|
817
|
+
type: Output
|
|
818
|
+
}], fileDeleted: [{
|
|
819
|
+
type: Output
|
|
820
|
+
}] } });
|
|
821
|
+
|
|
822
|
+
class DatepickerComponent {
|
|
823
|
+
constructor(ipaFormService, calendar, controlDir, config) {
|
|
824
|
+
this.ipaFormService = ipaFormService;
|
|
825
|
+
this.calendar = calendar;
|
|
826
|
+
this.controlDir = controlDir;
|
|
827
|
+
this.label = 'datepicker';
|
|
828
|
+
this.patternErrorMsg = 'invalid pattern';
|
|
829
|
+
this.required = false;
|
|
830
|
+
this.today = this.calendar.getToday();
|
|
831
|
+
this.formControl = new FormControl('');
|
|
832
|
+
this.controlDir.valueAccessor = this;
|
|
833
|
+
config.container = 'body';
|
|
834
|
+
}
|
|
835
|
+
ngOnInit() {
|
|
836
|
+
const control = this.controlDir.control;
|
|
837
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
838
|
+
control?.setValidators(validators);
|
|
839
|
+
control?.updateValueAndValidity();
|
|
840
|
+
this.formControl = control;
|
|
841
|
+
}
|
|
842
|
+
onChange(event) { }
|
|
843
|
+
onTouched() { }
|
|
844
|
+
writeValue(obj) { }
|
|
845
|
+
registerOnChange(fn) {
|
|
846
|
+
this.onChange = fn;
|
|
847
|
+
}
|
|
848
|
+
registerOnTouched(fn) {
|
|
849
|
+
this.onTouched = fn;
|
|
850
|
+
}
|
|
851
|
+
get errorMessage() {
|
|
852
|
+
this.errorMsg = this.ipaFormService.getErrorMessage(this.formControl, this.patternErrorMsg);
|
|
853
|
+
return this.errorMsg;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
DatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: DatepickerComponent, deps: [{ token: IPAFormService }, { token: i2.NgbCalendar }, { token: i2$1.NgControl, self: true }, { token: i2.NgbInputDatepickerConfig }], target: i0.ɵɵFactoryTarget.Component });
|
|
857
|
+
DatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: DatepickerComponent, selector: "ipa-datepicker", inputs: { id: "id", label: "label", patternErrorMsg: "patternErrorMsg", required: "required", maxDate: "maxDate", minDate: "minDate", classes: "classes", containerClasses: "containerClasses" }, ngImport: i0, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" title=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"d.toggle()\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], directives: [{ type: i2.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
858
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
859
|
+
type: Component,
|
|
860
|
+
args: [{ selector: 'ipa-datepicker', template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" title=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"d.toggle()\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
861
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2.NgbCalendar }, { type: i2$1.NgControl, decorators: [{
|
|
862
|
+
type: Self
|
|
863
|
+
}] }, { type: i2.NgbInputDatepickerConfig }]; }, propDecorators: { id: [{
|
|
864
|
+
type: Input
|
|
865
|
+
}], label: [{
|
|
866
|
+
type: Input
|
|
867
|
+
}], patternErrorMsg: [{
|
|
868
|
+
type: Input
|
|
869
|
+
}], required: [{
|
|
870
|
+
type: Input
|
|
871
|
+
}], maxDate: [{
|
|
872
|
+
type: Input
|
|
873
|
+
}], minDate: [{
|
|
874
|
+
type: Input
|
|
875
|
+
}], classes: [{
|
|
876
|
+
type: Input
|
|
877
|
+
}], containerClasses: [{
|
|
878
|
+
type: Input
|
|
879
|
+
}] } });
|
|
880
|
+
|
|
881
|
+
const WEEKDAYS$1 = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
882
|
+
const MONTHS$1 = [
|
|
883
|
+
'محرم',
|
|
884
|
+
'صفر',
|
|
885
|
+
'ربيع الأول',
|
|
886
|
+
'ربيع الآخر',
|
|
887
|
+
'جمادى الأولى',
|
|
888
|
+
'جمادى الآخرة',
|
|
889
|
+
'رجب',
|
|
890
|
+
'شعبان',
|
|
891
|
+
'رمضان',
|
|
892
|
+
'شوال',
|
|
893
|
+
'ذو القعدة',
|
|
894
|
+
'ذو الحجة',
|
|
895
|
+
];
|
|
896
|
+
class IslamicI18n extends NgbDatepickerI18n {
|
|
897
|
+
getMonthShortName(month) {
|
|
898
|
+
return MONTHS$1[month - 1];
|
|
899
|
+
}
|
|
900
|
+
getMonthFullName(month) {
|
|
901
|
+
return MONTHS$1[month - 1];
|
|
902
|
+
}
|
|
903
|
+
getWeekdayLabel(weekday, width) {
|
|
904
|
+
return WEEKDAYS$1[weekday - 1];
|
|
905
|
+
}
|
|
906
|
+
getDayAriaLabel(date) {
|
|
907
|
+
return `${date.day}-${date.month}-${date.year}`;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
IslamicI18n.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: IslamicI18n, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
911
|
+
IslamicI18n.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: IslamicI18n });
|
|
912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: IslamicI18n, decorators: [{
|
|
913
|
+
type: Injectable
|
|
914
|
+
}] });
|
|
915
|
+
|
|
916
|
+
class HijriDatepickerComponent extends DatepickerComponent {
|
|
917
|
+
}
|
|
918
|
+
HijriDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: HijriDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
919
|
+
HijriDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: HijriDatepickerComponent, selector: "ipa-hijri-datepicker", providers: [
|
|
920
|
+
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
921
|
+
{ provide: NgbDatepickerI18n, useClass: IslamicI18n },
|
|
922
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" title=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"d.toggle()\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], directives: [{ type: i2.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
923
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: HijriDatepickerComponent, decorators: [{
|
|
924
|
+
type: Component,
|
|
925
|
+
args: [{ selector: 'ipa-hijri-datepicker', providers: [
|
|
926
|
+
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
927
|
+
{ provide: NgbDatepickerI18n, useClass: IslamicI18n },
|
|
928
|
+
], template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" title=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"d.toggle()\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
929
|
+
}] });
|
|
930
|
+
|
|
931
|
+
const WEEKDAYS = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
932
|
+
const MONTHS = [
|
|
933
|
+
'يناير',
|
|
934
|
+
'فبراير',
|
|
935
|
+
'مارس',
|
|
936
|
+
'أبريل',
|
|
937
|
+
'مايو',
|
|
938
|
+
'يونيو',
|
|
939
|
+
'يوليو',
|
|
940
|
+
'اغسطس',
|
|
941
|
+
'سبتمبر',
|
|
942
|
+
'أكتوبر',
|
|
943
|
+
'نوفمبر',
|
|
944
|
+
'ديسمبر',
|
|
945
|
+
];
|
|
946
|
+
class Gregorian18n extends NgbDatepickerI18n {
|
|
947
|
+
getMonthShortName(month) {
|
|
948
|
+
return MONTHS[month - 1];
|
|
949
|
+
}
|
|
950
|
+
getMonthFullName(month) {
|
|
951
|
+
return MONTHS[month - 1];
|
|
952
|
+
}
|
|
953
|
+
getWeekdayLabel(weekday, width) {
|
|
954
|
+
return WEEKDAYS[weekday - 1];
|
|
955
|
+
}
|
|
956
|
+
getDayAriaLabel(date) {
|
|
957
|
+
return `${date.day}-${date.month}-${date.year}`;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
Gregorian18n.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: Gregorian18n, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
961
|
+
Gregorian18n.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: Gregorian18n });
|
|
962
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: Gregorian18n, decorators: [{
|
|
963
|
+
type: Injectable
|
|
964
|
+
}] });
|
|
965
|
+
|
|
966
|
+
class GregorianDatepickerComponent extends DatepickerComponent {
|
|
967
|
+
}
|
|
968
|
+
GregorianDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: GregorianDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
969
|
+
GregorianDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: GregorianDatepickerComponent, selector: "ipa-gregorian-datepicker", providers: [
|
|
970
|
+
{ provide: NgbCalendar, useClass: NgbCalendarGregorian },
|
|
971
|
+
{ provide: NgbDatepickerI18n, useClass: Gregorian18n },
|
|
972
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" title=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"d.toggle()\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], directives: [{ type: i2.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
973
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: GregorianDatepickerComponent, decorators: [{
|
|
974
|
+
type: Component,
|
|
975
|
+
args: [{ selector: 'ipa-gregorian-datepicker', providers: [
|
|
976
|
+
{ provide: NgbCalendar, useClass: NgbCalendarGregorian },
|
|
977
|
+
{ provide: NgbDatepickerI18n, useClass: Gregorian18n },
|
|
978
|
+
], template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" title=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"d.toggle()\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
979
|
+
}] });
|
|
980
|
+
|
|
981
|
+
class ShareButtonComponent {
|
|
982
|
+
constructor() {
|
|
983
|
+
this.title = '';
|
|
984
|
+
this.description = '';
|
|
985
|
+
this.btnLabel = '';
|
|
986
|
+
}
|
|
987
|
+
ngAfterViewInit() {
|
|
988
|
+
const elements = document.getElementsByClassName('sb-show-icon');
|
|
989
|
+
elements[0].setAttribute('type', 'button');
|
|
990
|
+
elements[0].setAttribute('id', 'IPAShareBtn');
|
|
991
|
+
const label = document.createElement('label');
|
|
992
|
+
label.innerHTML = this.btnLabel;
|
|
993
|
+
label.classList.add('sm-share-title');
|
|
994
|
+
label.classList.add('me-1');
|
|
995
|
+
elements[0].before(label);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
ShareButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
999
|
+
ShareButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: ShareButtonComponent, selector: "ipa-share-button", inputs: { title: "title", description: "description", btnLabel: "btnLabel" }, ngImport: i0, template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','email','copy']\">\r\n</share-popup-button>", styles: [""], components: [{ type: i1$1.SharePopupComponent, selector: "share-popup-button", inputs: ["theme", "icon", "text", "include", "exclude", "closeIcon", "url", "title", "description", "image", "tags", "autoSetMeta", "show", "showIcon", "showText", "disabled", "hasBackdrop", "backdropClass"], outputs: ["opened", "closed", "popupClosed"] }] });
|
|
1000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonComponent, decorators: [{
|
|
1001
|
+
type: Component,
|
|
1002
|
+
args: [{ selector: 'ipa-share-button', template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','email','copy']\">\r\n</share-popup-button>", styles: [""] }]
|
|
1003
|
+
}], ctorParameters: function () { return []; }, propDecorators: { title: [{
|
|
1004
|
+
type: Input
|
|
1005
|
+
}], description: [{
|
|
1006
|
+
type: Input
|
|
1007
|
+
}], btnLabel: [{
|
|
1008
|
+
type: Input
|
|
1009
|
+
}] } });
|
|
1010
|
+
|
|
1011
|
+
class ShareButtonModule {
|
|
1012
|
+
constructor(library) {
|
|
1013
|
+
library.addIconPacks(fas);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
ShareButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonModule, deps: [{ token: i1$2.FaIconLibrary }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1017
|
+
ShareButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonModule, declarations: [ShareButtonComponent], imports: [ShareIconsModule,
|
|
1018
|
+
ShareButtonsPopupModule,
|
|
1019
|
+
OverlayModule,
|
|
1020
|
+
FontAwesomeModule], exports: [ShareButtonComponent,
|
|
1021
|
+
ShareIconsModule,
|
|
1022
|
+
ShareButtonsPopupModule,
|
|
1023
|
+
OverlayModule,
|
|
1024
|
+
FontAwesomeModule] });
|
|
1025
|
+
ShareButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonModule, imports: [[
|
|
1026
|
+
ShareIconsModule,
|
|
1027
|
+
ShareButtonsPopupModule,
|
|
1028
|
+
OverlayModule,
|
|
1029
|
+
FontAwesomeModule,
|
|
1030
|
+
], ShareIconsModule,
|
|
1031
|
+
ShareButtonsPopupModule,
|
|
1032
|
+
OverlayModule,
|
|
1033
|
+
FontAwesomeModule] });
|
|
1034
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonModule, decorators: [{
|
|
1035
|
+
type: NgModule,
|
|
1036
|
+
args: [{
|
|
1037
|
+
declarations: [ShareButtonComponent],
|
|
1038
|
+
imports: [
|
|
1039
|
+
ShareIconsModule,
|
|
1040
|
+
ShareButtonsPopupModule,
|
|
1041
|
+
OverlayModule,
|
|
1042
|
+
FontAwesomeModule,
|
|
1043
|
+
],
|
|
1044
|
+
exports: [
|
|
1045
|
+
ShareButtonComponent,
|
|
1046
|
+
ShareIconsModule,
|
|
1047
|
+
ShareButtonsPopupModule,
|
|
1048
|
+
OverlayModule,
|
|
1049
|
+
FontAwesomeModule,
|
|
1050
|
+
]
|
|
1051
|
+
}]
|
|
1052
|
+
}], ctorParameters: function () { return [{ type: i1$2.FaIconLibrary }]; } });
|
|
1053
|
+
|
|
1054
|
+
class NgIPALibraryModule {
|
|
1055
|
+
}
|
|
1056
|
+
NgIPALibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NgIPALibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1057
|
+
NgIPALibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NgIPALibraryModule, declarations: [TextInputComponent,
|
|
1058
|
+
TextareaInputComponent,
|
|
1059
|
+
DropdownInputComponent,
|
|
1060
|
+
LoaderComponent,
|
|
1061
|
+
GenerateFormComponent,
|
|
1062
|
+
FileUploadComponent,
|
|
1063
|
+
DatepickerComponent,
|
|
1064
|
+
HijriDatepickerComponent,
|
|
1065
|
+
GregorianDatepickerComponent,
|
|
1066
|
+
RecaptchaComponent], imports: [CommonModule,
|
|
1067
|
+
FormsModule,
|
|
1068
|
+
ReactiveFormsModule,
|
|
1069
|
+
ToastrModule,
|
|
1070
|
+
DropzoneModule,
|
|
1071
|
+
NgxCaptchaModule,
|
|
1072
|
+
PipesModule,
|
|
1073
|
+
NgbDatepickerModule,
|
|
1074
|
+
ShareButtonModule,
|
|
1075
|
+
NgSelectModule], exports: [TextInputComponent,
|
|
1076
|
+
TextareaInputComponent,
|
|
1077
|
+
DropdownInputComponent,
|
|
1078
|
+
LoaderComponent,
|
|
1079
|
+
GenerateFormComponent,
|
|
1080
|
+
FileUploadComponent,
|
|
1081
|
+
PipesModule,
|
|
1082
|
+
HijriDatepickerComponent,
|
|
1083
|
+
GregorianDatepickerComponent,
|
|
1084
|
+
ShareButtonModule,
|
|
1085
|
+
RecaptchaComponent] });
|
|
1086
|
+
NgIPALibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NgIPALibraryModule, imports: [[
|
|
1087
|
+
CommonModule,
|
|
1088
|
+
FormsModule,
|
|
1089
|
+
ReactiveFormsModule,
|
|
1090
|
+
ToastrModule,
|
|
1091
|
+
DropzoneModule,
|
|
1092
|
+
NgxCaptchaModule,
|
|
1093
|
+
PipesModule,
|
|
1094
|
+
NgbDatepickerModule,
|
|
1095
|
+
ShareButtonModule,
|
|
1096
|
+
NgSelectModule,
|
|
1097
|
+
], PipesModule,
|
|
1098
|
+
ShareButtonModule] });
|
|
1099
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NgIPALibraryModule, decorators: [{
|
|
1100
|
+
type: NgModule,
|
|
1101
|
+
args: [{
|
|
1102
|
+
declarations: [
|
|
1103
|
+
TextInputComponent,
|
|
1104
|
+
TextareaInputComponent,
|
|
1105
|
+
DropdownInputComponent,
|
|
1106
|
+
LoaderComponent,
|
|
1107
|
+
GenerateFormComponent,
|
|
1108
|
+
FileUploadComponent,
|
|
1109
|
+
DatepickerComponent,
|
|
1110
|
+
HijriDatepickerComponent,
|
|
1111
|
+
GregorianDatepickerComponent,
|
|
1112
|
+
RecaptchaComponent,
|
|
1113
|
+
],
|
|
1114
|
+
imports: [
|
|
1115
|
+
CommonModule,
|
|
1116
|
+
FormsModule,
|
|
1117
|
+
ReactiveFormsModule,
|
|
1118
|
+
ToastrModule,
|
|
1119
|
+
DropzoneModule,
|
|
1120
|
+
NgxCaptchaModule,
|
|
1121
|
+
PipesModule,
|
|
1122
|
+
NgbDatepickerModule,
|
|
1123
|
+
ShareButtonModule,
|
|
1124
|
+
NgSelectModule,
|
|
1125
|
+
],
|
|
1126
|
+
exports: [
|
|
1127
|
+
TextInputComponent,
|
|
1128
|
+
TextareaInputComponent,
|
|
1129
|
+
DropdownInputComponent,
|
|
1130
|
+
LoaderComponent,
|
|
1131
|
+
GenerateFormComponent,
|
|
1132
|
+
FileUploadComponent,
|
|
1133
|
+
PipesModule,
|
|
1134
|
+
HijriDatepickerComponent,
|
|
1135
|
+
GregorianDatepickerComponent,
|
|
1136
|
+
ShareButtonModule,
|
|
1137
|
+
RecaptchaComponent,
|
|
1138
|
+
],
|
|
1139
|
+
}]
|
|
1140
|
+
}] });
|
|
1141
|
+
|
|
1142
|
+
class LoadingInterceptor {
|
|
1143
|
+
constructor(loaderService) {
|
|
1144
|
+
this.loaderService = loaderService;
|
|
1145
|
+
this.requests = [];
|
|
1146
|
+
}
|
|
1147
|
+
removeRequest(req) {
|
|
1148
|
+
const i = this.requests.indexOf(req);
|
|
1149
|
+
if (i >= 0) {
|
|
1150
|
+
this.requests.splice(i, 1);
|
|
1151
|
+
}
|
|
1152
|
+
this.loaderService.isLoading.next(this.requests.length > 0);
|
|
1153
|
+
}
|
|
1154
|
+
intercept(req, next) {
|
|
1155
|
+
if (this.isException(req)) {
|
|
1156
|
+
return next.handle(req);
|
|
1157
|
+
}
|
|
1158
|
+
this.requests.push(req);
|
|
1159
|
+
this.loaderService.isLoading.next(true);
|
|
1160
|
+
return new Observable((observer) => {
|
|
1161
|
+
const subscription = next.handle(req).subscribe((event) => {
|
|
1162
|
+
if (event instanceof HttpResponse) {
|
|
1163
|
+
this.removeRequest(req);
|
|
1164
|
+
observer.next(event);
|
|
1165
|
+
}
|
|
1166
|
+
}, (err) => {
|
|
1167
|
+
this.removeRequest(req);
|
|
1168
|
+
observer.error(err);
|
|
1169
|
+
}, () => {
|
|
1170
|
+
this.removeRequest(req);
|
|
1171
|
+
observer.complete();
|
|
1172
|
+
});
|
|
1173
|
+
// remove request from queue when cancelled
|
|
1174
|
+
return () => {
|
|
1175
|
+
this.removeRequest(req);
|
|
1176
|
+
subscription.unsubscribe();
|
|
1177
|
+
};
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
isException(req) {
|
|
1181
|
+
for (const url of this.loaderService.urls) {
|
|
1182
|
+
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1183
|
+
return true;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
return false;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
LoadingInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoadingInterceptor, deps: [{ token: LoaderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1190
|
+
LoadingInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoadingInterceptor });
|
|
1191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: LoadingInterceptor, decorators: [{
|
|
1192
|
+
type: Injectable
|
|
1193
|
+
}], ctorParameters: function () { return [{ type: LoaderService }]; } });
|
|
1194
|
+
|
|
1195
|
+
class ErrorService {
|
|
1196
|
+
constructor() {
|
|
1197
|
+
this.urls = [];
|
|
1198
|
+
}
|
|
1199
|
+
setExceptionUrls(urls) {
|
|
1200
|
+
this.urls = urls;
|
|
1201
|
+
}
|
|
1202
|
+
addExceptionUrl(url) {
|
|
1203
|
+
this.urls.push(url);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
ErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1207
|
+
ErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, providedIn: 'root' });
|
|
1208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, decorators: [{
|
|
1209
|
+
type: Injectable,
|
|
1210
|
+
args: [{
|
|
1211
|
+
providedIn: 'root'
|
|
1212
|
+
}]
|
|
1213
|
+
}], ctorParameters: function () { return []; } });
|
|
1214
|
+
|
|
1215
|
+
class ErrorInterceptor {
|
|
1216
|
+
constructor(errorService, toastrService) {
|
|
1217
|
+
this.errorService = errorService;
|
|
1218
|
+
this.toastrService = toastrService;
|
|
1219
|
+
}
|
|
1220
|
+
intercept(req, next) {
|
|
1221
|
+
if (this.isException(req)) {
|
|
1222
|
+
return next.handle(req);
|
|
1223
|
+
}
|
|
1224
|
+
return next.handle(req).pipe(catchError((error) => {
|
|
1225
|
+
const response = error.error;
|
|
1226
|
+
const toastrConfig = {
|
|
1227
|
+
disableTimeOut: true,
|
|
1228
|
+
};
|
|
1229
|
+
switch (response.statusCode) {
|
|
1230
|
+
case 500:
|
|
1231
|
+
this.toastrService.error(response?.innerException + ' ' + response?.stackTrace, response.message, toastrConfig);
|
|
1232
|
+
break;
|
|
1233
|
+
default:
|
|
1234
|
+
this.toastrService.error(response.message, '', toastrConfig);
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
return throwError(error);
|
|
1238
|
+
}));
|
|
1239
|
+
}
|
|
1240
|
+
isException(req) {
|
|
1241
|
+
for (const url of this.errorService.urls) {
|
|
1242
|
+
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1243
|
+
return true;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }, { token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1250
|
+
ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor });
|
|
1251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, decorators: [{
|
|
1252
|
+
type: Injectable
|
|
1253
|
+
}], ctorParameters: function () { return [{ type: ErrorService }, { type: i1.ToastrService }]; } });
|
|
1254
|
+
|
|
1255
|
+
class AuthService {
|
|
1256
|
+
constructor() {
|
|
1257
|
+
this.currentUser = new BehaviorSubject({ exp: 0 });
|
|
1258
|
+
this.currentUserUrl = '';
|
|
1259
|
+
}
|
|
1260
|
+
getToken() {
|
|
1261
|
+
return localStorage.getItem('token') ?? '';
|
|
1262
|
+
}
|
|
1263
|
+
getDecodedToken() {
|
|
1264
|
+
return this.decodeJwt(this.getToken());
|
|
1265
|
+
}
|
|
1266
|
+
setCurrentUser() {
|
|
1267
|
+
const decodedToken = this.getDecodedToken();
|
|
1268
|
+
this.currentUser.next({
|
|
1269
|
+
nameid: decodedToken.nameid,
|
|
1270
|
+
email: decodedToken.email,
|
|
1271
|
+
given_name: decodedToken.given_name,
|
|
1272
|
+
exp: decodedToken.exp,
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
setCurrentUserUrl(url) {
|
|
1276
|
+
this.currentUserUrl = url;
|
|
1277
|
+
}
|
|
1278
|
+
decodeJwt(token) {
|
|
1279
|
+
const base64Url = token.split('.')[1];
|
|
1280
|
+
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
1281
|
+
const jsonPayload = decodeURIComponent(atob(base64)
|
|
1282
|
+
.split('')
|
|
1283
|
+
.map((c) => {
|
|
1284
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
1285
|
+
})
|
|
1286
|
+
.join(''));
|
|
1287
|
+
return JSON.parse(jsonPayload);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1291
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
1292
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: AuthService, decorators: [{
|
|
1293
|
+
type: Injectable,
|
|
1294
|
+
args: [{
|
|
1295
|
+
providedIn: 'root',
|
|
1296
|
+
}]
|
|
1297
|
+
}], ctorParameters: function () { return []; } });
|
|
1298
|
+
|
|
1299
|
+
class TokenInterceptor {
|
|
1300
|
+
constructor(authService, http) {
|
|
1301
|
+
this.authService = authService;
|
|
1302
|
+
this.http = http;
|
|
1303
|
+
this.refresh = true;
|
|
1304
|
+
}
|
|
1305
|
+
intercept(request, next) {
|
|
1306
|
+
if (this.isException(request)) {
|
|
1307
|
+
return next.handle(request);
|
|
1308
|
+
}
|
|
1309
|
+
const token = this.authService.getToken();
|
|
1310
|
+
if (token) {
|
|
1311
|
+
this.isTokenExpired(token);
|
|
1312
|
+
request = request.clone({
|
|
1313
|
+
setHeaders: {
|
|
1314
|
+
Authorization: `Bearer ${token}`,
|
|
1315
|
+
},
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
return next.handle(request);
|
|
1319
|
+
}
|
|
1320
|
+
isTokenExpired(token) {
|
|
1321
|
+
const redirectPath = location.pathname;
|
|
1322
|
+
const decodedToken = this.authService.getDecodedToken();
|
|
1323
|
+
const expDate = new Date((decodedToken.exp ?? 0) * 1000);
|
|
1324
|
+
if (expDate < new Date()) {
|
|
1325
|
+
location.replace('/ar/login?redirect=' + redirectPath);
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
else {
|
|
1329
|
+
if (this.authService.currentUserUrl) {
|
|
1330
|
+
if (this.refresh) {
|
|
1331
|
+
this.http
|
|
1332
|
+
.get(this.authService.currentUserUrl + `/api/users?refresh`, {
|
|
1333
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
1334
|
+
})
|
|
1335
|
+
.subscribe((user) => {
|
|
1336
|
+
localStorage.setItem('token', user.token);
|
|
1337
|
+
this.refresh = false;
|
|
1338
|
+
setTimeout(() => {
|
|
1339
|
+
this.refresh = true;
|
|
1340
|
+
}, 60 * 1000);
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
throw new Error("provide current base user api url using this function authService.setCurrentUserUrl('https://...')");
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
isException(request) {
|
|
1350
|
+
if (request.url.includes('/api/users?refresh') &&
|
|
1351
|
+
request.method === 'GET') {
|
|
1352
|
+
return true;
|
|
1353
|
+
}
|
|
1354
|
+
return false;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
TokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor, deps: [{ token: AuthService }, { token: i2$4.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1358
|
+
TokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor });
|
|
1359
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor, decorators: [{
|
|
1360
|
+
type: Injectable
|
|
1361
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: i2$4.HttpClient }]; } });
|
|
1362
|
+
|
|
1363
|
+
class BreadcrumbsService {
|
|
1364
|
+
constructor() { }
|
|
1365
|
+
setPageTitle(text) {
|
|
1366
|
+
const titleEl = document.querySelector('.sub-section-title');
|
|
1367
|
+
if (titleEl) {
|
|
1368
|
+
titleEl.textContent = text;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
setMainPageTitle(text, url) {
|
|
1372
|
+
const div = document.getElementsByClassName('main-section-title');
|
|
1373
|
+
if (div && div.length > 0) {
|
|
1374
|
+
div[0].innerHTML = `<a id="site-url" href="${url}">${text}</a>`;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
addBreadcrumb(nodeName, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1378
|
+
const spans = document.getElementById('ctl00_path')?.children;
|
|
1379
|
+
//get last child
|
|
1380
|
+
const lastIndex = spans?.item(spans.length - 1);
|
|
1381
|
+
const innerHTML = lastIndex.innerHTML;
|
|
1382
|
+
lastIndex.innerHTML = '';
|
|
1383
|
+
lastIndex.classList.remove(...['bc-current']);
|
|
1384
|
+
//add new link
|
|
1385
|
+
lastIndex.appendChild(this.createLink(innerHTML, location.pathname, linkClasses));
|
|
1386
|
+
//add new span and empty span
|
|
1387
|
+
const newSpan = this.createSpan(nodeName, spanClasses);
|
|
1388
|
+
const emptySpan = document.createElement('span');
|
|
1389
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1390
|
+
}
|
|
1391
|
+
addBreadcrumbList(nodeList, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1392
|
+
const spans = document.getElementById('ctl00_path')?.childNodes;
|
|
1393
|
+
//get last child
|
|
1394
|
+
const lastSpan = spans?.item(spans.length - 1);
|
|
1395
|
+
const innerHTML = lastSpan.innerHTML;
|
|
1396
|
+
lastSpan.classList.remove(...[spanClasses]);
|
|
1397
|
+
lastSpan.innerHTML = '';
|
|
1398
|
+
//add new link
|
|
1399
|
+
lastSpan.appendChild(this.createLink(innerHTML, location.pathname, linkClasses));
|
|
1400
|
+
for (let i = 0; i < nodeList.length; i++) {
|
|
1401
|
+
const lastIndex = spans?.item(spans.length - 1);
|
|
1402
|
+
if (nodeList[i].nodeUrl) {
|
|
1403
|
+
const newSpan = document.createElement('span');
|
|
1404
|
+
newSpan.appendChild(this.createLink(nodeList[i].nodeName, nodeList[i].nodeUrl, linkClasses));
|
|
1405
|
+
const emptySpan = document.createElement('span');
|
|
1406
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1407
|
+
}
|
|
1408
|
+
else {
|
|
1409
|
+
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
1410
|
+
const emptySpan = document.createElement('span');
|
|
1411
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
createBreadcrumbs(nodeList, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1416
|
+
const currentSpan = document.getElementById('ctl00_path');
|
|
1417
|
+
currentSpan.innerHTML = '';
|
|
1418
|
+
const newSpan = document.createElement('span');
|
|
1419
|
+
currentSpan?.appendChild(newSpan);
|
|
1420
|
+
newSpan.appendChild(this.createLink(nodeList[0].nodeName, nodeList[0].nodeUrl, linkClasses));
|
|
1421
|
+
const spans = currentSpan?.children;
|
|
1422
|
+
for (let i = 1; i < nodeList.length; i++) {
|
|
1423
|
+
const lastIndex = spans?.item(spans.length - 1);
|
|
1424
|
+
if (nodeList[i].nodeUrl) {
|
|
1425
|
+
const newSpan = document.createElement('span');
|
|
1426
|
+
newSpan.appendChild(this.createLink(nodeList[i].nodeName, nodeList[i].nodeUrl, linkClasses));
|
|
1427
|
+
const emptySpan = document.createElement('span');
|
|
1428
|
+
lastIndex?.after(...[emptySpan, newSpan]);
|
|
1429
|
+
}
|
|
1430
|
+
else {
|
|
1431
|
+
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
1432
|
+
const emptySpan = document.createElement('span');
|
|
1433
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
removeLastBreadcrumb() {
|
|
1438
|
+
const spans = document.getElementById('ctl00_path')?.children;
|
|
1439
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1440
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1441
|
+
this.setCurrentNode(spans);
|
|
1442
|
+
}
|
|
1443
|
+
removeBreadcrumbByNodeName(nodeName) {
|
|
1444
|
+
const spans = document.getElementById('ctl00_path')
|
|
1445
|
+
?.children;
|
|
1446
|
+
let index = -1;
|
|
1447
|
+
for (let i = 0; i < spans.length; i++) {
|
|
1448
|
+
const span = spans.item(i);
|
|
1449
|
+
if (span?.textContent?.trim() === nodeName) {
|
|
1450
|
+
index = i;
|
|
1451
|
+
break;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
const lastNode = spans.length - 1 === index;
|
|
1455
|
+
if (index !== -1 && !lastNode) {
|
|
1456
|
+
spans?.item(index)?.remove();
|
|
1457
|
+
spans?.item(index)?.remove();
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
spans?.item(index)?.remove();
|
|
1461
|
+
spans?.item(index - 1)?.remove();
|
|
1462
|
+
}
|
|
1463
|
+
if (lastNode) {
|
|
1464
|
+
this.setCurrentNode(spans);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
removeLastBreadcrumbsByLength(length) {
|
|
1468
|
+
const spans = document.getElementById('ctl00_path')
|
|
1469
|
+
?.children;
|
|
1470
|
+
while (length > 0) {
|
|
1471
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1472
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1473
|
+
length--;
|
|
1474
|
+
}
|
|
1475
|
+
if (spans.length > 0) {
|
|
1476
|
+
this.setCurrentNode(spans);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
createLink(innerHTML, href, classes) {
|
|
1480
|
+
const link = document.createElement('a');
|
|
1481
|
+
link.innerHTML = ' ' + innerHTML;
|
|
1482
|
+
link.href = href ?? '';
|
|
1483
|
+
link.classList.add(...[classes]);
|
|
1484
|
+
return link;
|
|
1485
|
+
}
|
|
1486
|
+
createSpan(innerHTML, classes) {
|
|
1487
|
+
const span = document.createElement('span');
|
|
1488
|
+
span.classList.add(...[classes]);
|
|
1489
|
+
span.innerHTML = ' ' + innerHTML;
|
|
1490
|
+
return span;
|
|
1491
|
+
}
|
|
1492
|
+
setCurrentNode(spans) {
|
|
1493
|
+
const lastSpan = spans?.item(spans.length - 1);
|
|
1494
|
+
const lastSpanLink = spans
|
|
1495
|
+
?.item(spans.length - 1)
|
|
1496
|
+
?.children.item(0);
|
|
1497
|
+
lastSpan?.classList.add(...['bc-current']);
|
|
1498
|
+
lastSpan.innerHTML = lastSpanLink.innerHTML;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
BreadcrumbsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: BreadcrumbsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1502
|
+
BreadcrumbsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: BreadcrumbsService, providedIn: 'root' });
|
|
1503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: BreadcrumbsService, decorators: [{
|
|
1504
|
+
type: Injectable,
|
|
1505
|
+
args: [{
|
|
1506
|
+
providedIn: 'root',
|
|
1507
|
+
}]
|
|
1508
|
+
}], ctorParameters: function () { return []; } });
|
|
1509
|
+
|
|
1510
|
+
class CommonService {
|
|
1511
|
+
constructor() { }
|
|
1512
|
+
print(element, title, classes) {
|
|
1513
|
+
const styles = this.getElementTag('style');
|
|
1514
|
+
const linkes = this.getElementTag('link');
|
|
1515
|
+
const scripts = this.getElementTag('script');
|
|
1516
|
+
const printContents = document.getElementById(element)?.innerHTML;
|
|
1517
|
+
const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
|
|
1518
|
+
const data = `
|
|
1519
|
+
<!DOCTYPE html>
|
|
1520
|
+
<head>
|
|
1521
|
+
<title> ${title} </title>
|
|
1522
|
+
<meta charset="utf-8">
|
|
1523
|
+
${linkes}
|
|
1524
|
+
${styles}
|
|
1525
|
+
<style>
|
|
1526
|
+
@media print {
|
|
1527
|
+
.noPrint{
|
|
1528
|
+
display: none !important;
|
|
1529
|
+
}
|
|
1530
|
+
body {
|
|
1531
|
+
direction: rtl;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
</style>
|
|
1535
|
+
</head>
|
|
1536
|
+
<body class="${classes}">
|
|
1537
|
+
${printContents}
|
|
1538
|
+
${scripts}
|
|
1539
|
+
</body>
|
|
1540
|
+
|
|
1541
|
+
</html>`;
|
|
1542
|
+
popupWin?.document.open();
|
|
1543
|
+
popupWin?.document.write(data);
|
|
1544
|
+
popupWin?.document.close();
|
|
1545
|
+
popupWin?.focus();
|
|
1546
|
+
popupWin?.addEventListener('focus', () => {
|
|
1547
|
+
setTimeout(() => {
|
|
1548
|
+
if (popupWin.document.hasFocus()) {
|
|
1549
|
+
popupWin.print();
|
|
1550
|
+
popupWin.close();
|
|
1551
|
+
}
|
|
1552
|
+
}, 1000);
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
getElementTag(tag) {
|
|
1556
|
+
const html = [];
|
|
1557
|
+
const elements = document.getElementsByTagName(tag);
|
|
1558
|
+
for (let index = 0; index < elements.length; index++) {
|
|
1559
|
+
html.push(elements[index].outerHTML);
|
|
1560
|
+
}
|
|
1561
|
+
return html.join('\r\n');
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
CommonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1565
|
+
CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
1566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, decorators: [{
|
|
1567
|
+
type: Injectable,
|
|
1568
|
+
args: [{
|
|
1569
|
+
providedIn: 'root',
|
|
1570
|
+
}]
|
|
1571
|
+
}], ctorParameters: function () { return []; } });
|
|
1572
|
+
|
|
1573
|
+
/*
|
|
1574
|
+
* Public API Surface of ipa-library
|
|
1575
|
+
*/
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* Generated bundle index. Do not edit.
|
|
1579
|
+
*/
|
|
1580
|
+
|
|
1581
|
+
export { AuthService, BreadcrumbsService, CommonService, DropdownInputComponent, ErrorInterceptor, ErrorService, FileUploadComponent, GenerateFormComponent, GregorianDatepickerComponent, HijriDatePipe, HijriDatepickerComponent, IPAFormService, LoaderComponent, LoaderService, LoadingInterceptor, NgIPALibraryModule, PipesModule, RecaptchaComponent, ShareButtonComponent, ShareButtonModule, TextInputComponent, TextareaInputComponent, TokenInterceptor };
|
|
1582
|
+
//# sourceMappingURL=ng-ipa-library.mjs.map
|