@csmart/ngc-smart-core 0.7.79 → 0.7.80
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/bundles/csmart-ngc-smart-core.umd.js +8 -2
- package/bundles/csmart-ngc-smart-core.umd.js.map +1 -1
- package/bundles/csmart-ngc-smart-core.umd.min.js +1 -1
- package/bundles/csmart-ngc-smart-core.umd.min.js.map +1 -1
- package/esm2015/lib/smart-auth/smart-auth.service.js +10 -3
- package/esm5/lib/smart-auth/smart-auth.service.js +10 -3
- package/fesm2015/csmart-ngc-smart-core.js +9 -2
- package/fesm2015/csmart-ngc-smart-core.js.map +1 -1
- package/fesm5/csmart-ngc-smart-core.js +10 -3
- package/fesm5/csmart-ngc-smart-core.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("penpal"),require("@angular/material"),require("@angular/forms"),require("@angular/common/http"),require("@azure/msal-angular"),require("@angular/router"),require("rxjs"),require("@angular/core"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@csmart/ngc-smart-core",["exports","@angular/common","penpal","@angular/material","@angular/forms","@angular/common/http","@azure/msal-angular","@angular/router","rxjs","@angular/core","rxjs/operators"],t):t((e.csmart=e.csmart||{},e.csmart["ngc-smart-core"]={}),e.ng.common,e.penpal,e.ng.material,e.ng.forms,e.ng.common.http,e.msalAngular,e.ng.router,e.rxjs,e.ng.core,e.rxjs.operators)}(this,function(e,t,n,r,o,i,a,s,f,c,l){"use strict";function d(e,a,s,f){return new(s=s||Promise)(function(t,n){function r(e){try{i(f.next(e))}catch(t){n(t)}}function o(e){try{i(f["throw"](e))}catch(t){n(t)}}function i(e){e.done?t(e.value):function n(t){return t instanceof s?t:new s(function(e){e(t)})}(e.value).then(r,o)}i((f=f.apply(e,a||[])).next())})}function h(r,o){var i,a,s,e,f={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),"throw":t(1),"return":t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function n(e){if(i)throw new TypeError("Generator is already executing.");for(;f;)try{if(i=1,a&&(s=2&e[0]?a["return"]:e[0]?a["throw"]||((s=a["return"])&&s.call(a),0):a.next)&&!(s=s.call(a,e[1])).done)return s;switch(a=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return f.label++,{value:e[1],done:!1};case 5:f.label++,a=e[1],e=[0];continue;case 7:e=f.ops.pop(),f.trys.pop();continue;default:if(!(s=0<(s=f.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){f=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){f.label=e[1];break}if(6===e[0]&&f.label<s[1]){f.label=s[1],s=e;break}if(s&&f.label<s[2]){f.label=s[2],f.ops.push(e);break}s[2]&&f.ops.pop(),f.trys.pop();continue}e=o.call(r,f)}catch(t){e=[6,t],a=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([t,e])}}}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i["return"])&&n.call(i)}finally{if(o)throw o.error}}return a}function p(){}function m(){}function g(){}function v(){this.selectedRole="*"}function S(){this.intakeFlag=!1}function y(){}var b=(O.selectedOffender="smart-selected-offender",O.loginStaff="smart-login-staff",O.offenderQuery="smart-offender-query",O);function O(){}var I=new c.InjectionToken("SMART Web Storage Listener URL"),x=new c.InjectionToken("SMART Web Portal URL"),L=new c.InjectionToken("SMART Data Service URL"),M=(w.prototype.init=function(){var e=this.document.createElement("iframe");e.src=this.smartStorageListenerUrl,e.id="childframe",e.name=Math.random().toString(),e.onload=null,e.style.visibility="hidden",this.document.body.appendChild(e),this.connection=n.connectToChild({iframe:e,debug:!1})},w.prototype.getStaffOffenderListOptions=function(e){var t="{findvStaffOffenderListOptions(input:{\n where:{\n staffId: "+e+"\n }\n }){\n data{\n offenderListOptionId\n name\n serviceApiFieldName\n selectedFlag\n }\n } }";return this.httpClient.post(this.smartDataServiceUrl,{query:t}).pipe(l.map(function(e){var t=e.data;return t.findvStaffOffenderListOptions.data.offenderOptionListId=t.findvStaffOffenderListOptions.data.offenderListOptionId,t.findvStaffOffenderListOptions.data}))},w.prototype.clearAll=function(){var t=this;this.connection.promise.then(function(e){e.clearAll(),t.offenderSubject.next(),t.staffSubject.next()})},w.prototype.setSelectedOffender=function(t){var n=this;this.connection.promise.then(function(e){e.setSelectedOffender(t),n.offenderSubject.next(t)})},w.prototype.getSelectedOffender=function(){return this.connection.promise.then(function(e){return e.getSelectedOffender(b.selectedOffender)})},w.prototype.clearSelectedOffender=function(){var t=this;this.connection.promise.then(function(e){e.clearSelectedOffender(),t.offenderSubject.next()})},w.prototype.getOffenderUpdate=function(){return this.offenderSubject.asObservable()},w.prototype.setLoginStaff=function(t){var n=this;this.connection.promise.then(function(e){e.setLoginStaff(t),n.staffSubject.next(t)})},w.prototype.getLoginStaff=function(){return this.connection.promise.then(function(e){return e.getLoginStaff(b.loginStaff)})},w.prototype.clearLoginStaff=function(){var t=this;this.connection.promise.then(function(e){e.clearLoginStaff(),t.staffSubject.next()})},w.prototype.getStaffUpdate=function(){return this.staffSubject.asObservable()},w.prototype.refreshLoginStaffOptions=function(){var n=this;this.getLoginStaff().then(function(t){n.getStaffOffenderListOptions(t.staffId).subscribe(function(e){console.log(e),t.options=e,n.setLoginStaff(t)})})},w.prototype.setOffenderQuery=function(t){var n=this;this.connection.promise.then(function(e){e.setOffenderQuery(t),n.offenderQuerySubject.next(t)})},w.prototype.getOffenderQuery=function(){return this.connection.promise.then(function(e){return e.getOffenderQuery(b.offenderQuery)})},w.prototype.clearOffenderQuery=function(){var t=this;this.connection.promise.then(function(e){e.clearOffenderQuery(),t.offenderQuerySubject.next()})},w.prototype.getOffenderQueryUpdate=function(){return this.offenderQuerySubject.asObservable()},w.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],w.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[t.DOCUMENT]}]},{type:String,decorators:[{type:c.Inject,args:[I]}]},{type:i.HttpClient},{type:undefined,decorators:[{type:c.Inject,args:[L]}]}]},w.ngInjectableDef=c.defineInjectable({factory:function(){return new w(c.inject(t.DOCUMENT),c.inject(I),c.inject(i.HttpClient),c.inject(L))},token:w,providedIn:"root"}),w);function w(e,t,n,r){this.document=e,this.smartStorageListenerUrl=t,this.httpClient=n,this.smartDataServiceUrl=r,this.offenderSubject=new f.Subject,this.staffSubject=new f.Subject,this.offenderQuerySubject=new f.Subject,c.isDevMode&&console.log("SmartStorage XdmService (Client) - constructor()"),this.init()}var E=(C.prototype.getStaffOffenders=function(e){var t="\n query getStaffOffenderList{\n filterOffenderList(input: {staffId: "+e+"}) {\n data {\n offenderId\n offenderName\n pdId\n birthDate\n gender\n }\n }\n }\n ";return this.http.post(this.smartDataServiceUrl,{query:t}).pipe(l.map(function(e){return e.data.filterOffenderList.data}))},C.decorators=[{type:c.Injectable}],C.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[L]}]},{type:i.HttpClient}]},C);function C(e,t){this.smartDataServiceUrl=e,this.http=t}var R=(A.prototype.ngOnInit=function(){var t=this;this.isAuthenticated=!!this.authnService.getAccount(),this.xdmService.getLoginStaff().then(function(e){t.loginStaff=e||null}),this.xdmService.getSelectedOffender().then(function(e){t.selectedOffender=e&&e.offenderId?e:null}),this.subscription=this.xdmService.getOffenderUpdate().subscribe(function(e){t.selectedOffender=e,t.setSelectedOffenderControl()}),this.xdmService.getOffenderQuery().then(function(e){e&&(t.offenderQueryList=e.offenders,t.setSelectedOffenderControl())}),this.offenderQuerySubscription=this.xdmService.getOffenderQueryUpdate().subscribe(function(e){e&&e.offenders&&(t.offenderQueryList=function n(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e}(e.offenders))}),this.selectedOffenderControl$.valueChanges.subscribe(function(e){return t.onOffenderSelected(e)}),this.router.routeReuseStrategy.shouldReuseRoute=function(){return!1}},A.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},A.prototype.onOffenderSelected=function(e){e&&(this.selectedOffender=e,this.xdmService.setSelectedOffender(this.selectedOffender),this.reloadCurrentRoute())},A.prototype.setSelectedOffenderControl=function(){var t=this;if(this.selectedOffender&&this.offenderQueryList&&0<this.offenderQueryList.length){var e=this.offenderQueryList.find(function(e){return e.offenderId===t.selectedOffender.offenderId});e&&this.selectedOffenderControl$.setValue(e,{emitEvent:!1}),!e&&0<this.offenderQueryList.length&&this.selectedOffenderControl$.setValue(this.offenderQueryList[0],{emitEvent:!1})}},A.prototype.reloadCurrentRoute=function(){try{var e=this.router.parseUrl(this.router.url);e&&e.root&&e.root.segments&&1<e.root.segments.length?this.router.navigate([e.root.segments[0].path]):e&&e.root&&e.root.children&&e.root.children.primary&&e.root.children.primary.segments&&1<e.root.children.primary.segments.length?this.router.navigate([e.root.children.primary.segments[0].path]):this.router.navigate([this.router.url])}catch(t){this.router.navigateByUrl("/")}},A.prototype.hasIntakeRole=function(e){return!!(e&&0<e.length)&&-1<e.findIndex(this.isIntakeRole)},A.prototype.isIntakeRole=function(e){switch(e.roleId){case"OPA":case"OPS":case"SOPS":return!0;default:return!1}},A.decorators=[{type:c.Component,args:[{selector:"app-smart-offender-header",template:'<div\r\n class="offender-header-container"\r\n *ngIf="selectedOffender && isAuthenticated">\r\n <div class="offender-header-name-item">\r\n <mat-form-field appearance="standard" class="switch-offender">\r\n <mat-label>Switch Offender</mat-label>\r\n <mat-select [formControl]="selectedOffenderControl$">\r\n <mat-option\r\n *ngFor="let offender of offenderQueryList"\r\n [value]="offender">\r\n {{ offender?.name}} ({{offender?.offenderId}})\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <div class="offender-header-id-item">\r\n <span class="item-label">PDID:</span> {{ selectedOffender.pdId }}\r\n </div>\r\n <div class="offender-header-id-item">\r\n <span class="item-label">CSOSA ID:</span>\r\n {{ selectedOffender.offenderId }}\r\n </div>\r\n </div>\r\n</div>\r\n',styles:[".offender-header-container{display:-ms-grid;display:grid;-ms-grid-columns:2fr 1fr;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,'Helvetica Neue',sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:-ms-grid;display:grid;-ms-grid-columns:80px 80px;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width:740px){.offender-header-container{display:-ms-grid;display:grid;-ms-grid-rows:1fr 1fr;grid-template-rows:1fr 1fr;-ms-grid-columns:1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,'Helvetica Neue',sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}"]}]}],A.ctorParameters=function(){return[{type:M},{type:a.MsalService},{type:E},{type:s.Router}]},A);function A(e,t,n,r){this.xdmService=e,this.authnService=t,this.smartOffenderHeaderService=n,this.router=r,this.selectedOffenderControl$=new o.FormControl}var j=(U.prototype.getNavbarConfigs=function(e){return this.http.post(e,{query:"\n {\n findAppModules {\n data {\n appModuleId\n name\n url\n offenderSpecificFlag\n displayOrder\n }\n }\n }"}).pipe(l.map(function(e){var t=e.data;return c.isDevMode()&&console.log(t),t.findAppModules.data}))},U.decorators=[{type:c.Injectable}],U.ctorParameters=function(){return[{type:i.HttpClient}]},U);function U(e){this.http=e}var k=(T.prototype.ngOnChanges=function(){},T.prototype.ngOnInit=function(){var t=this;this.xdmService.getSelectedOffender().then(function(e){t.selectedOffender=e&&e.offenderId?e:null}),this.xdmService.getLoginStaff().then(function(e){t.loginStaff=e||null}),this.offenderSubscription=this.xdmService.getOffenderUpdate().subscribe(function(e){t.selectedOffender=e}),this.staffSubscription=this.xdmService.getStaffUpdate().subscribe(function(e){t.loginStaff=e}),this.navbarConfigService.getNavbarConfigs(this.serviceApiUrl).subscribe(function(e){t.navbarConfigs=e.sort(function(e,t){return e.displayOrder<t.displayOrder?-1:e.displayOrder>t.displayOrder?1:0})}),this.isAuthenticated=!!this.authnService.getAccount()},T.prototype.ngOnDestroy=function(){this.offenderSubscription.unsubscribe(),this.staffSubscription.unsubscribe()},T.prototype.logout=function(){this.xdmService.clearAll(),this.authnService.logout()},T.prototype.hasAppModulePermission=function(t){return!!(this.loginStaff&&this.loginStaff.permissions&&0<this.loginStaff.permissions.length)&&-1<this.loginStaff.permissions.findIndex(function(e){return e.appModuleId===t})},Object.defineProperty(T.prototype,"hasExternalUserRole",{get:function(){return!!(this.loginStaff&&this.loginStaff.roles&&0<this.loginStaff.roles.length)&&-1<this.loginStaff.roles.findIndex(this.isExternalRole)},enumerable:!0,configurable:!0}),T.prototype.isExternalRole=function(e){switch(e.roleId){case"EUDTL":case"EUDUSM":case"EUJDG":case"EUMPD":case"EUSOTV":case"EUUSA2":case"EUUSAO":case"EUUSPC":return!0;default:return!1}},T.decorators=[{type:c.Component,args:[{selector:"app-smart-navbar",template:'\x3c!--\r\n<a class="smart-navbar-toggle open" href="#nav">\r\n <i class="material-icons">menu</i>\r\n</a>\r\n\r\n<nav id="nav" role="navigation" class="smart-navbar-container">\r\n <a class="smart-navbar-toggle close" href="#">\r\n <i class="material-icons">close</i>\r\n </a>\r\n\r\n <span *ngFor="let config of navbarConfigs">\r\n <a mat-button class="smart-navbar-item" \r\n *ngIf="(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff" href="{{config.url}}">{{config.name}}</a>\r\n </span>\r\n\r\n <button mat-button class="smart-navbar-item" [matMenuTriggerFor]="menuTheme">Set Theme</button>\r\n <mat-menu #menuTheme="matMenu">\r\n <button mat-menu-item (click)="onSetTheme(\'blue-theme\')">Blue</button>\r\n <button mat-menu-item (click)="onSetTheme(\'red-theme\')">Red</button>\r\n <button mat-menu-item (click)="onSetTheme(\'green-theme\')">Green</button>\r\n </mat-menu>\r\n <button mat-button class="smart-navbar-item smart-navbar-last-item" [matMenuTriggerFor]="menu"\r\n *ngIf="isAuthenticated && loginStaff">{{loginStaff.firstName + \' \' + loginStaff.lastName}}</button>\r\n <mat-menu #menu="matMenu">\r\n <button mat-menu-item>Profile</button>\r\n <button mat-menu-item (click)="logout()">Sign Out</button>\r\n </mat-menu>\r\n</nav>\r\n--\x3e\r\n\r\n\x3c!-- <nav mat-tab-nav-bar>\r\n <a mat-tab-link mat-flat-button *ngFor="let config of navbarConfigs" [active]="appModuleId == config.appModuleId" href="{{config.url}}">{{config.name}}</a>\r\n</nav> --\x3e\r\n\r\n<mat-tab-group class="nav-tab-group" [selectedIndex]="null">\r\n <ng-container *ngFor="let config of navbarConfigs">\r\n <mat-tab\r\n *ngIf="\r\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\r\n (!hasExternalUserRole && (config.offenderSpecificFlag === false || selectedOffender))) &&\r\n isAuthenticated &&\r\n loginStaff \r\n "\r\n label="config.name"\r\n >\r\n <ng-template mat-tab-label>\r\n <a\r\n mat-flat-button\r\n [ngClass]="{ \'main-menu-active\': appModuleId == config.appModuleId }"\r\n href="{{ config.url }}"\r\n >{{ config.name }}</a\r\n >\r\n </ng-template>\r\n </mat-tab>\r\n </ng-container>\r\n</mat-tab-group>\r\n',encapsulation:c.ViewEncapsulation.None,styles:[".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color,#9fa8da);-webkit-text-decoration-line:none;text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid #00008b!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width:768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width:767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translateX(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}"]}]}],T.ctorParameters=function(){return[{type:j},{type:M},{type:a.MsalService}]},T.propDecorators={serviceApiUrl:[{type:c.Input}],appModuleId:[{type:c.Input}],tabGroup:[{type:c.ViewChild,args:["tabs"]}]},T);function T(e,t,n){this.navbarConfigService=e,this.xdmService=t,this.authnService=n,this.appModuleId="SMART",this.isAuthenticated=!1}var F=(P.prototype.ngOnInit=function(){this.type=this.route.snapshot.queryParamMap.get("type")||"staff",this.message=this.route.snapshot.queryParamMap.get("message")||"Error occured."},P.prototype.logout=function(){this.authnService.logout()},P.prototype.portal=function(){window.location.href=this.smartWebPortalUrl},P.decorators=[{type:c.Component,args:[{selector:"app-smart-error",template:'<div>\r\n <h2>\r\n {{ message }}\r\n </h2>\r\n <p>\r\n Please contact help desk if needed.\r\n </p>\r\n <div>\r\n <button (click)="logout()" *ngIf="type === \'staff\'">OK</button>\r\n <button (click)="portal()" *ngIf="type === \'offender\'">OK</button>\r\n </div>\r\n</div>\r\n',styles:["div{text-align:center}"]}]}],P.ctorParameters=function(){return[{type:a.MsalService},{type:s.ActivatedRoute},{type:String,decorators:[{type:c.Inject,args:[x]}]}]},P);function P(e,t,n){this.authnService=e,this.route=t,this.smartWebPortalUrl=n}var D=(N.prototype.showMessage=function(e){this.matSnackBar.open(e,null,{duration:2e3})},N.prototype.convertEmptyToNull=function(t){var n=this;t&&(t instanceof Array&&t.forEach(function(e){n.convertEmptyToNull(e)}),Object.keys(t).forEach(function(e){"object"==typeof t[e]?n.convertEmptyToNull(t[e]):"string"==typeof t[e]&&""===t[e].trim()&&(t[e]=null)}))},N.prototype.getGraphQueryData=function(t,e){return this.http.post(this.serviceApiUrl,{query:e}).pipe(l.map(function(e){return e.data[t]}))},N.prototype.getOffenderListOptions=function(){var e="findOffenderListOptions";return this.getGraphQueryData(e,"{\n findOffenderListOptions {\n data {\n offenderListOptionId\n name\n serviceApiFieldName\n }\n message\n }\n }")},N.prototype.getStaffOffenderListOptions=function(e){var t="{findStaffOffenderListOptions(input:{\n where:{\n staffId: "+e+"\n }\n }){\n data{\n offenderListOptionId\n }\n } }";return this.http.post(this.serviceApiUrl,{query:t}).pipe(l.map(function(e){return e.data.findStaffOffenderListOptions.data}))},N.prototype.saveStaffOffenderListOptionsData=function(e){var t="mutation {\n upsertStaffOffenderListOption(input: "+this.convertToString(e)+") {\n message\n }\n }";return this.http.post(this.serviceApiUrl,{query:t})},N.prototype.convertToString=function(t){var n=this,r="";return t&&(t instanceof Array?(r+=" [",t.forEach(function(e){r+=n.convertToString(e)}),r+="],"):(r+="{",Object.keys(t).forEach(function(e){"object"==typeof t[e]?r+=e+":"+n.convertToString(t[e]):isNaN(t[e])?r+=e+':"'+t[e]+'",':r+=e+":"+t[e]+","}),r=r.substring(0,r.length-1),r+="},")),r},N.decorators=[{type:c.Injectable}],N.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[L]}]},{type:i.HttpClient},{type:r.MatSnackBar}]},N);function N(e,t,n){this.serviceApiUrl=e,this.http=t,this.matSnackBar=n}var Q=(q.prototype.ngOnInit=function(){var t=this,e=this.route.snapshot.data;this.loginStaff=e.loginStaff,this.offenderListOptions=e.selectedOffenderResolverService,this.frmGroup=this.createForm(),this.offenderService.getStaffOffenderListOptions(this.loginStaff.staffId).subscribe(function(e){t.fillForm(e)})},q.prototype.fillForm=function(e){if(e){var t=this.frmGroup.get("offenderListOptions");e.forEach(function(e){t.get(e.offenderListOptionId).setValue(!0)})}},q.prototype.createForm=function(){var n=new o.FormGroup({});return this.offenderListOptions.forEach(function(e,t){n.addControl(e.offenderListOptionId,new o.FormControl(!1))}),new o.FormGroup({offenderListOptions:n})},q.prototype.onSave=function(){var t=this,n={options:[],staffId:this.loginStaff.staffId,modifiedBy:this.loginStaff.staffId},r=this.frmGroup.get("offenderListOptions").value;Object.keys(r).forEach(function(e){r[e]&&n.options.push({offenderListOptionId:e})}),this.offenderService.saveStaffOffenderListOptionsData(n).subscribe(function(e){e.message?t.offenderService.showMessage(e.message):(t.offenderService.showMessage("Saved successfully"),t.xdmService.refreshLoginStaffOptions())})},q.decorators=[{type:c.Component,args:[{selector:"lib-smart-staff-offender-options",template:'<form class="main-form" [formGroup]="frmGroup">\n <mat-card role="group">\n <mat-card-content>\n <div formGroupName="offenderListOptions">\n <div style="float:left;">\n <div *ngFor="let offenderListOption of offenderListOptions; let i = index">\n <mat-checkbox *ngIf="i%2!=0" color="primary" formControlName="{{offenderListOption.offenderListOptionId}}">\n {{offenderListOption.name}}\n </mat-checkbox>\n </div>\n </div>\n <div>\n <div *ngFor="let offenderListOption of offenderListOptions; let i = index" >\n <mat-checkbox *ngIf="i%2==0" color="primary" formControlName="{{offenderListOption.offenderListOptionId}}">\n {{offenderListOption.name}}\n </mat-checkbox> \n </div>\n </div>\n </div>\n </mat-card-content>\n <div align="center">\n <button mat-raised-button color="accent" (click)="onSave()">Save</button>\n </div>\n </mat-card>\n </form>\n ',styles:[""]}]}],q.ctorParameters=function(){return[{type:s.ActivatedRoute},{type:D},{type:M}]},q);function q(e,t,n){this.route=e,this.offenderService=t,this.xdmService=n,this.offenderListOptions=[]}var G=(H.prototype.getLoginStaff=function(){var r=this;if(c.isDevMode&&console.log("SmartAuthService - getLoginStaff()"),!c.isDevMode&&this.loginStaff){if(this.loginStaff.staffId)return c.isDevMode&&console.log("##### getLoginStaff(): get internal instance in service",this.loginStaff),f.of(this.loginStaff);if(this.loginStaff.userName)return c.isDevMode&&console.log("##### getLoginStaff(): get using preset user name",this.loginStaff),this.getStaff(this.loginStaff.userName)}return f.from(this.xdmService.getLoginStaff()).pipe(l.switchMap(function(e){if(e&&e.staffId)return c.isDevMode&&console.log("##### getLoginStaff(): get from session.",e),r.loginStaff=e,f.of(e);if(e&&e.userName)return c.isDevMode&&console.log("##### getLoginStaff(): get using preset user name",r.loginStaff),r.getStaff(e.userName);var t=r.authnService.getAccount().userName,n=t.substring(0,t.indexOf("@"));return c.isDevMode&&console.log("##### loginLoginStaff(): get using login staff name ",n),r.getStaff(n)}))},H.prototype.getTeamUrl=function(e,t){var n=window.location.href.indexOf("web-"),r=window.location.href.substring(0,n)+"web-",o=window.location.href.replace(r,"");n=o.indexOf("-",0);var i=o.substring(n);return r+e+(i=i.replace(window.location.pathname,""))+t},H.prototype.redirectToTeam=function(e){0<e.roles.filter(function(e){return"EUUSPC"===e.roleId}).length&&(window.location.href=this.getTeamUrl("investigation","/assignment"))},H.prototype.setSelectedOffender=function(n){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return n?[4,this.getStaffOffenderRelation(this.loginStaff.staffId,n.offenderId).toPromise()]:[3,2];case 1:t=e.sent(),n.assignmentStaffRelationId=t||"NOASSIGN",e.label=2;case 2:return this.xdmService.setSelectedOffender(n),this.selectedOffender=n,[2]}})})},H.prototype.logout=function(){this.xdmService.clearAll(),this.authnService.logout()},H.prototype.setPermission=function(p,i){return d(this,void 0,void 0,function(){var t,f,c,n,r,l,o,d,u=this;return h(this,function(e){switch(e.label){case 0:return this.loginStaff?[3,2]:[4,(t=this).xdmService.getLoginStaff()];case 1:t.loginStaff=e.sent(),e.label=2;case 2:return f=this.loginStaff.permissions,c=i.url[0].path,this.selectedOffender?[3,4]:[4,(n=this).xdmService.getSelectedOffender()];case 3:n.selectedOffender=e.sent(),e.label=4;case 4:return this.selectedOffender?[4,this.getStaffOffenderRelation(this.loginStaff.staffId,this.selectedOffender.offenderId).toPromise()]:[3,6];case 5:r=e.sent(),this.selectedOffender.assignmentStaffRelationId=r||"NOASSIGN",this.xdmService.setSelectedOffender(this.selectedOffender),e.label=6;case 6:return l=this.selectedOffender.assignmentStaffRelationId,o=document.querySelectorAll('[class^="sac-"]'),d=/^sac-(\S+)-(\S+)$/i,Array.from(o).forEach(function(i){var a,s;i.classList.forEach(function(e){var t=e.match(d);if(t&&2<t.length){var n=t[1]?t[1].toUpperCase():null,r=t[2],o=f.find(function(e){return e.appModuleId===p&&e.resource===c&&e.roleId===n&&e.assignmentStaffRelationId===l});console.log("##### Matched permission: ",o),o?"read"===r?o.readFlag?a=!1:!1!==a&&(a=!0):"create"===r&&!o.createFlag||"update"===r&&!o.updateFlag||"delete"===r&&!o.deleteFlag||"assign"===r&&!o.assignFlag||"close"===r&&!o.closeFlag||"expunge"===r&&!o.expungeFlag||"reopen"===r&&!o.reopenFlag?"BUTTON"===i.nodeName?!1!==a&&(a=!0):!1!==s&&(s=!0):"BUTTON"===i.nodeName?a=!1:s=!1:"read"===r?!1!==a&&(a=!0):"BUTTON"===i.nodeName?!1!==a&&(a=!0):!1!==s&&(s=!0)}}),console.log("hide: ",a),console.log("disable: ",s),!0===a?u.hideHtmlElement(i):!0===s&&u.disableHtmlElement(i)}),[2]}})})},H.prototype.checkPermission=function(t){var e=t.route.data;this.loginStaff=e.loginStaff,this.selectedOffender=e.selectedOffender;var n=this.loginStaff.permissions,r=t.route.url[0].path,o=t.roleId?t.roleId.toUpperCase():null,i=t.accessType,a=(this.selectedOffender.assignmentStaffRelationId&&this.selectedOffender.assignmentStaffRelationId,n.find(function(e){return e.appModuleId===t.appModuleId&&e.resource===r&&(!o||e.roleId===o)}));return!(!a||("read"===i?!a.readFlag:"create"===i&&!a.createFlag||"update"===i&&!a.updateFlag||"delete"===i&&!a.deleteFlag||"assign"===i&&!a.assignFlag||"close"===i&&!a.closeFlag||"expunge"===i&&!a.expungeFlag||"reopen"===i&&!a.reopenFlag))},H.prototype.canAppFeatureActivate=function(e,t,n){return void 0===n&&(n=null),!this.hasExternalUserRole(e.roles)||this.hasAppFeaturePermission(e.permissions,t,n)},H.prototype.hasExternalUserRole=function(e){return!!(e&&0<e.length)&&-1<e.findIndex(this.isExternalRole)},H.prototype.hasIntakeRole=function(e){return!!(e&&0<e.length)&&-1<e.findIndex(this.isIntakeRole)},H.prototype.hasAppFeaturePermission=function(e,t,n){return!!(e&&0<e.length)&&(n?-1<e.findIndex(function(e){return e.resource===t&&e.appModuleId===n}):-1<e.findIndex(function(e){return e.resource===t}))},H.prototype.isExternalRole=function(e){switch(e.roleId){case"EUDTL":case"EUDUSM":case"EUJDG":case"EUMPD":case"EUSOTV":case"EUUSA2":case"EUUSAO":case"EUUSPC":return!0;default:return!1}},H.prototype.isIntakeRole=function(e){switch(e.roleId){case"OPA":case"OPS":case"SOPS":return!0;default:return!1}},H.prototype.disableHtmlElement=function(e){switch(e.nodeName){case"A":e.setAttribute("style","pointer-events: none;cursor: not-allowed;"),e.setAttribute("tabIndex","-1");break;default:e.setAttribute("disabled","disabled")}},H.prototype.hideHtmlElement=function(e){e.setAttribute("style","display: none;")},H.prototype.getStaff=function(e){var n=this,t='\n {\n findvStaffs(input: {where: {userName: "'+e+'", activeFlag: true}}) {\n totalCount\n message\n data {\n staffId\n userName\n lastName\n firstName\n phone\n email\n roles {\n roleId\n role\n }\n permissions {\n roleId\n appModuleId\n resource\n assignmentStaffRelationId\n readFlag\n createFlag\n updateFlag\n deleteFlag\n assignFlag\n reopenFlag\n closeFlag\n expungeFlag\n }\n options {\n offenderListOptionId\n name\n serviceApiFieldName\n selectedFlag\n }\n }\n }\n }';return this.http.post(this.smartDataServiceUrl,{query:t}).pipe(l.take(1),l.map(function(e){if(c.isDevMode&&console.log("##### getStaff() from service ",e),0<e.data.findvStaffs.data.length){var t=e.data.findvStaffs.data[0];return n.xdmService.setLoginStaff(t),n.loginStaff=t}return null}),l.catchError(function(e){return console.log("error "+e),null}))},H.prototype.getStaffOffenderRelation=function(e,t){var n="\n {\n findvStaffOffenderRelations(input: {where: {staffId: "+e+", offenderId: "+t+"}}) {\n data {\n assignmentStaffRelationId\n }\n }\n }";return this.http.post(this.smartDataServiceUrl,{query:n}).pipe(l.take(1),l.map(function(e){return c.isDevMode&&console.log("##### getStaffOffenderRelation() from service ",e),0<e.data.findvStaffOffenderRelations.data.length?e.data.findvStaffOffenderRelations.data[0].assignmentStaffRelationId:null}),l.catchError(function(e){return console.log("error "+e),null}))},H.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],H.ctorParameters=function(){return[{type:i.HttpClient},{type:a.MsalService},{type:M},{type:undefined,decorators:[{type:c.Inject,args:[L]}]}]},H.ngInjectableDef=c.defineInjectable({factory:function(){return new H(c.inject(i.HttpClient),c.inject(a.MsalService),c.inject(M),c.inject(L))},token:H,providedIn:"root"}),H);function H(e,t,n,r){this.http=e,this.authnService=t,this.xdmService=n,this.smartDataServiceUrl=r}var B=(_.prototype.ngOnInit=function(){this.checkAccess()},_.prototype.checkAccess=function(){if(this.accessControlConfig&&this.accessControlConfig.route&&this.accessControlConfig.route.data&&this.accessControlConfig.route.data.loginStaff&&this.accessControlConfig.route.data.selectedOffender){var e=this.accessControlConfig.route.data.loginStaff;this.auth.hasExternalUserRole(e.roles)&&(this.elementRef.nativeElement.style.display=this.auth.checkPermission(this.accessControlConfig)?"block":"none")}},_.decorators=[{type:c.Directive,args:[{selector:"[accessControl]"}]}],_.ctorParameters=function(){return[{type:c.ElementRef},{type:G}]},_.propDecorators={accessControlConfig:[{type:c.Input}]},_);function _(e,t){this.elementRef=e,this.auth=t}var z=(V.prototype.canActivate=function(r){var o=this;return this.authnService.getLoginStaff().pipe(l.take(1),l.mergeMap(function(e){if(!e||!r||!r.routeConfig)return f.of(!1);if(!o.authnService.hasExternalUserRole(e.roles))return f.of(!0);var t=r.routeConfig.path?r.routeConfig.path.split("/")[0]:"",n=o.authnService.canAppFeatureActivate(e,t);return f.of(n)}),l.catchError(function(e){return f.of(!1)}))},V.decorators=[{type:c.Injectable}],V.ctorParameters=function(){return[{type:G}]},V);function V(e){this.authnService=e}var W=($.decorators=[{type:c.NgModule,args:[{declarations:[R,k,F,Q,B],imports:[t.CommonModule,i.HttpClientModule,r.MatButtonModule,r.MatMenuModule,r.MatTabsModule,r.MatSelectModule,r.MatCardModule,r.MatCheckboxModule,o.ReactiveFormsModule],exports:[R,k,F,Q,B],providers:[j,E,D,z,r.MatSnackBar]}]}],$);function $(){}var X=(K.prototype.resolve=function(e,t){var n=this;return this.authnService.getLoginStaff().pipe(l.take(1),l.mergeMap(function(e){return c.isDevMode&&console.log("LoginStaffResolverService: ",e),e?f.of(e):f.throwError("Not authorized to access SMART.")}),l.catchError(function(e){return console.log("LoginStaffResolverService: "+e),n.router.navigate(["/smart-error"],{queryParams:{type:"staff",message:"SMART Authentication: "+e}}),f.EMPTY}))},K.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],K.ctorParameters=function(){return[{type:G},{type:s.Router}]},K.ngInjectableDef=c.defineInjectable({factory:function(){return new K(c.inject(G),c.inject(s.Router))},token:K,providedIn:"root"}),K);function K(e,t){this.authnService=e,this.router=t}var J=(Y.prototype.resolve=function(e,t){var n=this;return f.from(this.service.getSelectedOffender()).pipe(l.mergeMap(function(e){return c.isDevMode&&console.log(e),e?f.of(e):f.throwError("No offender selected.")}),l.retryWhen(function(e){return e.pipe(l.delay(1e3),l.take(5),function(e){return f.concat(e,f.throwError("No offender selected (failed after retries)."))})}),l.catchError(function(e){return n.router.navigate(["/smart-error"],{queryParams:{type:"offender",message:e}}),f.EMPTY}))},Y.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],Y.ctorParameters=function(){return[{type:M},{type:c.NgZone},{type:s.Router}]},Y.ngInjectableDef=c.defineInjectable({factory:function(){return new Y(c.inject(M),c.inject(c.NgZone),c.inject(s.Router))},token:Y,providedIn:"root"}),Y);function Y(e,t,n){this.service=e,this.zone=t,this.router=n}var Z=(ee.prototype.resolve=function(){return this.offenderService.getOffenderListOptions().pipe(l.map(function(e){return e.data}))},ee.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],ee.ctorParameters=function(){return[{type:D}]},ee.ngInjectableDef=c.defineInjectable({factory:function(){return new ee(c.inject(D))},token:ee,providedIn:"root"}),ee);function ee(e){this.offenderService=e}e.NgcSmartCoreModule=W,e.SmartAuthService=G,e.LoginStaffResolverService=X,e.SelectedOffenderResolverService=J,e.SmartErrorComponent=F,e.SmartNavbarService=j,e.XdmService=M,e.Permission=p,e.Role=m,e.Option=g,e.LoginStaff=v,e.SelectedOffender=S,e.OffenderQuery=y,e.StorageKey=b,e.SMART_WEB_STORAGE_LISTENER_URL=I,e.SMART_WEB_PORTAL_URL=x,e.SMART_DATA_SERVICE_URL=L,e.SmartStaffOffenderOptionsComponent=Q,e.SmartStaffOffenderOptionsResolverService=Z,e.AccessType={READ:"read",CREATE:"create",UPDATE:"update",DELETE:"delete",EXPUNGE:"expunge",ASSIGN:"assign",REOPEN:"reopen",CLOSE:"close"},e.SmartAuthorizationGuard=z,e.ɵe=B,e.ɵc=k,e.ɵa=R,e.ɵb=E,e.ɵd=D,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("penpal"),require("@angular/material"),require("@angular/forms"),require("@angular/common/http"),require("@azure/msal-angular"),require("@angular/router"),require("rxjs"),require("@angular/core"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@csmart/ngc-smart-core",["exports","@angular/common","penpal","@angular/material","@angular/forms","@angular/common/http","@azure/msal-angular","@angular/router","rxjs","@angular/core","rxjs/operators"],t):t((e.csmart=e.csmart||{},e.csmart["ngc-smart-core"]={}),e.ng.common,e.penpal,e.ng.material,e.ng.forms,e.ng.common.http,e.msalAngular,e.ng.router,e.rxjs,e.ng.core,e.rxjs.operators)}(this,function(e,t,n,r,o,i,a,s,f,c,l){"use strict";function d(e,a,s,f){return new(s=s||Promise)(function(t,n){function r(e){try{i(f.next(e))}catch(t){n(t)}}function o(e){try{i(f["throw"](e))}catch(t){n(t)}}function i(e){e.done?t(e.value):function n(t){return t instanceof s?t:new s(function(e){e(t)})}(e.value).then(r,o)}i((f=f.apply(e,a||[])).next())})}function h(r,o){var i,a,s,e,f={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),"throw":t(1),"return":t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function n(e){if(i)throw new TypeError("Generator is already executing.");for(;f;)try{if(i=1,a&&(s=2&e[0]?a["return"]:e[0]?a["throw"]||((s=a["return"])&&s.call(a),0):a.next)&&!(s=s.call(a,e[1])).done)return s;switch(a=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return f.label++,{value:e[1],done:!1};case 5:f.label++,a=e[1],e=[0];continue;case 7:e=f.ops.pop(),f.trys.pop();continue;default:if(!(s=0<(s=f.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){f=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){f.label=e[1];break}if(6===e[0]&&f.label<s[1]){f.label=s[1],s=e;break}if(s&&f.label<s[2]){f.label=s[2],f.ops.push(e);break}s[2]&&f.ops.pop(),f.trys.pop();continue}e=o.call(r,f)}catch(t){e=[6,t],a=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([t,e])}}}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i["return"])&&n.call(i)}finally{if(o)throw o.error}}return a}function p(){}function m(){}function g(){}function v(){this.selectedRole="*"}function S(){this.intakeFlag=!1}function y(){}var b=(O.selectedOffender="smart-selected-offender",O.loginStaff="smart-login-staff",O.offenderQuery="smart-offender-query",O);function O(){}var I=new c.InjectionToken("SMART Web Storage Listener URL"),x=new c.InjectionToken("SMART Web Portal URL"),L=new c.InjectionToken("SMART Data Service URL"),M=(w.prototype.init=function(){var e=this.document.createElement("iframe");e.src=this.smartStorageListenerUrl,e.id="childframe",e.name=Math.random().toString(),e.onload=null,e.style.visibility="hidden",this.document.body.appendChild(e),this.connection=n.connectToChild({iframe:e,debug:!1})},w.prototype.getStaffOffenderListOptions=function(e){var t="{findvStaffOffenderListOptions(input:{\n where:{\n staffId: "+e+"\n }\n }){\n data{\n offenderListOptionId\n name\n serviceApiFieldName\n selectedFlag\n }\n } }";return this.httpClient.post(this.smartDataServiceUrl,{query:t}).pipe(l.map(function(e){var t=e.data;return t.findvStaffOffenderListOptions.data.offenderOptionListId=t.findvStaffOffenderListOptions.data.offenderListOptionId,t.findvStaffOffenderListOptions.data}))},w.prototype.clearAll=function(){var t=this;this.connection.promise.then(function(e){e.clearAll(),t.offenderSubject.next(),t.staffSubject.next()})},w.prototype.setSelectedOffender=function(t){var n=this;this.connection.promise.then(function(e){e.setSelectedOffender(t),n.offenderSubject.next(t)})},w.prototype.getSelectedOffender=function(){return this.connection.promise.then(function(e){return e.getSelectedOffender(b.selectedOffender)})},w.prototype.clearSelectedOffender=function(){var t=this;this.connection.promise.then(function(e){e.clearSelectedOffender(),t.offenderSubject.next()})},w.prototype.getOffenderUpdate=function(){return this.offenderSubject.asObservable()},w.prototype.setLoginStaff=function(t){var n=this;this.connection.promise.then(function(e){e.setLoginStaff(t),n.staffSubject.next(t)})},w.prototype.getLoginStaff=function(){return this.connection.promise.then(function(e){return e.getLoginStaff(b.loginStaff)})},w.prototype.clearLoginStaff=function(){var t=this;this.connection.promise.then(function(e){e.clearLoginStaff(),t.staffSubject.next()})},w.prototype.getStaffUpdate=function(){return this.staffSubject.asObservable()},w.prototype.refreshLoginStaffOptions=function(){var n=this;this.getLoginStaff().then(function(t){n.getStaffOffenderListOptions(t.staffId).subscribe(function(e){console.log(e),t.options=e,n.setLoginStaff(t)})})},w.prototype.setOffenderQuery=function(t){var n=this;this.connection.promise.then(function(e){e.setOffenderQuery(t),n.offenderQuerySubject.next(t)})},w.prototype.getOffenderQuery=function(){return this.connection.promise.then(function(e){return e.getOffenderQuery(b.offenderQuery)})},w.prototype.clearOffenderQuery=function(){var t=this;this.connection.promise.then(function(e){e.clearOffenderQuery(),t.offenderQuerySubject.next()})},w.prototype.getOffenderQueryUpdate=function(){return this.offenderQuerySubject.asObservable()},w.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],w.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[t.DOCUMENT]}]},{type:String,decorators:[{type:c.Inject,args:[I]}]},{type:i.HttpClient},{type:undefined,decorators:[{type:c.Inject,args:[L]}]}]},w.ngInjectableDef=c.defineInjectable({factory:function(){return new w(c.inject(t.DOCUMENT),c.inject(I),c.inject(i.HttpClient),c.inject(L))},token:w,providedIn:"root"}),w);function w(e,t,n,r){this.document=e,this.smartStorageListenerUrl=t,this.httpClient=n,this.smartDataServiceUrl=r,this.offenderSubject=new f.Subject,this.staffSubject=new f.Subject,this.offenderQuerySubject=new f.Subject,c.isDevMode&&console.log("SmartStorage XdmService (Client) - constructor()"),this.init()}var C=(E.prototype.getStaffOffenders=function(e){var t="\n query getStaffOffenderList{\n filterOffenderList(input: {staffId: "+e+"}) {\n data {\n offenderId\n offenderName\n pdId\n birthDate\n gender\n }\n }\n }\n ";return this.http.post(this.smartDataServiceUrl,{query:t}).pipe(l.map(function(e){return e.data.filterOffenderList.data}))},E.decorators=[{type:c.Injectable}],E.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[L]}]},{type:i.HttpClient}]},E);function E(e,t){this.smartDataServiceUrl=e,this.http=t}var R=(A.prototype.ngOnInit=function(){var t=this;this.isAuthenticated=!!this.authnService.getAccount(),this.xdmService.getLoginStaff().then(function(e){t.loginStaff=e||null}),this.xdmService.getSelectedOffender().then(function(e){t.selectedOffender=e&&e.offenderId?e:null}),this.subscription=this.xdmService.getOffenderUpdate().subscribe(function(e){t.selectedOffender=e,t.setSelectedOffenderControl()}),this.xdmService.getOffenderQuery().then(function(e){e&&(t.offenderQueryList=e.offenders,t.setSelectedOffenderControl())}),this.offenderQuerySubscription=this.xdmService.getOffenderQueryUpdate().subscribe(function(e){e&&e.offenders&&(t.offenderQueryList=function n(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e}(e.offenders))}),this.selectedOffenderControl$.valueChanges.subscribe(function(e){return t.onOffenderSelected(e)}),this.router.routeReuseStrategy.shouldReuseRoute=function(){return!1}},A.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},A.prototype.onOffenderSelected=function(e){e&&(this.selectedOffender=e,this.xdmService.setSelectedOffender(this.selectedOffender),this.reloadCurrentRoute())},A.prototype.setSelectedOffenderControl=function(){var t=this;if(this.selectedOffender&&this.offenderQueryList&&0<this.offenderQueryList.length){var e=this.offenderQueryList.find(function(e){return e.offenderId===t.selectedOffender.offenderId});e&&this.selectedOffenderControl$.setValue(e,{emitEvent:!1}),!e&&0<this.offenderQueryList.length&&this.selectedOffenderControl$.setValue(this.offenderQueryList[0],{emitEvent:!1})}},A.prototype.reloadCurrentRoute=function(){try{var e=this.router.parseUrl(this.router.url);e&&e.root&&e.root.segments&&1<e.root.segments.length?this.router.navigate([e.root.segments[0].path]):e&&e.root&&e.root.children&&e.root.children.primary&&e.root.children.primary.segments&&1<e.root.children.primary.segments.length?this.router.navigate([e.root.children.primary.segments[0].path]):this.router.navigate([this.router.url])}catch(t){this.router.navigateByUrl("/")}},A.prototype.hasIntakeRole=function(e){return!!(e&&0<e.length)&&-1<e.findIndex(this.isIntakeRole)},A.prototype.isIntakeRole=function(e){switch(e.roleId){case"OPA":case"OPS":case"SOPS":return!0;default:return!1}},A.decorators=[{type:c.Component,args:[{selector:"app-smart-offender-header",template:'<div\r\n class="offender-header-container"\r\n *ngIf="selectedOffender && isAuthenticated">\r\n <div class="offender-header-name-item">\r\n <mat-form-field appearance="standard" class="switch-offender">\r\n <mat-label>Switch Offender</mat-label>\r\n <mat-select [formControl]="selectedOffenderControl$">\r\n <mat-option\r\n *ngFor="let offender of offenderQueryList"\r\n [value]="offender">\r\n {{ offender?.name}} ({{offender?.offenderId}})\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <div class="offender-header-id-item">\r\n <span class="item-label">PDID:</span> {{ selectedOffender.pdId }}\r\n </div>\r\n <div class="offender-header-id-item">\r\n <span class="item-label">CSOSA ID:</span>\r\n {{ selectedOffender.offenderId }}\r\n </div>\r\n </div>\r\n</div>\r\n',styles:[".offender-header-container{display:-ms-grid;display:grid;-ms-grid-columns:2fr 1fr;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,'Helvetica Neue',sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:-ms-grid;display:grid;-ms-grid-columns:80px 80px;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width:740px){.offender-header-container{display:-ms-grid;display:grid;-ms-grid-rows:1fr 1fr;grid-template-rows:1fr 1fr;-ms-grid-columns:1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,'Helvetica Neue',sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}"]}]}],A.ctorParameters=function(){return[{type:M},{type:a.MsalService},{type:C},{type:s.Router}]},A);function A(e,t,n,r){this.xdmService=e,this.authnService=t,this.smartOffenderHeaderService=n,this.router=r,this.selectedOffenderControl$=new o.FormControl}var j=(U.prototype.getNavbarConfigs=function(e){return this.http.post(e,{query:"\n {\n findAppModules {\n data {\n appModuleId\n name\n url\n offenderSpecificFlag\n displayOrder\n }\n }\n }"}).pipe(l.map(function(e){var t=e.data;return c.isDevMode()&&console.log(t),t.findAppModules.data}))},U.decorators=[{type:c.Injectable}],U.ctorParameters=function(){return[{type:i.HttpClient}]},U);function U(e){this.http=e}var k=(T.prototype.ngOnChanges=function(){},T.prototype.ngOnInit=function(){var t=this;this.xdmService.getSelectedOffender().then(function(e){t.selectedOffender=e&&e.offenderId?e:null}),this.xdmService.getLoginStaff().then(function(e){t.loginStaff=e||null}),this.offenderSubscription=this.xdmService.getOffenderUpdate().subscribe(function(e){t.selectedOffender=e}),this.staffSubscription=this.xdmService.getStaffUpdate().subscribe(function(e){t.loginStaff=e}),this.navbarConfigService.getNavbarConfigs(this.serviceApiUrl).subscribe(function(e){t.navbarConfigs=e.sort(function(e,t){return e.displayOrder<t.displayOrder?-1:e.displayOrder>t.displayOrder?1:0})}),this.isAuthenticated=!!this.authnService.getAccount()},T.prototype.ngOnDestroy=function(){this.offenderSubscription.unsubscribe(),this.staffSubscription.unsubscribe()},T.prototype.logout=function(){this.xdmService.clearAll(),this.authnService.logout()},T.prototype.hasAppModulePermission=function(t){return!!(this.loginStaff&&this.loginStaff.permissions&&0<this.loginStaff.permissions.length)&&-1<this.loginStaff.permissions.findIndex(function(e){return e.appModuleId===t})},Object.defineProperty(T.prototype,"hasExternalUserRole",{get:function(){return!!(this.loginStaff&&this.loginStaff.roles&&0<this.loginStaff.roles.length)&&-1<this.loginStaff.roles.findIndex(this.isExternalRole)},enumerable:!0,configurable:!0}),T.prototype.isExternalRole=function(e){switch(e.roleId){case"EUDTL":case"EUDUSM":case"EUJDG":case"EUMPD":case"EUSOTV":case"EUUSA2":case"EUUSAO":case"EUUSPC":return!0;default:return!1}},T.decorators=[{type:c.Component,args:[{selector:"app-smart-navbar",template:'\x3c!--\r\n<a class="smart-navbar-toggle open" href="#nav">\r\n <i class="material-icons">menu</i>\r\n</a>\r\n\r\n<nav id="nav" role="navigation" class="smart-navbar-container">\r\n <a class="smart-navbar-toggle close" href="#">\r\n <i class="material-icons">close</i>\r\n </a>\r\n\r\n <span *ngFor="let config of navbarConfigs">\r\n <a mat-button class="smart-navbar-item" \r\n *ngIf="(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff" href="{{config.url}}">{{config.name}}</a>\r\n </span>\r\n\r\n <button mat-button class="smart-navbar-item" [matMenuTriggerFor]="menuTheme">Set Theme</button>\r\n <mat-menu #menuTheme="matMenu">\r\n <button mat-menu-item (click)="onSetTheme(\'blue-theme\')">Blue</button>\r\n <button mat-menu-item (click)="onSetTheme(\'red-theme\')">Red</button>\r\n <button mat-menu-item (click)="onSetTheme(\'green-theme\')">Green</button>\r\n </mat-menu>\r\n <button mat-button class="smart-navbar-item smart-navbar-last-item" [matMenuTriggerFor]="menu"\r\n *ngIf="isAuthenticated && loginStaff">{{loginStaff.firstName + \' \' + loginStaff.lastName}}</button>\r\n <mat-menu #menu="matMenu">\r\n <button mat-menu-item>Profile</button>\r\n <button mat-menu-item (click)="logout()">Sign Out</button>\r\n </mat-menu>\r\n</nav>\r\n--\x3e\r\n\r\n\x3c!-- <nav mat-tab-nav-bar>\r\n <a mat-tab-link mat-flat-button *ngFor="let config of navbarConfigs" [active]="appModuleId == config.appModuleId" href="{{config.url}}">{{config.name}}</a>\r\n</nav> --\x3e\r\n\r\n<mat-tab-group class="nav-tab-group" [selectedIndex]="null">\r\n <ng-container *ngFor="let config of navbarConfigs">\r\n <mat-tab\r\n *ngIf="\r\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\r\n (!hasExternalUserRole && (config.offenderSpecificFlag === false || selectedOffender))) &&\r\n isAuthenticated &&\r\n loginStaff \r\n "\r\n label="config.name"\r\n >\r\n <ng-template mat-tab-label>\r\n <a\r\n mat-flat-button\r\n [ngClass]="{ \'main-menu-active\': appModuleId == config.appModuleId }"\r\n href="{{ config.url }}"\r\n >{{ config.name }}</a\r\n >\r\n </ng-template>\r\n </mat-tab>\r\n </ng-container>\r\n</mat-tab-group>\r\n',encapsulation:c.ViewEncapsulation.None,styles:[".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color,#9fa8da);-webkit-text-decoration-line:none;text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid #00008b!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width:768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width:767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translateX(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}"]}]}],T.ctorParameters=function(){return[{type:j},{type:M},{type:a.MsalService}]},T.propDecorators={serviceApiUrl:[{type:c.Input}],appModuleId:[{type:c.Input}],tabGroup:[{type:c.ViewChild,args:["tabs"]}]},T);function T(e,t,n){this.navbarConfigService=e,this.xdmService=t,this.authnService=n,this.appModuleId="SMART",this.isAuthenticated=!1}var F=(P.prototype.ngOnInit=function(){this.type=this.route.snapshot.queryParamMap.get("type")||"staff",this.message=this.route.snapshot.queryParamMap.get("message")||"Error occured."},P.prototype.logout=function(){this.authnService.logout()},P.prototype.portal=function(){window.location.href=this.smartWebPortalUrl},P.decorators=[{type:c.Component,args:[{selector:"app-smart-error",template:'<div>\r\n <h2>\r\n {{ message }}\r\n </h2>\r\n <p>\r\n Please contact help desk if needed.\r\n </p>\r\n <div>\r\n <button (click)="logout()" *ngIf="type === \'staff\'">OK</button>\r\n <button (click)="portal()" *ngIf="type === \'offender\'">OK</button>\r\n </div>\r\n</div>\r\n',styles:["div{text-align:center}"]}]}],P.ctorParameters=function(){return[{type:a.MsalService},{type:s.ActivatedRoute},{type:String,decorators:[{type:c.Inject,args:[x]}]}]},P);function P(e,t,n){this.authnService=e,this.route=t,this.smartWebPortalUrl=n}var D=(N.prototype.showMessage=function(e){this.matSnackBar.open(e,null,{duration:2e3})},N.prototype.convertEmptyToNull=function(t){var n=this;t&&(t instanceof Array&&t.forEach(function(e){n.convertEmptyToNull(e)}),Object.keys(t).forEach(function(e){"object"==typeof t[e]?n.convertEmptyToNull(t[e]):"string"==typeof t[e]&&""===t[e].trim()&&(t[e]=null)}))},N.prototype.getGraphQueryData=function(t,e){return this.http.post(this.serviceApiUrl,{query:e}).pipe(l.map(function(e){return e.data[t]}))},N.prototype.getOffenderListOptions=function(){var e="findOffenderListOptions";return this.getGraphQueryData(e,"{\n findOffenderListOptions {\n data {\n offenderListOptionId\n name\n serviceApiFieldName\n }\n message\n }\n }")},N.prototype.getStaffOffenderListOptions=function(e){var t="{findStaffOffenderListOptions(input:{\n where:{\n staffId: "+e+"\n }\n }){\n data{\n offenderListOptionId\n }\n } }";return this.http.post(this.serviceApiUrl,{query:t}).pipe(l.map(function(e){return e.data.findStaffOffenderListOptions.data}))},N.prototype.saveStaffOffenderListOptionsData=function(e){var t="mutation {\n upsertStaffOffenderListOption(input: "+this.convertToString(e)+") {\n message\n }\n }";return this.http.post(this.serviceApiUrl,{query:t})},N.prototype.convertToString=function(t){var n=this,r="";return t&&(t instanceof Array?(r+=" [",t.forEach(function(e){r+=n.convertToString(e)}),r+="],"):(r+="{",Object.keys(t).forEach(function(e){"object"==typeof t[e]?r+=e+":"+n.convertToString(t[e]):isNaN(t[e])?r+=e+':"'+t[e]+'",':r+=e+":"+t[e]+","}),r=r.substring(0,r.length-1),r+="},")),r},N.decorators=[{type:c.Injectable}],N.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[L]}]},{type:i.HttpClient},{type:r.MatSnackBar}]},N);function N(e,t,n){this.serviceApiUrl=e,this.http=t,this.matSnackBar=n}var Q=(q.prototype.ngOnInit=function(){var t=this,e=this.route.snapshot.data;this.loginStaff=e.loginStaff,this.offenderListOptions=e.selectedOffenderResolverService,this.frmGroup=this.createForm(),this.offenderService.getStaffOffenderListOptions(this.loginStaff.staffId).subscribe(function(e){t.fillForm(e)})},q.prototype.fillForm=function(e){if(e){var t=this.frmGroup.get("offenderListOptions");e.forEach(function(e){t.get(e.offenderListOptionId).setValue(!0)})}},q.prototype.createForm=function(){var n=new o.FormGroup({});return this.offenderListOptions.forEach(function(e,t){n.addControl(e.offenderListOptionId,new o.FormControl(!1))}),new o.FormGroup({offenderListOptions:n})},q.prototype.onSave=function(){var t=this,n={options:[],staffId:this.loginStaff.staffId,modifiedBy:this.loginStaff.staffId},r=this.frmGroup.get("offenderListOptions").value;Object.keys(r).forEach(function(e){r[e]&&n.options.push({offenderListOptionId:e})}),this.offenderService.saveStaffOffenderListOptionsData(n).subscribe(function(e){e.message?t.offenderService.showMessage(e.message):(t.offenderService.showMessage("Saved successfully"),t.xdmService.refreshLoginStaffOptions())})},q.decorators=[{type:c.Component,args:[{selector:"lib-smart-staff-offender-options",template:'<form class="main-form" [formGroup]="frmGroup">\n <mat-card role="group">\n <mat-card-content>\n <div formGroupName="offenderListOptions">\n <div style="float:left;">\n <div *ngFor="let offenderListOption of offenderListOptions; let i = index">\n <mat-checkbox *ngIf="i%2!=0" color="primary" formControlName="{{offenderListOption.offenderListOptionId}}">\n {{offenderListOption.name}}\n </mat-checkbox>\n </div>\n </div>\n <div>\n <div *ngFor="let offenderListOption of offenderListOptions; let i = index" >\n <mat-checkbox *ngIf="i%2==0" color="primary" formControlName="{{offenderListOption.offenderListOptionId}}">\n {{offenderListOption.name}}\n </mat-checkbox> \n </div>\n </div>\n </div>\n </mat-card-content>\n <div align="center">\n <button mat-raised-button color="accent" (click)="onSave()">Save</button>\n </div>\n </mat-card>\n </form>\n ',styles:[""]}]}],q.ctorParameters=function(){return[{type:s.ActivatedRoute},{type:D},{type:M}]},q);function q(e,t,n){this.route=e,this.offenderService=t,this.xdmService=n,this.offenderListOptions=[]}var G=(H.prototype.getLoginStaff=function(){var r=this;if(c.isDevMode&&console.log("SmartAuthService - getLoginStaff()"),!c.isDevMode&&this.loginStaff){if(this.loginStaff.staffId)return c.isDevMode&&console.log("##### getLoginStaff(): get internal instance in service",this.loginStaff),f.of(this.loginStaff);if(this.loginStaff.userName)return c.isDevMode&&console.log("##### getLoginStaff(): get using preset user name",this.loginStaff),this.getStaff(this.loginStaff.userName)}return f.from(this.xdmService.getLoginStaff()).pipe(l.switchMap(function(e){if(e&&e.staffId)return c.isDevMode&&console.log("##### getLoginStaff(): get from session.",e),r.loginStaff=e,f.of(e);if(e&&e.userName)return c.isDevMode&&console.log("##### getLoginStaff(): get using preset user name",r.loginStaff),r.getStaff(e.userName);var t=r.authnService.getAccount().userName,n=t.substring(0,t.indexOf("@"));return c.isDevMode&&console.log("##### loginLoginStaff(): get using login staff name ",n),r.getStaff(n)}))},H.prototype.getTeamUrl=function(e,t){var n=window.location.href.indexOf("web-"),r=window.location.href.substring(0,n)+"web-",o=window.location.href.replace(r,"");n=o.indexOf("-",0);var i=o.substring(n);return r+e+(i=i.replace(window.location.pathname,""))+t},H.prototype.redirectToTeam=function(e){-1<e.roles.findIndex(function(e){return"EUUSPC"===e.roleId})&&(window.location.href=this.getTeamUrl("investigation","/assignment")),-1<e.roles.findIndex(function(e){return"RSC"===e.roleId.substring(0,3)})&&(window.location.href=this.getTeamUrl("rsc","/offender-list"))},H.prototype.setSelectedOffender=function(n){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return n?[4,this.getStaffOffenderRelation(this.loginStaff.staffId,n.offenderId).toPromise()]:[3,2];case 1:t=e.sent(),n.assignmentStaffRelationId=t||"NOASSIGN",e.label=2;case 2:return this.xdmService.setSelectedOffender(n),this.selectedOffender=n,[2]}})})},H.prototype.logout=function(){this.xdmService.clearAll(),this.authnService.logout()},H.prototype.setPermission=function(p,i){return d(this,void 0,void 0,function(){var t,f,c,n,r,l,o,d,u=this;return h(this,function(e){switch(e.label){case 0:return this.loginStaff?[3,2]:[4,(t=this).xdmService.getLoginStaff()];case 1:t.loginStaff=e.sent(),e.label=2;case 2:return f=this.loginStaff.permissions,c=i.url[0].path,this.selectedOffender?[3,4]:[4,(n=this).xdmService.getSelectedOffender()];case 3:n.selectedOffender=e.sent(),e.label=4;case 4:return this.selectedOffender?[4,this.getStaffOffenderRelation(this.loginStaff.staffId,this.selectedOffender.offenderId).toPromise()]:[3,6];case 5:r=e.sent(),this.selectedOffender.assignmentStaffRelationId=r||"NOASSIGN",this.xdmService.setSelectedOffender(this.selectedOffender),e.label=6;case 6:return l=this.selectedOffender.assignmentStaffRelationId,o=document.querySelectorAll('[class^="sac-"]'),d=/^sac-(\S+)-(\S+)$/i,Array.from(o).forEach(function(i){var a,s;i.classList.forEach(function(e){var t=e.match(d);if(t&&2<t.length){var n=t[1]?t[1].toUpperCase():null,r=t[2],o=f.find(function(e){return e.appModuleId===p&&e.resource===c&&e.roleId===n&&e.assignmentStaffRelationId===l});console.log("##### Matched permission: ",o),o?"read"===r?o.readFlag?a=!1:!1!==a&&(a=!0):"create"===r&&!o.createFlag||"update"===r&&!o.updateFlag||"delete"===r&&!o.deleteFlag||"assign"===r&&!o.assignFlag||"close"===r&&!o.closeFlag||"expunge"===r&&!o.expungeFlag||"reopen"===r&&!o.reopenFlag?"BUTTON"===i.nodeName?!1!==a&&(a=!0):!1!==s&&(s=!0):"BUTTON"===i.nodeName?a=!1:s=!1:"read"===r?!1!==a&&(a=!0):"BUTTON"===i.nodeName?!1!==a&&(a=!0):!1!==s&&(s=!0)}}),console.log("hide: ",a),console.log("disable: ",s),!0===a?u.hideHtmlElement(i):!0===s&&u.disableHtmlElement(i)}),[2]}})})},H.prototype.checkPermission=function(t){var e=t.route.data;this.loginStaff=e.loginStaff,this.selectedOffender=e.selectedOffender;var n=this.loginStaff.permissions,r=t.route.url[0].path,o=t.roleId?t.roleId.toUpperCase():null,i=t.accessType,a=(this.selectedOffender.assignmentStaffRelationId&&this.selectedOffender.assignmentStaffRelationId,n.find(function(e){return e.appModuleId===t.appModuleId&&e.resource===r&&(!o||e.roleId===o)}));return!(!a||("read"===i?!a.readFlag:"create"===i&&!a.createFlag||"update"===i&&!a.updateFlag||"delete"===i&&!a.deleteFlag||"assign"===i&&!a.assignFlag||"close"===i&&!a.closeFlag||"expunge"===i&&!a.expungeFlag||"reopen"===i&&!a.reopenFlag))},H.prototype.canAppFeatureActivate=function(e,t,n){return void 0===n&&(n=null),!this.hasExternalUserRole(e.roles)||this.hasAppFeaturePermission(e.permissions,t,n)},H.prototype.hasExternalUserRole=function(e){return!!(e&&0<e.length)&&-1<e.findIndex(this.isExternalRole)},H.prototype.hasIntakeRole=function(e){return!!(e&&0<e.length)&&-1<e.findIndex(this.isIntakeRole)},H.prototype.hasAppFeaturePermission=function(e,t,n){return!!(e&&0<e.length)&&(n?-1<e.findIndex(function(e){return e.resource===t&&e.appModuleId===n}):-1<e.findIndex(function(e){return e.resource===t}))},H.prototype.isExternalRole=function(e){switch(e.roleId){case"EUDTL":case"EUDUSM":case"EUJDG":case"EUMPD":case"EUSOTV":case"EUUSA2":case"EUUSAO":case"EUUSPC":return!0;default:return!1}},H.prototype.isIntakeRole=function(e){switch(e.roleId){case"OPA":case"OPS":case"SOPS":return!0;default:return!1}},H.prototype.disableHtmlElement=function(e){switch(e.nodeName){case"A":e.setAttribute("style","pointer-events: none;cursor: not-allowed;"),e.setAttribute("tabIndex","-1");break;default:e.setAttribute("disabled","disabled")}},H.prototype.hideHtmlElement=function(e){e.setAttribute("style","display: none;")},H.prototype.getStaff=function(e){var n=this,t='\n {\n findvStaffs(input: {where: {userName: "'+e+'", activeFlag: true}}) {\n totalCount\n message\n data {\n staffId\n userName\n lastName\n firstName\n phone\n email\n roles {\n roleId\n role\n }\n permissions {\n roleId\n appModuleId\n resource\n assignmentStaffRelationId\n readFlag\n createFlag\n updateFlag\n deleteFlag\n assignFlag\n reopenFlag\n closeFlag\n expungeFlag\n }\n options {\n offenderListOptionId\n name\n serviceApiFieldName\n selectedFlag\n }\n }\n }\n }';return this.http.post(this.smartDataServiceUrl,{query:t}).pipe(l.take(1),l.map(function(e){if(c.isDevMode&&console.log("##### getStaff() from service ",e),0<e.data.findvStaffs.data.length){var t=e.data.findvStaffs.data[0];return n.xdmService.setLoginStaff(t),n.loginStaff=t}return null}),l.catchError(function(e){return console.log("error "+e),null}))},H.prototype.getStaffOffenderRelation=function(e,t){var n="\n {\n findvStaffOffenderRelations(input: {where: {staffId: "+e+", offenderId: "+t+"}}) {\n data {\n assignmentStaffRelationId\n }\n }\n }";return this.http.post(this.smartDataServiceUrl,{query:n}).pipe(l.take(1),l.map(function(e){return c.isDevMode&&console.log("##### getStaffOffenderRelation() from service ",e),0<e.data.findvStaffOffenderRelations.data.length?e.data.findvStaffOffenderRelations.data[0].assignmentStaffRelationId:null}),l.catchError(function(e){return console.log("error "+e),null}))},H.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],H.ctorParameters=function(){return[{type:i.HttpClient},{type:a.MsalService},{type:M},{type:undefined,decorators:[{type:c.Inject,args:[L]}]}]},H.ngInjectableDef=c.defineInjectable({factory:function(){return new H(c.inject(i.HttpClient),c.inject(a.MsalService),c.inject(M),c.inject(L))},token:H,providedIn:"root"}),H);function H(e,t,n,r){this.http=e,this.authnService=t,this.xdmService=n,this.smartDataServiceUrl=r}var B=(_.prototype.ngOnInit=function(){this.checkAccess()},_.prototype.checkAccess=function(){if(this.accessControlConfig&&this.accessControlConfig.route&&this.accessControlConfig.route.data&&this.accessControlConfig.route.data.loginStaff&&this.accessControlConfig.route.data.selectedOffender){var e=this.accessControlConfig.route.data.loginStaff;this.auth.hasExternalUserRole(e.roles)&&(this.elementRef.nativeElement.style.display=this.auth.checkPermission(this.accessControlConfig)?"block":"none")}},_.decorators=[{type:c.Directive,args:[{selector:"[accessControl]"}]}],_.ctorParameters=function(){return[{type:c.ElementRef},{type:G}]},_.propDecorators={accessControlConfig:[{type:c.Input}]},_);function _(e,t){this.elementRef=e,this.auth=t}var z=(V.prototype.canActivate=function(r){var o=this;return this.authnService.getLoginStaff().pipe(l.take(1),l.mergeMap(function(e){if(!e||!r||!r.routeConfig)return f.of(!1);if(!o.authnService.hasExternalUserRole(e.roles))return f.of(!0);var t=r.routeConfig.path?r.routeConfig.path.split("/")[0]:"",n=o.authnService.canAppFeatureActivate(e,t);return f.of(n)}),l.catchError(function(e){return f.of(!1)}))},V.decorators=[{type:c.Injectable}],V.ctorParameters=function(){return[{type:G}]},V);function V(e){this.authnService=e}var W=($.decorators=[{type:c.NgModule,args:[{declarations:[R,k,F,Q,B],imports:[t.CommonModule,i.HttpClientModule,r.MatButtonModule,r.MatMenuModule,r.MatTabsModule,r.MatSelectModule,r.MatCardModule,r.MatCheckboxModule,o.ReactiveFormsModule],exports:[R,k,F,Q,B],providers:[j,C,D,z,r.MatSnackBar]}]}],$);function $(){}var X=(K.prototype.resolve=function(e,t){var n=this;return this.authnService.getLoginStaff().pipe(l.take(1),l.mergeMap(function(e){return c.isDevMode&&console.log("LoginStaffResolverService: ",e),e?f.of(e):f.throwError("Not authorized to access SMART.")}),l.catchError(function(e){return console.log("LoginStaffResolverService: "+e),n.router.navigate(["/smart-error"],{queryParams:{type:"staff",message:"SMART Authentication: "+e}}),f.EMPTY}))},K.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],K.ctorParameters=function(){return[{type:G},{type:s.Router}]},K.ngInjectableDef=c.defineInjectable({factory:function(){return new K(c.inject(G),c.inject(s.Router))},token:K,providedIn:"root"}),K);function K(e,t){this.authnService=e,this.router=t}var J=(Y.prototype.resolve=function(e,t){var n=this;return f.from(this.service.getSelectedOffender()).pipe(l.mergeMap(function(e){return c.isDevMode&&console.log(e),e?f.of(e):f.throwError("No offender selected.")}),l.retryWhen(function(e){return e.pipe(l.delay(1e3),l.take(5),function(e){return f.concat(e,f.throwError("No offender selected (failed after retries)."))})}),l.catchError(function(e){return n.router.navigate(["/smart-error"],{queryParams:{type:"offender",message:e}}),f.EMPTY}))},Y.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],Y.ctorParameters=function(){return[{type:M},{type:c.NgZone},{type:s.Router}]},Y.ngInjectableDef=c.defineInjectable({factory:function(){return new Y(c.inject(M),c.inject(c.NgZone),c.inject(s.Router))},token:Y,providedIn:"root"}),Y);function Y(e,t,n){this.service=e,this.zone=t,this.router=n}var Z=(ee.prototype.resolve=function(){return this.offenderService.getOffenderListOptions().pipe(l.map(function(e){return e.data}))},ee.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],ee.ctorParameters=function(){return[{type:D}]},ee.ngInjectableDef=c.defineInjectable({factory:function(){return new ee(c.inject(D))},token:ee,providedIn:"root"}),ee);function ee(e){this.offenderService=e}e.NgcSmartCoreModule=W,e.SmartAuthService=G,e.LoginStaffResolverService=X,e.SelectedOffenderResolverService=J,e.SmartErrorComponent=F,e.SmartNavbarService=j,e.XdmService=M,e.Permission=p,e.Role=m,e.Option=g,e.LoginStaff=v,e.SelectedOffender=S,e.OffenderQuery=y,e.StorageKey=b,e.SMART_WEB_STORAGE_LISTENER_URL=I,e.SMART_WEB_PORTAL_URL=x,e.SMART_DATA_SERVICE_URL=L,e.SmartStaffOffenderOptionsComponent=Q,e.SmartStaffOffenderOptionsResolverService=Z,e.AccessType={READ:"read",CREATE:"create",UPDATE:"update",DELETE:"delete",EXPUNGE:"expunge",ASSIGN:"assign",REOPEN:"reopen",CLOSE:"close"},e.SmartAuthorizationGuard=z,e.ɵe=B,e.ɵc=k,e.ɵa=R,e.ɵb=C,e.ɵd=D,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=csmart-ngc-smart-core.umd.min.js.map
|