@bnsights/bbsf-utilities 1.0.3 → 1.0.4
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/bnsights-bbsf-utilities-1.0.4.tgz +0 -0
- package/bnsights-bbsf-utilities.metadata.json +1 -1
- package/bundles/bnsights-bbsf-utilities.umd.js +234 -176
- package/bundles/bnsights-bbsf-utilities.umd.js.map +1 -1
- package/esm2015/lib/shared/authentication/auth.service.js +5 -16
- package/esm2015/lib/shared/services/controlvalidation.service.js +46 -31
- package/esm2015/lib/shared/services/requesthandler.service.js +53 -16
- package/fesm2015/bnsights-bbsf-utilities.js +207 -158
- package/fesm2015/bnsights-bbsf-utilities.js.map +1 -1
- package/lib/shared/authentication/auth.service.d.ts +1 -1
- package/lib/shared/services/controlvalidation.service.d.ts +2 -2
- package/lib/shared/services/requesthandler.service.d.ts +11 -7
- package/package.json +1 -1
- package/bnsights-bbsf-utilities-1.0.3.tgz +0 -0
|
@@ -14,6 +14,7 @@ import * as i1$1 from '@angular/common/http';
|
|
|
14
14
|
import { HttpHeaders, HttpClient, HttpParams } from '@angular/common/http';
|
|
15
15
|
import { UserManager, WebStorageStateStore } from 'oidc-client';
|
|
16
16
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
17
|
+
import { Observable } from 'rxjs/internal/Observable';
|
|
17
18
|
import { takeUntil, tap } from 'rxjs/operators';
|
|
18
19
|
|
|
19
20
|
// This file can be replaced during build by using the `fileReplacements` array.
|
|
@@ -162,28 +163,17 @@ class AuthService {
|
|
|
162
163
|
getCurrentUser() {
|
|
163
164
|
return this.manager.getUser();
|
|
164
165
|
}
|
|
165
|
-
isAuthenticated(
|
|
166
|
+
isAuthenticated() {
|
|
166
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
168
|
let user = yield this.manager.getUser().then(user => {
|
|
168
169
|
return user;
|
|
169
170
|
});
|
|
170
|
-
|
|
171
|
-
if (allowedPermission.length == 0) {
|
|
172
|
-
return this.user != null && !this.user.expired;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
let isUserInRole = this.isUserInRole(allowedPermission);
|
|
176
|
-
return this.user != null && !this.user.expired && isUserInRole;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
else
|
|
180
|
-
return this.user != null && !this.user.expired;
|
|
171
|
+
return this.user != null && !this.user.expired;
|
|
181
172
|
});
|
|
182
173
|
}
|
|
183
174
|
isUserInRole(allowedPermission) {
|
|
184
|
-
;
|
|
185
|
-
|
|
186
|
-
return allowedPermission.every(i => permissionSetSID.includes(i));
|
|
175
|
+
let selectedPermissionSetID = this.user.profile["selectedPermissionSetID"];
|
|
176
|
+
return allowedPermission.includes(selectedPermissionSetID);
|
|
187
177
|
}
|
|
188
178
|
authorizationHeaderValue() {
|
|
189
179
|
return AuthService.user ? `${AuthService.user.token_type} ${AuthService.user.access_token}` : "";
|
|
@@ -319,13 +309,170 @@ class RequestOptionsModel {
|
|
|
319
309
|
}
|
|
320
310
|
}
|
|
321
311
|
|
|
312
|
+
class RequestHandlerService {
|
|
313
|
+
constructor(http, authService, environmentService, utilityService, bbsfTranslateService) {
|
|
314
|
+
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
315
|
+
this.http = http;
|
|
316
|
+
this.authService = authService;
|
|
317
|
+
this.environmentService = environmentService;
|
|
318
|
+
this.utilityService = utilityService;
|
|
319
|
+
this.bbsfTranslateService = bbsfTranslateService;
|
|
320
|
+
this.requestOptions = new RequestOptionsModel();
|
|
321
|
+
this.currentLanguage = "";
|
|
322
|
+
this.onDestroy$ = new Subject();
|
|
323
|
+
this.bbsfTranslateService.onLangChange.subscribe((event) => {
|
|
324
|
+
if (this.currentLanguage != event.lang) {
|
|
325
|
+
this.currentLanguage = event.lang;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
getLuckyNumber() {
|
|
330
|
+
return Observable.create((subject) => {
|
|
331
|
+
setInterval(() => {
|
|
332
|
+
const number = Math.floor(Math.random() * 10);
|
|
333
|
+
console.log(number);
|
|
334
|
+
subject.next(number);
|
|
335
|
+
}, 1000);
|
|
336
|
+
}).pipe(takeUntil(this.onDestroy$));
|
|
337
|
+
}
|
|
338
|
+
get(Url, params, requestOptions) {
|
|
339
|
+
if (requestOptions)
|
|
340
|
+
this.requestOptions = requestOptions;
|
|
341
|
+
let headers = new HttpHeaders({
|
|
342
|
+
'Content-Type': 'application/json',
|
|
343
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
344
|
+
});
|
|
345
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
346
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
347
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
348
|
+
if (!this.requestOptions.disableBlockUI)
|
|
349
|
+
this.utilityService.startBlockUI();
|
|
350
|
+
return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
351
|
+
if (!this.requestOptions.disableBlockUI)
|
|
352
|
+
this.utilityService.stopBlockUI();
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
post(Url, model, params, requestOptions) {
|
|
356
|
+
if (requestOptions)
|
|
357
|
+
this.requestOptions = requestOptions;
|
|
358
|
+
let headers = new HttpHeaders({
|
|
359
|
+
'Content-Type': 'application/json',
|
|
360
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
361
|
+
});
|
|
362
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
363
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
364
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
365
|
+
if (!this.requestOptions.disableBlockUI)
|
|
366
|
+
this.utilityService.startBlockUI();
|
|
367
|
+
return this.http.post(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
368
|
+
if (!this.requestOptions.disableBlockUI)
|
|
369
|
+
this.utilityService.stopBlockUI();
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
delete(Url, deletedId, params, requestOptions) {
|
|
373
|
+
if (requestOptions)
|
|
374
|
+
this.requestOptions = requestOptions;
|
|
375
|
+
let headers = new HttpHeaders({
|
|
376
|
+
'Content-Type': 'application/json',
|
|
377
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
378
|
+
});
|
|
379
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
380
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
381
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
382
|
+
if (!this.requestOptions.disableBlockUI)
|
|
383
|
+
this.utilityService.startBlockUI();
|
|
384
|
+
return this.http.delete(this.environmentService.getApiUrl() + Url + `/${deletedId}`, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
385
|
+
if (!this.requestOptions.disableBlockUI)
|
|
386
|
+
this.utilityService.stopBlockUI();
|
|
387
|
+
}));
|
|
388
|
+
}
|
|
389
|
+
put(Url, model, params, requestOptions) {
|
|
390
|
+
if (requestOptions)
|
|
391
|
+
this.requestOptions = requestOptions;
|
|
392
|
+
let headers = new HttpHeaders({
|
|
393
|
+
'Content-Type': 'application/json',
|
|
394
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
395
|
+
});
|
|
396
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
397
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
398
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
399
|
+
if (!this.requestOptions.disableBlockUI)
|
|
400
|
+
this.utilityService.startBlockUI();
|
|
401
|
+
return this.http.put(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
402
|
+
if (!this.requestOptions.disableBlockUI)
|
|
403
|
+
this.utilityService.stopBlockUI();
|
|
404
|
+
}));
|
|
405
|
+
}
|
|
406
|
+
destroyHandler() {
|
|
407
|
+
this.onDestroy$.next();
|
|
408
|
+
}
|
|
409
|
+
ngOnDestroy() {
|
|
410
|
+
console.log("clearInterval");
|
|
411
|
+
this.destroyHandler();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
RequestHandlerService.decorators = [
|
|
415
|
+
{ type: Injectable }
|
|
416
|
+
];
|
|
417
|
+
RequestHandlerService.ctorParameters = () => [
|
|
418
|
+
{ type: HttpClient },
|
|
419
|
+
{ type: AuthService },
|
|
420
|
+
{ type: EnvironmentService },
|
|
421
|
+
{ type: UtilityService },
|
|
422
|
+
{ type: BBSFTranslateService }
|
|
423
|
+
];
|
|
424
|
+
|
|
425
|
+
class StylesBundleService {
|
|
426
|
+
constructor(document, translateService) {
|
|
427
|
+
this.document = document;
|
|
428
|
+
this.translateService = translateService;
|
|
429
|
+
}
|
|
430
|
+
loadThemes(lang, bundleEnglishName, bundleArabicName) {
|
|
431
|
+
if (lang == "ar") {
|
|
432
|
+
this.loadStyleBundle(bundleArabicName.toString());
|
|
433
|
+
document.querySelector('html').setAttribute("lang", "ar");
|
|
434
|
+
document.querySelector('html').setAttribute("dir", "rtl");
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
this.loadStyleBundle(bundleEnglishName.toString());
|
|
438
|
+
document.querySelector('html').setAttribute("lang", "en");
|
|
439
|
+
document.querySelector('html').setAttribute("dir", "ltr");
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
loadStyleBundle(styleName) {
|
|
443
|
+
const head = this.document.getElementsByTagName('head')[0];
|
|
444
|
+
let themeLink = this.document.getElementById('client-theme');
|
|
445
|
+
if (themeLink && themeLink.href.includes(styleName)) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
else if (themeLink && !themeLink.href.includes(styleName)) {
|
|
449
|
+
themeLink.remove();
|
|
450
|
+
}
|
|
451
|
+
const style = this.document.createElement('link');
|
|
452
|
+
style.id = 'client-theme';
|
|
453
|
+
style.rel = 'stylesheet';
|
|
454
|
+
style.href = `${styleName}`;
|
|
455
|
+
head.appendChild(style);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
StylesBundleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StylesBundleService_Factory() { return new StylesBundleService(i0.ɵɵinject(i1$2.DOCUMENT), i0.ɵɵinject(BBSFTranslateService)); }, token: StylesBundleService, providedIn: "root" });
|
|
459
|
+
StylesBundleService.decorators = [
|
|
460
|
+
{ type: Injectable, args: [{
|
|
461
|
+
providedIn: 'root'
|
|
462
|
+
},] }
|
|
463
|
+
];
|
|
464
|
+
StylesBundleService.ctorParameters = () => [
|
|
465
|
+
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
466
|
+
{ type: BBSFTranslateService }
|
|
467
|
+
];
|
|
468
|
+
|
|
322
469
|
class ControlValidationService {
|
|
323
470
|
constructor(utilityService) {
|
|
324
471
|
this.utilityService = utilityService;
|
|
325
472
|
this.requestOptions = new RequestOptionsModel();
|
|
326
473
|
this.isCreatedBefor = false;
|
|
327
474
|
}
|
|
328
|
-
showGlobalError(errorMessage, formId) {
|
|
475
|
+
showGlobalError(errorMessage, formId, deleteOld) {
|
|
329
476
|
let globalErorrElement = document.getElementsByClassName('alert alert-danger alert-InvalidValidation');
|
|
330
477
|
if (globalErorrElement.length > 0) {
|
|
331
478
|
this.removeElementsByClass('alert alert-danger alert-InvalidValidation');
|
|
@@ -336,28 +483,38 @@ class ControlValidationService {
|
|
|
336
483
|
// tslint:disable-next-line: prefer-const
|
|
337
484
|
if (!formId)
|
|
338
485
|
formId = "currentForm";
|
|
339
|
-
var
|
|
486
|
+
var object = document.getElementById(formId);
|
|
340
487
|
const tagName = 'div';
|
|
341
488
|
// tslint:disable-next-line: prefer-const
|
|
342
489
|
var elementToAppend = document.createElement(tagName); // Your tag name here
|
|
343
490
|
let message = "";
|
|
344
|
-
if (
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
//
|
|
491
|
+
if (!errorMessage || (typeof errorMessage == "string")) {
|
|
492
|
+
if (localStorage.getItem('language') == "ar")
|
|
493
|
+
message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
|
|
494
|
+
else
|
|
495
|
+
message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
|
|
496
|
+
elementToAppend.innerHTML = "<ul><li>" + message + "</li></ul>";
|
|
497
|
+
elementToAppend.className += 'alert alert-danger alert-InvalidValidation';
|
|
498
|
+
elementToAppend.id += 'errorId';
|
|
499
|
+
// tslint:disable-next-line: prefer-for-of
|
|
500
|
+
const elementToAppen = elementToAppend.cloneNode(true);
|
|
501
|
+
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
502
|
+
object.insertBefore(elementToAppen, object.firstChild);
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
elementToAppend.innerHTML = "<ul>";
|
|
506
|
+
for (const iterator of errorMessage) {
|
|
507
|
+
elementToAppend.innerHTML = "<li>" + iterator + "</li>";
|
|
508
|
+
}
|
|
509
|
+
elementToAppend.innerHTML = "</ul>";
|
|
510
|
+
elementToAppend.className += 'alert alert-danger alert-InvalidValidation';
|
|
511
|
+
elementToAppend.id += 'errorId';
|
|
512
|
+
// tslint:disable-next-line: prefer-for-of
|
|
355
513
|
const elementToAppen = elementToAppend.cloneNode(true);
|
|
356
|
-
let targetElement =
|
|
357
|
-
|
|
358
|
-
this.isCreatedBefor = true;
|
|
359
|
-
break;
|
|
514
|
+
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
515
|
+
object.insertBefore(elementToAppen, object.firstChild);
|
|
360
516
|
}
|
|
517
|
+
this.isCreatedBefor = true;
|
|
361
518
|
}
|
|
362
519
|
RemoveGlobalError() {
|
|
363
520
|
const removedList = document.getElementsByClassName('alert alert-danger alert-InvalidValidation');
|
|
@@ -399,10 +556,11 @@ class ControlValidationService {
|
|
|
399
556
|
elements[0].parentNode.removeChild(elements[0]);
|
|
400
557
|
}
|
|
401
558
|
}
|
|
402
|
-
renderServerErrors(form, err, requestOptions) {
|
|
559
|
+
renderServerErrors(form, err, requestOptions, formId) {
|
|
403
560
|
if (err.error == null) {
|
|
404
561
|
return;
|
|
405
562
|
}
|
|
563
|
+
let errorsArray = [];
|
|
406
564
|
this.requestOptions = requestOptions;
|
|
407
565
|
err.error.validation_errors.forEach((element) => {
|
|
408
566
|
let fieldName = element.field;
|
|
@@ -412,41 +570,45 @@ class ControlValidationService {
|
|
|
412
570
|
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${fieldName}: ${message}`);
|
|
413
571
|
}
|
|
414
572
|
else if (!this.hasControlName(form, controlName)) {
|
|
415
|
-
|
|
573
|
+
errorsArray.push(`${fieldName}: ${message}`);
|
|
574
|
+
// this.showGlobalError(`${fieldName}: ${message}`,formId )
|
|
416
575
|
}
|
|
417
576
|
else {
|
|
418
577
|
this.setFieldError(form, controlName, fieldName, message);
|
|
419
578
|
}
|
|
420
579
|
});
|
|
580
|
+
if (errorsArray.length > 0)
|
|
581
|
+
this.showGlobalError(errorsArray, formId);
|
|
421
582
|
}
|
|
422
583
|
hasControlName(form, controlName) {
|
|
423
584
|
let control = form.get(controlName);
|
|
424
585
|
return control != null;
|
|
425
586
|
}
|
|
426
587
|
setFieldError(form, controlName, fieldName, message) {
|
|
427
|
-
let control =
|
|
428
|
-
|
|
588
|
+
let control = null;
|
|
589
|
+
if (controlName)
|
|
590
|
+
control = form.get(controlName);
|
|
591
|
+
else
|
|
592
|
+
control = form.get(fieldName.split('.')[0]);
|
|
593
|
+
let errors = { "errorMassage": message };
|
|
429
594
|
let fieldNameArray = fieldName.split('.');
|
|
430
595
|
if (fieldNameArray.length >= 1) {
|
|
431
|
-
switch (fieldNameArray[length - 1].toLocaleLowerCase()) {
|
|
596
|
+
switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
|
|
432
597
|
case "english":
|
|
433
|
-
let englishControl = control.get("
|
|
598
|
+
let englishControl = control.get("English");
|
|
434
599
|
englishControl.setErrors(errors);
|
|
435
|
-
englishControl.markAsTouched();
|
|
436
|
-
englishControl.updateValueAndValidity();
|
|
437
600
|
break;
|
|
438
601
|
case "arabic":
|
|
439
|
-
let arabicControl = control.get("
|
|
602
|
+
let arabicControl = control.get("Arabic");
|
|
440
603
|
arabicControl.setErrors(errors);
|
|
441
|
-
arabicControl.markAsTouched();
|
|
442
|
-
arabicControl.updateValueAndValidity();
|
|
443
604
|
break;
|
|
444
605
|
default:
|
|
445
606
|
control.setErrors(errors);
|
|
446
|
-
control.markAsTouched();
|
|
447
|
-
control.updateValueAndValidity();
|
|
448
607
|
}
|
|
449
608
|
}
|
|
609
|
+
else if (fieldNameArray.length == 1) {
|
|
610
|
+
control.setErrors(errors);
|
|
611
|
+
}
|
|
450
612
|
else {
|
|
451
613
|
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${fieldName}: ${message}`);
|
|
452
614
|
}
|
|
@@ -465,119 +627,6 @@ __decorate([
|
|
|
465
627
|
BlockUI()
|
|
466
628
|
], ControlValidationService.prototype, "blockUI", void 0);
|
|
467
629
|
|
|
468
|
-
class RequestHandlerService {
|
|
469
|
-
constructor(http, authService, environmentService, utilityService, controlValidationService, bbsfTranslateService) {
|
|
470
|
-
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
471
|
-
this.http = http;
|
|
472
|
-
this.authService = authService;
|
|
473
|
-
this.environmentService = environmentService;
|
|
474
|
-
this.utilityService = utilityService;
|
|
475
|
-
this.controlValidationService = controlValidationService;
|
|
476
|
-
this.bbsfTranslateService = bbsfTranslateService;
|
|
477
|
-
this.requestOptions = new RequestOptionsModel();
|
|
478
|
-
this.currentLanguage = "";
|
|
479
|
-
this.onDestroy$ = new Subject();
|
|
480
|
-
this.bbsfTranslateService.onLangChange.subscribe((event) => {
|
|
481
|
-
if (this.currentLanguage != event.lang) {
|
|
482
|
-
this.currentLanguage = event.lang;
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
get(Url, params, requestOptions) {
|
|
487
|
-
if (requestOptions)
|
|
488
|
-
this.requestOptions = requestOptions;
|
|
489
|
-
let headers = new HttpHeaders({
|
|
490
|
-
'Content-Type': 'application/json',
|
|
491
|
-
'Authorization': this.authService.authorizationHeaderValue(),
|
|
492
|
-
});
|
|
493
|
-
this.currentLanguage = localStorage.getItem('language');
|
|
494
|
-
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
495
|
-
if (!this.requestOptions.disableBlockUI)
|
|
496
|
-
this.utilityService.startBlockUI();
|
|
497
|
-
return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
498
|
-
if (!this.requestOptions.disableBlockUI)
|
|
499
|
-
this.utilityService.stopBlockUI();
|
|
500
|
-
}));
|
|
501
|
-
}
|
|
502
|
-
post(Url, model, params, requestOptions) {
|
|
503
|
-
if (requestOptions)
|
|
504
|
-
this.requestOptions = requestOptions;
|
|
505
|
-
let headers = new HttpHeaders({
|
|
506
|
-
'Content-Type': 'application/json',
|
|
507
|
-
'Authorization': this.authService.authorizationHeaderValue(),
|
|
508
|
-
});
|
|
509
|
-
this.currentLanguage = localStorage.getItem('language');
|
|
510
|
-
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
511
|
-
if (!this.requestOptions.disableBlockUI)
|
|
512
|
-
this.utilityService.startBlockUI();
|
|
513
|
-
return this.http.post(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
514
|
-
if (!this.requestOptions.disableBlockUI)
|
|
515
|
-
this.utilityService.stopBlockUI();
|
|
516
|
-
}));
|
|
517
|
-
}
|
|
518
|
-
destroyHandler() {
|
|
519
|
-
this.onDestroy$.next();
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
RequestHandlerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RequestHandlerService_Factory() { return new RequestHandlerService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(AuthService), i0.ɵɵinject(EnvironmentService), i0.ɵɵinject(UtilityService), i0.ɵɵinject(ControlValidationService), i0.ɵɵinject(BBSFTranslateService)); }, token: RequestHandlerService, providedIn: "root" });
|
|
523
|
-
RequestHandlerService.decorators = [
|
|
524
|
-
{ type: Injectable, args: [{
|
|
525
|
-
providedIn: 'root'
|
|
526
|
-
},] }
|
|
527
|
-
];
|
|
528
|
-
RequestHandlerService.ctorParameters = () => [
|
|
529
|
-
{ type: HttpClient },
|
|
530
|
-
{ type: AuthService },
|
|
531
|
-
{ type: EnvironmentService },
|
|
532
|
-
{ type: UtilityService },
|
|
533
|
-
{ type: ControlValidationService },
|
|
534
|
-
{ type: BBSFTranslateService }
|
|
535
|
-
];
|
|
536
|
-
|
|
537
|
-
class StylesBundleService {
|
|
538
|
-
constructor(document, translateService) {
|
|
539
|
-
this.document = document;
|
|
540
|
-
this.translateService = translateService;
|
|
541
|
-
}
|
|
542
|
-
loadThemes(lang, bundleEnglishName, bundleArabicName) {
|
|
543
|
-
if (lang == "ar") {
|
|
544
|
-
this.loadStyleBundle(bundleArabicName.toString());
|
|
545
|
-
document.querySelector('html').setAttribute("lang", "ar");
|
|
546
|
-
document.querySelector('html').setAttribute("dir", "rtl");
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
this.loadStyleBundle(bundleEnglishName.toString());
|
|
550
|
-
document.querySelector('html').setAttribute("lang", "en");
|
|
551
|
-
document.querySelector('html').setAttribute("dir", "ltr");
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
loadStyleBundle(styleName) {
|
|
555
|
-
const head = this.document.getElementsByTagName('head')[0];
|
|
556
|
-
let themeLink = this.document.getElementById('client-theme');
|
|
557
|
-
if (themeLink && themeLink.href.includes(styleName)) {
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
else if (themeLink && !themeLink.href.includes(styleName)) {
|
|
561
|
-
themeLink.remove();
|
|
562
|
-
}
|
|
563
|
-
const style = this.document.createElement('link');
|
|
564
|
-
style.id = 'client-theme';
|
|
565
|
-
style.rel = 'stylesheet';
|
|
566
|
-
style.href = `${styleName}`;
|
|
567
|
-
head.appendChild(style);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
StylesBundleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StylesBundleService_Factory() { return new StylesBundleService(i0.ɵɵinject(i1$2.DOCUMENT), i0.ɵɵinject(BBSFTranslateService)); }, token: StylesBundleService, providedIn: "root" });
|
|
571
|
-
StylesBundleService.decorators = [
|
|
572
|
-
{ type: Injectable, args: [{
|
|
573
|
-
providedIn: 'root'
|
|
574
|
-
},] }
|
|
575
|
-
];
|
|
576
|
-
StylesBundleService.ctorParameters = () => [
|
|
577
|
-
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
578
|
-
{ type: BBSFTranslateService }
|
|
579
|
-
];
|
|
580
|
-
|
|
581
630
|
class MasterLayoutService {
|
|
582
631
|
constructor(router, http, authService, stylesBundleService, translate) {
|
|
583
632
|
this.router = router;
|